Dependent packet uploading method, device and equipment of private library and storage medium

By comparing the version information sets of historical and current dependency packages, identifying and uploading the difference packages to the private library, the problem of low efficiency in uploading dependency packages in the private library is solved, and more efficient dependency package management is achieved.

CN120602471APending Publication Date: 2025-09-05PIPECHINA SOUTH CHINA CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510574919.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

The efficiency of uploading dependent packages in existing private libraries is low, resulting in a waste of time and network resources.

Method used

By obtaining the version information set of the locally downloaded historical dependency package set and the version information set of the dependency package set required by the current project, the differences are compared to obtain the dependency package set that actually needs to be uploaded, and the compressed package is uploaded to the private library through multi-threading.

Benefits of technology

It reduces the repeated uploading of dependent packages in private libraries, saves time and resources, and improves the uploading efficiency of dependent packages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120602471A_ABST
    Figure CN120602471A_ABST
Patent Text Reader

Abstract

The invention provides a private library dependency package uploading method, device and equipment and a storage medium, and relates to the technical field of computers, the method comprises the following steps: obtaining a version information set of a first dependency package set of a front-end project, the first dependency package set being a locally downloaded historical dependency package set; and obtaining a version information set of a second dependent packet set currently required by the front-end project. And based on the version information set of the first dependency package set and the version information set of the second dependency package set, obtaining a version information set of a third dependency package, the third dependency package being a different dependency package in the second dependency package set relative to the first dependency package set. And downloading a compressed packet of the third dependency packet based on the version information set of the third dependency packet. And uploading the compressed packet of the third dependent packet to the private library. On the basis, the uploading efficiency of the private library dependent packet can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for uploading dependency packages of a private library. Background Art

[0002] With the advancement of front-end engineering, the Node.js package manager (NPM) has become a mainstream tool for front-end dependency management. In the practical application of NPM dependency packages, if a front-end project is to be deployed on a cloud service, it is necessary to manually package the project and its dependencies and then upload the packaged static results to the cloud service. This packaging and deployment method is relatively mechanical and manual, which is not conducive to continuous integration and management of the project.

[0003] This is where NPM private repository technology comes in. A private repository is a dedicated dependency package storage and management platform built by an enterprise or team, with internal access only. It allows developers to upload the required dependency packages for their projects to the private repository. When deploying front-end projects to cloud services, these packages can be directly pulled from the private repository, eliminating the need for manual packaging. This effectively addresses the inefficiency and inconvenience of traditional manual packaging and deployment methods, which hinder continuous integration.

[0004] Currently, when using private libraries, there is still a problem of low efficiency in uploading dependent packages. Summary of the Invention

[0005] The present application provides a method, apparatus, device and storage medium for uploading dependency packages of a private library, which can improve the uploading efficiency of dependency packages.

[0006] In order to solve the above problems, the embodiments of the present application provide the following technical solutions:

[0007] In the first aspect, the present application provides a method for uploading dependency packages of a private library, the method comprising: obtaining a version information set of a first dependency package set of a front-end project, where the first dependency package set is a historical dependency package set that has been downloaded locally. Obtain a version information set of a second dependency package set currently required by the front-end project. Based on the version information set of the first dependency package set and the version information set of the second dependency package set, obtain a version information set of a third dependency package, where the third dependency package is a different dependency package in the second dependency package set relative to the first dependency package set. Based on the version information set of the third dependency package, download a compressed package of the third dependency package. Upload the compressed package of the third dependency package to the private library.

[0008] It should be understood that the existing dependency package uploading technology will upload all the dependency packages in the project to the private library every time the dependency package is uploaded, which may lead to repeated uploading of the dependency packages of the private library, resulting in a waste of time and network resources.

[0009] The dependency package uploading method of the private library provided in the present application, first, by obtaining the version information set of the historical dependency package (first dependency package set) downloaded locally, it is possible to grasp the dependency package situation that the project has used in the past and has been uploaded to the private library. The version information set of the second dependency package set required for the current project is obtained, and the dependency package set that the project needs to upload at this stage can be obtained. By comparing the third dependency package and its version information set that are different in the second dependency package set relative to the first dependency package set, it is possible to obtain the dependency package that the project really needs to upload to the private library at the current time, reduce the repeated uploading of the existing dependency package of the private library, save the time and resources of the dependency package upload, and improve the upload efficiency of the dependency package.

[0010] A possible implementation method is that before executing the dependency package download instruction based on the version information set of the third dependency package and obtaining the compressed package of the third dependency package, the method also includes: canceling the dependency package upload under the condition that the version information set of the third dependency package set is empty.

[0011] In a possible implementation, the version information in the version information set includes: dependent package name and dependent package version.

[0012] One possible implementation method, based on the version information set of the first dependency package and the version information set of the second dependency package, obtains the version information set of the third dependency package, including: comparing the version information of each second dependency package with the version information set of the first dependency package, and determining the version information of the second dependency package that meets the version difference condition as the version information of the third dependency package. The version difference condition includes at least one of the following: the dependency package name of the second dependency package does not exist in the version information set of the first dependency package. And / or, the dependency package version of the second dependency package does not exist in the version information set of the first dependency package.

[0013] One possible implementation method involves obtaining a version information set of a second dependency package of a project at a current time. The second dependency package is a dependency package required by the project at the current time, including: executing a dependency package installation instruction in the current project to obtain a dependency package version lock file; and extracting the version information set of the second dependency package from a preset field in the dependency package version lock file.

[0014] One possible implementation involves uploading a compressed package of the third dependency package to a private repository when the number of dependency packages in the third dependency package set exceeds a preset dependency package threshold. The method includes creating multiple threads and assigning each thread a preset number of compressed packages of the third dependency package. The multiple threads execute dependency package upload instructions respectively, and upload the preset number of compressed packages of the third dependency package corresponding to each thread to the private repository.

[0015] In a second aspect, the present application provides a device for uploading dependency packages of a private library, which includes various functional modules used in the method described in the first aspect above.

[0016] In a third aspect, the present application provides an electronic device comprising: a processor and a memory. The memory stores instructions executable by the processor, and when the processor is configured to execute the instructions, the electronic device implements the method described in the first aspect above.

[0017] In a fourth aspect, the present application provides a readable storage medium, the readable storage medium comprising software instructions. When the software instructions are executed in an electronic device, the electronic device implements the method described in the first aspect.

[0018] In a fifth aspect, the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device implements the method described in the first aspect.

[0019] The beneficial effects of the second to fifth aspects mentioned above can be referred to those described in the first aspect and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0021] Figure 1 A flowchart of a method for uploading dependency packages to a private library provided in an embodiment of the present application;

[0022] Figure 2 A flowchart of a method for obtaining version information of a second dependent package set provided in an embodiment of the present application;

[0023] Figure 3 A flowchart of an implementation method for uploading a dependency package based on a private library provided in an embodiment of the present application;

[0024] Figure 4 A schematic diagram of the composition of a device for uploading dependency packages to a private library provided in an embodiment of the present application;

[0025] Figure 5 A schematic diagram of the composition of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] In the following, the terms "first," "second," and "third," etc. are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Thus, a feature qualified as "first," "second," or "third," etc. may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0027] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0028] In order to understand this application solution, the dependent packages and the role of npm are explained.

[0029] Dependency packages are essentially independent code modules that encapsulate specific functionality and processing logic. Developers can quickly implement project requirements by directly calling the interfaces and methods of dependency packages, without having to write complex functional code from scratch. npm is a dependency management tool for Node.js projects. It has built-in commands that help developers quickly and easily install the various dependency packages needed for their projects and automatically manage dependencies.

[0030] As described in the background technology, private library technology allows the dependency packages required by a project to be centrally managed on an internal server of an enterprise or team, and allows the project to directly pull the dependency packages in the private library during deployment, thus achieving automated project deployment. However, in actual development, if the number of dependency packages required by a project is relatively large, then the number of dependency packages that need to be uploaded to the private library will also increase. This process consumes a lot of time and resources, reducing the efficiency of uploading dependency packages.

[0031] Therefore, how to improve the efficiency of uploading private library dependency packages has become an urgent problem that we need to solve.

[0032] In view of this, the present application provides a method for uploading dependency packages to a private library. This method can obtain the dependency package set that actually needs to be uploaded to the private library by comparing the version information set of the dependency package set cached locally. This can reduce the number of uploaded dependency packages and the situation of repeated dependency package uploads, thereby improving the upload efficiency of dependency packages.

[0033] First, the application scenarios of the embodiments of the present application are briefly introduced.

[0034] The method for uploading dependency packages of a private library provided in this application can be applied to a computing device. Specifically, the computing device can be a personal computer, a mobile smart terminal, a smart TV, etc. The embodiment of this application does not limit the specific form of the computing device.

[0035] The following is a detailed description of the method for uploading dependent packages to a private library provided in an embodiment of the present application in conjunction with the accompanying drawings.

[0036] like Figure 1 As shown, when the method is applied to a computing device, it includes the following:

[0037] S101. Obtain a version information set of a first dependency package set of a front-end project.

[0038] The first dependency package set is a historical dependency package set that has been downloaded locally.

[0039] It should be noted that the first dependency package set can be understood as the dependency package set that has been uploaded to the private library, which represents the dependency package set that has been integrated into the front-end project during the development process in the past.

[0040] It should also be noted that the front-end project can be a nodejs project, specifically, it can be a project built based on the Vue framework, React framework or Angular framework, etc. The embodiment of the present application does not limit the specific implementation framework of the front-end project.

[0041] In some embodiments, the version information in the version information set may include: dependent package name and dependent package version.

[0042] Specifically, the dependency package name refers to the specific identification name of the external library, framework or tool that the software project depends on during operation or development, which is used to clearly distinguish dependency packages with different functional purposes.

[0043] The dependency package version refers to the specific version number of the corresponding dependency package during the iterative update process. This version number reflects the functional characteristics, performance optimization level, security fix status, etc. of the dependency package.

[0044] It should be understood that by using the version information of the dependency package, the differences in functions or versions of two dependency packages can be accurately compared.

[0045] In a possible implementation, the version information set of the first dependent package set may be stored in a local disk in the form of a text file.

[0046] Specifically, the version information set can be stored in a text file in the format of a json array. When the dependency package upload method is triggered, the computing device can read the version information set of the first dependency package set according to the specific file name identifier and file path.

[0047] In another possible implementation, the version information set of the first dependency package set can be stored in the front-end project in the form of a configuration file, and the version information set of the first dependency package set generated in each development stage or function iteration can be maintained through a remote code repository (such as git).

[0048] Specifically, this approach allows developers on front-end projects to maintain consistency in the first dependency package set. When a new developer joins the front-end project development process, they can obtain the version information set of the first dependency package set when pulling project code from the remote code repository, and understand the version information of the dependency package set that already exists in the current private library. At the same time, the version control function of the remote code repository can also record the change history of dependency package versions, making it easier for developers to trace and review the version information of each past version of the dependency package set deployed to the private library.

[0049] S102: Obtain the version information set of the second dependency package set currently required by the front-end project.

[0050] It should be noted that the software development process can be divided into the construction phase and the functional iteration phase. The construction phase refers to the initial construction phase of the front-end project. During this phase, the basic architecture of the project (such as directories of code files and configuration files, etc.) will be built, which may generate a large number of dependency package imports. The functional iteration phase refers to the phase of updating and expanding the functions of the front-end project after the development phase. During this phase, if the project needs to expand a completely new function, a large number of dependency package imports may also be generated. Therefore, the second dependency package set currently required by the front-end project can refer to both the second dependency packages required by the front-end project in the construction phase and the dependency packages required by the front-end project in the functional iteration phase.

[0051] In some embodiments, the computing device may obtain the version information set of the second dependency package set through the dependency package file of the front-end project. Specifically, the process may refer to steps S1021-S1022 below, which will not be repeated here.

[0052] In other embodiments, the computing device may also obtain the version information set of the current second dependent package of the project through the npm list command provided by npm.

[0053] One possible implementation is to run the npmlist --depth=0 --json command to output all of the project's dependencies and their version information in JSON format. This command output includes not only direct dependencies but also nested dependencies of secondary dependencies by adjusting the depth parameter, making it easier to obtain comprehensive dependency version information.

[0054] S103: Based on the version information set of the first dependency package set and the version information set of the second dependency package set, obtain the version information set of the third dependency package.

[0055] The third dependency package is a different dependency package in the second dependency package set relative to the first dependency package set.

[0056] It should be noted that, as mentioned above, the first dependency package represents the set of packages and their version information that the front-end project depends on in a certain state (such as the last version release). It records the dependency environment in which the project was running stably at that time. The second dependency package represents the set of dependency packages and their version information required by the front-end project during the current development or functional iteration process. It reflects the dependency status of the project after changes based on new requirements. Therefore, by comparing the first and second dependency packages, we can obtain the changes in the dependency packages of the project during this development process, that is, the third dependency package.

[0057] In some embodiments, the third dependency package may be a newly added dependency package that exists in the second dependency package set but not in the first dependency package set, or it may be an updated dependency package that exists in both the second dependency package set and the first dependency package set but has a different version number.

[0058] S104: Download the compressed package of the third dependency package based on the version information set of the third dependency package.

[0059] In one possible implementation, the computing device may download the compressed package of the third dependency package through the npm pack command built into npm.

[0060] For example, assume thirdDependency is the version information set for the third dependency package, in the format {"packageName":"version"}. The following is the reference code for executing the npm pack command in a JavaScript script to download the package.

[0061]

[0062]

[0063] S105: Upload the compressed package of the third dependency package to the private library.

[0064] In one possible implementation, the computing device may upload the compressed package by executing the npm publish command built into npm in a script.

[0065] It should be noted that before uploading the compressed package of the third dependency package, the developer needs to configure the private library address information in npm and configure the permission authentication information to access the private library address. Only then can the dependency package be uploaded using the npmpublish command.

[0066] For example, assuming the compressed package file name format is packageName-version.tgz, the following is the reference code for executing the npm publish command in a js script to upload the package.

[0067]

[0068]

[0069] It should be noted that the above reference codes are all used to understand this application. In the specific implementation process, there will also be data validity verification logic code, network anomaly processing logic code and other codes, which will not be repeated here.

[0070] The method for uploading dependency packages to a private library provided by the present application, first, by obtaining the version information set of the historical dependency package (first dependency package set) downloaded locally, it is possible to grasp the dependency packages that the project has used in the past and uploaded to the private library, and then obtain the version information set of the second dependency package set required by the current project, and obtain the dependency package set that the project needs to upload at the current stage. By comparing the third dependency package and its version information set that are different in the second dependency package set relative to the first dependency package set, it is possible to obtain the dependency package that the project really needs to upload to the private library at the current time, thereby reducing the repeated uploading of the existing dependency packages in the private library, saving time and resources for uploading dependency packages, and improving the upload efficiency of dependency packages.

[0071] In some embodiments, before step S104, when the computing device obtains the third dependency package set, it can also determine whether it is necessary to download the compressed package of the third dependency package and upload it to the private library based on the status of the third dependency package set. In this case, the method further includes the following steps:

[0072] S106. Under the condition that the version information set of the third dependency package set is empty, cancel the dependency package upload.

[0073] It should be noted that when the third dependency package set is empty, the following situations may occur:

[0074] There are no new or changed dependency packages. The first and second dependency packages are exactly the same, with no difference in either the name or version of the dependency packages. This means that during the development or feature iteration phase of the front-end project, no new dependency packages were introduced, and no existing dependency packages were upgraded or downgraded. For example, during feature iteration, if only the code logic was modified without adjusting the dependency packages, the third dependency package set obtained by comparing the first and second dependency package sets would naturally be empty.

[0075] No new dependencies were added after the dependency packages were deleted. During feature iteration, some existing dependency packages were deleted, but no new ones were introduced. This may be because the project was optimized, removing unused functional modules and their corresponding dependency packages, and no new features were added, thus omitting the need to introduce new dependencies. For example, a front-end project originally used a dependency package for image compression, but later decided to implement image processing using other methods. This dependency package was deleted without introducing new dependencies, and the third dependency package set was empty.

[0076] Dependency package versions are rolled back to their initial state. During development, some dependency packages were upgraded, but later found to have compatibility issues or other serious problems with the new versions. Therefore, these dependency packages were rolled back to their previous state without introducing any new dependency packages. This version rollback operation restores the dependency package state to the same state as the first dependency package set, resulting in an empty third dependency package set. For example, after upgrading a JavaScript framework from version 2.0 to version 3.0, page rendering anomalies occurred, and it was then rolled back to version 2.0 without any changes to other dependency packages.

[0077] The following describes the specific process of obtaining the version information set of the third dependent package with reference to the accompanying drawings.

[0078] In some embodiments, the computing device may compare the version information sets of the first dependency package set and the second dependency package set to obtain the version information set of the third dependency package set. In this case, step S103 may be specifically implemented as follows:

[0079] S1031: Compare the version information of each second dependency package with the version information set of the first dependency package, and determine the version information of the second dependency package that meets the version difference condition as the version information of the third dependency package.

[0080] In one possible implementation, the version difference condition may be that the dependency package name of the second dependency package does not exist in the dependency package in the version information set of the first dependency package. In this case, the third dependency package is the dependency package currently newly added to the front-end project.

[0081] For example, assuming that the version information set of the first dependency package is {"packageA":"1.0.0","packageB":"2.0.0"}, and the version information set of the second dependency package is {"packageA":"1.0.0","packageB":"2.0.0","packageC":"3.0.0"}, since the dependency package name of packageC in the second dependency package does not exist in the version information set of the first dependency package, packageC is the third dependency package, that is, the newly added dependency package of the front-end project.

[0082] In another possible implementation, the version difference condition can be that the dependency package version of the second dependency package does not exist in the dependency package in the version information set of the first dependency package. In this case, the third dependency package is a dependency package that exists in both the first dependency package set and the second dependency package set, but has a different dependency package version, that is, the front-end project has an updated version of the dependency package.

[0083] Assume that the version information set of the first dependency package is {"packageA":"1.0.0","packageB":"2.0.0"}, and the version information set of the second dependency package is {"packageA":"1.1.0","packageB":"2.0.0"}, where the version of packageA in the second dependency package is 1.1.0, which does not exist in the version information set of the first dependency package, and packageA exists in both the first and second dependency package sets, so packageA is the third dependency package, that is, the dependency package of the front-end project has an updated version compared to the previous one.

[0084] In another possible implementation, the version difference condition may include a combination of the above two implementations, that is, the third dependency package may be either a newly added dependency package in the second dependency package set relative to the first dependency package set or a dependency package with an updated version relative to the first dependency package set.

[0085] Assume that the version information set of the first dependency package is {"packageA":"1.0.0","packageB":"2.0.0"}, and the version information set of the second dependency package is {"packageA":"1.1.0","packageB":"2.0.0","packageC":"3.0.0"}. At this time, the third dependency package contains both the newly added dependency package packageC (whose dependency package name is not in the first dependency package version information set) and the updated dependency package packageA (whose version is not in the first dependency package version information set).

[0086] It can be seen from step S1031 that this method can accurately identify changes in front-end project dependency packages, distinguish between newly added dependency packages and dependency packages with updated versions, and provide a data basis for subsequent private library uploads of dependency packages.

[0087] In some embodiments, the version information set of the second dependent package set is obtained in step S102, which can be obtained by Figure 2 The method shown in the figure is used to obtain the data. The process specifically includes the following steps:

[0088] S1021. Execute the dependency package installation instruction in the current project to obtain the dependency package version lock file.

[0089] In some embodiments, when the front-end project uses npm as a package management tool for the nodejs project, the dependency package version locking file may be a package-lock.json file, an npm-shrinkwrap.json file, or the like.

[0090] One possible implementation method is that the computing device can use the npminstall command built into npm in the root directory of the front-end project to download and install the dependency packages according to the versions specified by each dependency package in the second dependency package set. During the installation process, npm will automatically resolve the dependency relationship and download the corresponding dependency packages to the project, and then the version lock file of the second dependency package set downloaded this time can be obtained.

[0091] For example, the following is an example of a package-lock.json file.

[0092]

[0093] In other embodiments, the front-end project can also use the yarn dependency package management tool (hereinafter referred to as yarn) or the pnpm dependency package management tool (hereinafter referred to as pnpm) instead of npm to manage project dependencies. In this case, the version lock file when using yarn can be yarn.lock, and the version lock file when using pnpm can be pnpm-lock.yarm.

[0094] It's important to note that Yarn and pnpm, as dependency management tools, can be considered both alternatives and enhancements to npm. From the perspective of alternatives, both can perform the same basic operations as npm, such as installing, updating, and removing packages, as well as managing project dependencies. From the perspective of enhancements, Yarn and pnpm offer numerous improvements and optimizations over npm. For example, Yarn optimizes installation speed by employing parallel downloads and caching, enabling faster package installation and reducing wait times. Regarding dependency version management, Yarn's yarn.lock file provides a stricter and more precise version locking mechanism, helping ensure consistent project dependencies across different environments. Pnpm, on the other hand, excels in disk space utilization. Its unique storage method avoids duplicate installation of dependency packages, significantly saving disk space. It also offers fast installation speeds and flexible dependency management capabilities. Furthermore, both Yarn and pnpm support a wider range of commands and features, meeting the diverse project management needs of developers and providing a more efficient and reliable solution for dependency management in front-end projects.

[0095] One possible implementation method is to execute the yarn install command in the root directory of a project that uses yarn for dependency management. This can achieve the same effect as executing the npm install command of npm. The difference is that the generated version lock file is yarn.lock.

[0096] Another possible implementation method is to execute pnpm's pnpm install in the project root directory that uses pnpm for dependency management to achieve the same effect as executing npm's npm install command, and the version lock file it generates is pnpm-lock.yarm.

[0097] One possible implementation method is that the computing device can use the npminstall command built into npm in the root directory of the front-end project to download and install the dependency packages according to the versions specified by each dependency package in the second dependency package set. During the installation process, npm will automatically resolve the dependency relationship and download the corresponding dependency packages to the project, and then the version lock file of the second dependency package set downloaded this time can be obtained.

[0098] S1022: Extract the version information set of the second dependent package from a preset field of the dependent package version lock file.

[0099] In some embodiments, the preset field may be dependencies in a dependency package version lock file.

[0100] One possible implementation approach is to use package-lock.json, a version lock file generated by npm. The dependencies field lists the project's direct dependencies and their precise versions. We can write a script to read and parse the file, extracting the name and version number of each dependency in the dependencies field to construct the version information set for the second dependency.

[0101] In some embodiments, when the number of dependent packages in the third dependent package set is too large, for example, when the number of dependent packages exceeds a threshold value preset by the computing device, the compressed packages of the third dependent packages are uploaded in parallel. In this case, step S105 may specifically include:

[0102] S1051. Create multiple threads and allocate a preset number of compressed packages of the third dependent package to each thread.

[0103] It should be noted that the threshold value of the number of dependent packages can be 50, 100 or 200, and the number of compressed packages allocated to each thread (i.e., the preset number) can be 5, 10, or 20. The embodiment of the present application does not limit the specific values ​​of the third threshold value of the number of dependent packages and the number of compressed packages allocated to each thread.

[0104] In some embodiments, the number of threads created may be the quotient of the total number of the third dependency package set and a preset number.

[0105] In some embodiments, the computing device can create multiple threads through the worker_threads module based on the nodejs script and allocate a preset number of compressed packages of the third dependency package to each thread to achieve parallel uploading.

[0106] S1052: Execute the dependency package upload instruction through multiple threads respectively, and upload the compressed packages of a preset number of third dependency packages corresponding to each thread to the private library.

[0107] In one possible implementation, the upload instruction of the dependency package may be the npm publish instruction in npm. The computing device may upload a preset number of compressed packages of the third dependency package corresponding to each thread to the private library by executing the instruction in each thread.

[0108] Through steps S1051-S1052, when the number of dependent packages in the third dependent package set is too large and exceeds the threshold, the third dependent package set is divided into multiple upload tasks by creating a thread, which can effectively solve the problem of long upload time due to the large number of dependent packages and improve the upload efficiency of the third dependent package compressed package.

[0109] In an exemplary embodiment, the present application also provides a flowchart of an implementation method of a dependency package upload method based on a private library. Figure 3 As shown, the implementation flowchart specifically includes:

[0110] Get the version information set of the first dependent package set stored locally.

[0111] The local project downloads the second dependency package set and obtains the version information set of the second dependency package set. Specifically, before downloading the second dependency package set, the developer can configure the public network download source of the second dependency package by setting the npm configuration file, and then download the second dependency package to the local project by executing the npm install command.

[0112] Based on the version information of the first and second dependency package sets, the version information set of the third dependency package set is compared. Specifically, the comparison method can refer to the detailed introduction of step S1031, which will not be repeated here.

[0113] Download the compressed archive of each third-party dependency package.

[0114] Specifically, the developer can download the compressed package of the third dependency package to the local computer based on the previously configured npm public network download source and the version information of each third dependency package.

[0115] Based on the number of third dependency packages, multiple threads are created, and a compressed package of the third dependency package is uploaded in each thread.

[0116] When deploying a project, the project is packaged based on the dependency packages in the private library. Specifically, when the project is developed and needs to be released, the project code can be uploaded to the private network server, which then downloads the dependency packages in the private library and packages them together with the project to obtain the static product of this project.

[0117] Publish the packaged static product to the cloud platform to complete the project release.

[0118] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, the dependency package upload device of the private library includes the hardware structure and / or software modules corresponding to the execution of each function. It should be easy to realize that the technical goals in this field are combined with the units and algorithm steps of each example described in the embodiments disclosed in this article, and the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technical goals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0119] In an exemplary embodiment, the present application also provides a device for uploading dependency packages of a private library. The device for uploading dependency packages of a private library may include one or more functional modules for implementing the method for uploading dependency packages of a private library of the above method embodiment.

[0120] For example, Figure 4 As shown, the device for uploading the dependency package of the private library includes: an acquisition module 410 and a processing module 420.

[0121] The acquisition module 410 is used to obtain the version information set of the first dependency package set of the front-end project; the first dependency package set is a historical dependency package set downloaded locally; and obtain the version information set of the second dependency package set currently required by the front-end project;

[0122] The processing module 420 is used to obtain the version information set of the third dependency package based on the version information set of the first dependency package set and the version information set of the second dependency package set; the third dependency package is a different dependency package in the second dependency package set relative to the first dependency package set; based on the version information set of the third dependency package, download the compressed package of the third dependency package; and upload the compressed package of the third dependency package to a private library.

[0123] In a possible implementation, the processing module 420 is further configured to cancel uploading of the dependency package if the version information set of the third dependency package set is empty.

[0124] In a possible implementation, the version information in the version information set includes: dependent package name and dependent package version.

[0125] In one possible implementation, the processing module 420 is specifically configured to compare the version information of each second dependency package with the version information set of the first dependency package, and determine the version information of the second dependency package that meets the version difference condition as the version information of the third dependency package. The version difference condition includes at least one of the following: the dependency package name of the second dependency package does not exist in the version information set of the first dependency package. And / or, the dependency package version of the second dependency package does not exist in the version information set of the first dependency package.

[0126] In a possible implementation, the acquisition module 410 is specifically configured to execute a dependency package installation instruction in the current project to acquire a dependency package version lock file, and extract the version information set of the second dependency package from a preset field in the dependency package version lock file.

[0127] In one possible implementation, when the number of dependency packages in the third dependency package set exceeds a preset dependency package number threshold, processing module 420 is specifically configured to create multiple threads and allocate a preset number of compressed packages of the third dependency packages to each thread. The multiple threads respectively execute dependency package upload instructions, and upload the preset number of compressed packages of the third dependency packages corresponding to each thread to the private repository.

[0128] It should be noted that Figure 4 The module division described is illustrative and represents only one logical functional division. Actual implementations may employ different divisions. For example, two or more functions may be integrated into a single processing module. These integrated modules may be implemented as either hardware or software functional modules.

[0129] In an exemplary embodiment, as described above, the computing device may specifically be an electronic device having a computing and processing function. In this case, the embodiment of the present application further provides an electronic device, Figure 5 This is a schematic diagram of the composition of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device includes: a processor 10 , a memory 20 , a communication line 30 , a communication interface 40 , and an input / output interface 50 .

[0130] The processor 10 , the memory 20 , the communication interface 40 , and the input / output interface 50 may be connected via a communication line 30 .

[0131] The processor 10 is used to execute the instructions stored in the memory 20 to implement the private library dependency package uploading method provided in the above embodiment of the present application. The processor 10 can be a CPU, a general-purpose processor network processor (network processor, NP), a digital signal processor (digital signal processing, DSP), a microprocessor, a microcontroller (micro control unit, MCU) / single-chip microcomputer / single-chip microcomputer, a programmable logic device (programmable logic device, PLD) or any combination thereof. The processor 10 can also be any other device with processing functions, such as a circuit, device or software module, which is not limited in the embodiment of the present application. In one example, the processor 10 may include one or more CPUs, such as Figure 5 As an optional implementation, the electronic device may include multiple processors, for example, in addition to the processor 10, it may also include a processor 60 ( Figure 5 The dashed line is used as an example.

[0132] The memory 20 is used to store instructions. For example, the instruction may be a computer program. Optionally, the memory 20 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, etc., and the embodiments of the present application are not limited thereto.

[0133] It should be noted that the memory 20 may exist independently of the processor 10 or may be integrated with the processor 10. The memory 20 may be located inside the electronic device or outside the electronic device, which is not limited in the embodiment of the present application.

[0134] The communication line 30 is used to transmit information between the components included in the electronic device.

[0135] Communication interface 40 is used to communicate with other devices or other communication networks. Such other communication networks may be Ethernet, radio access networks (RAN), wireless local area networks (WLAN), etc. Communication interface 40 may be a module, circuit, transceiver, or any other device capable of communication.

[0136] The input / output interface 50 is used to implement human-computer interaction between a user and the electronic device, for example, to implement action interaction or information interaction between the user and the electronic device.

[0137] For example, the input / output interface 50 may be a mouse, keyboard, display screen, or touch screen screen, etc. Action interaction or information interaction between a user and the electronic device may be achieved through the mouse, keyboard, display screen, or touch screen screen, etc.

[0138] It should be noted that Figure 5 The structure shown in the figure does not constitute a limitation on the electronic device, except Figure 5 In addition to the components shown, the electronic device may include more or fewer components than shown, or a combination of certain components, or a different arrangement of components.

[0139] In an exemplary embodiment, the present application also provides a readable storage medium including software instructions, which, when executed on an electronic device, enables the electronic device to execute any one of the methods provided in the above embodiments.

[0140] In an exemplary embodiment, the present application also provides a computer program product including computer-executable instructions, which, when executed on an electronic device, enables the electronic device to execute any one of the methods provided in the above embodiments.

[0141] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using a software program, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer-executable instructions. When the computer-executable instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer-executable instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer-executable instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0142] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by reviewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple components. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0143] Although the present application has been described with reference to specific features and embodiments thereof, it is apparent that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely illustrative of the present application as defined by the appended claims and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, the present application is intended to include such modifications and variations as fall within the scope of the claims of the present application and their equivalents.

[0144] The above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A method for uploading a dependency package of a private library, characterized in that: The method comprises: Obtaining a version information set of a first dependency package set of a front-end project; the first dependency package set is a historical dependency package set that has been downloaded locally; Obtaining a version information set of a second dependency package set currently required by the front-end project; Based on the version information set of the first dependency package set and the version information set of the second dependency package set, obtaining the version information set of the third dependency package; the third dependency package is a different dependency package in the second dependency package set relative to the first dependency package set; Downloading the compressed package of the third dependent package based on the version information set of the third dependent package; Upload the compressed package of the third dependency package to the private library.

2. The method according to claim 1, characterized in that Before executing the dependency package download instruction based on the version information set of the third dependency package to obtain the compressed package of the third dependency package, the method further includes: Under the condition that the version information set of the third dependency package set is empty, the dependency package upload is canceled.

3. The method according to claim 1, characterized in that The version information in the version information set includes: dependent package name and dependent package version.

4. The method according to claim 2, characterized in that The acquiring the version information set of the third dependent package based on the version information set of the first dependent package and the version information set of the second dependent package includes: Compare the version information of each second dependency package with the version information set of the first dependency package, and determine the version information of the second dependency package that meets the version difference condition as the version information of the third dependency package; The version difference condition includes at least one of the following: The dependency package name of the second dependency package does not exist in the version information set of the first dependency package; and / or, The dependency package version of the second dependency package does not exist in the version information set of the first dependency package.

5. The method according to claim 1, wherein The version information set of the second dependency package of the project at the current time is obtained; the second dependency package is the dependency package required by the project at the current time, including Execute the dependency package installation instructions in the current project to obtain the dependency package version lock file; The version information set of the second dependent package is extracted from a preset field of the dependent package version lock file.

6. The method according to claim 1, characterized in that When the number of dependent packages in the third dependent package set is greater than a preset dependent package number threshold, uploading the compressed package of the third dependent package to the private library includes: Create multiple threads and allocate a preset number of compressed packages of the third dependency package to each thread; The dependency package upload instructions are respectively executed by the multiple threads to upload the compressed packages of the preset number of third dependency packages corresponding to each thread to the private library.

7. A private library dependency package upload, characterized in that: The device includes: an acquisition module and a processing module; The acquisition module is used to obtain the version information set of the first dependency package set of the front-end project; the first dependency package set is a historical dependency package set downloaded locally; and obtain the version information set of the second dependency package set currently required by the front-end project; The processing module is used to obtain the version information set of the third dependency package based on the version information set of the first dependency package set and the version information set of the second dependency package set; the third dependency package is a different dependency package in the second dependency package set relative to the first dependency package set; based on the version information set of the third dependency package, download the compressed package of the third dependency package; and upload the compressed package of the third dependency package to a private library.

8. An electronic device, characterized in that: include: processor and memory; The memory stores instructions executable by the processor; When the processor is configured to execute the instructions, the electronic device implements the method according to any one of claims 1 to 6.

9. A readable storage medium, characterized in that: include: Software instructions; When the software instructions are executed in the electronic device, the electronic device is enabled to implement the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that include: Computer instructions; When the computer instructions are executed in the electronic device, the electronic device is enabled to implement the method according to any one of claims 1 to 6.