Method, system and device for viewing project version information and storage medium

By registering the Vite plug-in in the project configuration file, obtaining and generating version information in custom formats, the problems of inaccurate and inefficient version information management in the existing technology are solved, and efficient and accurate version information display and management are achieved.

CN120447945APending Publication Date: 2025-08-08JIALIAN PAYMENTS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510304561.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

When viewing project version information, manually writing version information is easy to forget and update, and the probability of error is high. The ETag and Last-Modify information configured in the browser response header is limited, making it difficult to expand detailed project information, and it is impossible to efficiently manage the version number and other information of multiple projects.

Method used

Register a Vite-based plug-in in the configuration file of the target project, obtain environment variables and generate version information in a custom format, and execute resource files through the browser to display detailed version information on the console.

Benefits of technology

It automatically obtains version information in custom formats, improves the accuracy and completeness of version management, and can view detailed information of multiple target projects at the same time, accelerates the version management process, and improves overall work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120447945A_ABST
    Figure CN120447945A_ABST
Patent Text Reader

Abstract

The invention discloses a method, system and device for viewing project version information and a storage medium. The method, system and device are used for efficiently and automatically obtaining version data of a project. The method for viewing the project version information comprises the steps of registering a plug-in in a configuration file of a target project, wherein the plug-in is a pre-developed Vite-based plug-in; obtaining an environment variable of the target project, and inputting the environment variable into the plug-in to obtain version information output by the plug-in according to the environment variable, the version information being version information in a user-defined format; generating a resource file according to the version information and the HTML document of the target project; and executing the resource file in the browser to enable a console of the browser to display the version information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of project information configuration, and in particular to a method, system, device and storage medium for viewing project version information. Background Art

[0002] Effective management of project version information is crucial in today's software development and project deployment. Currently, there are two ways to view version information. The first involves manually writing version information in HTML files so that it can be viewed later. This requires explicitly adding the version number and related description information to the code. This process requires developers to invest additional time and effort, making it easy for them to forget to update the version information, increasing the likelihood of errors and causing confusion in version management. To address this manual inconvenience, another way to view version information is to configure server response information such as ETag and Last-Modify in the browser response header to determine the current release time and obtain the latest version information. ETags are primarily used to identify specific project versions. By comparing the ETag values on the client and server, it is possible to determine whether the project has changed. Last-Modify records the last modification time of the project, which is used to determine the release time of the version.

[0003] However, in general, for the sake of system and browser response speed, the browser response header will not be configured with too much information. That is, the information provided by ETag and Last-Modified is limited, mainly focusing on the unique identifier and modification time of the project. It is difficult to expand detailed information related to other projects, and it is even more difficult to view version information such as version numbers and builders of multiple projects. Summary of the Invention

[0004] In order to solve the above technical problems, the present application provides a method, system, device and storage medium for viewing project version information, which are used to efficiently and automatically obtain project version data.

[0005] The technical solution provided in this application is described below:

[0006] A first aspect of the present application provides a method for viewing project version information, comprising:

[0007] Register the plug-in in the target project's configuration file. The plug-in is a pre-developed Vite-based plug-in.

[0008] Obtaining the environment variables of the target project, and inputting the environment variables into the plug-in to obtain version information output by the plug-in according to the environment variables, wherein the version information is version information in a custom format;

[0009] Generate a resource file according to the version information and the HTML document of the target project;

[0010] The resource file is executed in a browser, so that a console of the browser displays the version information.

[0011] Optionally, generating a resource file according to the version information and the HTML document of the target project includes:

[0012] Concatenate the builder information, commit identifier, version number, name information, and timestamp in the version information into a custom string;

[0013] The custom string is inserted into the body tag of the HTML document of the target project to generate a resource file.

[0014] Optionally, registering the plug-in in the configuration file of the target project includes:

[0015] In the target project's vite.config.js or vite.config.ts configuration file, use the import statement to introduce the plug-in module;

[0016] Use the plugin module to add the plugin to the plugins array of the vite.config.js configuration file or the plugins array of the vite.config.ts configuration file.

[0017] Optionally, before executing the resource file in the browser, the method further includes:

[0018] Storing the resource file in the local front-end code server of the system;

[0019] Establishing a communication connection between the browser and the front-end code server;

[0020] The resource file is sent to the browser via the communication connection.

[0021] Optionally, after storing the resource file in the local front-end code server of the system, the method further includes:

[0022] Expired resource files are cleaned up regularly according to the timestamp and preset period of the version information output by the plug-in.

[0023] Optionally, before executing the resource file in the browser so that the browser console displays the version information, the method further includes:

[0024] Detecting compatibility between the browser and the resource file, and obtaining a detection result;

[0025] If the detection result indicates that the resource file is incompatible with the browser, an error notification is sent.

[0026] Optionally, after registering the plug-in in the configuration file of the target project, the following is also included:

[0027] An initialization name is set in the plug-in, and the initialization name is used to be displayed on the console of the browser as an identifier of the target project when the console displays the version information.

[0028] A second aspect of the present application provides a system for viewing version information, including:

[0029] A registration unit, used to register the plug-in in the configuration file of the target project. The plug-in is a pre-developed Vite-based plug-in;

[0030] an acquiring unit, configured to acquire an environment variable of the target project, and input the environment variable into the plug-in to obtain version information output by the plug-in according to the environment variable, wherein the version information is in a custom format;

[0031] A generating unit, configured to generate a resource file according to the version information and the HTML document of the target project;

[0032] The display unit is configured to execute the resource file in a browser so that a console of the browser displays the version information.

[0033] A third aspect of the present application provides a device for viewing version information, the device comprising:

[0034] processor, memory, input and output units, and buses;

[0035] The processor is connected to the memory, the input and output unit, and the bus;

[0036] The memory stores a program, and the processor calls the program to execute the first aspect and the optional method for viewing version information in any one of the first aspects.

[0037] In a fourth aspect, the present application provides a computer-readable storage medium having a program stored thereon. When the program is executed on a computer, the method for viewing version information in the first aspect and any optional item in the first aspect is executed.

[0038] It can be seen from the above technical solutions that this application has the following advantages:

[0039] The present application provides a method for viewing project version information. First, a plug-in is registered in the configuration file of the target project. The plug-in is a pre-developed Vite-based plug-in. Then, the environment variables of the target project are obtained and the environment variables are input into the plug-in to obtain the version information output by the plug-in according to the environment variables. The version information is version information in a custom format. Then, a resource file is generated based on the version information and the HTML document of the target project. Finally, the resource file is executed in the browser so that the browser console displays the version information. The method of the present application registers a Vite-based plug-in in the target project configuration file, which can automatically obtain environment variables and output version information. The version information is version information in a custom format and can contain multiple types of data to ensure the accuracy and completeness of the version information. Because the plug-in itself is reusable, the detailed version information of multiple target projects can also be viewed at the same time by calling the plug-in function. Finally, the resource file is executed by the browser, and the version information can be directly displayed on the browser console, which speeds up the version management process of the target project and improves the overall work efficiency of building the target project. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0041] Figure 1 A flowchart of an embodiment of a method for viewing version information provided by this application;

[0042] Figure 2 A flowchart of another embodiment of the method for viewing version information provided by this application;

[0043] Figure 3 A flowchart of another embodiment of the method for viewing version information provided by this application;

[0044] Figure 4 A flowchart of another embodiment of the method for viewing version information provided by this application;

[0045] Figure 5 A schematic diagram of the structure of an embodiment of a system for viewing version information provided by this application;

[0046] Figure 6 This is a schematic diagram of the structure of an embodiment of the device for viewing version information provided by this application. DETAILED DESCRIPTION

[0047] The present application provides a method, system, device and storage medium for viewing project version information, which are used to efficiently and automatically obtain project version data.

[0048] It should be noted that the method for viewing project version information provided in this application can be applied to terminals, systems, and servers. For example, the terminal can be a smart phone or computer, tablet computer, portable computer terminal, or a fixed terminal such as a desktop computer.

[0049] See also Figure 1 The present application provides an embodiment of a method for viewing project version information, the method for viewing project version information comprising:

[0050] Step S101: Register a plug-in in the target project's configuration file. The plug-in is a pre-developed Vite-based plug-in.

[0051] Step S102: Obtain the environment variables of the target project, input the environment variables into the plug-in, and obtain version information output by the plug-in based on the environment variables. The version information is in a custom format.

[0052] Step S103: Generate a resource file based on the version information and the HTML document of the target project;

[0053] Step S104: Execute the resource file in the browser so that the browser console displays version information.

[0054] In step S101 of the embodiment, a plug-in is registered in a configuration file of a target project, where the plug-in is a pre-developed Vite-based plug-in.

[0055] In the target project built on Vite, the first step is to modify the target project's configuration file to register a pre-developed plugin. This plugin receives environment variables, parses and processes them, generates version information containing key information about the target project, and generates resource files based on the version information and HTML documentation. The plugin registration process typically involves adding a reference to the plugin in the target project's Vite configuration file and ensuring it is correctly loaded into the build process. Before registering the plugin, you need to confirm the location and format of the configuration file. This can be determined by reviewing the target project's file structure or referring to the target project's documentation. Once the configuration file is determined, use the appropriate import statement to import the developed plugin module, operating according to the target project's module system. After importing the plugin module, add it to the plugin configuration section of the configuration file, perhaps as an element of an array. Once added, save the configuration file. At this point, Vite will recognize and load the plugin when starting the build process, preparing for subsequent steps.

[0056] In practice, you might need to view the version information of multiple target projects simultaneously, or different versions of the same target project. Therefore, a clear identifier should be provided so that when viewing the output version information, you can determine the ownership and meaning of the version information based on the identifier. Specifically, you can set an initialization name in the plug-in. This initialization name will be used to identify the target project when the browser console displays the version information in subsequent steps. This provides a more convenient way to manage versions and helps ensure the stability and maintainability of the target project.

[0057] In step S102 of the embodiment, the environment variables of the target project are obtained and input into the plug-in to obtain the version information output by the plug-in based on the environment variables. The version information is version information in a custom format. After registering the plug-in, the relevant environment variables should be obtained from the target project. The environment variables are usually stored in the configuration file or environment file of the target project, such as the .env file. That is, in the Node.js environment, the value of the environment variable can be obtained through the process.env object, which contains all the environment variable information of the current process. Environment variables refer to the relevant variables that specify the environment information of the target project when it is built and packaged, including but not limited to basic environment information class variables, code management and version control class variables, and build and deployment class variables. After obtaining the environment variables, the environment variables are passed to the plug-in as input. After the plug-in receives the environment variables, it will first verify these variables, that is, check whether the values of the variables conform to the expected format and range. After verification, the plug-in will generate a timestamp based on the current system time. This timestamp represents the specific moment when the plug-in outputs the version information, which can help users understand the generation time of the version information. Finally, the plug-in integrates the builder information, commit identifier, version number, name information, and generated timestamp into complete version information, that is, version information in a custom format. This version information will serve as an important basis for subsequent resource file generation.

[0058] In step S103 of the embodiment, a resource file is generated based on the version information and the HTML document of the target project. After receiving the environment variable, the plug-in will call its internal generation module. This module is responsible for reading the HTML document of the target project, which is usually the entry file or template file of the target project, and embedding the version information into the HTML document. Before embedding, the plug-in's generation module will format the version information. That is, first, according to the preset format requirements, the version information is organized into a suitable data structure, for example, it is encapsulated into a JavaScript object (i.e., it is introduced into JavaScript code); then the version information is encoded and escaped to ensure that the information does not cause syntax errors or security issues when embedded in the HTML document. For example, special characters are escaped to avoid affecting the normal parsing of the HTML document. After the formatting process is completed, the version information is embedded in the HTML document in an appropriate manner. The embedding method can be directly adding a script tag containing the version information in the HTML, or by modifying the header comment of the CSS / JS file to include this information. The generation module also ensures that the generated resource file is compatible with the other parts of the target project and can be correctly loaded and executed in the browser. After the version information is embedded, the generation module will generate a new resource file. This resource file contains the HTML document content with embedded version information. When generating the resource file, ensure that the file encoding format and file type are correct. You can also perform some optimizations on the file, such as compressing the file size and removing unnecessary spaces and comments, to increase file loading speed.

[0059] In step S104 of the embodiment, the resource file is executed in the browser, so that the console of the browser displays version information.

[0060] The generated resource files need to be deployed to a server so that users can access them through a browser. First, select a suitable server environment and ensure that the server supports parsing and displaying HTML files. Then, upload the generated resource files to the designated directory on the server. During the upload process, pay attention to the file permissions to ensure that the server can access and serve the files properly. When accessing the target project through a browser, the browser sends a request to the server for the target project's resource files. After receiving the request, the server sends the corresponding resource files to the browser based on the requested path and file type. When the plug-in generates the resource files, it injects JavaScript code into them to display version information in the browser console. After receiving the resource files, the browser loads and parses them. During the parsing process, it identifies and executes the JavaScript code embedded in the HTML document. After the code executes, the version information is output to the browser console. Users can open the console to view the displayed version information for troubleshooting and version management.

[0061] The method for viewing version information of the present invention first registers a plug-in in the configuration file of the target project, and the plug-in is a pre-developed Vite-based plug-in; then the environment variables of the target project are obtained, and the environment variables are input into the plug-in to obtain the version information output by the plug-in according to the environment variables, and the version information is version information in a custom format; then a resource file is generated according to the version information and the HTML document of the target project; finally, the resource file is executed in the browser so that the browser console displays the version information. The method of the present application registers a Vite-based plug-in in the target project configuration file, which can automatically obtain environment variables and output version information. The version information is version information in a custom format, which can contain multiple types of data to ensure the accuracy and completeness of the version information. Because the plug-in itself is reusable, the detailed version information of multiple target projects can also be viewed at the same time by calling the plug-in function. Finally, the resource file is executed by the browser, and the version information can be directly displayed on the browser console, which speeds up the version management process of the target project and improves the overall work efficiency of building the target project.

[0062] Reference Figure 2 According to some embodiments of the present invention, registering the plug-in in the configuration file of the target project in step S101 may specifically include, but is not limited to, the following:

[0063] Step S201: In the vite.config.js configuration file or the vite.config.ts configuration file of the target project, use the import statement to introduce the plug-in module;

[0064] Step S202: Add the plug-in to the plugins array of the vite.config.js configuration file or the plugins array of the vite.config.ts configuration file through the plug-in module.

[0065] In steps S201 and S202 of the embodiment, the plugin module is first introduced using the import statement in the target project's vite.config.js or vite.config.ts configuration file. The plugin module then adds the plugin to the plugins array in the vite.config.js or vite.config.ts configuration file. In a target project built on Vite, the vite.config.js or vite.config.ts configuration file is the core configuration hub, responsible for guiding the target project's construction, including configuration details such as the target project's entry point, output path, and plugin usage. By configuring the configuration file, the specific requirements of the target project can be met. In the configuration file, the import statement is a key tool for importing external modules. When using the import statement, the path to the plugin module must be specified. The plugins array is specifically used to store the plugins to be used. When building the target project, Vite executes the functionality of each plugin in the order listed in the plugins array. Using the plugin module introduced using the import statement, an instance of the plugin can be obtained. Adding the plugin to the plugins array effectively adds the plugin to the target project's construction process. Plugins can encapsulate various automated tasks, such as code compression, file merging, and automatic import of commonly used modules. By introducing and registering plugins in configuration files, there is no need to manually write a lot of repetitive code to complete these tasks. Plugins will automatically perform corresponding operations during the target project build process, greatly saving working time and improving work efficiency.

[0066] Reference Figure 3 According to some embodiments of the present invention, the generation module in the plug-in may include a splicing algorithm and a hook function. Then, the generation of the resource file according to the version information and the HTML document of the target project in step S103 may specifically include, but is not limited to, the following:

[0067] Step S301: Concatenate the builder information, commit identifier, version number, name information, and timestamp in the version information into a custom string;

[0068] Step S302: Insert the custom string into the body tag of the HTML document of the target project to generate a resource file.

[0069] In step S301 to step S302 of the embodiment, the builder information, submission identifier, version number, name information and timestamp in the version information are first spliced into a custom string; then the custom string is inserted into the body tag of the HTML document of the target project to generate a resource file. The version information contains the key data of the target project during the construction process. The builder information can clearly identify who built the target project, which helps to trace the responsible person when problems arise; the submission identifier, such as Git's commit ID, can accurately record the status of code submission, which is convenient for backtracking and comparing code versions; the version number reflects the iterative stage and stability of the target project; the name information uniquely identifies the target project; and the timestamp records the specific moment when the plug-in outputs the version information. This information is combined through a splicing algorithm to form a complete custom string, which is convenient for subsequent processing and display of this information, unifying the scattered information, and facilitating insertion in an HTML document and display in a browser. When calling the splicing algorithm, the splicing rules must first be determined, such as using specific delimiters (such as commas, vertical bars, etc.) to separate each information item. For example, using a comma as a delimiter, the builder information is first obtained and used as the beginning of the custom string. A comma is then added, followed by the commit identifier. The same logic is repeated, with the version number, name, and timestamp appended in that order. The final custom string is something like "builder name, commit identifier, version number, name, timestamp."

[0070] After generating the string, it needs to be added to the HTML document. The version information contained in the string must also be visible when the HTML document is subsequently executed. Therefore, a hook function can be called to perform the insertion operation. A hook function is a function that is called when a specific event occurs, allowing developers to insert custom logic at specific stages of program execution. Using hook functions, HTML documents can be customized without changing the core Vite build process. The hook function searches for the location of the body tag in the document. Once the body tag is found, the custom string concatenated previously is inserted into the body tag, with the location within the body tag being customizable. After the custom string is inserted, the HTML document becomes a new resource file. This resource file contains the target project's version information, which can be retrieved and displayed when the browser loads this resource file.

[0071] Reference Figure 4 Before the browser executes the resource file, it is necessary to manage and transmit the resource file, which may include, but is not limited to, the following:

[0072] Step S401: storing the resource file in the local front-end code server of the system;

[0073] Step S402: Regularly clear outdated resource files based on the timestamp of the plug-in output version information and a preset period;

[0074] Step S403: Detect the compatibility between the browser and the resource file and obtain the detection result;

[0075] Step S404: If the detection result indicates that the resource file is incompatible with the browser, an error notification is sent;

[0076] Step S405: If the detection result indicates that the resource file is compatible with the browser, a communication connection is established between the browser and the front-end code server;

[0077] Step S406: Send the resource file to the browser via the communication connection.

[0078] In steps S401 to S406 of the embodiment, the resource file is first stored in the local front-end code server of the system; then, based on the timestamp and preset period of the version information output by the plug-in, expired resource files are regularly cleaned up; then the compatibility between the browser and the resource file is detected to obtain a detection result; if the detection result indicates that the resource file is incompatible with the browser, an error notification is sent; if the detection result indicates that the resource file is compatible with the browser, a communication connection is established between the browser and the front-end code server; then the resource file is sent to the browser through the communication connection. The front-end code server is the storage and management center for the target project resources. The resource files containing version information are stored on the local front-end code server to facilitate centralized management and unified deployment of resources. Doing so can ensure the security and accessibility of the resource files and provide a basis for subsequent browser requests for resource files.

[0079] As the target project continues to iterate and update, a large number of resource files will be generated. Some older versions of these resource files may no longer be used. If not promptly cleared, they will occupy storage space on the front-end code server and increase maintenance costs. Furthermore, excessive expired resources can complicate resource management, hindering the efficiency of finding and using valid resources. The timestamp in the plugin's output version information records the specific time when the resource file was generated. The preset period is a time range set based on the actual situation of the target project, such as a week or a month. By comparing the timestamp with the current time, if the generation time of a resource file exceeds the preset period from the current time, the resource file is considered expired. You can write a scheduled task script and use the front-end code server's scheduled task scheduling tool to execute it periodically. The script will traverse the directory storing resource files on the front-end code server, obtain the timestamp information of each resource file, and compare it with the preset period. For expired resource files, the script will delete them from the front-end code server to free up storage space.

[0080] Different browsers may have varying levels of support for front-end technologies such as HTML, CSS, and JavaScript. If resource files use specific technologies or features that aren't supported by the browser, the files may not display or run properly, impacting the user experience. Therefore, before sending resource files to the browser, compatibility testing is necessary to ensure they function properly in the target browser. Compatibility testing can be performed in a variety of ways. One common approach is to use browser feature detection technology, using JavaScript code to detect whether the browser supports specific APIs or features used in the resource files. Another approach is to refer to the browser's compatibility list and determine whether the target browser is supported based on the resource file's technical requirements. When incompatibility between a resource file and a browser is detected, prompt error notifications allow developers or operations personnel to quickly identify the issue and take appropriate action. Error notifications can prevent users from encountering compatibility issues and improve the user experience.

[0081] After confirming that the resource files are compatible with the browser, a communication connection needs to be established between the browser and the front-end code server to transfer the resource files from the front-end code server to the browser. The browser initiates the connection by sending an HTTP request to the front-end code server. The request contains information about the requested resource file, such as the file name and path. After receiving the request, the front-end code server verifies and processes it. If the request is valid, the front-end code server establishes a TCP connection with the browser and returns an HTTP response, indicating that the connection has been established. After the communication connection is established, the front-end code server retrieves the corresponding resource files from the storage path based on the browser's request. The front-end code server then encapsulates the resource files according to the HTTP protocol and adds necessary header information, such as file type and file size. The front-end code server then sends the encapsulated resource files to the browser via the established TCP connection. After receiving the resource files, the browser parses and renders them, presenting the user with a console page containing version information.

[0082] The above embodiment describes the method for viewing version information provided by this application. The following describes the system, device, and storage medium for viewing version information provided by this application:

[0083] See also Figure 5 , Figure 5 An embodiment of a system for viewing version information provided by the present application includes:

[0084] A registration unit 501 is used to register a plug-in in the configuration file of the target project. The plug-in is a pre-developed Vite-based plug-in.

[0085] An acquisition unit 502 is used to acquire the environment variables of the target project and input the environment variables into the plug-in to obtain version information output by the plug-in according to the environment variables. The version information is in a custom format.

[0086] A generating unit 503 is configured to generate a resource file according to the version information and the HTML document of the target project;

[0087] The display unit 504 is configured to execute the resource file in the browser so that the console of the browser displays the version information.

[0088] Optionally, the generating unit 503 is specifically configured to:

[0089] Concatenate the builder information, commit identifier, version number, name information, and timestamp in the version information into a custom string;

[0090] Insert the custom string into the body tag of the HTML document of the target project to generate a resource file.

[0091] Optionally, the registration unit 501 is specifically configured to:

[0092] In the target project's vite.config.js or vite.config.ts configuration file, use the import statement to introduce the plug-in module;

[0093] Use the plugin module to add the plugin to the plugins array of the vite.config.js configuration file or the plugins array of the vite.config.ts configuration file.

[0094] Optionally, before the display unit 504, the following is further included:

[0095] Storage unit 505, used to store resource files in the system's local front-end code server;

[0096] Communication connection unit 506, used to establish a communication connection between the browser and the front-end code server;

[0097] The sending unit 507 is configured to send the resource file to the browser via a communication connection.

[0098] Optionally, after the storage unit 505, the method further includes:

[0099] The periodic cleaning unit 508 is used to periodically clean up expired resource files according to the timestamp of the plug-in output version information and a preset period.

[0100] Optionally, before the display unit 504, the following is further included:

[0101] A detection unit 509 is used to detect the compatibility between the browser and the resource file and obtain a detection result;

[0102] The error reporting unit 510 is configured to send an error notification if the detection result indicates that the resource file is incompatible with the browser.

[0103] Optionally, after the registration unit 501, the following is further included:

[0104] The setting unit 511 is used to set an initialization name in the plug-in. The initialization name is used to be displayed on the console as an identifier of the target project when the browser console displays version information.

[0105] This application also provides a device for viewing version information. Figure 6 , the device comprises:

[0106] Processor 601, memory 602, input and output unit 603, bus 604;

[0107] The processor 601 is connected to the memory 602, the input and output unit 603 and the bus 604;

[0108] The memory 602 stores a program, and the processor 601 calls the program to execute the following Figures 1 to 4 The method for viewing version information shown in any embodiment.

[0109] The present application also relates to a computer-readable storage medium, on which a program is stored, which, when executed on a computer, causes the computer to execute the following Figures 1 to 4 The method for viewing version information shown in any embodiment.

[0110] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0111] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0112] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0113] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0114] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk, and other media that can store program code.

Claims

1. A method for viewing version information, characterized in that: The method comprises: Register the plug-in in the target project's configuration file. The plug-in is a pre-developed Vite-based plug-in. Obtaining the environment variables of the target project, and inputting the environment variables into the plug-in to obtain version information output by the plug-in according to the environment variables, wherein the version information is version information in a custom format; Generate a resource file according to the version information and the HTML document of the target project; The resource file is executed in a browser, so that a console of the browser displays the version information.

2. The method according to claim 1, wherein Generating a resource file according to the version information and the HTML document of the target project includes: Concatenate the builder information, commit identifier, version number, name information, and timestamp in the version information into a custom string; The custom string is inserted into the body tag of the HTML document of the target project to generate a resource file.

3. The method according to claim 1, wherein Registering the plug-in in the target project's configuration file includes: In the target project's vite.config.js or vite.config.ts configuration file, use the import statement to introduce the plug-in module; Use the plugin module to add the plugin to the plugins array of the vite.config.js configuration file or the plugins array of the vite.config.ts configuration file.

4. The method according to any one of claims 1 to 3, characterized in that Before executing the resource file in the browser, the method further includes: Storing the resource file in the local front-end code server of the system; Establishing a communication connection between the browser and the front-end code server; The resource file is sent to the browser via the communication connection.

5. The method according to claim 4, characterized in that After storing the resource file in the local front-end code server of the system, the method further includes: Expired resource files are cleaned up regularly according to the timestamp and preset period of the version information output by the plug-in.

6. The method according to any one of claims 1 to 3, characterized in that Before executing the resource file in the browser so that the console of the browser displays the version information, the method further includes: Detecting compatibility between the browser and the resource file, and obtaining a detection result; If the detection result indicates that the resource file is incompatible with the browser, an error notification is sent.

7. The method according to any one of claims 1 to 3, characterized in that After registering the plugin in the target project's configuration file, also include: An initialization name is set in the plug-in, and the initialization name is used to be displayed on the console of the browser as an identifier of the target project when the console displays the version information.

8. A system for viewing version information, characterized in that: The system comprises: A registration unit, used to register the plug-in in the configuration file of the target project. The plug-in is a pre-developed Vite-based plug-in; an acquiring unit, configured to acquire an environment variable of the target project, and input the environment variable into the plug-in to obtain version information output by the plug-in according to the environment variable, wherein the version information is in a custom format; A generating unit, configured to generate a resource file according to the version information and the HTML document of the target project; The display unit is configured to execute the resource file in a browser so that a console of the browser displays the version information.

9. A device for viewing version information, characterized in that: The device comprises: processor, memory, input and output units, and buses; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method for viewing version information according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, and when the program is executed on a computer, the method for viewing version information according to any one of claims 1 to 7 is executed.