Dependencies include installation methods, devices, equipment, media, and products for version updates.

By obtaining configuration dependency version information of the front-end project through the back-end dependency manager, it automatically recommends and updates deprecated installation versions, thus solving the security vulnerability problem caused by the lack of maintenance of configuration dependencies in the front-end project.

CN116301981BActive Publication Date: 2026-03-13CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-27
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

The lack of maintenance of configuration dependencies in the front-end project leads to the inability to update them in a timely manner, resulting in security vulnerabilities.

Method used

The backend dependency manager retrieves all version information of the configuration dependencies, determines whether the currently installed version is deprecated, and recommends updating the installed version based on all version information.

Benefits of technology

Automatically monitor the installation status of configuration dependencies, promptly identify and update deprecated versions, and avoid security vulnerabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116301981B_ABST
    Figure CN116301981B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, device, medium, and product for updating installation dependencies, relating to the fields of financial technology, information, internet, and computer technology. The method includes: identifying configuration dependencies in a front-end project; obtaining all version information of the configuration dependencies through a back-end dependency manager; determining the current installed version of the configuration dependencies; in response to determining that the current installed version is deprecated based on all version information, recommending an installation version for the configuration dependencies based on all version information and the current installed version; and in response to user-triggered confirmation of agreement to the recommended installation version update, updating the current installed version of the configuration dependencies using the recommended installation version. This avoids security vulnerabilities in front-end projects due to a lack of maintenance of configuration dependencies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of financial technology, information, internet and computer technology, and in particular to a method, apparatus, device, medium and product that depends on installation version updates. Background Technology

[0002] With the continuous development of computer technology and the increasing demands of people, various front-end projects have emerged. The development and production of front-end projects rely on a large number of dependencies.

[0003] As time goes by, the versions of dependencies in the backend dependency manager are gradually updated. Some versions may be deprecated due to defects or because the dependency maintainer no longer maintains them. Using these deprecated versions of dependencies can introduce security vulnerabilities into the operation of the frontend project.

[0004] However, when the configuration dependencies in the front-end project are not maintained, it is impossible to detect in time whether the installed versions of the configuration dependencies in the front-end project have been deprecated. As a result, the installed versions of the configuration dependencies in the front-end project cannot be updated in time with the updates of the dependency versions in the back-end dependency manager, which may lead to security vulnerabilities in the front-end project. Summary of the Invention

[0005] This application provides a method, apparatus, device, medium, and product for dependency-based version updates, which addresses the security vulnerabilities that may arise in front-end projects due to a lack of maintenance of configuration dependencies.

[0006] In a first aspect, embodiments of this application provide a method for updating a dependency installation version, the method comprising:

[0007] Identify configuration dependencies in the front-end project;

[0008] Obtain all version information of the configuration dependencies through the backend dependency manager;

[0009] Determine the currently installed versions that the configuration depends on;

[0010] In response to determining that the currently installed version is deprecated based on all version information, the system recommends the installation versions that the configuration depends on based on all version information and the current installed version.

[0011] In response to a user-triggered message agreeing to an update to the recommended installation version, the currently installed version on which the configuration depends is updated using the recommended installation version.

[0012] Optionally, determining the configuration dependencies in the front-end project includes:

[0013] Obtain the configuration file content of the aforementioned front-end project;

[0014] The configuration file content is converted into a first JSON object using a JSON parsing interface;

[0015] Read the contents of the development dependency field and the production dependency field of the front-end project in the first JSON object to determine the configuration dependencies in the front-end project.

[0016] Optionally, the development dependency field includes at least one key-value pair, and the production dependency field includes at least one key-value pair;

[0017] The step of reading the contents of the development dependency field and the production dependency field of the front-end project in the first JSON object to determine the configuration dependencies in the front-end project includes:

[0018] Read the development dependency field of the front-end project in the first JSON object to determine the key in at least one key-value pair of the development dependency field;

[0019] Read the production dependency field of the front-end project in the first JSON object to determine the key in at least one key-value pair of the production dependency field;

[0020] The keys in all key-value pairs of the development dependency field and the keys in all key-value pairs of the production dependency field are determined as the configuration dependencies in the front-end project.

[0021] Optionally, obtaining all version information of the configuration dependencies through the backend dependency manager includes:

[0022] Generate a dependency information retrieval request based on the identifier of the configuration dependency;

[0023] Send the dependency information retrieval request to the backend dependency manager. The dependency information retrieval request is used to instruct the backend dependency manager to retrieve all version information of the configuration dependency based on the identifier of the configuration dependency.

[0024] Receive all version information of the configuration dependencies sent by the backend dependency manager.

[0025] Optionally, determining the currently installed version that the configuration depends on includes:

[0026] Obtain the installation file content of the aforementioned front-end project;

[0027] The contents of the installation file are converted into a second JSON object using a JSON parsing interface;

[0028] Read the contents of the production dependency field of the front-end project in the second JSON object to determine the current installed version of the configuration dependency.

[0029] Optionally, the production dependency field includes at least one key-value pair;

[0030] The step of reading the content of the production dependency field of the front-end project in the second JSON object to determine the current installed version of the configuration dependency includes:

[0031] Read the production dependency field of the front-end project in the second JSON object to determine the key and value in at least one key-value pair of the production dependency field;

[0032] In response to the existence of at least one key-value pair of the production dependency field having a key whose content is the same as the identifier of the configuration dependency, the value in the key-value pair of the production dependency field having a key whose content is the same as the identifier of the configuration dependency is determined as the current installed version of the configuration dependency.

[0033] Optionally, the total version information includes the version information of the currently installed version;

[0034] The step of determining that the currently installed version is deprecated based on all version information includes:

[0035] Read the version information of the currently installed version from the total version information;

[0036] In response to the fact that the version information of the currently installed version includes a preset field associated with the deprecated status, it is determined that the currently installed version is deprecated.

[0037] Optionally, recommending the installation versions of the configuration dependencies based on all version information and the current installation version includes:

[0038] The recommended installation version for the configuration dependencies is determined based on all version information and the currently installed version.

[0039] Output the recommended installation version information for the configuration dependencies. The recommended installation version information includes: the identifier of the configuration dependency, the current installation version, and the recommended installation version.

[0040] Optionally, determining the recommended installation version for the configuration dependency based on all version information and the current installation version includes:

[0041] Obtain the major version number and version number format of the currently installed version;

[0042] Determine the number of candidate versions among all version information, wherein the candidate versions are versions that have the same configuration dependency as the currently installed version;

[0043] In response to the number of candidate versions being greater than a preset number, the candidate versions are traversed, and the candidate version with the same version number format as the current installed version, the same major version number as the current installed version, the largest version number, and a version number different from the current installed version is determined as the recommended installation version for the configuration dependency.

[0044] Optionally, after determining the number of candidate versions among all version information, the method further includes:

[0045] If the number of alternative versions is less than or equal to the preset number, or if the alternative version with the largest version number is the currently installed version, then the recommended installation version for the configuration dependency is determined to be empty.

[0046] Secondly, embodiments of this application provide a dependency installation version update device, the dependency installation version update device comprising:

[0047] The first determination module is used to determine the configuration dependencies in the front-end project.

[0048] The acquisition module is used to obtain all version information of the configuration dependencies through the backend dependency manager;

[0049] The second determining module is used to determine the currently installed version of the configuration dependency;

[0050] The recommendation module is used to recommend installation versions that the configuration depends on, in response to determining that the currently installed version is deprecated based on all version information and the currently installed version.

[0051] The update module is used to update the current installed version that the configuration depends on in response to the user's request for a recommended installation version.

[0052] Thirdly, embodiments of this application provide an electronic device, the electronic device comprising: a processor, and a memory communicatively connected to the processor;

[0053] The memory stores computer-executed instructions;

[0054] The processor executes computer execution instructions stored in the memory to implement the dependent installation version update method as described in any one of the first aspect embodiments.

[0055] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the dependency installation version update method described in any one of the embodiments of the first aspect.

[0056] Fifthly, embodiments of this application provide a computer program product, the computer program product including a computer program that, when executed by a processor, implements the dependency installation version update method described in any one of the embodiments of the first aspect.

[0057] This application provides a method, apparatus, device, medium, and product for updating dependency installation versions. The dependency installation version update method includes: identifying configuration dependencies in a front-end project; obtaining all version information of the configuration dependencies through a back-end dependency manager; determining the current installed version of the configuration dependencies; in response to determining that the current installed version is deprecated based on all version information, recommending an installation version for the configuration dependencies based on all version information and the current installed version; and in response to user-triggered confirmation of agreement to the recommended installation version update, updating the current installed version of the configuration dependencies using the recommended installation version. Through this scheme, the installation status of configuration dependencies in a front-end project can be automatically monitored, enabling timely detection of whether the installed versions of configuration dependencies in a front-end project are deprecated. Furthermore, when the current installed version of a configuration dependency is deprecated, a recommended installation version is determined based on all version information and the current installed version of the configuration dependencies, and the current installed version of the configuration dependencies is updated promptly using the recommended installation version when the user agrees to the update, thereby preventing security vulnerabilities in the front-end project due to a lack of maintenance of configuration dependencies. Attached Figure Description

[0058] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0059] Figure 1 A schematic diagram illustrating a scenario for the dependency installation version update method provided in this application embodiment;

[0060] Figure 2 A flowchart illustrating the dependency installation version update method provided in this application embodiment;

[0061] Figure 3 A flowchart illustrating the process for determining the recommended installation version for configuration dependencies, provided in an embodiment of this application.

[0062] Figure 4 A schematic diagram of the structure of the dependency installation version update device provided in the embodiments of this application;

[0063] Figure 5This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0064] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0065] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0066] First, let me explain the terms used in this application:

[0067] Project dependencies refer to third-party resources or tools used in a front-end project. Front-end projects include web projects, Node.js projects, etc. Web projects are those where the server-side is deployed on a server and the client-side uses a browser to access and retrieve data via the network. Node.js projects are those running on the server-side and using JavaScript as the programming language. Dependencies enable the rapid implementation of business requirements. For example, using a dependency named axios can quickly implement network request processing without requiring developers to manually implement network requests. It should be noted that the concepts of "dependency" and "package" are the same in this application.

[0068] Project Dependency Configuration: The front-end project includes a configuration file that describes the project's dependencies. These dependencies are the configured project dependencies. The configuration file is in JSON format. It includes production dependency fields and development dependency fields. The production dependency field records the dependencies required for the front-end project to run, and can include the names and version numbers of the dependencies needed for runtime. The development dependency field records the dependencies required for the front-end project to develop, and can include the names and version numbers of the dependencies needed for development.

[0069] Dependency version number: xyz, where xyz are all numbers. x is the major version number, indicating a version with significant changes (usually a breaking update, where the new version may not be compatible with the old version); y is the minor version number, indicating a version that adds software features (compatible with the interfaces and usage of the same major version number); z is the revision number, indicating a version that fixes dependency defects.

[0070] Dependency Manager: A manager for dependencies, such as npm, yarn, pnpm, etc. A dependency manager can perform operations such as publishing, deleting, and updating dependencies.

[0071] Dependency installation: This refers to installing dependencies into the front-end project. Dependencies can be installed using dependency installation directives, which can include the names of the dependencies to be installed. Both npm and yarn can be used to install dependencies. Although npm and yarn have different installation mechanisms, using npm or yarn to install dependencies does not affect the technical solution claimed in this application. Therefore, this application uses npm to install dependencies as an example to illustrate the relevant concepts.

[0072] For production dependency installation, you can use the production dependency installation directive. The production dependency installation directive can include an identifier to indicate that a production dependency is being installed. The name and version number of the dependency to be installed will be added to the production dependency field of the configuration file.

[0073] For installing development dependencies, you can use the development dependency installation directive. This directive can include an identifier to indicate that a development dependency is being installed. The name and version of the dependency being installed are added to the development dependency field of the configuration file. The identifier in the production dependency installation directive is different from that in the development dependency installation directive.

[0074] Dependency Deprecation: This indicates to developers that they should not use a specific version of a dependency. Dependency deprecation includes partial deprecation of a dependency with the same name and complete deprecation of a dependency with the same name. Partial deprecation means that the corresponding version of the dependency is no longer recommended for use; complete deprecation means that the entire dependency is no longer recommended for use. Using deprecated dependencies (including using a specific deprecated version) can pose risks to the operation of front-end projects, such as potentially leading to security vulnerabilities.

[0075] To clearly understand the technical solution of this application, the solutions of the prior art will be described in detail first.

[0076] In existing technologies, the configuration of dependencies in front-end projects lacks maintenance. When the version of a dependency in the back-end dependency manager is updated or the old version is deprecated, the dependency installed in the front-end project is still the deprecated old version, without being updated to the new version. Since the old version of the dependency may have defects, this can lead to security vulnerabilities in the operation of the front-end project.

[0077] To address the issue of potential security vulnerabilities in front-end projects due to a lack of maintenance of configuration dependencies, the inventors discovered a method for automatically updating dependency installation versions. This method automatically monitors the installation status of configuration dependencies in the front-end project and, when a current installed version of a configuration dependency is deprecated, automatically determines and recommends a recommended installation version based on all version information of the dependency and the current installed version. This allows users to promptly identify deprecated configuration dependencies and, upon user approval, updates the current installed version of the configuration dependency using the recommended version, thereby preventing security vulnerabilities in the front-end project caused by a lack of maintenance of configuration dependencies.

[0078] Based on the above-mentioned inventive discovery, the inventor has proposed the technical solution of this application.

[0079] The following describes the application scenarios of the dependency installation version update method provided in the embodiments of this application.

[0080] like Figure 1 As shown, during the operation of the front-end project, the front-end electronic device 100 automatically reads the configuration file of the front-end project, determines the identifiers of the configuration dependencies of the front-end project from the configuration file, and obtains all version information of these configuration dependencies from the back-end dependency manager 200 based on the identifiers of the configuration dependencies of the front-end project. Further, the front-end electronic device 100 automatically reads the installation file of the front-end project, determines the current installation version of the configuration dependencies of the front-end project from the installation file. Since the all version information of the configuration dependencies includes information on whether each version is deprecated, after determining the all version information of the configuration dependencies and the current installation version, it can be determined whether the current installation version is deprecated. Then, if it is determined that the current installation version is deprecated, the installation version of the configuration dependencies is recommended based on the all version information and the current installation version, that is, the recommended installation version corresponding to the deprecated version configuration dependency is recommended. Finally, in response to the user-triggered update information of the recommended installation version, the current installation version of the configuration dependencies is updated using the recommended installation version, thereby avoiding security vulnerabilities in the front-end project due to the deprecation of the deprecated installation version.

[0081] The technical solutions shown in this application will now be described in detail through specific embodiments. Optionally, the following embodiments may exist alone or in combination with each other. For the same or similar content, the description will not be repeated in different embodiments.

[0082] Figure 2 A flowchart of the dependency installation version update method provided in the embodiments of this application is shown below. Figure 2 As shown, the dependency installation version update method provided in this application embodiment includes:

[0083] S10: Determine the configuration dependencies in the front-end project;

[0084] The execution entity of this application embodiment can be an electronic device or a dependency installation version update device installed in an electronic device. Electronic devices include, but are not limited to, servers, laptops, and desktop computers. The dependency installation version update device can be implemented through software or a combination of software and hardware. Further, the dependency installation version update method of this application embodiment can be implemented by a plugin of the electronic device. The plugin can include path parameters of the project to be detected and information output file name parameters. The path parameter of the project to be detected can be the path where the configuration file of the front-end project is located, and the information output file name parameter is used to output deprecated information and recommended installation versions of configuration dependencies. After configuring the path parameters of the project to be detected and the information output file name parameters, the plugin can automatically check the deprecated configuration dependencies used in the front-end project and recommend installation versions, facilitating users to quickly update the installation versions of configuration dependencies and reducing security vulnerabilities. It is understood that plugin processing eliminates the need for manual code review, enabling more efficient identification of deprecated installation versions. Simultaneously, plugin processing does not miss configuration dependencies, enabling more accurate identification of deprecated and recommended installation versions.

[0085] Before development and production, front-end projects need to configure project dependencies for development and production respectively. After configuring the corresponding dependencies, the versions of the dependencies that correspond to the configuration should be installed.

[0086] Configuration dependencies can be understood as project dependencies that are pre-configured for the production and development of front-end projects.

[0087] S20: Obtain all version information of configuration dependencies through the backend dependency manager;

[0088] Specifically, the complete version information can include detailed information about each version of each configuration dependency. For example, the complete version information can include the dependency's identifier (name and / or id), version, creation time, maintainer, and description. This complete version information is stored in the backend dependency manager, which allows access to all version information of configuration dependencies.

[0089] S30: Determine the currently installed versions of the configuration dependencies;

[0090] It should be noted that when configuring project dependencies for front-end project development and front-end project production, special characters such as ~, >, <, ^, *, and latest are added to the version numbers of the corresponding dependencies. These characters have special meanings. For example, "latest" indicates that the version of the dependency configured in the front-end project is the latest version. However, as versions are released, the latest version may change, resulting in the actual installed dependency version being different from the version described in the configuration. Therefore, the version number in the configuration file cannot be directly determined as the current installed version of the configured dependency; the current installed version of the configured dependency needs to be determined separately.

[0091] S40: In response to determining that the current installed version is deprecated based on all version information, recommend the installed versions of configuration dependencies based on all version information and the current installed version;

[0092] Querying all version information can determine whether the currently installed version has been deprecated. If the currently installed version has been deprecated, a newer version (if a newer version exists) can be identified from all version information, and the identified newer version can be designated as the recommended installation version.

[0093] S50: In response to a user-triggered update message indicating agreement to the recommended installation version, update the currently installed version that the configuration depends on using the recommended installation version.

[0094] Specifically, after recommending the recommended installation version to the user, the system can detect when the user agrees to the update. Then, when the system detects that the user clicks the "agree to update" button or speaks the "agree to update" voice message, the system updates the current installation version of the configuration dependencies using the recommended installation version, i.e., it installs the configuration dependencies of the recommended installation version.

[0095] The dependency installation version update method in this embodiment of the application determines the configuration dependencies in the front-end project; obtains all version information of the configuration dependencies through the back-end dependency manager; determines the current installed version of the configuration dependencies; in response to determining that the current installed version is deprecated based on all version information, recommends an installation version of the configuration dependencies based on all version information and the current installed version; in response to user-triggered update information indicating agreement to the recommended installation version, updates the current installed version of the configuration dependencies using the recommended installation version. Through the above scheme, the installation status of configuration dependencies in the front-end project can be automatically monitored, enabling timely detection of whether the installed versions of configuration dependencies in the front-end project are deprecated. Furthermore, when the current installed version of a configuration dependency is deprecated, a recommended installation version of the configuration dependency is determined based on all version information and the current installed version, and the current installed version of the configuration dependency is updated promptly using the recommended installation version when the user agrees to the update, thereby preventing security vulnerabilities in the front-end project due to a lack of maintenance of configuration dependencies.

[0096] Optionally, step S10 includes:

[0097] S11: Retrieves the contents of the configuration file for the front-end project.

[0098] The configuration files for the front-end project are in JSON format. Using the file read API (fs.readFileAPI) to read the configuration file allows you to retrieve the contents of the front-end project's configuration files, thus facilitating the acquisition of configuration dependencies.

[0099] S12: Use the JSON parsing API (JSON.parse API) to convert the configuration file content into a first JSON object.

[0100] The first JSON object includes development dependency fields for the front-end project and production dependency fields for the front-end project.

[0101] S13: Read the contents of the development dependency field and the production dependency field of the front-end project in the first JSON object to determine the configuration dependencies in the front-end project.

[0102] The dependency installation version update method in this embodiment obtains the configuration file content of the front-end project; uses a JSON parsing interface to convert the configuration file content into a first JSON object; and reads the contents of the development dependency field and the production dependency field of the front-end project in the first JSON object to determine the configuration dependencies in the front-end project. Thus, by reading the development dependency field and the production dependency field in the configuration file content, and determining both the production dependencies used for running the front-end project and the development dependencies used for developing the front-end project as configuration dependencies in the front-end project, it ensures that all configured dependencies in the front-end project are completely obtained. It is understandable that if the developer installs the contents of the production dependency field into the development dependency field, although this will not affect the operation of the front-end project, if the configuration dependencies of the front-end project are determined only by the contents of the production dependency field in the configuration file, the number and types of configuration dependencies determined will be incomplete, because some are still located in the development dependency field.

[0103] Optionally, the development dependency field includes at least one key-value pair, the production dependency field includes at least one key-value pair, and step 13 includes:

[0104] S131: Read the development dependency fields of the front-end project in the first JSON object to determine the key in at least one key-value pair of the development dependency fields;

[0105] S132: Read the production dependency fields of the front-end project in the first JSON object to determine the key in at least one key-value pair of the production dependency fields;

[0106] S133: Determine the keys in all key-value pairs of the development dependency field and the keys in all key-value pairs of the production dependency field as configuration dependencies in the front-end project.

[0107] In key-value pairs, the key is the name of the dependency, and the value is the version of the dependency.

[0108] In one example, a configuration dependency array is initialized to store the configuration dependencies in the front-end project. First, the production dependency field is read (an object), and each key and value of the object is iterated and stored in the configuration dependency array. For example, the processed configuration dependency array would be [{"dependency1":"Version A"},{"dependency2":"Version B"}]. Next, the development dependency field is read, and each key and value of the development dependency field is iterated and stored in the configuration dependency array. For example, the processed configuration dependency array would be [{"dependency1":"Version A"},{"dependency2":"Version B"},{"dependency3":"Version D"},{"dependency4":"Version C"}]. Finally, the names of the configuration dependencies in the front-end project are determined as dependency1, dependency2, dependency3, and dependency4.

[0109] The dependency installation version update method in this embodiment reads the development dependency field of the front-end project in the first JSON object to determine the key in at least one key-value pair of the development dependency field; reads the production dependency field of the front-end project in the first JSON object to determine the key in at least one key-value pair of the production dependency field; and determines the keys in all key-value pairs of the development dependency field and all key-value pairs of the production dependency field as configuration dependencies in the front-end project. Thus, by determining the keys in at least one key-value pair of the production dependency field and at least one key-value pair of the development dependency field, both the production dependencies used for running the front-end project and the development dependencies used for developing the front-end project are determined as configuration dependencies in the front-end project, enabling the complete acquisition of all configured dependencies in the front-end project.

[0110] Optionally, step S20 includes:

[0111] S21: Generate a dependency information retrieval request based on the identifier of the configuration dependency.

[0112] Understandably, once the configuration dependencies in the front-end project are determined, the identifiers of the configuration dependencies can be obtained. The identifiers of the configuration dependencies may include the name of the configuration dependency and / or the ID of the configuration dependency.

[0113] In one example, the keys of each element in the configuration dependency array are traversed. The name of the configuration dependency is taken from the key of this element and then assigned to a predefined variable, such as `package-name`. If requesting all version information of a configuration dependency, the name of the configuration dependency is appended to the address `https: / / aaaa.bbbb.cc`, and a GET request is used to retrieve all version information. That is, the Uniform Resource Locator (URL) for the dependency information retrieval request is: `https: / / aaaa.bbbb.cc / package-name`. When the dependency information retrieval request is `https: / / aaaa.bbbb.cc / dependency1`, it means retrieving all version information of the configuration dependency named `dependency1`.

[0114] It should be noted that the above https: / / aaaa.bbbb.cc is a non-real address written for ease of understanding the scheme, and is not a real address.

[0115] S22: Send a dependency information retrieval request to the backend dependency manager. The dependency information retrieval request is used to instruct the backend dependency manager to retrieve all version information of the configuration dependency based on the identifier of the configuration dependency.

[0116] Specifically, the axios library can be used to send dependency information retrieval requests to the backend dependency manager. The axios library is a promise-based HyperText Transfer Protocol (HTTP) library.

[0117] After receiving a dependency information retrieval request, the backend dependency manager retrieves all version information of the configuration dependencies based on the identifier of the configuration dependencies, and returns the retrieved version information of the configuration dependencies to the requester.

[0118] S23: Receive all version information of configuration dependencies sent by the backend dependency manager.

[0119] The dependency information retrieval request returns a JSON object, which includes a version field containing version information for each of the requested configuration dependencies.

[0120] For example, when the requested configuration dependency is "dependency 1", the version field of the returned content can include version A1, version A2, and version A3, thus obtaining the A1, A2, and A3 version information for the configuration dependency "dependency 1". Each version information can include a version description, maintainer, etc. It should be noted that if a version is deprecated, then the version information will include a preset field associated with the deprecation status. The content of the preset field is a description of the dependency's deprecation, such as "This version has some defects".

[0121] The dependency installation version update method in this embodiment generates a dependency information retrieval request based on the identifier of the configuration dependency; sends the dependency information retrieval request to the backend dependency manager, which instructs the backend dependency manager to retrieve all version information of the configuration dependency based on the identifier of the configuration dependency; and receives all version information of the configuration dependency sent by the backend dependency manager. In this way, all version information of the configuration dependency is completely obtained through the backend dependency manager.

[0122] Optionally, step S30 includes:

[0123] S31: Retrieve the installation file content of the front-end project.

[0124] When installing and configuring dependencies, front-end projects record relevant installation information in the installation file.

[0125] When installing and configuring dependencies using different dependency managers, the installation information will be saved in different files, which are automatically generated during installation.

[0126] Using the file read API (fs.readFile API) to read the installation file allows you to obtain the contents of the installation file of the front-end project, thus making it easy to obtain the current installed version of the configuration dependencies.

[0127] It should be noted that, since the installation file of the front-end project includes not only the configuration dependencies of the front-end project, but also other dependencies used to implement the functions of the configuration dependencies, the number of dependencies in the installation file of the front-end project is large. Furthermore, it is impossible to distinguish which are configuration dependencies based solely on the installation file of the front-end project. Therefore, in steps S11-S13, the configuration dependencies in the front-end project are determined based on the configuration file of the front-end project, rather than based on the installation file of the front-end project.

[0128] S32: Use the JSON parsing interface to convert the contents of the installation file into a second JSON object.

[0129] The second JSON object includes the production dependency field for the front-end project, which describes the configuration dependencies installed in the front-end project.

[0130] S33: Read the contents of the production dependency field of the front-end project in the second JSON object to determine the current installed version of the configuration dependencies.

[0131] The dependency installation version update method in this embodiment of the application obtains the installation file content of the front-end project; uses a JSON parsing interface to convert the installation file content into a second JSON object; and reads the content of the production dependency field of the front-end project in the second JSON object to determine the current installation version of the configuration dependency. Thus, the current installation version of the configuration dependency can be accurately determined through the installation file of the front-end project.

[0132] Optionally, the production dependency field includes at least one key-value pair, and step S33 includes:

[0133] S331: Read the production dependency fields of the front-end project in the second JSON object to determine the key and value in at least one key-value pair of the production dependency fields;

[0134] S332: In response to the existence of at least one key-value pair of a production dependency field having a key whose content is the same as the identifier of a configuration dependency, the value in the key-value pair of the production dependency field having a key whose content is the same as the identifier of the configuration dependency is determined as the current installed version of the configuration dependency.

[0135] In key-value pairs, the key is the name of the dependency, and the value is the version of the dependency.

[0136] In one example, the keys of the production dependency field of the second JSON object are traversed. If the key is the same as the name of the configuration dependency obtained in step S10, it means that the installation information of the configuration dependency has been found, and the value corresponding to the key is determined as the current installed version of the configuration dependency.

[0137] The dependency installation version update method in this embodiment reads the production dependency field of the front-end project in the second JSON object to determine the key and value in at least one key-value pair of the production dependency field; in response to the existence of at least one key-value pair of the production dependency field whose key content is the same as the identifier of the configuration dependency, the value in the key-value pair of the production dependency field whose key content is the same as the identifier of the configuration dependency is determined as the current installation version of the configuration dependency. In this way, the current installation version of the configuration dependency can be accurately determined.

[0138] Optionally, the complete version information includes the version information of the currently installed version, and step S40 includes:

[0139] S41: Read the version information of the currently installed version from the total version information;

[0140] S42: In response to the fact that the version information of the current installed version includes a preset field associated with the deprecation status, determine that the current installed version is deprecated.

[0141] In one example, the default field associated with the deprecated status is the deprecated field, which contains a dependency deprecation description. Therefore, if the version information of the currently installed version in the total version information includes the deprecated field, then it can be determined that the currently installed version is deprecated.

[0142] In one example, the deprecated dependency array is initialized. If it is detected that the current installed version of a certain configuration dependency is deprecated, the name, version and deprecation description of the configuration dependency are combined into an object and stored in the deprecated dependency array.

[0143] The dependency installation version update method in this application reads the version information of the currently installed version from all version information; in response to the fact that the version information of the currently installed version includes a preset field associated with the deprecation status, it determines that the currently installed version is deprecated. Thus, it can accurately detect that the currently installed version is deprecated.

[0144] Optionally, step S40 further includes:

[0145] S43: Determine the recommended installation versions of configuration dependencies based on all version information and the currently installed version;

[0146] S44: Outputs recommended installation versions for configuration dependencies. The recommended installation versions include: the identifier of the configuration dependency, the current installation version, and the recommended installation version.

[0147] Specifically, the recommended installation version information can be output in ways including but not limited to pop-up notifications, voice prompts, and preset files stored in preset paths.

[0148] In one example, after determining the recommended installation versions of the configuration dependencies, the recommended installation version information is output to a preset file in the root directory of the front-end project, so that users can easily view the recommended installation versions of the configuration dependencies of this project.

[0149] It should be noted that even though the recommended installation version is deprecated, since the recommended installation version is higher than the current installation version and this configuration dependency is required for the front-end project to run, it is still recommended that users upgrade the installed configuration dependency to the recommended installation version to minimize the risk of security vulnerabilities.

[0150] The dependency installation version update method in this embodiment determines the recommended installation version of configuration dependencies based on all version information and the current installation version; it outputs recommended installation version information for configuration dependencies, which includes: the identifier of the configuration dependency, the current installation version, and the recommended installation version. This allows users to promptly obtain information on the installation status of configuration dependencies in their front-end project and facilitates updates to the installed versions of these dependencies.

[0151] Optionally, step S43 includes:

[0152] S431: Get the major version number and version number format of the currently installed version.

[0153] Dependency version numbers typically include a major version number, a minor version number, and a revision number. The version number format for the currently installed version is usually xyz, where x, y, and z are all numbers, x is the major version number, y is the minor version number, and z is the revision number.

[0154] S432: Determine the number of candidate versions in the total version information, where the candidate versions are versions that have the same configuration dependency as the currently installed version.

[0155] S433: In response to the number of alternative versions being greater than the preset number, iterate through the alternative versions and determine the alternative version with the same version number format as the current installed version, the same major version number as the current installed version, the largest version number, and a version number different from the current installed version as the recommended installation version for configuration dependencies.

[0156] In some implementations, a preview version number may follow the revision number, such as 1.0.0-alpha.1, 1.0.0-beta.4, 2.0.0-rc.1, etc. Common preview versions are generally alpha, beta, rc, stable, csp, etc. Since preview versions are usually not used as production versions (i.e., they are not used in front-end project engineering production), they are not recommended installation versions. Because the preview version number format differs from the production version number format, the preview version among the candidate versions can be avoided from being determined as the recommended installation version by filtering the version number format. That is, candidate versions with version number formats different from the currently installed version will not be determined as the recommended installation version for configuration dependencies.

[0157] The dependency installation version update method in this embodiment obtains the major version number and version number format of the currently installed version; determines the number of candidate versions in all version information, wherein the candidate versions have the same major version number as the currently installed version; in response to the number of candidate versions being greater than a preset number, it iterates through the candidate versions and determines the candidate version with the same version number format as the currently installed version, the largest version number, and a different version number from the currently installed version as the recommended installation version for configuration dependencies. Thus, recommendations are made based on the major version number of the currently installed version, ensuring that the major version number of the recommended installation version is consistent with that of the currently installed version, guaranteeing the compatibility of the recommended installation version, avoiding the inability to use the recommended installation version, and ensuring the stable operation of the front-end project.

[0158] Optionally, after step S432, the method further includes:

[0159] S434: In response to the fact that the number of alternative versions is less than or equal to the preset number or the alternative version with the largest version number is the currently installed version, the recommended installation version for configuration dependencies is determined to be empty.

[0160] In one example, the preset quantity is 1. This means that when the number of alternative versions is less than or equal to 1, the recommended installation version for configuration dependencies is set to empty. This means that when the number of alternative versions is 1, there is only one version with the same major version number as the currently installed version. This version is the currently installed version, and therefore it is not recommended. Thus, the recommended installation version for configuration dependencies is set to empty and not recommended.

[0161] The version with the highest version number is the latest version.

[0162] The dependency installation version update method in this application, in response to the situation where the number of candidate versions is less than or equal to a preset number or the candidate version with the largest version number is the current installation version, determines that the recommended installation version for configuration dependencies is empty. Thus, when only the current installation version or the latest version is available in all version information, the recommended installation version for configuration dependencies is determined to be empty, and no further recommendations are made for this configuration dependency installation version, thereby avoiding user confusion regarding recommended content and impacting the user experience.

[0163] Figure 3 This is a flowchart illustrating the process for determining the recommended installation version for configuration dependencies, provided in an embodiment of this application. Please refer to... Figure 3 ,include:

[0164] S601: Create a new temporary variable temp, whose initial value is the current installed version of the configuration dependency (marked as deprecated in the backend dependency manager);

[0165] S602: Get the major version number and version number format of the currently installed version;

[0166] S603: Determine whether the number of candidate versions in all version information is greater than 1. If yes, proceed to step S604; otherwise, proceed to step S605.

[0167] S604: Determine whether all candidate versions have been traversed. If yes, proceed to step S606; otherwise, proceed to step S609.

[0168] S605: Output: No recommended installation version found and the process ends;

[0169] S606: Determine if the temporary variable temp is the same as the currently installed version. If yes, proceed to step S605; otherwise, proceed to step S607.

[0170] S607: Determines the value of the temporary variable temp as the recommended installation version of the configuration dependency;

[0171] S608: Save the recommended installation version of the configuration dependency and the identifier of the configuration dependency to the suggested dependency array;

[0172] S609: Select a candidate version i and determine whether the version number format of candidate version i meets the xyz format. If yes, proceed to step S610; otherwise, return to step S604.

[0173] S610: Determine whether the major version number of the candidate version i is the same as the major version number of the currently installed version. If yes, proceed to step S611; otherwise, return to step S604.

[0174] S611: Determine whether the alternative version i is greater than the temporary variable temp. If yes, proceed to step S612; otherwise, proceed to step S613.

[0175] S612: Assign the temporary variable temp the value of alternative version i;

[0176] S613: Keep the temporary variable temp unchanged.

[0177] In this embodiment, by traversing the candidate versions, the recommended installation version of the deprecated configuration dependency can be determined relatively accurately. Since there may be more than one deprecated configuration dependency, for each deprecated dependency, it can be determined according to... Figure 3 The process shown determines the recommended installation version, and then the recommended installation versions of all deprecated configuration dependencies are stored in the suggested dependency array, so that the recommended installation versions of deprecated configuration dependencies can be directly output from the suggested dependency array.

[0178] Figure 4This is a schematic diagram of the structure of the dependency installation version update device provided in the embodiments of this application, as shown below. Figure 4 As shown, the dependency installation version update device 400 provided in this application embodiment includes a first determining module 401, an obtaining module 402, a second determining module 403, a recommending module 404, and an updating module 405.

[0179] The system comprises the following modules: a first determination module 401, used to determine configuration dependencies in the front-end project; an acquisition module 402, used to obtain all version information of the configuration dependencies through the back-end dependency manager; a second determination module 403, used to determine the currently installed version of the configuration dependencies; a recommendation module 404, used to recommend a new installation version for the configuration dependencies based on all version information and the current installation version, in response to a user-triggered update request for a recommended installation version; and an update module 405, used to update the current installation version of the configuration dependencies using the recommended installation version.

[0180] Optionally, the first determining module 401 is specifically used for:

[0181] Retrieve the contents of the configuration file of the front-end project;

[0182] The configuration file content is converted into a first JSON object using a JSON parsing interface;

[0183] Read the contents of the development dependency field and the production dependency field of the front-end project in the first JSON object to determine the configuration dependencies in the front-end project.

[0184] Optionally, the development dependency field includes at least one key-value pair, and the production dependency field includes at least one key-value pair.

[0185] The first determining module 401 is specifically used for:

[0186] Read the development dependency fields of the front-end project in the first JSON object to determine the key in at least one key-value pair of the development dependency fields;

[0187] Read the production dependency fields of the front-end project in the first JSON object to determine the key in at least one key-value pair of the production dependency fields;

[0188] The keys in all key-value pairs of the development dependency field and the keys in all key-value pairs of the production dependency field are determined as the configuration dependencies in the front-end project.

[0189] Optionally, module 402 is used specifically for:

[0190] Generate a dependency information retrieval request based on the identifier of the configuration dependency;

[0191] Send a dependency information retrieval request to the backend dependency manager. The dependency information retrieval request is used to instruct the backend dependency manager to retrieve all version information of the configuration dependency based on the identifier of the configuration dependency.

[0192] Receive all version information of configuration dependencies sent by the backend dependency manager.

[0193] Optionally, the second determining module 403 is specifically used for:

[0194] Retrieve the installation file contents of the front-end project;

[0195] The installation file content is converted into a second JSON object using a JSON parsing interface;

[0196] Read the contents of the production dependency field of the front-end project in the second JSON object to determine the current installed version of the configuration dependencies.

[0197] Optionally, the production dependency field includes at least one key-value pair.

[0198] The second determining module 403 is specifically used for:

[0199] Read the production dependency fields of the front-end project in the second JSON object to determine the key and value in at least one key-value pair of the production dependency fields;

[0200] In response to the existence of key-value pairs where the content of the key in at least one production dependency field is the same as the identifier of the configuration dependency, the value in the key-value pair where the content of the key in at least one production dependency field is the same as the identifier of the configuration dependency is determined as the current installed version of the configuration dependency.

[0201] Optionally, the full version information includes the version information of the currently installed version.

[0202] Recommended module 404, specifically used for:

[0203] Read the version information of the currently installed version from the total version information;

[0204] In response to the fact that the version information of the currently installed version includes a preset field associated with the deprecation status, it is determined that the currently installed version is deprecated.

[0205] Optionally, module 404 is recommended, and is also used for:

[0206] Determine the recommended installation versions of the configuration dependencies based on all version information and the currently installed version;

[0207] Outputs recommended installation versions for configuration dependencies. The recommended installation versions include: the identifier of the configuration dependency, the current installation version, and the recommended installation version.

[0208] Optionally, module 404 is recommended, specifically for:

[0209] Get the major version number and version number format of the currently installed version;

[0210] Determine the number of candidate versions in the total version information, where the candidate versions are versions that have the same configuration dependency as the currently installed version;

[0211] If the number of alternative versions exceeds the preset number, the alternative versions are iterated through, and the alternative versions with the same version number format as the current installed version, the same major version number as the current installed version, the largest version number, and different version number from the current installed version are determined as the recommended installation versions for configuration dependencies.

[0212] Optionally, after determining the number of candidate versions from all version information, the recommendation module 404 is also used for:

[0213] If the number of alternative versions is less than or equal to the preset number, or if the alternative version with the largest version number is selected, the currently installed version is determined, and the recommended installation version for configuration dependencies is left empty.

[0214] The dependency installation version update device 400 provided in this application embodiment can execute the technical solution shown in the above-described dependency installation version update method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.

[0215] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 5 As shown, the electronic device 500 provided in this application embodiment includes: a processor 501 and a memory 502 communicatively connected to the processor 501; the memory 502 stores computer execution instructions; the processor 501 executes the computer execution instructions stored in the memory 502 to implement the dependent installation version update method of any of the above embodiments.

[0216] For example, when processor 501 executes computer execution instructions stored in memory 502, the following steps of the dependency installation version update method are implemented:

[0217] S10: Determine the configuration dependencies in the front-end project;

[0218] S20: Obtain all version information of configuration dependencies through the backend dependency manager;

[0219] S30: Determine the currently installed versions of the configuration dependencies;

[0220] S40: In response to determining that the current installed version is deprecated based on all version information, recommend the installed versions of configuration dependencies based on all version information and the current installed version;

[0221] S50: In response to a user-triggered update message indicating agreement to the recommended installation version, update the currently installed version that the configuration depends on using the recommended installation version.

[0222] exist Figure 5 In a corresponding embodiment, the program may include program code, which includes computer-executable instructions. Memory 502 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0223] The memory 502 and processor 501 are connected via a bus. This bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be categorized into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0224] The electronic device 500 provided in this application embodiment can execute the technical solution shown in the above-described dependent installation version update method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.

[0225] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the dependency installation version update method of any of the above embodiments.

[0226] This application provides a computer program product, which includes a computer program that, when executed by a processor, implements the dependency installation version update method of any of the above embodiments.

[0227] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0228] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method of updating a dependent installation version, characterized by, The method comprises the following steps: determining a configuration dependency in a front-end project; obtaining all version information of the configuration dependency through a back-end dependency manager; determining a current installation version of the configuration dependency; in response to determining that the current installation version is abandoned according to the all version information, recommending an installation version of the configuration dependency according to the all version information and the current installation version; in response to user-triggered recommended installation version consent update information, updating the current installation version of the configuration dependency with the recommended installation version; the determining of the current installation version of the configuration dependency comprises: obtaining installation file content of the front-end project; converting the installation file content into a second JSON object through a JSON parsing interface; reading content of a production dependency field of the front-end project in the second JSON object to determine the current installation version of the configuration dependency; the production dependency field comprises at least one key-value pair; the reading of the content of the production dependency field of the front-end project in the second JSON object to determine the current installation version of the configuration dependency comprises: reading the production dependency field of the front-end project in the second JSON object to determine the key and value in at least one key-value pair of the production dependency field; in response to the content of at least one key-value pair of the production dependency field being the same as the identifier of the configuration dependency, determining the value in the key-value pair of the production dependency field as the current installation version of the configuration dependency.

2. The method of claim 1, wherein, the determining of the configuration dependency in the front-end project comprises: obtaining configuration file content of the front-end project; converting the configuration file content into a first JSON object through a JSON parsing interface; reading content of a development dependency field of the front-end project and a production dependency field of the front-end project in the first JSON object to determine the configuration dependency in the front-end project.

3. The method of claim 2, wherein, the development dependency field comprises at least one key-value pair, and the production dependency field comprises at least one key-value pair; the reading of the content of the development dependency field of the front-end project and the production dependency field of the front-end project in the first JSON object to determine the configuration dependency in the front-end project comprises: reading the development dependency field of the front-end project in the first JSON object to determine the key in at least one key-value pair of the development dependency field; reading the production dependency field of the front-end project in the first JSON object to determine the key in at least one key-value pair of the production dependency field; determining the key in all key-value pairs of the development dependency field and the key in all key-value pairs of the production dependency field as the configuration dependency in the front-end project.

4. The method of claim 1, wherein, the obtaining of the all version information of the configuration dependency through the back-end dependency manager comprises: generating dependency information obtaining requests according to the identifier of the configuration dependency; sending the dependency information acquisition request to the backend dependency manager, the dependency information acquisition request being used to instruct the backend dependency manager to acquire all version information of the configuration dependency based on the identification of the configuration dependency; receiving all version information of the configuration dependency sent by the backend dependency manager.

5. The method of claim 1, wherein, The all version information includes version information of the current installation version. The determining that the current installation version is deprecated according to the all version information comprises: reading the version information of the current installation version in the all version information; in response to the version information of the current installation version including a preset field associated with a deprecated state, determining that the current installation version is deprecated.

6. The method according to any one of claims 1-5, characterized in that, The recommending an installation version of the configuration dependency according to the all version information and the current installation version comprises: determining a recommended installation version of the configuration dependency according to the all version information and the current installation version; outputting installation version recommendation information of the configuration dependency, the installation version recommendation information including: an identification of the configuration dependency, the current installation version and the recommended installation version.

7. The method of claim 6, wherein, The determining a recommended installation version of the configuration dependency according to the all version information and the current installation version comprises: acquiring a major version number and a version number format of the current installation version; determining a number of alternative versions in the all version information, wherein the alternative versions are versions of the same configuration dependency as the current installation version; in response to the number of alternative versions being greater than a preset number, traversing the alternative versions, and determining an alternative version with a version number format same as the version number format of the current installation version, a major version number same as the major version number of the current installation version, a maximum version number, and a version number different from the current installation version as the recommended installation version of the configuration dependency.

8. The method of claim 7, wherein, After the determining the number of alternative versions in the all version information, the method further comprises: in response to the number of alternative versions being less than or equal to the preset number or the alternative version with the maximum version number being the current installation version, determining that the recommended installation version of the configuration dependency is empty.

9. An installation version update device-dependent apparatus, characterized by comprising: comprise: a first determining module configured to determine a configuration dependency in a front-end project; an acquiring module configured to acquire all version information of the configuration dependency through a backend dependency manager; a second determining module configured to determine a current installation version of the configuration dependency; a recommending module configured to, in response to determining that the current installation version is deprecated according to the all version information, recommend an installation version of the configuration dependency according to the all version information and the current installation version; an updating module configured to, in response to user-triggered recommended installation version consent update information, update the current installation version of the configuration dependency with a recommended installation version; the second determining module is specifically configured to acquire installation file content of the front-end project; the installation file content is converted into a second JSON object by using a JSON parsing interface; reading content of a production dependency field of the front-end project in the second JSON object to determine a current installation version of the configuration dependency; the production dependency field includes at least one key-value pair; the second determining module is specifically configured to read the production dependency field of the front-end project in the second JSON object to determine a key and a value in the at least one key-value pair of the production dependency field; in response to the content of the key in the at least one key-value pair of the production dependency field being identical to the identifier of the configuration dependency, determining the value in the key-value pair of the production dependency field, in which the content of the key is identical to the identifier of the configuration dependency, as the current installation version of the configuration dependency.

10. An electronic device, comprising: comprise: a processor, and a memory connected to the processor in communication; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the dependency installation version updating method according to any one of claims 1-8.

11. A computer readable storage medium, characterized in that, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by the processor to implement the dependency installation version updating method according to any one of claims 1-8.

12. A computer program product, characterised in that, a computer program is executed by the processor to implement the dependency installation version updating method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Component processing method and device, electronic device and storage medium

    CN114003269A

  • Dependence package configuration method and device, electronic equipment and storage medium

    CN115344269A