Business component code installation method, tool and component code sharing system
By automatically judging and traversing the business component code in the component warehouse and copying it to the project folder of the target device, the problem of low automation and low efficiency of business component code installation in the existing technology is solved, and efficient and reliable code installation and operation is achieved.
Patent Information
- Application Number
- CN202110979073.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-25
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2041-08-25
AI Technical Summary
The existing business component code installation methods have problems such as long installation time, high cost, poor automation, low efficiency and prone to errors caused by the need for frequent manual operations by developers.
Provide a business component code installation method, by automatically determining whether the target component obtained from the Internet component warehouse and currently stored in the local storage unit is a business component. If so, the local storage unit is traversed to obtain the target code data corresponding to the target component and copy it to the project business folder of the target device to complete the installation.
It effectively improves the automation and reliability of business component code installation, avoids errors caused by omission of target code and manual operations, significantly reduces installation time and cost, and improves the reliability and user experience of code operation.
Smart Images

Figure CN113656048B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, in particular to the field of big data technology, and specifically to a business component code installation method, tool, and component code sharing system. Background Art
[0002] In the front-end field in recent years, the idea of "componentization" has become more and more popular. Various minimal functional units can be developed, and then assembled into various pages and websites in a building block manner. In this way, code can be reused to the greatest extent, repetitive work can be reduced, and development efficiency can be greatly improved. Generally, component developers can publish their developed components to a public Internet component warehouse (such as the npm website, etc.), and then others can install the desired components from the component warehouse to their own projects through installation methods such as the Node.js-based package manager npm (node package manager). Components can also be generally divided into technical components and business components.
[0003] At present, when users want to install component codes in the public component repository, they need to download the target component to their own project first. The package manager will install the component to a temporary folder in their own project by default. If the target component is a technical component, the user needs to reference the functions in the technical component from the temporary folder to their own code file; if the target component is a business component, the user needs to copy the files in the component from the temporary folder to their own project folder one by one. When the number of files in the business component increases and the file structure becomes more complex, this work will become more time-consuming and prone to errors due to operational errors. In other words, the existing business component code installation method has the problems of long installation time, high cost, poor automation, low efficiency and easy errors due to frequent manual operations by developers. Summary of the invention
[0004] In response to the problems in the prior art, the present application provides a business component code installation method, tool and component code sharing system, which can effectively improve the automation, efficiency and intelligence of obtaining and installing target code data corresponding to the target component from the Internet component repository, avoid frequent manual operations and code omissions by developers, and thus effectively improve the convenience, reliability and effectiveness of code operation.
[0005] In order to solve the above technical problems, this application provides the following technical solutions:
[0006] In a first aspect, the present application provides a method for installing a business component code, comprising:
[0007] Determine whether a target component pre-acquired from an Internet component repository and currently stored in a first local storage unit is a business component, and if so, traverse the first local storage unit to acquire target code data corresponding to the target component;
[0008] The target code data is copied to a second local storage unit corresponding to a target device that requests to obtain the target component to complete the installation of the target code corresponding to the target component.
[0009] Further, traversing the first local storage unit to obtain the target code data corresponding to the target component includes:
[0010] Traversing the first local storage unit and searching for each code file and folder corresponding to the target component therein;
[0011] The code files and folders corresponding to the target component are determined as the target code data corresponding to the target component.
[0012] Further, traversing the first local storage unit to search for target code data corresponding to the target component includes:
[0013] Receiving a target functional module identifier corresponding to the target component sent by a user;
[0014] Traversing the first local storage unit to search for code files and folders corresponding to the target functional module identifier from the target component;
[0015] The code files and folders corresponding to the target functional module identifier are determined as the target code data corresponding to the target component.
[0016] Furthermore, before receiving the target functional module identifier corresponding to the target component sent by the user, the method further includes:
[0017] Search the first local storage unit to see whether it contains a configuration file of the target component, wherein the configuration file is used to store the various functional module identifiers of the target component; if so, send the various functional module identifiers of the target component to the user who requests to obtain the target component, so that the user selects at least one from the various functional module identifiers as the target functional module identifier and returns the target functional module identifier.
[0018] Furthermore, before determining whether the target component pre-acquired from the Internet component repository and currently stored in the first local storage unit is a business component, the method further includes:
[0019] Receiving a component download request from a user to an Internet component repository;
[0020] Obtaining a corresponding target component identifier from the component download request;
[0021] Searching for a corresponding target component from the Internet component repository according to the target component identifier;
[0022] The target component is stored in a preset first local storage unit.
[0023] Furthermore, the first local storage unit includes: a local temporary folder corresponding to the Internet component repository;
[0024] The second local storage unit includes: requesting to obtain a project business folder corresponding to a target device of the target component.
[0025] In a second aspect, the present application provides a business component code installation tool, including:
[0026] a judgment and traversal module, used to judge whether a target component pre-acquired from an Internet component repository and currently stored in a first local storage unit is a business component, and if so, traverse the first local storage unit to obtain target code data corresponding to the target component;
[0027] The installation module is used to copy the target code data to a second local storage unit corresponding to a target device that requests to obtain the target component to complete the installation of the target code corresponding to the target component.
[0028] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the business component code installation method when executing the program.
[0029] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the business component code installation method when executed by a processor.
[0030] In a fifth aspect, the present application provides a component code sharing system, including: an Internet component repository and a business component code installation tool that are communicatively connected, the business component code installation tool being used to execute the business component code installation method;
[0031] The Internet component repository is communicatively connected to at least one client device to receive components uploaded by the client device and publish the components;
[0032] The business component code installation tool is communicatively connected to at least one client device to receive a component download request for an Internet component repository sent by the client device, and searches and downloads the corresponding target component from the Internet component repository to the local business component code installation tool according to the component download request.
[0033] It can be seen from the above technical scheme that the present application provides a business component code installation method, tool and component code sharing system, the method comprising: judging whether a target component pre-acquired from an Internet component warehouse and currently stored in a first local storage unit is a business component, and if so, traversing the first local storage unit to obtain target code data corresponding to the target component; copying the target code data to a second local storage unit corresponding to a target device requesting to obtain the target component to complete the installation of the target code corresponding to the target component, by automatically judging whether a target component acquired from an Internet component warehouse and currently stored in the first local storage unit is a business component, and then actively traversing the first local storage unit to obtain the target code data corresponding to the target component according to the judgment result, the speed of obtaining the target code data corresponding to the target component can be effectively improved. The automation, efficiency and intelligence of the target code data can be improved, thereby avoiding frequent manual operations of developers who request to obtain these target components; by copying the target code data to the second local storage unit specified by the client device that requests to obtain the target component to complete the installation of the target code corresponding to the target component in the client device, the automation and reliability of the business component code installation can be further improved, and the omission of the target code can be avoided, and the problems of long installation time, high cost, poor automation, low efficiency and easy errors caused by the need for frequent manual operations by developers can be avoided; since the reliability and effectiveness of the code operation in the second local storage unit subsequently installed in the client device can be effectively improved, the user experience of developers and the like who have the need to download and install the target components can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0035] Figure 1 This is an example sequence diagram of obtaining and installing component code from a public component repository.
[0036] Figure 2It is a schematic diagram of the relationship between the business component code installation tool in the embodiment of the present application and the client device and the Internet component warehouse.
[0037] Figure 3 This is a first flow chart of the method for installing the business component code in the embodiment of the present application.
[0038] Figure 4 This is a second flow chart of the service component code installation method in the embodiment of the present application.
[0039] Figure 5 This is a third flow chart of the business component code installation method in the embodiment of the present application.
[0040] Figure 6 This is a fourth flow chart of the business component code installation method in the embodiment of the present application.
[0041] Figure 7 This is a fifth flow chart of the service component code installation method in the embodiment of the present application.
[0042] Figure 8 It is a structural diagram of the business component code installation tool in the embodiment of the present application.
[0043] Fig. 9 This is the installation sequence diagram of the business component code provided by the application example of this application.
[0044] Fig.10 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] It should be noted that the business component code installation method and device disclosed in this application can be used in the field of big data technology, and can also be used in any field other than the field of big data technology. The application field of the business component code installation method and device disclosed in this application is not limited.
[0047] In one or more embodiments of the present application, npm stands for Node Package Manager, which is a package manager based on Node.js and is also the most popular package manager in the entire Node.js community that supports the most third-party modules.
[0048] Components can generally be divided into technical components and business components. Technical components are atomic basic components. They are very abstract components without any business logic. They provide developers with rich interfaces and configurations to customize the functions of components. Business components are a combination of a series of technical components. They are functional units or web pages with certain specific business scenarios. They can be used out of the box without too much reference and modification of the components. The installation and use processes of the two components are also different.
[0049] For an example sequence diagram of obtaining and installing component code from a public component repository, see Figure 1 ; Examples of obtaining and installing component code from a public component repository Figure 1 The specific process is as follows:
[0050] First, component providers can use the "npm publish" command of the "npm tool" to publish their components to the component sharing repository for others to view and use.
[0051] Then, business developers can also use the "npm install xxx" command of the npm tool to install the component into their own business projects. When using the installation command, the npm tool will search for the required component in the component shared warehouse. If the search is successful, the npm tool will automatically download the component to the "node_modules" folder of the project (this directory is only a temporary folder during the development process, not a formal file directory at runtime).
[0052] After the installation is complete, if the component is a technical component, we need to introduce the newly installed component into our own code file for use, such as: require('xxx') or import xxx from'xxx'.
[0053] If the component is a business component, the developer needs to manually copy all the files and directories of the component in node_modules to the project's business folder (not node_modules) before it can be used. The developer needs to repeat this process until all the required files are accurately copied.
[0054] Moreover, when the business component itself needs to rely on other third-party components, developers will need to do more things manually. We need to manually install all third-party dependencies of the business component one by one using the npm tool npm install xxx until all dependencies are installed.
[0055] However, although the above method can enable developers to enjoy the benefits of shared components, improve developers' work efficiency and save code to a certain extent, the application scenarios and code reuse degree of this solution have certain limitations.
[0056] When developers want to use components in the public component repository, they can download the components to their own projects by "npm install xxx". By default, npm will install the components to a temporary folder "node_modules" in their own projects. If the component is a technical component, developers who want to really use the functions of this component also need to reference the functions in the component from the node_modules folder to their own code files (for example, require('xxx') or import xxx from'xxx'). If it is a business component, it is even more complicated. We need to copy the files in the component from the node_modules folder to our own project folder one by one. When the number of files in the business component increases and the file structure becomes more complex, this work will become more time-consuming and prone to errors due to operational errors. Therefore, if business developers want to fully install and use a business component, the cost is very high, and the entire process has a low degree of automation, requiring developers to frequently operate manually, which is not only inefficient but also prone to errors.
[0057] Based on this, in view of the problems that the existing business component code installation method has the problems of long installation time, high cost, poor automation, low efficiency and easy errors caused by the need for frequent manual operations by developers, the embodiment of the present application provides a business component code installation method, which determines whether a target component pre-obtained from an Internet component warehouse and currently stored in a first local storage unit is a business component. If so, traverse the first local storage unit to obtain the target code data corresponding to the target component; copy the target code data to the second local storage unit corresponding to the target device requesting to obtain the target component to complete the installation of the target code corresponding to the target component, automatically determine whether the target component obtained from the Internet component warehouse and currently stored in the first local storage unit is a business component, and then actively traverse the first local storage unit according to the determination result to obtain the target component corresponding to the target code. The target code data can effectively improve the automation, efficiency and intelligence of obtaining the target code data corresponding to the target component, thereby avoiding frequent manual operations of developers who request to obtain these target components; by copying the target code data to the second local storage unit in the client device that requests to obtain the target component to complete the installation of the target code corresponding to the target component in the client device, the automation and reliability of the business component code installation can be further improved, the target code can be avoided from being missed, and the installation process can be time-consuming, costly, poorly automated, inefficient and prone to errors due to frequent manual operations by developers can be avoided; since the reliability and effectiveness of the code operation subsequently installed in the second local storage unit in the client device can be effectively improved, the user experience of developers who have the need to download and install target components can be effectively improved.
[0058] Based on the above content, the present application also provides a business component code installation tool for implementing the business component code installation method provided in one or more embodiments of the present application. The business component code installation tool can be an independent server or a functional module installed in a client device, etc. Taking the specific implementation of the business component code installation tool as a server as an example, see Figure 2 The business component code installation tool can communicate and connect with each client device in turn by itself or through a third-party server, and communicate and connect with the Internet component warehouse. The Internet component warehouse is communicated and connected with at least one client device to receive components uploaded by the client device and publish components; the business component code installation tool is communicated and connected with at least one client device to receive component download requests for the Internet component warehouse sent by the client device, and search and download the corresponding target component from the Internet component warehouse to the local business component code installation tool according to the component download request.
[0059] In another practical application scenario, the part of the business component code installation tool that performs the business component code installation can be executed in the server as described above, or all operations can be completed in the user terminal device. The specific selection can be made based on the processing capability of the user terminal device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the user terminal device, the user terminal device can also include a processor for specific processing of the business component code installation.
[0060] It is understandable that the mobile terminal may include any mobile device capable of loading applications, such as a smart phone, a tablet electronic device, a network set-top box, a portable computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, smart watches, smart bracelets, etc.
[0061] The above-mentioned mobile terminal may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.
[0062] The server and the mobile terminal may communicate with each other using any suitable network protocol, including network protocols that have not yet been developed on the date of filing this application. The network protocols may include, for example, TCP / IP, UDP / IP, HTTP, HTTPS, etc. Of course, the network protocols may also include, for example, RPC (Remote Procedure Call Protocol) and REST (Representational State Transfer) protocols used on top of the above protocols.
[0063] The details are described in detail through the following embodiments and application examples.
[0064] In order to solve the problems of the existing business component code installation method, which requires frequent manual operations by developers and causes long installation time, high cost, poor automation, low efficiency and easy errors, the present application provides an embodiment of a business component code installation method, see Figure 3 The business component code installation method executed by the business component code installation tool specifically includes the following contents:
[0065] Step 100: Determine whether the target component pre-acquired from the Internet component repository and currently stored in the first local storage unit is a business component, if so, execute step 200;
[0066] It is understandable that when the installation command is executed, the business component code installation tool will first search for the component in the Internet component repository, and after a successful search, the component will be downloaded to the first local storage unit of the business component code installation tool.
[0067] In step 100, after the target component is downloaded and installed to the first local storage unit, the business component code installation tool will determine whether the target component provided by the component publisher is a business component. The specific judgment method can be determined by whether the target component, such as the package.json file, contains a preset business component identifier.
[0068] If it is determined in step 100 that the target component is not a business component, it means that the target component is a technical component, and the developer can introduce the technical component into his own business code in the form of require('xxx') or import xxx from 'xxx'.
[0069] Step 200: traverse the first local storage unit to obtain target code data corresponding to the target component.
[0070] Step 300: Copy the target code data to a second local storage unit corresponding to a target device that requests to obtain the target component to complete the installation of the target code corresponding to the target component.
[0071] In step 200 and step 300, if it is a business component, the business component code installation tool will recursively traverse all files and directories of the business component in the first local storage unit, and then automatically copy all files and folders of the business component to the second local storage unit corresponding to the target device requesting to obtain the target component. The entire process of this step is fully automated and does not require manual operation by the developer.
[0072] From the above description, it can be seen that the business component code installation method provided in the embodiment of the present application can effectively improve the automation, efficiency and intelligence of obtaining the target code data corresponding to the target component by automatically determining whether the target component obtained from the Internet component warehouse and currently stored in the first local storage unit is a business component, and then actively traversing the first local storage unit according to the determination result to obtain the target code data corresponding to the target component, thereby avoiding frequent manual operations of developers who request to obtain these target components; by copying the target code data to the second local storage unit in the client device that requests to obtain the target component to complete the installation of the target code corresponding to the target component in the client device, the automation and reliability of the business component code installation can be further improved, the target code can be avoided, and the installation time-consuming, costly, poorly automated, inefficient and error-prone problems caused by the need for frequent manual operations by developers can be avoided; since the reliability and effectiveness of the code operation subsequently installed in the second local storage unit in the client device can be effectively improved, the user experience of developers and others who have the need to download and install the target component can be effectively improved.
[0073] In order to further improve the automation, efficiency and intelligence of obtaining the target code data corresponding to the target component, an embodiment of the business component code installation method provided in this application is provided. Figure 4 , step 200 of the business component code installation method may specifically include the following content:
[0074] Step 211: traverse the first local storage unit and search for each code file and folder corresponding to the target component therein.
[0075] Step 212: Determine each code file and folder corresponding to the target component as the target code data corresponding to the target component.
[0076] For example, when a component is downloaded and installed in the node_modules folder, the business component code installation tool will determine whether the tool provided by the component publisher is a business component. The specific determination method can be determined by the identifier in the package.json file of the component. It can recursively traverse all files and directories of the component in node_modules, and then automatically copy all files and folders of the component to the directory of the business project (project business folder). The entire process of this step is fully automated and does not require manual operation by developers.
[0077] From the above description, it can be seen that the business component code installation method provided in the embodiment of the present application can make the business component code installation process without user participation throughout the process by searching for all the code files and folders corresponding to the target component. When or after determining that the target component is a business component, the business component code installation tool can directly, automatically and reliably extract all the business component codes and install them in a predetermined user-specified installation directory, thereby further improving the automation, efficiency and intelligence of obtaining the target code data corresponding to the target component, and ensuring the reliability and effectiveness of the business component code installation and operation.
[0078] In order to further shorten the time of the entire service component code installation process, an embodiment of the service component code installation method provided in this application is shown in FIG. Figure 5 Step 200 of the business component code installation method may also specifically include the following content:
[0079] Step 221: Receive the target functional module identifier corresponding to the target component sent by the user.
[0080] Step 222: Traverse the first local storage unit to search for code files and folders corresponding to the target functional module identifier from the target component.
[0081] Step 223: Determine the code files and folders corresponding to the target functional module identifier as the target code data corresponding to the target component.
[0082] For example, a business developer can send the target functional module identifier corresponding to the target component to the business component code installation tool, and the business component code installation tool will automatically copy the code files and folders of these modules to the business project according to the modules selected by the business personnel, instead of copying the code files of all components. In this way, the function of on-demand reference can be achieved.
[0083] From the above description, it can be seen that the business component code installation method provided in the embodiment of the present application can make the business component code installation process meet the user's personalized preferences by searching for the code files and folders corresponding to the target component according to the target function module identifier corresponding to the target component specified by the user, and only install the code data that the user is interested in or needs into a predetermined user-specified installation directory, so that on the basis of being able to meet the user's needs, the time of the entire business component code installation process is further shortened, so as to further improve the degree of automation, efficiency and intelligence of obtaining the business component code installation, and can improve the applicability and personalization of the business component code installation and operation, and further improve the user experience.
[0084] In order to proactively inform the user of which functional modules are included in the target component of his / her needs, so that the user can select the target functional module by himself / herself, an embodiment of the business component code installation method provided in this application is provided, see Figure 6 The business component code installation method may further include the following contents before step 221:
[0085] Step 201: searching the first local storage unit to see whether the configuration file of the target component is included, wherein the configuration file is used to store the identifiers of each functional module of the target component; if so, executing step 202;
[0086] Step 202: Send each functional module identifier of the target component to the user who requests to obtain the target component, so that the user selects at least one from each functional module identifier as the target functional module identifier and returns the target functional module identifier.
[0087] Then, step 221 is executed after step 202 .
[0088] If the configuration file containing the target component is not found in the first local storage unit, step 211 or step 221 may be directly executed.
[0089] For example, the business component provided by the component provider is a series of huge business function sets. He also provides a configuration file in the component, which defines which function modules are included in the complex component, as well as the files and folders corresponding to these function modules. In the above step S5, before copying the code file, the business component code installation tool will go to the folder of the component in node_modules to find whether the configuration file of the business component is included. If there is a configuration file and multiple function modules are defined in the configuration file, the business component code installation tool will automatically prompt the business developer to select the function module he wants to install. After the business developer has finished selecting, the business component code installation tool will automatically copy the code files and folders of these modules to the business project according to the modules selected by the business personnel, without copying all the code files of all components. In this way, the function of on-demand reference can be achieved. Business personnel can choose some of the functions in the component they need according to the actual situation, without having to copy all the codes in the component to the business project.
[0090] From the above description, it can be seen that the business component code installation method provided in the embodiment of the present application, by searching for the configuration file of the target component and then sending the functional module identifiers of the target component to the user who requests to obtain the target component, can actively inform the user which functional modules are in the target component of his / her requirements, so that the user can select the target functional module by himself / herself, and then send these target functional module identifiers to the business component code installation tool, so that the business component code installation tool can search for the code files and folders corresponding to the target component according to the target functional module identifier corresponding to the target component specified by the user, so that the business component code installation process can meet the user's personalized preferences, and only install the code data that the user is interested in or needs to a predetermined user-specified installation directory, thereby further improving the intelligence of the business component code installation process and further improving the user experience.
[0091] In order to enable the service component code installation tool to quickly and reliably perform the service component code installation process, an embodiment of the service component code installation method provided in this application is described in detail. Figure 7 The business component code installation method further includes the following contents before step 100:
[0092] Step 010: Receive a component download request sent by a user to an Internet component repository.
[0093] Step 020: Obtain the corresponding target component identifier from the component download request.
[0094] Step 030: Search for the corresponding target component from the Internet component repository according to the target component identifier.
[0095] Step 040: Store the target component in a preset first local storage unit.
[0096] For example, developers can use the business component code installation tool command "itfe install xxx" to install this component. When the installation command is executed, the tool will first search for the component in the component shared repository, and after the search is successful, it will install the component into the project's node_modules folder.
[0097] From the above description, it can be seen that the business component code installation method provided in the embodiment of the present application, by receiving a component download request from a user for an Internet component repository, and obtaining and locally storing the corresponding target component from the Internet component repository according to the request, can provide a convenient and reliable technical basis for the business component code installation tool to determine whether the target component is a business component locally, and obtain the various code files and folders corresponding to the business component, so that the business component code installation tool can quickly and reliably execute the business component code installation process, thereby further improving the automation, efficiency and intelligence of the business component code installation process.
[0098] In order to improve the convenience and efficiency of the business component code installation tool in determining whether the target component is a business component locally and obtaining various code files and folders corresponding to the business component, in an embodiment of the business component code installation method provided in the present application, the first local storage unit in the business component code installation method includes: a local temporary folder corresponding to the Internet component warehouse;
[0099] The second local storage unit includes: requesting to obtain a project business folder corresponding to a target device of the target component.
[0100] From the above description, it can be seen that the business component code installation method provided in the embodiment of the present application, by first storing the target component obtained from the Internet component warehouse in a temporary folder local to the business component code installation tool, can effectively improve the convenience and efficiency of the business component code installation tool in determining whether the target component is a business component locally and obtaining the various code files and folders corresponding to the business component. By copying the target code data to the project business folder specified by the target device, the user can directly run the target code data in the project business folder, which can further improve the convenience and efficiency of the business component code operation, thereby further improving the user experience.
[0101] From the software level, in order to solve the problems of the existing business component code installation method, such as long installation time, high cost, poor automation, low efficiency and easy error caused by frequent manual operations by developers, the present application provides an embodiment of a business component code installation tool for executing all or part of the content of the business component code installation method, see Figure 8 The business component code installation tool specifically includes the following contents:
[0102] A determination and traversal module 10, configured to determine whether a target component pre-acquired from an Internet component repository and currently stored in a first local storage unit is a business component, and if so, traverse the first local storage unit to acquire target code data corresponding to the target component;
[0103] The installation module 20 is used to copy the target code data to a second local storage unit corresponding to the target device that requests to obtain the target component to complete the installation of the target code corresponding to the target component.
[0104] The embodiment of the business component code installation tool provided in the present application can be specifically used to execute the processing flow of the embodiment of the business component code installation method in the above embodiment. Its functions are not repeated here, and reference can be made to the detailed description of the above method embodiment.
[0105] From the above description, it can be seen that the business component code installation tool provided in the embodiment of the present application can effectively improve the automation, efficiency and intelligence of obtaining the target code data corresponding to the target component by automatically determining whether the target component obtained from the Internet component warehouse and currently stored in the first local storage unit is a business component, and then actively traversing the first local storage unit according to the determination result to obtain the target code data corresponding to the target component, thereby avoiding frequent manual operations of developers who request to obtain these target components; by copying the target code data to the second local storage unit in the client device that requests to obtain the target component to complete the installation of the target code corresponding to the target component in the client device, the automation and reliability of the business component code installation can be further improved, the target code can be avoided, and the installation time-consuming, costly, poorly automated, inefficient and error-prone problems caused by the need for frequent manual operations by developers can be avoided; since the reliability and effectiveness of the code operation subsequently installed in the second local storage unit in the client device can be effectively improved, the user experience of developers and others who have the need to download and install the target component can be effectively improved.
[0106] Based on the above-mentioned embodiments of the business component code installation method or the business component code installation tool, the present application also provides a component code sharing system, including: a communicatively connected Internet component warehouse and a business component code installation tool, the business component code installation tool being used for the business component code installation method; the Internet component warehouse being communicatively connected to at least one client device to receive components uploaded by the client device and publish components; the business component code installation tool being communicatively connected to at least one client device to receive component download requests sent by the client device for the Internet component warehouse, and searching and downloading corresponding target components from the Internet component warehouse to the local business component code installation tool according to the component download request.
[0107] The embodiment of the component code sharing system provided in the present application can be specifically used to execute the processing flow of the business component code installation tool and / or business component code installation method in the above embodiments. Its functions are not repeated here and the detailed description of the above method embodiments can be referred to.
[0108] From the above description, it can be seen that the component code sharing system provided in the embodiment of the present application can effectively improve the automation, efficiency and intelligence of obtaining the target code data corresponding to the target component by automatically determining whether the target component obtained from the Internet component warehouse and currently stored in the first local storage unit is a business component, and then actively traversing the first local storage unit according to the determination result to obtain the target code data corresponding to the target component, thereby avoiding frequent manual operations of developers who request to obtain these target components; by copying the target code data to the second local storage unit in the client device that requests to obtain the target component to complete the installation of the target code corresponding to the target component in the client device, the automation and reliability of the business component code installation can be further improved, the target code can be avoided, and the installation time-consuming, costly, poorly automated, inefficient and error-prone problems caused by the need for frequent manual operations by developers can be avoided; since the reliability and effectiveness of the code operation subsequently installed in the second local storage unit in the client device can be effectively improved, the user experience of developers and others who have the need to download and install the target component can be effectively improved.
[0109] To further illustrate this solution, the application example of this application provides a business component code installation method, which is a component code installation method that can quickly and automatically install the "business component" into the project quickly and accurately with one click, and is compatible with the automatic installation capabilities of existing components; the component developed by the component provider can be a very complex business component, which contains a series of code files and can also include dependencies on other technical components. In addition, if this business component is a series of very large functions, it can also provide the ability for others to dynamically choose to enable some of the functions without installing other unnecessary functions into the project.
[0110] For the installation sequence diagram of the business component code, see Fig. 9 , the business component code installation method specifically includes the following contents:
[0111] S1: The component provider uses the tools provided by the application example of this application to publish the component to the shared warehouse (this process is similar to the npm tool), involving Fig. 9 The serial numbers 1 to 4 in the.
[0112] S2: Developers can also use the business component code installation tool command "itfe install xxx" to install this component. When executing the installation command, the tool will also first search for the component in the component shared warehouse. After the search is successful, it will also install the component in the project's node_modules folder. (This step is only a file download operation so far) Fig. 9 Serial numbers 5 to 9 in the.
[0113] S3: After the component is downloaded and installed in the node_modules folder, the business component code installation tool will determine whether the tool provided by the component publisher is a business component. The specific determination method can be determined by the identifier in the package.json file in the component. Fig. 9 The serial number is 10.
[0114] S4: If it is a common technical component, the subsequent usage is the same as that of a common component. Developers introduce the component into their business code through require('xxx') or import xxx from'xxx'.
[0115] S5: If it is a business component, the tool provided by this solution will recursively traverse all files and directories of the component in node_modules, and then automatically copy all files and folders of the component to the directory of the business project (project business folder). The entire process of this step is fully automated and does not require manual operation by developers.
[0116] S6: Based on the above step S5, this solution also provides a more powerful capability, which allows business personnel to select the partial functions of the component they need according to the actual situation, without having to copy all the code in the component to the business project. For example: the business component provided by the component provider is a large set of business functions. He also provides a configuration file in the component, which defines which functional modules are included in the complex component, as well as the files and folders corresponding to these functional modules. In the above step S5, before copying the code file, the business component code installation tool will go to the folder of the component in node_modules to find out whether it contains the configuration file of the business component. If there is a configuration file and multiple functional modules are defined in the configuration file, the business component code installation tool will automatically prompt the business developer to select the functional module he wants to install. After the business developer has made his selection, the business component code installation tool will automatically copy the code files and folders of these modules to the business project according to the modules selected by the business personnel, instead of copying all the code files of the components. In this way, on-demand reference functions can be achieved, involving Fig. 9 Serial numbers 11 to 14 in the.
[0117] After the tool automatically copies the required files, the business component actually exists in the business developer's project, and the business developer can run it directly to see the actual web page effect. Fig. 9 During the entire process, all file copy operations are automatically performed by the tool, without the need for frequent intervention by developers, which greatly improves efficiency and reduces the risk of human operational errors.
[0118] Due to the limitations of existing technical solutions, component providers generally do not spend time and effort to publish business components to shared warehouses, because the cost of installation and use is relatively high, so the application value of such components is also limited. Based on this, the application example of this application is not only compatible with the installation and use methods of existing components, but also expands the sharing scenarios of business components. Component providers can publish more business components to shared warehouses for others to use, and provide components with more flexible optional functional modules for on-demand use. It is a flexible method and implementation that greatly improves the application scenarios of front-end component sharing ecology, and has great market promotion space.
[0119] From the hardware level, in order to solve the problems of the existing business component code installation method, such as long installation time, high cost, poor automation, low efficiency and easy error caused by frequent manual operations by developers, the present application provides an embodiment of an electronic device for implementing all or part of the content of the business component code installation method, and the electronic device specifically includes the following content:
[0120] Fig.10 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Fig.10 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig.10 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0121] In one embodiment, the service component code installation function may be integrated into the central processing unit. The central processing unit may be configured to perform the following control:
[0122] Step 100: Determine whether the target component pre-acquired from the Internet component repository and currently stored in the first local storage unit is a business component, if so, execute step 200;
[0123] It is understandable that when the installation command is executed, the business component code installation tool will first search for the component in the Internet component repository, and after a successful search, the component will be downloaded to the first local storage unit of the business component code installation tool.
[0124] In step 100, after the target component is downloaded and installed to the first local storage unit, the business component code installation tool will determine whether the target component provided by the component publisher is a business component. The specific judgment method can be determined by whether the target component, such as the package.json file, contains a preset business component identifier.
[0125] If it is determined in step 100 that the target component is not a business component, it means that the target component is a technical component, and the developer can introduce the technical component into his own business code in the form of require('xxx') or import xxx from 'xxx'.
[0126] Step 200: traverse the first local storage unit to obtain target code data corresponding to the target component.
[0127] Step 300: Copy the target code data to a second local storage unit corresponding to a target device that requests to obtain the target component to complete the installation of the target code corresponding to the target component.
[0128] In step 200 and step 300, if it is a business component, the business component code installation tool will recursively traverse all files and directories of the business component in the first local storage unit, and then automatically copy all files and folders of the business component to the second local storage unit corresponding to the target device requesting to obtain the target component. The entire process of this step is fully automated and does not require manual operation by the developer.
[0129] From the above description, it can be seen that the electronic device provided in the embodiment of the present application can effectively improve the automation, efficiency and intelligence of obtaining the target code data corresponding to the target component by automatically determining whether the target component obtained from the Internet component warehouse and currently stored in the first local storage unit is a business component, and then actively traversing the first local storage unit according to the determination result to obtain the target code data corresponding to the target component, thereby avoiding frequent manual operations of developers who request to obtain these target components; by copying the target code data to the second local storage unit in the client device that requests to obtain the target component to complete the installation of the target code corresponding to the target component in the client device, the automation and reliability of the business component code installation can be further improved, the target code can be avoided, and the installation time-consuming, costly, poorly automated, inefficient and error-prone problems caused by the need for frequent manual operations by developers can be avoided; since the reliability and effectiveness of the code operation subsequently installed in the second local storage unit in the client device can be effectively improved, the user experience of developers and others who have the need to download and install the target component can be effectively improved.
[0130] In another embodiment, the business component code installation tool may be configured separately from the central processor 9100. For example, the business component code installation tool may be configured as a chip connected to the central processor 9100, and the business component code installation function is implemented under the control of the central processor.
[0131] like Fig.10 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig.10 In addition, the electronic device 9600 may also include Fig.10 For components not shown, reference may be made to the prior art.
[0132] like Fig.10 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.
[0133] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.
[0134] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.
[0135] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.
[0136] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0137] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0138] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.
[0139] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the service component code installation method in the above embodiments. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the service component code installation method in the above embodiments are implemented by the execution subject being a server or a client. For example, when the processor executes the computer program, the following steps are implemented:
[0140] Step 100: Determine whether the target component pre-acquired from the Internet component repository and currently stored in the first local storage unit is a business component, if so, execute step 200;
[0141] It is understandable that when the installation command is executed, the business component code installation tool will first search for the component in the Internet component repository, and after a successful search, the component will be downloaded to the first local storage unit of the business component code installation tool.
[0142] In step 100, after the target component is downloaded and installed to the first local storage unit, the business component code installation tool will determine whether the target component provided by the component publisher is a business component. The specific judgment method can be determined by whether the target component, such as the package.json file, contains a preset business component identifier.
[0143] If it is determined in step 100 that the target component is not a business component, it means that the target component is a technical component, and the developer can introduce the technical component into his own business code in the form of require('xxx') or import xxx from 'xxx'.
[0144] Step 200: traverse the first local storage unit to obtain target code data corresponding to the target component.
[0145] Step 300: Copy the target code data to a second local storage unit corresponding to a target device that requests to obtain the target component to complete the installation of the target code corresponding to the target component.
[0146] In step 200 and step 300, if it is a business component, the business component code installation tool will recursively traverse all files and directories of the business component in the first local storage unit, and then automatically copy all files and folders of the business component to the second local storage unit corresponding to the target device requesting to obtain the target component. The entire process of this step is fully automated and does not require manual operation by the developer.
[0147] From the above description, it can be seen that the computer-readable storage medium provided in the embodiment of the present application can effectively improve the automation, efficiency and intelligence of obtaining the target code data corresponding to the target component by automatically determining whether the target component obtained from the Internet component warehouse and currently stored in the first local storage unit is a business component, and then actively traversing the first local storage unit according to the determination result to obtain the target code data corresponding to the target component, thereby avoiding frequent manual operations of developers who request to obtain these target components; by copying the target code data to the second local storage unit in the client device that requests to obtain the target component to complete the installation of the target code corresponding to the target component in the client device, the automation and reliability of the business component code installation can be further improved, the target code can be avoided, and the installation time-consuming, costly, poorly automated, inefficient and error-prone problems caused by the need for frequent manual operations by developers can be avoided; since the reliability and effectiveness of the code operation subsequently installed in the second local storage unit in the client device can be effectively improved, the user experience of developers and others who have the need to download and install the target component can be effectively improved.
[0148] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0149] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0152] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for installing a business component code, characterized in that: include: Determine whether a target component pre-acquired from an Internet component repository and currently stored in a first local storage unit is a business component, and if so, traverse the first local storage unit to acquire target code data corresponding to the target component; The first local storage unit includes: a local temporary folder corresponding to the Internet component repository, the temporary folder is a temporary folder in the development process, not a formal file directory at runtime; the first local storage unit is a local storage unit of the business component code installation tool; The step of determining whether the target component pre-obtained from the Internet component repository and currently stored in the first local storage unit is a business component includes: Determine whether the target component is a business component by checking whether the package.json file in the target component contains a preset business component identifier; The target code data is copied to a second local storage unit corresponding to the target device for requesting to obtain the target component to complete the installation of the target code corresponding to the target component; the second local storage unit includes: a project business folder corresponding to the target device for requesting to obtain the target component; The traversing the first local storage unit to search for the target code data corresponding to the target component includes: Receiving a target functional module identifier corresponding to the target component sent by a user; Traversing the first local storage unit to search for code files and folders corresponding to the target functional module identifier from the target component; The code files and folders corresponding to the target functional module identifier are determined as the target code data corresponding to the target component.
2. The method for installing a business component code according to claim 1, characterized in that: The traversing the first local storage unit to acquire the target code data corresponding to the target component includes: Traversing the first local storage unit and searching for each code file and folder corresponding to the target component therein; The code files and folders corresponding to the target component are determined as the target code data corresponding to the target component.
3. The method for installing a business component code according to claim 1, characterized in that: Before receiving the target functional module identifier corresponding to the target component sent by the user, the method further includes: Search the first local storage unit to see whether it contains a configuration file of the target component, wherein the configuration file is used to store the various functional module identifiers of the target component; if so, send the various functional module identifiers of the target component to the user who requests to obtain the target component, so that the user selects at least one from the various functional module identifiers as the target functional module identifier and returns the target functional module identifier.
4. The method for installing a business component code according to any one of claims 1 to 3, characterized in that: Before determining whether the target component pre-acquired from the Internet component repository and currently stored in the first local storage unit is a business component, the method further includes: Receiving a component download request from a user to an Internet component repository; Obtaining a corresponding target component identifier from the component download request; Searching for a corresponding target component from the Internet component repository according to the target component identifier; The target component is stored in a preset first local storage unit.
5. A business component code installation tool, characterized in that: include: a judgment and traversal module, used to judge whether a target component pre-acquired from an Internet component repository and currently stored in a first local storage unit is a business component, and if so, traverse the first local storage unit to obtain target code data corresponding to the target component; The first local storage unit includes: a local temporary folder corresponding to the Internet component repository, the temporary folder is a temporary folder in the development process, not a formal file directory at runtime; the first local storage unit is a local storage unit of the business component code installation tool; The step of determining whether the target component pre-obtained from the Internet component repository and currently stored in the first local storage unit is a business component includes: Determine whether the target component is a business component by checking whether the package.json file in the target component contains a preset business component identifier; The installation module is used to copy the target code data to a second local storage unit corresponding to the target device for requesting to obtain the target component to complete the installation of the target code corresponding to the target component; the second local storage unit includes: a project business folder corresponding to the target device for requesting to obtain the target component; The traversing the first local storage unit to search for the target code data corresponding to the target component includes: Receiving a target functional module identifier corresponding to the target component sent by a user; Traversing the first local storage unit to search for code files and folders corresponding to the target functional module identifier from the target component; The code files and folders corresponding to the target functional module identifier are determined as the target code data corresponding to the target component.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the business component code installation method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the business component code installation method described in any one of claims 1 to 4 is implemented.
8. A component code sharing system, characterized in that: include: An Internet component repository and a business component code installation tool that are communicatively connected, the business component code installation tool being used to execute the business component code installation method according to any one of claims 1 to 4; The Internet component repository is communicatively connected to at least one client device to receive components uploaded by the client device and publish the components; The business component code installation tool is communicatively connected to at least one client device to receive a component download request for an Internet component repository sent by the client device, and searches and downloads the corresponding target component from the Internet component repository to the local business component code installation tool according to the component download request.
Citation Information
Patent Citations
Distributed web static resource sharing method and system
CN110347385A