Component processing method, device, electronic device and storage medium
By obtaining component configuration files, the problem of high threshold for component reuse in the existing technology is solved, and the efficient use of component management tools is achieved.
Patent Information
- Application Number
- CN202111561131.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2041-12-15
AI Technical Summary
In the prior art, when component reuse is used, complex commands need to be input and different commands in different acquisition methods are different, resulting in a high threshold for the use of component management tools and reducing component reuse efficiency.
By obtaining the client's component configuration file, determining the attribute information of the component to be obtained, automatically generating component pull commands, and uniformly using pull method to obtain components to avoid users entering complex commands.
Lower the threshold for using component management tools and improves the efficiency of developers reusing published components.
Smart Images

Figure CN114265588B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computers, and in particular to a component processing method, device, electronic device, and storage medium. Background Art
[0002] With the development of computer technology, developers are increasingly using component reuse to improve the efficiency of front-end project development.
[0003] In the related art, in order to balance the reuse cost and component function when reusing components, developers can use a preset component management tool. Through the component management tool, when developers obtain pre-developed components, they can enter corresponding commands to obtain components based on different acquisition methods. For example, when using the component management tool Bit, developers can enter the command to pull components or the command to install components for two different acquisition methods, namely, pull and install, to obtain components.
[0004] However, in the above method, complex commands need to be input when obtaining components, and the input commands for different acquisition methods are also different, resulting in a high threshold for using preset components based on component management tools, which reduces the efficiency of component reuse. Summary of the invention
[0005] The present disclosure provides a component processing method, device, electronic device and storage medium to at least solve the problem of low component reuse efficiency in the related art. The technical solution of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a component processing method is provided, which is applied to a client, and the method includes:
[0007] In response to the component acquisition instruction, a component configuration file corresponding to the front-end project of the client is acquired; the component configuration file records component attribute information corresponding to all published components associated with the front-end project;
[0008] Based on the component configuration file, determining first component attribute information corresponding to the first component to be acquired, and generating a corresponding component pull command based on the first component attribute information;
[0009] Converting the component pull command into a component pull message;
[0010] The component pull message is sent to the component server, and the first component is obtained based on the response information returned by the component server.
[0011] In an exemplary embodiment, sending the component pull message to the component server and obtaining the first component based on response information returned by the component server includes:
[0012] Sending the component pull message to the component server to instruct the component server to obtain the code file corresponding to the first component;
[0013] The code file returned by the component server is received to obtain the first component.
[0014] In an exemplary embodiment, after sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server, the method further includes:
[0015] After modifying the first component, in response to the first component issuing an instruction, obtaining a new component obtained by the modification;
[0016] Determine the identity authentication information corresponding to the current account of the client and the first storage space identifier of the first target storage space corresponding to the new component;
[0017] The identity authentication information, the first storage space identifier and the new component are sent to a component server; the component server is used to store the new component in the first target storage space when it is determined, based on the identity authentication information and the first storage space identifier, that the current account has write permission for the first target storage space.
[0018] In an exemplary embodiment, it further includes:
[0019] In response to the second component publishing instruction, obtaining a second component to be published;
[0020] Determine the identity authentication information corresponding to the current account of the client and the second storage space identifier of the second target storage space corresponding to the second component;
[0021] The identity authentication information, the second storage space identifier and the second component are sent to a component server; the component server is used to store the new component in the second target storage space when it is determined, based on the identity authentication information and the second storage space identifier, that the current account has write permission for the second target storage space.
[0022] In an exemplary embodiment, the component attribute information includes a component identifier and component version information; and determining, based on the component configuration file, first component attribute information corresponding to the first component to be acquired includes:
[0023] Based on the component configuration file, a component identifier and component version information corresponding to the first component to be acquired are determined.
[0024] In an exemplary embodiment, generating a corresponding component pull instruction based on the first component attribute information includes:
[0025] Obtaining a preset command prefix; the command prefix is a prefix corresponding to a native command for the client to pull a component from a component server;
[0026] The command prefix, component identifier and component version information are concatenated to obtain a component pull command corresponding to the first component.
[0027] In an exemplary embodiment, determining the identity authentication information corresponding to the current account of the client includes:
[0028] Obtain a public key corresponding to the current account, and determine a hash value corresponding to the public key as identity authentication information of the current account.
[0029] In an exemplary embodiment, after sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server, the method further includes:
[0030] In response to a local update operation on the first component, updating the component configuration file based on component attribute information corresponding to the updated component;
[0031] The updated component configuration file is sent to the version library corresponding to the front-end project, so as to synchronize the updated component configuration file to other clients associated with the front-end project.
[0032] In an exemplary embodiment, the component attribute information includes dependency relationships corresponding to the components;
[0033] After obtaining the component configuration file corresponding to the front-end project of the client, it also includes:
[0034] Obtaining, from the component configuration file, a dependency relationship corresponding to the first component;
[0035] According to the dependency relationship, a dependent component corresponding to the first component is obtained from the component server.
[0036] In an exemplary embodiment, after sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server, the method further includes:
[0037] Obtaining path configuration information of the publishing client corresponding to the first component, and performing local path configuration according to the path configuration information;
[0038] When installing the first component, the first component is installed in a folder corresponding to the local path configuration.
[0039] According to a second aspect of an embodiment of the present disclosure, a component processing method is provided, which is applied to a component server, and the method includes:
[0040] Receive a component pull message sent by a client; the client is used to obtain a component configuration file corresponding to the client's front-end project when receiving a component acquisition instruction, determine first component attribute information corresponding to a first component to be acquired based on the component configuration file, generate a corresponding component pull command based on the first component attribute information, and convert the component pull instruction into the component pull message, wherein the component configuration file records component attribute information corresponding to all published components associated with the front-end project;
[0041] In response to the component pull message, generating a code file in a preset file format corresponding to the first component;
[0042] The code file is returned to the client.
[0043] In an exemplary embodiment, in response to the component pull message, generating a code file in a preset file format corresponding to the first component includes:
[0044] Acquire a component identifier and component version information corresponding to the first component from the component pull message;
[0045] Obtaining a component code associated with the component identifier and the component version information;
[0046] Based on the component code, a code file in a preset file format corresponding to the first component is generated.
[0047] In an exemplary embodiment, after returning the code file to the client, the method further includes:
[0048] Acquire the second component sent by the client, as well as the identity authentication information corresponding to the current account of the client, and the second storage space identifier of the second target storage space corresponding to the second component;
[0049] Sending the identity authentication information and the second storage space identifier to an authority server, the authority server being used to obtain a verification result of whether the current account has write permission for the second target storage space based on a preset storage space permission table, the hash value and the second storage space identifier, and returning the verification result to the component server;
[0050] When the verification result is yes, the second component is published in the second target storage space.
[0051] According to a third aspect of an embodiment of the present disclosure, a component processing device is provided, which is applied to a client, and the device includes:
[0052] A component configuration file acquisition unit is configured to execute in response to a component acquisition instruction to acquire a component configuration file corresponding to a front-end project of a client; the component configuration file records component attribute information corresponding to all published components associated with the front-end project;
[0053] a pull command generating unit, configured to determine first component attribute information corresponding to the first component to be acquired based on the component configuration file, and generate a corresponding component pull command based on the first component attribute information;
[0054] A command conversion unit, configured to convert the component pull command into a component pull message;
[0055] The component pulling unit is configured to execute sending the component pulling message to the component server, and obtain the first component based on the response information returned by the component server.
[0056] In an exemplary embodiment, the component pulling unit comprises:
[0057] A pull message sending module is configured to execute sending the component pull message to the component server to instruct the component server to obtain a code file corresponding to the first component;
[0058] The first component acquisition module is configured to execute and receive the code file returned by the component server to obtain the first component.
[0059] In an exemplary embodiment, the apparatus further comprises:
[0060] A new component acquisition unit is configured to execute, after modifying the first component, in response to the first component issuing instruction, to acquire a new component obtained by the modification;
[0061] A first verification information acquisition unit is configured to determine the identity authentication information corresponding to the current account of the client and the first storage space identifier of the first target storage space corresponding to the new component;
[0062] The first verification information sending unit is configured to send the identity authentication information, the first storage space identifier and the new component to the component server; the component server is used to store the new component in the first target storage space when it is determined, based on the identity authentication information and the first storage space identifier, that the current account has write permission for the first target storage space.
[0063] In an exemplary embodiment, the apparatus further comprises:
[0064] A second component acquisition unit is configured to execute, in response to the second component publishing instruction, to acquire a second component to be published;
[0065] A second verification information acquisition unit is configured to determine the identity authentication information corresponding to the current account of the client and a second storage space identifier of the second target storage space corresponding to the second component;
[0066] The second verification information sending unit is configured to send the identity authentication information, the second storage space identifier and the second component to the component server; the component server is used to store the new component in the second target storage space when it is determined that the current account has write permission to the second target storage space based on the identity authentication information and the second storage space identifier.
[0067] In an exemplary embodiment, the component attribute information includes component identification and component version information; the pull command generation unit includes:
[0068] The identification reading module is configured to determine the component identification and component version information corresponding to the first component to be obtained based on the component configuration file.
[0069] In an exemplary embodiment, the pull command generation unit includes:
[0070] A prefix acquisition module is configured to execute and acquire a preset command prefix; the command prefix is a prefix corresponding to a native command for the client to pull a component from a component server;
[0071] The splicing module is configured to execute splicing of the command prefix, component identifier and component version information to obtain a component pull command corresponding to the first component.
[0072] In an exemplary embodiment, the verification information acquisition unit includes:
[0073] The public key acquisition module is configured to execute acquisition of the public key corresponding to the current account and determine a hash value corresponding to the public key as the identity authentication information of the current account.
[0074] In an exemplary embodiment, the apparatus further comprises:
[0075] a component updating unit, configured to execute a local update operation in response to the first component to obtain an updated component;
[0076] a configuration file updating unit, configured to update the component configuration file based on the component attribute information corresponding to the updated component;
[0077] The configuration file sending unit is configured to send the updated component configuration file to the version library corresponding to the front-end project, so as to synchronize the updated component configuration file to other clients associated with the front-end project.
[0078] In an exemplary embodiment, the component attribute information includes a dependency relationship corresponding to the component; and the apparatus further includes:
[0079] A dependency relationship obtaining unit, configured to obtain a dependency relationship corresponding to the first component from the component configuration file;
[0080] The dependent component acquisition unit is configured to acquire the dependent component corresponding to the first component from the component server according to the dependency relationship.
[0081] In an exemplary embodiment, the apparatus further comprises:
[0082] A path configuration unit, configured to obtain path configuration information of a publishing client corresponding to the first component, and perform local path configuration according to the path configuration information;
[0083] The installation unit is configured to install the first component into a folder corresponding to the local path configuration when installing the first component.
[0084] According to a fourth aspect of an embodiment of the present disclosure, a component processing device is provided, which is applied to a component server, and the device includes:
[0085] A pull message receiving unit is configured to execute and receive a component pull message sent by a client; the client is used to obtain a component configuration file corresponding to the client's front-end project when receiving a component acquisition instruction, determine first component attribute information corresponding to a first component to be acquired based on the component configuration file, generate a corresponding component pull command based on the first component attribute information, and convert the component pull instruction into the component pull message, wherein the component configuration file records the component attribute information corresponding to the published component associated with the front-end project;
[0086] A code file generating unit, configured to generate a code file in a preset file format corresponding to the first component in response to the component pull message;
[0087] The code sending unit is configured to return the code file to the client.
[0088] In an exemplary embodiment, the code file generating unit is configured to execute:
[0089] Acquire a component identifier and component version information corresponding to the first component from the component pull message;
[0090] Obtaining a component code associated with the component identifier and the component version information;
[0091] Based on the component code, a code file in a preset file format corresponding to the first component is generated.
[0092] In an exemplary embodiment, the apparatus further comprises:
[0093] A second component receiving unit is configured to obtain the second component sent by the client, the identity authentication information corresponding to the current account of the client, and the second storage space identifier of the second target storage space corresponding to the second component;
[0094] a verification information forwarding unit configured to execute sending the identity authentication information and the second storage space identifier to an authority server, the authority server being used to obtain a verification result of whether the current account has write permission for the second target storage space based on a preset storage space permission table, the hash value and the second storage space identifier, and return the verification result to the component server;
[0095] The component publishing unit is configured to publish the new component in the second target storage space when the verification result is yes.
[0096] According to a fifth aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0097] processor;
[0098] a memory for storing instructions executable by the processor;
[0099] The processor is configured to execute the instructions to implement the component processing method as described in any one of the above items.
[0100] According to a sixth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the component processing method as described in any one of the above items.
[0101] According to a seventh aspect of an embodiment of the present disclosure, a computer program product is provided, wherein the computer program product includes instructions, and when the instructions are executed by a processor of an electronic device, the electronic device is enabled to execute the component processing method as described in any one of the above items.
[0102] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0103] In the present disclosure, after receiving a component acquisition instruction, the client can automatically generate a component pull command for the first component based on the component attribute information in the component configuration file, and pull the first component in a unified pull manner without the user having to enter complex commands. This not only lowers the threshold for using component management tools, but also effectively improves the efficiency of developers reusing released components.
[0104] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0105] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0106] Figure 1 The present invention is an application environment diagram showing a component processing method according to an exemplary embodiment.
[0107] Figure 2 The present invention is a flowchart of a component processing method according to an exemplary embodiment.
[0108] Figure 3 The invention is a flowchart showing another component processing method according to an exemplary embodiment.
[0109] Figure 4 The invention is a flowchart showing another component processing method according to an exemplary embodiment.
[0110] Figure 5 The invention is a flowchart showing another component processing method according to an exemplary embodiment.
[0111] Figure 6 The invention is a flowchart showing another component processing method according to an exemplary embodiment.
[0112] Figure 7 The invention is a block diagram of a component processing device according to an exemplary embodiment.
[0113] Figure 8 It is a block diagram of another component processing device according to an exemplary embodiment.
[0114] Fig. 9 It is a block diagram of an electronic device according to an exemplary embodiment.
[0115] Fig.10is a block diagram of another electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0116] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0117] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0118] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0119] With the development of computer technology, developers are increasingly using component reuse to improve front-end development efficiency. In order to improve development efficiency, developers can achieve different component reuse effects by copying components or using development tools. Specifically, component copying has extremely low learning costs and technical barriers, and has the characteristics of being reused in any code repository (Repository) and at any granularity, while supporting developers to read and write it, but there are shortcomings of lack of component version control and component dependency management. In the Node.js operating environment, Node.jsModule can be used to achieve file-level component reuse, version control and dependency management with less learning cost, but reused components only support read functions, and developers need to manually manage component dependencies, and separate code repositories need to be split for the code corresponding to the reused components. For the open source distributed version control system Git, the Git Submodules it provides can achieve version control, and the components reused through Git Submodules can support reading and writing at the same time, but the learning cost of this method is high, and multiple code repositories also need to be split during component reuse. Alternatively, you can use the project management tool Monorepo. Monorepo implements component reuse based on Node.js Module. Developers can put the code of all projects in a code repository. The code in the code repository supports reading and writing, but there is physical coupling between the corresponding sub-code repositories, and the learning cost and operation cost are high. The above method is difficult to balance function and cost in the process of component reuse.
[0120] In related technologies, in order to achieve a balance between functionality and cost, the industry has developed related component reuse solutions and tool chains, such as the component management tool Bit. When the component management tool is working, it can perform dependency analysis on the code and images in the local workspace and other related resources used to build components, automatically generate components similar to the Node.js Module structure, and push the current version of the component to the remote server to complete the component production process. Other workspaces can obtain pre-produced components from remote servers by "installing" or "pulling". The component management tool will automatically obtain and install the dependencies required for the components to complete the process of obtaining (consuming) components. Compared with previous component reuse solutions, the component management tool allows users to directly extract components from existing code repositories without splitting the code repository. It also supports dependency management and version management. Developers can customize the obtained components and release new versions to achieve component reuse at any granularity.
[0121] However, in the above method, complex commands need to be input when obtaining components, and the input commands for different acquisition methods are also different, resulting in a high threshold for using preset components based on component management tools, which reduces the efficiency of component reuse. Based on this, the present disclosure provides a component processing method to at least solve the problem of low component reuse efficiency in the related art.
[0122] The component processing method provided in the present disclosure can be applied to Figure 1 In the application environment shown. In the application environment, the client 110 interacts with the component server 120 through the network. The client may be a client corresponding to the component management tool, which may be deployed on a terminal, which may be but is not limited to various personal computers, laptops, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The component server 120 may be implemented by an independent server or a server cluster consisting of multiple servers.
[0123] Figure 2 is a flowchart of a component processing method according to an exemplary embodiment. Figure 2 As shown, the method is used in the client 110 and includes the following steps.
[0124] In step S210, in response to the component acquisition instruction, a component configuration file corresponding to the front-end project of the client is acquired.
[0125] As an example, a front-end project can be a project for building a front-end page for interaction with users. The front-end page can be a page displayed to users on a terminal device. Users can interact with the website backend through one or more components on the front-end page. The client's front-end project can refer to a front-end project for which the client has read permission for the corresponding component.
[0126] The component configuration file can record the component attribute information corresponding to all published components associated with the front-end project. Specifically, during the front-end project development process, developers can create and publish corresponding components for the front-end project, and for all published components, the component attribute information corresponding to them can be recorded through the component configuration file.
[0127] In the related art, component attribute information can be maintained through two or more files, for example, dependency management can be performed through Bit and NPM. However, this method also requires developers to pay attention to more information when obtaining components, which increases their mental burden. In this embodiment, the component attribute information corresponding to the published components can be uniformly maintained in the component configuration file, so that it is decoupled from other files and, as an independent file management component, is avoided from being written into other description files, thereby reducing the complexity of component pulling.
[0128] The published component may be a component that has been published locally or in a component server; the component attribute information may include information for identifying the component, and different components may be distinguished through the component attribute information.
[0129] In actual applications, after logging into the client, the developer can send a component acquisition instruction to the client to instruct the client to acquire related components. Specifically, the user can use the component acquisition instruction to acquire one or more specified components associated with the front-end project, such as specifying to acquire component a in the front-end project, or can also use the component acquisition instruction to instruct the client to acquire all components that have been released by the front-end project.
[0130] In one example, when a user instructs a client to obtain a specified component associated with a front-end project, the component name corresponding to the component and the command line name corresponding to the component acquisition instruction can be sent to the client so that the client can obtain the corresponding component acquisition instruction. For example, when a user enters the component acquisition command "XXX avatar", it can be instructed to obtain a component whose corresponding component name is "avatar", where "XXX" is the command line name. When a user directly sends the command line name corresponding to the component acquisition instruction to the client, the default component corresponding to the command line name can be obtained. For example, the component acquisition command "XXX" can be directly entered to obtain all components associated with the front-end project. Of course, the developer can set the default component to be obtained when the command line name is entered according to the actual situation.
[0131] After receiving the component acquisition instruction input by the user, the client can obtain the component configuration file corresponding to the front-end project of the client in response to the component acquisition instruction.
[0132] In step S220, first component attribute information corresponding to the first component to be acquired is determined based on the component configuration file, and a corresponding component pull command is generated based on the first component attribute information.
[0133] The first component may be a component that is acquired according to the component acquisition instruction, for example, it may be a published component associated with a specified front-end project, or it may be all components that have been published by the front-end project.
[0134] The component pull command may be a native command that can be parsed by a component management tool. In traditional technologies, developers often need to input complex component pull commands to trigger a component management tool to obtain components.
[0135] In the present disclosure, after obtaining the component configuration file, the client can parse the component configuration file and obtain the first component attribute information corresponding to the first component from the component configuration file, and then automatically generate a corresponding component pull command based on the first component attribute information.
[0136] In step S230, the component pull command is converted into a component pull message.
[0137] The component pull message is a message parsed by the component server, which may be a message generated according to a message body preset by the component server.
[0138] After obtaining the component pull instruction, since the component pull instruction is an instruction that can be parsed by the client of the component management tool after conversion, the component pull instruction is used to trigger the client to obtain the corresponding component from the component server. Therefore, after obtaining the parsable component pull instruction, the client can determine that the user currently needs to pull the relevant component from the component server, and can convert the component pull command into a component pull message that can be parsed by the component server.
[0139] In step S240, the component pull message is sent to the component server, and the first component is obtained based on the response information returned by the component server.
[0140] After obtaining the component pull message, the client can send the component pull message to the component server. After receiving the component pull message, in response to the component pull message, the component server can generate corresponding response information and return the response information to the client, so that the client can obtain the first component based on the response information.
[0141] For example, the response information may include the first component, and the client may directly obtain the first component from the response information; or, the response information may include a file associated with the first component, and the client may obtain the first component by reading the file.
[0142] In another example, if the components associated with the front-end project are already stored on the local device, the client can directly search for data on the local device based on the component pull command to pull the first component.
[0143] In the above-mentioned component processing method, the client can obtain the component configuration file corresponding to the client's front-end project in response to the component acquisition instruction, and the component configuration file records the component attribute information corresponding to all the published components associated with the front-end project. Then, the client can determine the first component attribute information corresponding to the first component to be acquired based on the component configuration file, and generate the corresponding component pull command based on the first component attribute information. After converting the component pull command into a component pull message, the component pull message can be sent to the component server, and the first component can be obtained based on the response information returned by the component server. In the present disclosure, after receiving the component acquisition instruction, the client can automatically generate a component pull command for the first component based on the component attribute information in the component configuration file, and uniformly use a pull method to pull the first component, without the user having to input complex commands, which not only reduces the threshold for using component management tools, but also effectively improves the efficiency of developers in reusing published components.
[0144] In an exemplary embodiment, the component attribute information may include a component identifier and component version information. The component identifier may be a unique identifier of the component, used to distinguish different components; the component version information may represent the version corresponding to the component. During the construction and development process of the same component, developers may continuously modify it to obtain different versions, and the version corresponding to the component may be determined through the component version information.
[0145] In step S220, determining first component attribute information corresponding to the first component to be acquired based on the component configuration file includes:
[0146] Based on the component configuration file, a component identifier and component version information corresponding to the first component to be acquired are determined.
[0147] In a specific implementation, after obtaining the component configuration file, the client can read the component identification and component version information corresponding to the first component to be obtained from the component configuration file as the component attribute information corresponding to the first component, and then subsequently generate a corresponding component pull command based on the component identification and component version information to pull the first component of the specified version.
[0148] In the present disclosure, the client can determine the component identification and component version information corresponding to the first component to be acquired based on the component configuration file, providing a component identification basis for subsequently generating the correct component pull command and accurately pulling the first component.
[0149] In an exemplary embodiment, in step S220, generating a corresponding component pull instruction based on the first component attribute information may include the following steps:
[0150] Obtain a preset command prefix; and concatenate the command prefix, component identifier, and component version information to obtain a component pull command corresponding to the first component.
[0151] As an example, the command prefix may be a prefix corresponding to a native command for a client to pull a component from a component server, and the native command may be a command that can be parsed by a client of a component management tool.
[0152] The component pull command may be one of the native commands that can be parsed by the client of the component management tool.
[0153] In the related art, when instructing a client of a component management tool to obtain a component from a component server, a developer often needs to input a complex native command when inputting a command to trigger the component management tool to obtain the first component, so that the component management tool can understand the user's current instruction and perform the corresponding operation after reading the native command. The native command includes a corresponding command prefix.
[0154] In the present disclosure, after obtaining the component identification and component version information corresponding to the first component, the client 110 can obtain a preset command prefix and concatenate the command prefix, component identification and component version information to obtain a component pull command corresponding to the first component.
[0155] For example, a dependent installation module can be set in the client. When receiving the component acquisition instruction "XXXavatar", the dependent installation module can determine that the user intends to obtain the avatar component "avatar". By scanning the "{"tea / basic / avatar@0.0.1":{…}}" information in the component configuration file, the component identification and component version information corresponding to the avatar component can be obtained as "tea / basic / avatar" and "0.0.1" respectively. The client can concatenate the pre-set command prefix with "tea / basic / avatar" and "0.0.1" to obtain the native command "command prefix-tea / basic / avatar@0.0.1" for pulling the component.
[0156] In the present disclosure, the client obtains a preset command prefix, concatenates the command prefix, component identifier and component version information, and obtains a component pull command corresponding to the first component. By receiving simple user instructions, it can automatically convert into a complex component pull command for instructing the client to pull the component, thereby avoiding users from entering complex instructions, reducing the usage threshold and mental cost of component management tools, and improving component acquisition efficiency.
[0157] In an exemplary embodiment, in step S240, sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server may include the following steps:
[0158] The component pull message is sent to the component server to instruct the component server to generate a code file corresponding to the first component; and the code file returned by the component server is received to obtain the first component.
[0159] In an exemplary embodiment, if Figure 3 As shown, the client may specifically include client 111, client 112 and client 113, and client 111, client 112 and client 113 are respectively deployed on different terminals, wherein client 111 may publish the component to the component server after producing the component. Client 112 and client 113 may pull the component from the component server and consume it.
[0160] In actual applications, after obtaining the component pull message, the component pull message can be sent to the component server. After receiving the component pull message, the component server can determine the component code corresponding to the component pull message from the storage space and generate a code file corresponding to the first component based on the component code.
[0161] After generating the code file, the component server may return the code file as response information to the client, so that the client can obtain the first component based on the received code file. The code file may be an index file, such as an "index.ts" file.
[0162] In one example, when generating a code file, the component server can organize the code corresponding to the first component according to the preset component directory format. Specifically, in the related art, there are various ways for users to consume components, which makes it easy for the component directory formats corresponding to the components to have different differences, resulting in errors in the process of components and their corresponding dependent components. For example, component A depends on component B. When the user obtains component A, although the component management tool can automatically install component B, it is easy to fail to install due to the difference in the actual component directory format between component B and component A, which reduces the efficiency of component reuse. By organizing the code corresponding to the first component according to the preset component directory format and generating a code file, even if there are differences in the component directory format of multiple components stored in the component server, since the code file can be generated in a unified preset component directory format, the client can obtain a standardized code file without paying attention to the differences in the component directory structure stored by the component server, avoiding problems in the subsequent installation of components and their dependencies, and improving the efficiency of component reuse.
[0163] In the present disclosure, the client can send a component pull message to the component server to instruct the component server to generate a code file corresponding to the first component, and return it to the client as a response message, so that the client can receive the code file returned by the component server and obtain the first component. In the present disclosure, the code file corresponding to the first component is generated, and the consumption and reuse of the component can be realized by reusing the source code corresponding to the component, without the need for developers to pay too much attention to non-essential configuration items provided by component management tools such as compilers and extensions, thereby reducing the mental burden when reusing components. In addition, by exporting code files, the component consumption method can be standardized, the dependencies between components can be decoupled, and direct reference to the files where the components are located in the component server can be avoided, thereby avoiding errors in the subsequent use of the component, such as installation errors when installing dependent components associated with the first component.
[0164] In an exemplary embodiment, after pulling the first component according to the component pulling command, the method further includes:
[0165] After modifying the first component, in response to the first component issuing an instruction, obtain a new component obtained by the modification; determine the identity authentication information corresponding to the current account of the client and the first storage space identifier of the first target storage space corresponding to the new component; send the identity authentication information, the first storage space identifier and the new component to a component server; the component server is used to store the new component in the first target storage space when it is determined, based on the identity authentication information and the first storage space identifier, that the current account has write permission to the first target storage space.
[0166] As an example, identity verification information may be information used to identify and verify an account identity.
[0167] The first target storage space may be a storage space for storing new components after the new components are released. Specifically, the storage space corresponding to the component server for storing components may be divided into a plurality of different storage spaces, each storage space may have a corresponding first storage space identifier, and different accounts may have different write permissions and / or read permissions for the same storage space.
[0168] In actual applications, after obtaining the first component, the developer can modify the first component to generate a new component, log in to the component management tool through the corresponding account, and send the first component release instruction to the component management tool. Figure 3As shown, after the client 113 obtains the first component from the component server, it can modify the first component to achieve component reproduction. Of course, the client can also obtain new components in other ways and publish new components, such as developers re-create independent components on the client or build other new components based on the first component and then publish them to the component server.
[0169] In response to the first component publishing instruction, the client can obtain the new component and the identity authentication information corresponding to the current account, as well as the first storage space identifier corresponding to the first target storage space where the new component is to be stored, and send the new component, identity authentication information and the first storage space identifier to the component server.
[0170] After receiving the new component, the identity verification information and the first storage space identifier, the component server may determine whether the current account has write permission for the first target storage space based on the identity verification information and the first storage space identifier.
[0171] When the component server determines that the current account has write permission for the first target storage space, the new component can be stored in the first target storage space, and a response message of successful publishing of the new component can be returned to the client. In one example, when publishing a new component, the component server can also determine whether the component identifier corresponding to the new component is unique in the first target storage space. If so, the component can continue to be published; if not, a component identifier modification prompt can be sent to the client to notify the developer to make corresponding modifications in a timely manner.
[0172] When the component server determines that the current account does not have write permission, it can return a prompt message indicating that the component publishing failed to the client, and can also display the reason for the component publishing failure in the prompt message. For example, the current account lacks write permission for the first target storage space, and the developer can be reminded to register permissions for the first target storage space first.
[0173] In the present disclosure, the identity authentication information corresponding to the current account of the client, the first storage space identifier of the first target storage space corresponding to the new component, and the new component can be sent to the component server, so that when the component is released, the component server can store the new component in the first target storage space when it determines that the current account has write permission for the first target storage space based on the identity authentication information and the first storage space identifier. When the first component is modified and a new component is released, permission control for component release can be implemented, effectively improving the security and reliability of the component when it is produced and released, increasing security, and preventing the first component from being modified arbitrarily.
[0174] In an exemplary embodiment, the method may further include the following steps:
[0175] In response to a second first component publishing instruction, obtain a second component to be published; determine the identity authentication information corresponding to the current account of the client and the second storage space identifier of the second target storage space corresponding to the second component; send the identity authentication information, the second storage space identifier and the second component to a component server; the component server is used to store the new component in the second target storage space when it is determined, based on the identity authentication information and the second storage space identifier, that the current account has write permission to the second target storage space.
[0176] As an example, the second component may be an unreleased component, for example, the second component may be a newly developed component of the local device, or may be a new component obtained from other channels and whose corresponding component attribute information is not recorded in the component configuration file.
[0177] In a specific implementation, in response to a second component release instruction, the client can obtain the second component to be released, and obtain the identity authentication information corresponding to the current account, as well as the second storage space identifier corresponding to the second target storage space where the new component is to be stored, and send the second component, identity authentication information and the second storage space identifier to the component server.
[0178] After receiving the second component, the identity verification information and the second storage space identifier, the component server may determine whether the current account has write permission for the second target storage space based on the identity verification information and the second storage space identifier.
[0179] When the component server determines that the current account has write permission for the second target storage space, the second component can be stored in the second target storage space, and a response message of successful publishing of the second component can be returned to the client. In one example, when publishing the second component, the component server can also determine whether the component identifier corresponding to the second component is unique in the second target storage space. If so, the component can continue to be published; if not, a component identifier modification prompt can be sent to the client to notify the developer to make corresponding modifications in a timely manner.
[0180] When the component server determines that the current account does not have write permission, it can return a prompt message indicating that the component publishing failed to the client, and can also display the reason for the component publishing failure in the prompt message. For example, the current account lacks write permission for the second target storage space, and the developer can be reminded to register permissions for the second target storage space first.
[0181] In the present disclosure, permission control for component release of the second component can be performed, effectively improving the safety and reliability of the component when the second component is produced and released, increasing security protection, and preventing people without authority from arbitrarily adding components to the second target storage space.
[0182] In an exemplary embodiment, determining the identity authentication information corresponding to the current account of the client may include the following steps:
[0183] Obtain a public key corresponding to the current account, and determine a hash value corresponding to the public key as identity authentication information of the current account.
[0184] Specifically, the client can obtain the public key corresponding to the current account and determine the hash value corresponding to the public key. For example, the hash value corresponding to the public key can be determined based on a preset hash algorithm such as the SHA256 algorithm.
[0185] The sending the identity authentication information, the first storage space identifier, and the new component to the component server may include:
[0186] The hash value, the domain name of the first target storage space and the new component are sent to the component server; the component server is used to send the hash value and the domain name to the authority server, and receive the verification result of whether the current account has the write permission for the first target storage space based on the preset storage space permission table, the hash value and the domain name.
[0187] As an example, the storage space permission table may have an account with write permission corresponding to the specified storage space. Specifically, the storage space permission table may record the corresponding relationship between the domain name of the storage space and the account name.
[0188] In a specific implementation, the component server may have a corresponding storage space, which may be divided into multiple different domains, i.e., multiple storage spaces. Different teams or development projects may maintain their respective components in different domains. The first storage space identifier corresponding to the first target storage space may be the domain name corresponding to the domain.
[0189] After obtaining the hash value corresponding to the current account public key, the client can send the hash value, the domain name corresponding to the first target storage space, and the new component to the component server, and the component server can send the received hash value and domain name to the authority server to query the authority server whether the current account has write permission for the first target storage space. After receiving the hash value and domain name sent by the component server, the authority server can query the pre-set storage space permission table based on the hash value and domain name to verify whether the current account has write permission for the first target storage space, and return the verification result to the component server so that the component server can read the verification result.
[0190] like Figure 3 As shown, in order to improve the security of components in the domain and limit the user's write permission to the domain, the account can be pre-registered to record the corresponding relationship between the account and the domain's usage permissions. Specifically, an account table and a storage space permission table can be set in the permission server. Among them, the account table can record the account information, which can include the account name corresponding to the account, the public key and the hash value corresponding to the public key, and the storage space permission table can record a list of account names with domain names and corresponding domain names.
[0191] Before releasing a component, the developer can log in to the corresponding account and send a permission registration request to the permission server, so that the permission server can obtain the account name, public key and public key hash value corresponding to the account, assign the account the use permission of the corresponding domain, and register the account name for the domain in the storage space permission table. In one example, the account name, public key, hash value corresponding to the public key and the account name recorded in the account name list can be recorded in string format.
[0192] When publishing a component, based on the Secure Shell Protocol (SSH), after the client sends the new component and the domain name, and the hash value corresponding to the current account public key to the component server, the component server can send the hash value and domain name to the authority server for permission query. The authority server can determine the account name corresponding to the currently received hash value based on the account table, and verify whether the account has write permission to the domain corresponding to the domain name based on the storage space permission table, and then return the verification result to the component server.
[0193] After receiving the verification result, the component server can determine whether the current account has write permission. If so, the new component can be published in the domain corresponding to the domain name; if not, a prompt message indicating write failure or write error is returned to the client.
[0194] In the present disclosure, the public key corresponding to the current account can be obtained, and the hash value corresponding to the public key can be determined as the identity authentication information of the current account, which can improve the security and reliability of components in the domain. At the same time, by encrypting the client public key and then verifying it, the identity information leakage in the verification process can be avoided, thereby improving the security of data transmission.
[0195] When the second component is released, the identity authentication process of the current account is similar to the identity authentication process of the current account when a new component is released. For the verification method when the second component is released, please refer to the previous text, and this disclosure will not repeat it.
[0196] In an exemplary embodiment, after sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server, the method may further include:
[0197] In response to a local update operation on the first component, an updated component is obtained; based on component attribute information corresponding to the updated component, the component configuration file is updated; and the updated component configuration file is sent to a version library corresponding to the front-end project to synchronize the updated component configuration file to other clients associated with the front-end project.
[0198] As an example, the component attribute information corresponding to the updated component may include at least one of the following: component identification, component version information, and dependency relationship corresponding to the component.
[0199] The version library can be a storage space for storing version information of front-end projects. For example, when developers are developing a front-end project, the components associated with the front-end project change. The version library can store one or more component configuration files corresponding to the front-end project, such as the latest component configuration file, or multiple component configuration files generated during the development process.
[0200] In actual applications, developers can locally update the first component through the client, for example, modify the first component and use the modified first component as the updated component; or, they can create new components based on the first component. The local update process can also be called component production or reproduction.
[0201] In response to the local update operation on the first component, the client can obtain the updated component and the component attribute information corresponding to the updated component, and update the current component configuration file based on the component attribute information, and then send the updated component configuration file to the version library corresponding to the front-end project. Other clients associated with the front-end project can download the component configuration file from the version library and obtain the published components associated with the front-end project based on the component configuration file.
[0202] In the present disclosure, the client obtains an updated component and can update the component configuration file based on the component property information corresponding to the updated component, and send the updated component configuration file to the version library corresponding to the front-end project, and can synchronize the updated component configuration file to other clients associated with the front-end project, so that other developers can automatically obtain the released components based on the generated component configuration file.
[0203] In an exemplary embodiment, component attribute information may include dependency relationships corresponding to the components, wherein the dependency relationship may be the dependency between the first component and other components. The dependent components on which the first component depends may be determined based on the dependency relationship. For example, when the first component a references component b during installation, the dependency relationship may refer to the relationship between the first component a and component b.
[0204] After obtaining the component configuration file corresponding to the front-end project of the client, the method may further include:
[0205] Obtain a dependency relationship corresponding to the first component from the component configuration file; and obtain a dependent component corresponding to the first component from the component server according to the dependency relationship.
[0206] In a specific implementation, after obtaining the component configuration file, the client may read the dependency relationship of the first component from the component configuration file, and then may obtain the dependent component corresponding to the first component from the component server based on the dependency relationship.
[0207] In the present disclosure, by obtaining the dependency relationship corresponding to the first component from the component configuration file, and obtaining the dependent components corresponding to the first component from the component server based on the dependency relationship, the component dependency relationship is independently maintained in the component configuration file and decoupled from other dependency management files, so that the dependency of the first component can be determined directly based on the component configuration file, reducing the mental burden of developers and improving component reuse efficiency.
[0208] In an exemplary embodiment, after sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server, the method may further include:
[0209] Obtain the path configuration information of the publishing client corresponding to the first component, and perform local path configuration according to the path configuration information; when installing the first component, install the first component into a folder corresponding to the local path configuration.
[0210] As an example, the path configuration information may include root path configuration information, such as the root path configuration corresponding to tsconfigbaseUrl, SASS_PATH, and Bit modulesDirectories.
[0211] In actual applications, the client can obtain the path configuration information of the publishing client corresponding to the first component, and perform local path configuration according to the path configuration information. By keeping the configurations corresponding to the clients of the generated component and the consumer component consistent, such as consistent path information, the relevant parameters in the component production and consumption process can be standardized to avoid errors in the subsequent installation process.
[0212] After pulling the first component, when installing the first component, the client can install the first component into a folder corresponding to the local path configuration. In one example, the local path configuration can also include a path configuration for a dependent component, and when subsequently installing the dependent component, the dependent component can also be installed into a corresponding folder according to the local path configuration.
[0213] In the present disclosure, by performing local path configuration according to the path configuration information, when installing the first component, the first component is installed in a folder corresponding to the local path configuration, which can standardize component installation and avoid installation errors.
[0214] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present disclosure is illustrated below by using an example, but it should be understood that the embodiment of the present disclosure is not limited thereto.
[0215] like Figure 5 As shown, the application environment may include client 111, client 112, client 113, component server 120 and authority server 130. Before producing or consuming components, each client may install a tool chain and initialize the client, which may include adding a remote component server, setting the storage space accessed by the client, and setting configuration information of the component management tool, such as path information.
[0216] After initialization is completed, client 111 can produce component A. Specifically, client 111 can declare that component A is composed of specified resources in an existing code repository (such as code or pictures). After tracking and versioning the specified resources, the specified resources and component version information corresponding to component A can be sent to domain B in the component server 120 for publication.
[0217] After receiving component A, component server 120 may verify with authority server 130 whether client 111 has write permission for domain B, and receive the verification result returned by authority server 130. If the verification result is yes, the component may be stored in domain B; if the verification result is no, component server 120 may temporarily not publish component A, and return a publishing error indication to client 111.
[0218] After component A is successfully published in component server 120, client 112 can consume component A by pulling, and apply component A to a preset front-end project. After pulling component A, client 112 can update the component configuration file corresponding to the front-end project by analyzing the component, and upload it to the version library corresponding to the front-end project. Client 113 can obtain the component configuration file from the version library, and after receiving the user's component acquisition instruction, automatically pull component A from component server 120 by reading the component configuration file, and use it in the business code.
[0219] After pulling component A, client 113 can also (re)produce and publish components based on component A; or, after pulling component A and modifying it, if the latest version of component A is also released in component server 120, client 113 can merge the latest version in component server 120 with the local version.
[0220] Figure 6 is a flowchart of a component processing method according to an exemplary embodiment. Figure 6 As shown, taking the method used in a component server as an example, the following steps may be included.
[0221] In step S610, a component pull message sent by the client is received; the client is used to obtain a component configuration file corresponding to the client's front-end project when receiving a component acquisition instruction, determine first component attribute information corresponding to a first component to be acquired based on the component configuration file, generate a corresponding component pull command based on the first component attribute information, and convert the component pull instruction into the component pull message, wherein the component configuration file records component attribute information corresponding to all published components associated with the front-end project.
[0222] In actual applications, the component server can receive component pull messages sent by the client. Specifically, after logging into the client, the developer can send a component acquisition instruction to the client to instruct the client to acquire related components. After receiving the component acquisition instruction input by the user, the client can obtain the component configuration file corresponding to the client's front-end project and parse it in response to the component acquisition instruction, so as to obtain the first component attribute information corresponding to the first component from the component configuration file.
[0223] After acquiring the first component attribute information, the client can automatically generate a corresponding component pull command based on the first component attribute information, convert the component pull command into a component pull message in a format preset by the component server, and send the component pull message to the component server.
[0224] In step S620, in response to the component pull message, a code file in a preset file format corresponding to the first component is generated.
[0225] In step S630, the code file is returned to the client.
[0226] As an example, the preset file format may be a file format that is set in advance.
[0227] After receiving the component pull message, the component server can determine the component code corresponding to the component pull message from the storage space, generate a code file corresponding to the first component based on the component code, and then return the code file to the client as response information to the component pull message, so that the client can obtain the first component based on the received code file.
[0228] In the above-mentioned component processing method, when the client receives the component acquisition instruction, it can obtain the component configuration file corresponding to the client's front-end project, determine the first component attribute information corresponding to the first component to be acquired based on the component configuration file, and generate the corresponding component pull command based on the first component attribute information, convert the component pull instruction into a component pull message and send it to the component server. After receiving the component pull message, the component server can generate a code file in a preset file format corresponding to the first component and return the code file to the client. In the present disclosure, after receiving the component acquisition instruction, the client can automatically generate a component pull command for the first component based on the component attribute information in the component configuration file, and uniformly use the pull method to pull the code file corresponding to the first component from the component server, without the user inputting complex commands, and the component server can uniformly export the first component through the code file in the preset file format, standardize the component consumption method, and avoid errors in the subsequent use of components, which not only lowers the threshold for using component management tools, but also effectively improves the efficiency of developers reusing released components.
[0229] In an exemplary embodiment, in response to the component pull message, generating a code file in a preset file format corresponding to the first component may include:
[0230] Obtain a component identifier and component version information corresponding to the first component from the component pull message; obtain a component code associated with the component identifier and component version information; and generate a code file in a preset file format corresponding to the first component based on the component code.
[0231] As an example, the preset file format may be a file format of an index file, for example, the code file may be an "index.ts" file.
[0232] In a specific implementation, after receiving the component pull message, the component identifier and component version information corresponding to the first component can be read from the component pull message, and the component code associated with the component identifier and component version information can be found from the corresponding storage space according to the component identifier and component version information. Then, a code file in a preset file format containing the component code can be generated.
[0233] In the present disclosure, the component code associated with the first component can be found and a code file can be generated through the component identifier and component version information in the component pull message. The component can be used based on the component code to achieve source code reuse of the component. At the same time, by generating a code file in a preset file format, the error rate in the source code reuse process can be reduced, effectively improving processing efficiency.
[0234] In an exemplary embodiment, after returning the code file to the client, the method may further include:
[0235] Obtain a second component sent by the client, as well as the identity authentication information corresponding to the current account of the client and the second storage space identifier of the second target storage space corresponding to the second component; send the identity authentication information and the second storage space identifier to an authority server, the authority server being used to obtain a verification result of whether the current account has write permission to the second target storage space based on a preset storage space permission table, the hash value and the second storage space identifier, and return the verification result to the component server; when the verification result is yes, publish the new component in the second target storage space.
[0236] In actual applications, developers can obtain the second component, log in to the component management tool through the corresponding account, and send a second component publishing instruction to the component management tool. In response to the second component publishing instruction, the client can obtain the second component, the identity verification information corresponding to the current account, and the second storage space identifier corresponding to the second target storage space to store the second component, and send the second component, the identity verification information and the second storage space identifier to the component server.
[0237] After receiving the second component, the identity verification information, and the second storage space identifier, the component server may send the received identity verification information and the second storage space identifier to the authority server, and query the authority server whether the current account has write permission for the second target storage space. After receiving the hash value and domain name sent by the component server, the authority server may query the pre-set storage space permission table based on the identity verification information and the second storage space identifier to verify whether the current account has write permission for the second target storage space, and return the verification result to the component server so that the component server can read the verification result.
[0238] After receiving the verification result, if the verification result is yes, the component server may publish the new component in the second target storage space; if the verification result is no, the component server may refuse to publish and return corresponding prompt information to the client.
[0239] In the present disclosure, after obtaining the second component, as well as the identity authentication information and the second storage space identifier corresponding to the client's current account, the component server can send the identity authentication information and the second storage space identifier to the permission server, and the permission server obtains the verification result of whether the current account has write permission to the second target storage space based on the preset storage space permission table, the identity authentication information and the second storage space identifier, and returns the verification result to the component server. When the verification result is yes, the component server can publish the second component in the second target storage space, which can improve the security and reliability of the components in the storage space.
[0240] It can be understood that if the first component is modified to obtain a new component and publish it, the verification method of the component server for the new component is similar to the verification method for the second component mentioned above. The specific implementation method can refer to the verification process of the second component release, and this disclosure will not go into details.
[0241] It should be understood that although Figure 1-Figure 6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-Figure 6 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0242] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.
[0243] Figure 7 FIG. 7 is a block diagram of a component processing device 700 according to an exemplary embodiment. Figure 7 The device includes a component configuration file obtaining unit 701, a pull command generating unit 702, a command conversion unit 703 and a component pulling unit 704.
[0244] The component configuration file acquisition unit 701 is configured to execute in response to the component acquisition instruction, and acquire the component configuration file corresponding to the front-end project of the client; the component configuration file records the component attribute information corresponding to the published component associated with the front-end project;
[0245] The pull command generating unit 702 is configured to determine first component attribute information corresponding to the first component to be acquired based on the component configuration file, and generate a corresponding component pull command based on the first component attribute information;
[0246] A command conversion unit 703 is configured to convert the component pull command into a component pull message;
[0247] The component pulling unit 704 is configured to execute sending the component pulling message to the component server, and obtain the first component based on the response information returned by the component server.
[0248] In an exemplary embodiment, the component pulling unit comprises:
[0249] A pull message sending module is configured to execute sending the component pull message to the component server to instruct the component server to obtain a code file corresponding to the first component;
[0250] The first component acquisition module is configured to execute and receive the code file returned by the component server to obtain the first component.
[0251] In an exemplary embodiment, the apparatus further comprises:
[0252] A new component acquisition unit is configured to execute, after modifying the first component, in response to the first component issuing instruction, to acquire a new component obtained by the modification;
[0253] A first verification information acquisition unit is configured to determine the identity authentication information corresponding to the current account of the client and the first storage space identifier of the first target storage space corresponding to the new component;
[0254] The first verification information sending unit is configured to send the identity authentication information, the first storage space identifier and the new component to the component server; the component server is used to store the new component in the first target storage space when it is determined, based on the identity authentication information and the first storage space identifier, that the current account has write permission for the first target storage space.
[0255] In an exemplary embodiment, the apparatus further comprises:
[0256] A second component acquisition unit is configured to execute, in response to the second component publishing instruction, to acquire a second component to be published;
[0257] A second verification information acquisition unit is configured to determine the identity authentication information corresponding to the current account of the client and the second storage space identifier of the second target storage space corresponding to the second component;
[0258] The second verification information sending unit is configured to send the identity authentication information, the second storage space identifier and the second component to the component server; the component server is used to store the new component in the second target storage space when it is determined that the current account has write permission to the second target storage space based on the identity authentication information and the second storage space identifier.
[0259] In an exemplary embodiment, the component attribute information includes component identification and component version information; the pull command generation unit includes:
[0260] The identification reading module is configured to determine the component identification and component version information corresponding to the first component to be obtained based on the component configuration file.
[0261] In an exemplary embodiment, the pull command generation unit includes:
[0262] A prefix acquisition module is configured to execute and acquire a preset command prefix; the command prefix is a prefix corresponding to a native command for the client to pull a component from a component server;
[0263] The splicing module is configured to execute splicing of the command prefix, component identifier and component version information to obtain a component pull command corresponding to the first component.
[0264] In an exemplary embodiment, the verification information acquisition unit includes:
[0265] The public key acquisition module is configured to execute acquisition of the public key corresponding to the current account and determine a hash value corresponding to the public key as the identity authentication information of the current account.
[0266] In an exemplary embodiment, the apparatus further comprises:
[0267] a component updating unit, configured to execute a local update operation in response to the first component to obtain an updated component;
[0268] a configuration file updating unit, configured to update the component configuration file based on the component attribute information corresponding to the updated component;
[0269] The configuration file sending unit is configured to send the updated component configuration file to the version library corresponding to the front-end project, so as to synchronize the updated component configuration file to other clients associated with the front-end project.
[0270] In an exemplary embodiment, the component attribute information includes a dependency relationship corresponding to the component; and the apparatus further includes:
[0271] A dependency relationship obtaining unit, configured to obtain a dependency relationship corresponding to the first component from the component configuration file;
[0272] The dependent component acquisition unit is configured to acquire the dependent component corresponding to the first component from the component server according to the dependency relationship.
[0273] In an exemplary embodiment, the apparatus further comprises:
[0274] A path configuration unit, configured to obtain path configuration information of a publishing client corresponding to the first component, and perform local path configuration according to the path configuration information;
[0275] The installation unit is configured to install the first component into a folder corresponding to the local path configuration when installing the first component.
[0276] Figure 8 FIG. 8 is a block diagram of a component processing device 800 according to an exemplary embodiment. Figure 8 The device includes a pull message receiving unit 801, a code file generating unit 802 and a code sending unit 803.
[0277] The pull message receiving unit 801 is configured to execute and receive a component pull message sent by a client; the client is used to obtain a component configuration file corresponding to the client's front-end project when receiving a component acquisition instruction, determine first component attribute information corresponding to the first component to be acquired based on the component configuration file, generate a corresponding component pull command based on the first component attribute information, and convert the component pull instruction into the component pull message, wherein the component configuration file records the component attribute information corresponding to the published component associated with the front-end project;
[0278] A code file generating unit 802 is configured to generate a code file in a preset file format corresponding to the first component in response to the component pull message;
[0279] The code sending unit 803 is configured to return the code file to the client.
[0280] In an exemplary embodiment, the code file generating unit is configured to execute:
[0281] Acquire a component identifier and component version information corresponding to the first component from the component pull message;
[0282] Obtaining a component code associated with the component identifier and the component version information;
[0283] Based on the component code, a code file in a preset file format corresponding to the first component is generated.
[0284] In an exemplary embodiment, the apparatus further comprises:
[0285] A second component receiving unit is configured to obtain the second component sent by the client, the identity authentication information corresponding to the current account of the client, and the second storage space identifier of the second target storage space corresponding to the second component;
[0286] a verification information forwarding unit configured to execute sending the identity authentication information and the second storage space identifier to an authority server, the authority server being used to obtain a verification result of whether the current account has write permission for the second target storage space based on a preset storage space permission table, the hash value and the second storage space identifier, and return the verification result to the component server;
[0287] The component publishing unit is configured to publish the new component in the second target storage space when the verification result is yes.
[0288] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0289] Fig. 9 1 is a block diagram of an electronic device 900 for implementing a component processing method according to an exemplary embodiment. For example, the electronic device 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0290] Reference Fig. 9 , the electronic device 900 may include one or more of the following components: a processing component 902 , a memory 904 , a power component 906 , a multimedia component 908 , an audio component 910 , an input / output (I / O) interface 912 , a sensor component 914 , and a communication component 916 .
[0291] The processing component 902 generally controls the overall operation of the electronic device 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 902 may include one or more modules to facilitate the interaction between the processing component 902 and other components. For example, the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 908 and the processing component 902.
[0292] The memory 804 is configured to store various types of data to support operations on the electronic device 900. Examples of such data include instructions for any application or method operating on the electronic device 900, contact data, phone book data, messages, pictures, videos, etc. The memory 904 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, an optical disk, or a graphene memory.
[0293] The power supply component 906 provides power to the various components of the electronic device 900. The power supply component 906 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 900.
[0294] The multimedia component 908 includes a screen that provides an output interface between the electronic device 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 908 includes a front camera and / or a rear camera. When the electronic device 900 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0295] The audio component 910 is configured to output and / or input audio signals. For example, the audio component 910 includes a microphone (MIC), and when the electronic device 900 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 904 or sent via the communication component 916. In some embodiments, the audio component 910 also includes a speaker for outputting an audio signal.
[0296] I / O interface 912 provides an interface between processing component 902 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0297] The sensor assembly 914 includes one or more sensors for providing various aspects of status assessment for the electronic device 900. For example, the sensor assembly 914 can detect the open / closed state of the electronic device 900, the relative positioning of the components, such as the display and keypad of the electronic device 900, and the sensor assembly 914 can also detect the position change of the electronic device 900 or the electronic device 900 components, the presence or absence of contact between the user and the electronic device 900, the orientation or acceleration / deceleration of the device 900 and the temperature change of the electronic device 900. The sensor assembly 914 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 914 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 914 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0298] The communication component 916 is configured to facilitate wired or wireless communication between the electronic device 900 and other devices. The electronic device 900 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 916 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 916 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0299] In an exemplary embodiment, the electronic device 900 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0300] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 904 including instructions, and the above instructions can be executed by the processor 920 of the electronic device 900 to perform the above method. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0301] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by the processor 920 of the electronic device 900 to complete the above method.
[0302] Fig.10 1 is a block diagram of an electronic device 1000 for implementing a component processing method according to an exemplary embodiment. For example, the electronic device 1000 may be a server. Fig.10 , the electronic device 1000 includes a processing component 1020, which further includes one or more processors, and a memory resource represented by a memory 1022 for storing instructions executable by the processing component 1020, such as an application. The application stored in the memory 1022 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1020 is configured to execute the instructions to perform the above method.
[0303] The electronic device 1000 may further include a power supply component 1024 configured to perform power management of the electronic device 1000, a wired or wireless network interface 1026 configured to connect the electronic device 1000 to a network, and an input / output (I / O) interface 1028. The electronic device 1000 may operate based on an operating system stored in the memory 1022, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or the like.
[0304] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1022 including instructions, and the instructions can be executed by a processor of the electronic device 1000 to complete the above method. The storage medium can be a computer-readable storage medium, for example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0305] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by a processor of the electronic device 1000 to complete the above method.
[0306] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. may also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.
[0307] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0308] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A component processing method, characterized in that: Applied to a client, the method comprises: In response to the component acquisition instruction, a component configuration file corresponding to the front-end project of the client is acquired; the component configuration file records component attribute information corresponding to all published components associated with the front-end project; Based on the component configuration file, determining first component attribute information corresponding to the first component to be acquired, and generating a corresponding component pull command based on the first component attribute information; Converting the component pull command into a component pull message; The component pull message is sent to the component server, and the first component is obtained based on the response information returned by the component server.
2. The method according to claim 1, characterized in that The sending the component pull message to the component server and obtaining the first component based on response information returned by the component server includes: Sending the component pull message to the component server to instruct the component server to obtain the code file corresponding to the first component; The code file returned by the component server is received to obtain the first component.
3. The method according to claim 1, characterized in that After sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server, the method further includes: After modifying the first component, in response to the first component issuing an instruction, obtaining a new component obtained by the modification; Determine the identity authentication information corresponding to the current account of the client and the first storage space identifier of the first target storage space corresponding to the new component; The identity authentication information, the first storage space identifier and the new component are sent to a component server; the component server is used to store the new component in the first target storage space when it is determined, based on the identity authentication information and the first storage space identifier, that the current account has write permission for the first target storage space.
4. The method according to claim 1, characterized in that: Also includes: In response to the second component publishing instruction, obtaining a second component to be published; Determine the identity authentication information corresponding to the current account of the client and the second storage space identifier of the second target storage space corresponding to the second component; Sending the identity authentication information, the second storage space identifier, and the second component to a component server; The component server is used to store the second component in the second target storage space when it is determined that the current account has write permission for the second target storage space based on the identity authentication information and the second storage space identifier.
5. The method according to claim 1, characterized in that: The component attribute information includes a component identifier and component version information; and determining, based on the component configuration file, first component attribute information corresponding to the first component to be acquired includes: Based on the component configuration file, a component identifier and component version information corresponding to the first component to be acquired are determined.
6. The method according to claim 5, characterized in that The generating a corresponding component pull instruction based on the first component attribute information includes: Obtaining a preset command prefix; the command prefix is a prefix corresponding to a native command for the client to pull a component from a component server; The command prefix, component identifier and component version information are concatenated to obtain a component pull command corresponding to the first component.
7. The method according to claim 3 or 4, characterized in that: The determining the identity authentication information corresponding to the current account of the client includes: Obtain a public key corresponding to the current account, and determine a hash value corresponding to the public key as identity authentication information of the current account.
8. The method according to claim 1, characterized in that After sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server, the method further includes: In response to a local update operation on the first component, updating the component configuration file based on component attribute information corresponding to the updated component; The updated component configuration file is sent to the version library corresponding to the front-end project, so as to synchronize the updated component configuration file to other clients associated with the front-end project.
9. The method according to claim 1, characterized in that: The component attribute information includes the dependency relationship corresponding to the component; After obtaining the component configuration file corresponding to the front-end project of the client, it also includes: Obtaining, from the component configuration file, a dependency relationship corresponding to the first component; According to the dependency relationship, a dependent component corresponding to the first component is obtained from the component server.
10. The method according to claim 1, characterized in that After sending the component pull message to the component server and obtaining the first component based on the response information returned by the component server, the method further includes: Obtaining the path configuration information of the publishing client corresponding to the first component, and performing local path configuration according to the path configuration information; When installing the first component, the first component is installed in a folder corresponding to the local path configuration.
11. A component processing method, characterized in that: Applied to a component server, the method comprises: Receive a component pull message sent by a client; the client is used to obtain a component configuration file corresponding to the client's front-end project when receiving a component acquisition instruction, determine first component attribute information corresponding to a first component to be acquired based on the component configuration file, generate a corresponding component pull command based on the first component attribute information, and convert the component pull command into the component pull message, wherein the component configuration file records component attribute information corresponding to all published components associated with the front-end project; In response to the component pull message, generating a code file in a preset file format corresponding to the first component; The code file is returned to the client.
12. The method according to claim 11, characterized in that The generating, in response to the component pull message, a code file in a preset file format corresponding to the first component, comprises: Acquire a component identifier and component version information corresponding to the first component from the component pull message; Obtaining a component code associated with the component identifier and the component version information; Based on the component code, a code file in a preset file format corresponding to the first component is generated.
13. The method according to claim 11, characterized in that After returning the code file to the client, the method further includes: Acquire the second component sent by the client, as well as the identity authentication information corresponding to the current account of the client, and the second storage space identifier of the second target storage space corresponding to the second component; Sending the identity authentication information and the second storage space identifier to an authority server, the authority server being used to obtain a verification result of whether the current account has write permission for the second target storage space based on a preset storage space permission table, a hash value and the second storage space identifier, and returning the verification result to the component server; When the verification result is yes, the second component is published in the second target storage space.
14. A component processing device, characterized in that: Applied to a client, the device comprises: A component configuration file acquisition unit is configured to execute in response to a component acquisition instruction to acquire a component configuration file corresponding to a front-end project of a client; the component configuration file records component attribute information corresponding to all published components associated with the front-end project; a pull command generating unit, configured to determine first component attribute information corresponding to the first component to be acquired based on the component configuration file, and generate a corresponding component pull command based on the first component attribute information; A command conversion unit, configured to convert the component pull command into a component pull message; The component pulling unit is configured to execute sending the component pulling message to the component server, and obtain the first component based on the response information returned by the component server.
15. The device according to claim 14, characterized in that The component pulling unit comprises: A pull message sending module is configured to execute sending the component pull message to the component server to instruct the component server to obtain a code file corresponding to the first component; The first component acquisition module is configured to execute and receive the code file returned by the component server to obtain the first component.
16. The device according to claim 14, characterized in that The device also includes: A new component acquisition unit is configured to execute, after modifying the first component, in response to the first component issuing instruction, to acquire a new component obtained by the modification; A first verification information acquisition unit is configured to determine the identity authentication information corresponding to the current account of the client and the first storage space identifier of the first target storage space corresponding to the new component; The first verification information sending unit is configured to send the identity authentication information, the first storage space identifier and the new component to the component server; the component server is used to store the new component in the first target storage space when it is determined, based on the identity authentication information and the first storage space identifier, that the current account has write permission for the first target storage space.
17. The device according to claim 14, characterized in that The device also includes: A second component acquisition unit is configured to execute, in response to the second component publishing instruction, to acquire a second component to be published; A second verification information acquisition unit is configured to determine the identity authentication information corresponding to the current account of the client and a second storage space identifier of the second target storage space corresponding to the second component; The second verification information sending unit is configured to send the identity authentication information, the second storage space identifier and the second component to the component server; the component server is used to store the second component in the second target storage space when it is determined, based on the identity authentication information and the second storage space identifier, that the current account has write permission for the second target storage space.
18. The device according to claim 14, characterized in that The component attribute information includes component identification and component version information; the pull command generation unit includes: The identification reading module is configured to determine the component identification and component version information corresponding to the first component to be obtained based on the component configuration file.
19. The device according to claim 18, characterized in that The pull command generating unit includes: A prefix acquisition module is configured to execute and acquire a preset command prefix; the command prefix is a prefix corresponding to a native command for the client to pull a component from a component server; The splicing module is configured to execute splicing of the command prefix, component identifier and component version information to obtain a component pull command corresponding to the first component.
20. The device according to claim 16 or 17, characterized in that The verification information acquisition unit includes: The public key acquisition module is configured to execute acquisition of the public key corresponding to the current account and determine a hash value corresponding to the public key as the identity authentication information of the current account.
21. The device according to claim 14, characterized in that The device also includes: a component updating unit, configured to execute a local update operation in response to the first component to obtain an updated component; a configuration file updating unit, configured to update the component configuration file based on the component attribute information corresponding to the updated component; The configuration file sending unit is configured to send the updated component configuration file to the version library corresponding to the front-end project, so as to synchronize the updated component configuration file to other clients associated with the front-end project.
22. The device according to claim 14, characterized in that The component attribute information includes the dependency relationship corresponding to the component; the device also includes: A dependency relationship obtaining unit, configured to obtain a dependency relationship corresponding to the first component from the component configuration file; The dependent component acquisition unit is configured to acquire the dependent component corresponding to the first component from the component server according to the dependency relationship.
23. The device according to claim 14, characterized in that The device also includes: A path configuration unit, configured to obtain path configuration information of a publishing client corresponding to the first component, and perform local path configuration according to the path configuration information; The installation unit is configured to install the first component into a folder corresponding to the local path configuration when installing the first component.
24. A component processing device, characterized in that: Applied to a component server, the device comprises: A pull message receiving unit is configured to execute and receive a component pull message sent by a client; the client is used to obtain a component configuration file corresponding to the client's front-end project when receiving a component acquisition instruction, determine first component attribute information corresponding to a first component to be acquired based on the component configuration file, generate a corresponding component pull command based on the first component attribute information, and convert the component pull command into the component pull message, wherein the component configuration file records the component attribute information corresponding to the published component associated with the front-end project; A code file generating unit, configured to generate a code file in a preset file format corresponding to the first component in response to the component pull message; The code sending unit is configured to return the code file to the client.
25. The device according to claim 24, characterized in that The code file generating unit is configured to execute: Acquire a component identifier and component version information corresponding to the first component from the component pull message; Obtaining a component code associated with the component identifier and the component version information; Based on the component code, a code file in a preset file format corresponding to the first component is generated.
26. The device according to claim 24, characterized in that The device also includes: A second component receiving unit is configured to obtain the second component sent by the client, the identity authentication information corresponding to the current account of the client, and the second storage space identifier of the second target storage space corresponding to the second component; a verification information forwarding unit configured to execute sending the identity authentication information and the second storage space identifier to an authority server, the authority server being used to obtain a verification result of whether the current account has write permission for the second target storage space based on a preset storage space permission table, a hash value and the second storage space identifier, and return the verification result to the component server; The component publishing unit is configured to publish the second component in the second target storage space when the verification result is yes.
27. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the component processing method according to any one of claims 1 to 13.
28. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the component processing method according to any one of claims 1 to 13.
29. A computer program product, comprising instructions, characterized in that: When the instructions are executed by a processor of an electronic device, the electronic device is enabled to execute the component processing method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Page and page configuration file generation method, device, terminal device and medium
CN109460276A
Service component loading method and device, computer device and storage medium
CN110109712A