Version injection method and device, electronic equipment, storage medium and product
By automatically obtaining and replacing application version information, manual errors and opacity problems in traditional version maintenance mechanisms are solved, and efficient and intelligent version management and output are achieved.
Patent Information
- Application Number
- CN202411420671.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2024-11-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The traditional application version maintenance mechanism relies on manual update of version numbers, which leads to large workloads, error-prone, and lacks a mechanism to automatically output version information, which increases the opacity and difficulty of version management.
By obtaining the version information of the application project to be built, replacing the placeholder in the front-end entry file, and generating a new entry file, allowing the browser developer tools to output version information, realizing automated version management and dynamic updates.
Reduce manual errors, improve the accuracy and efficiency of version information, enhance the transparency and traceability of version management, simplify the update process, and improve the level of intelligence.
Smart Images

Figure CN118916076A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software / Internet development technology, and in particular to a version injection method, device, electronic device, storage medium and computer program product. Background Art
[0002] The traditional application version maintenance mechanism often relies on manually writing the version number in the configuration file of the front-end source code. Every time a new version is built and released, the version number needs to be manually updated, which not only significantly increases the workload, but also easily leads to human errors, resulting in forgotten updates or inconsistent version numbers, which brings unnecessary troubles to version tracking and problem troubleshooting. At the same time, the front-end application lacks a mechanism to actively output version information in the browser's developer tool console under the traditional method, making it difficult for developers or testers to quickly confirm the code version of the currently running program through convenient means, which undoubtedly exacerbates the opacity of version management and the lack of intelligence. Therefore, most of the current traditional application version information injection mechanisms have the problem that the update process is not intelligent enough. Summary of the invention
[0003] The main purpose of the present application is to provide a version injection method, device, electronic device, storage medium and computer program product, aiming to solve the technical problem that most traditional application version information injection mechanisms have insufficient intelligence in the update process.
[0004] To achieve the above purpose, the present application proposes a version injection method, which includes: Get the version information of the application project to be built; The placeholder of the first front-end entry file in the application project to be built is replaced with the version information to generate a second front-end entry file, so that after the preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
[0005] In one embodiment, the application project to be constructed further includes a configuration file, in which a subprocess module is pre-set, and the version information includes at least a version number. The step of obtaining the version information of the application project to be constructed includes: Determine the subprocess module in the configuration file; In the sub-process module, the version number is obtained, wherein the version number uniquely identifies the version information.
[0006] In one embodiment, the step of generating the second front-end entry file further includes: Determine whether any abnormal problems occur after the application project to be built is deployed and launched; If an abnormal problem occurs after the application project to be built is deployed online, search for target version information related to the abnormal problem in the application logs collected based on the application project to be built; Retrieve the submission record corresponding to the target version information, and feed the submission record back to the console.
[0007] In one embodiment, the submission record includes a program name, a submitter, submission information, and code change information, and the step of feeding back the submission record to the console includes: The program name, the submitter, the submission information, and the code change information are fed back to the console to determine the scope of the abnormal problem, the submission information at least includes the submission purpose and the submission content, the code change information at least includes the file modification record and the code modification record, and the program name, the submitter, the submission information, and the code change information are related to each other.
[0008] In one embodiment, before the step of replacing the placeholder of the first front-end entry file in the application project to be constructed with the version information, the step further includes: Determining whether the version information complies with a preset rule; If the version information does not conform to the preset rule, the version information is recorded as error version information, and the error version information is fed back to the application log of the application project to be built; If the version information complies with the preset rule, a step of replacing the placeholder of the first front-end entry file in the application project to be built with the version information is executed.
[0009] In one embodiment, the step of determining whether the version information complies with a preset rule includes: Determining the structural organization, version character set and version length of the version information; Determine whether the structural organization conforms to a preset format, whether the version character set conforms to a preset character set, and whether the version length conforms to a preset length limit; If the structural organization conforms to the preset format, the version character set conforms to the preset character set, and the version length conforms to the preset length limit, then it is determined that the version information conforms to the preset rule.
[0010] In addition, to achieve the above purpose, the present application also proposes a version injection device, which includes: The acquisition module is used to obtain the version information of the application project to be built; A replacement module is used to replace the placeholder of the first front-end entry file in the application project to be built with the version information, and generate a second front-end entry file, so that after the preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
[0011] In addition, to achieve the above objectives, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the version injection method described above.
[0012] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the version injection method described above are implemented.
[0013] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the version injection method described above are implemented.
[0014] The present application provides a version injection method: obtaining version information of an application project to be built; replacing the placeholder of a first front-end entry file in the application project to be built with the version information, generating a second front-end entry file, so that after a preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
[0015] This application obtains the version information of the application project to be built to ensure the accuracy of the version information. At the same time, it can instantly reflect the latest project version status, avoid manual input errors, reduce manual intervention, and improve the efficiency and accuracy of version information acquisition. By replacing the placeholder in the front-end entry file with version information and outputting it, the current version information can be displayed on the front end. When feedback errors are given, testers can quickly determine the corresponding abnormal version source code, thereby quickly eliminating version-related problems, achieving persistent version management, enhancing the transparency of the application and the traceability of version management, and not only improving the efficiency of application version management, but also enhancing its intelligence and reliability. Compared with related solutions that rely on manually updating the version information in the configuration file or code, this application uses automated means to achieve automatic acquisition and dynamic replacement of version information, significantly improving the intelligence level of version maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A flowchart of the first embodiment of the method for injecting the version of this application is provided; Figure 2 A flow chart of the second embodiment of the injection method of this application version is provided; Figure 3 A flowchart of the third embodiment of the injection method of this application version is provided; Figure 4 This is a brief flowchart of the injection method of this application version; Figure 5 This is a schematic diagram of the module structure of the injection device of the embodiment version of the present application; Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the version injection method in the embodiment of the present application. DETAILED DESCRIPTION
[0019] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0020] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0021] The main solution of the embodiment of the present application is: obtain the version information of the application project to be built; replace the placeholder of the first front-end entry file in the application project to be built with the version information, and generate a second front-end entry file, so that after the preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
[0022] In this embodiment, for the convenience of description, the following description is made with the version control system as the execution subject.
[0023] The existing technology manually maintains the version number in the front-end source code, which increases the workload of building and publishing and is prone to errors. Once an update is missed or erroneous, it will increase the difficulty of locating the problem. At the same time, traditional front-end programs lack a mechanism to actively output version numbers in the browser's developer tools, making it difficult for testers to quickly confirm the current code version in use. When an exception occurs, it is difficult to quickly and accurately locate the root cause of the problem in a complex system, affecting the efficiency of problem solving.
[0024] This application provides a solution that automatically obtains version information of the application project to be built, reduces human errors, improves efficiency and accuracy, and replaces the placeholders in the front-end entry file with version information so that the current version information can be displayed on the front-end, making it easier for testers to quickly locate abnormal versions. It realizes persistent management of version information, improves version management efficiency, and enhances the intelligence and reliability of version maintenance.
[0025] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a version control system, etc. The following takes the version control system as an example to illustrate this embodiment and the following embodiments.
[0026] Based on this, the present application embodiment provides a version injection method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the version injection method of this application.
[0027] In this embodiment, the version injection method includes steps S01-S02: Step S01, obtaining version information of the application project to be built; It should be noted that in the build process during software development, there are various build scenarios, including but not limited to local build, micro-frontend build, and containerized build. For each build scenario, the version control system or automation tool identifies and connects to the environment of the application project to be built. The application project to be built refers to the software project that currently needs to be built (compiled, packaged, etc.) in preparation for deployment or testing. By reading the configuration file of the application project to be built, the submission record of the version control system (such as Git), or directly querying the database of the application project to be built, the version information about the application project to be built is collected and parsed. The version information is a set of data used to identify the current version of the application project to be built, including but not limited to the version number, application name, build time, etc.
[0028] It is understandable that since the traditional application version maintenance mechanism relies on manual recording or querying of version information, which reduces the efficiency of version maintenance, step S01 is performed to automatically obtain version information, thereby ensuring the accuracy and efficiency of the construction process and reducing the possibility of human errors. At the same time, it provides a reliable basis for subsequent version tracking and problem troubleshooting.
[0029] Step S02, replace the placeholder of the first front-end entry file in the application project to be built with version information, and generate a second front-end entry file, so that after the preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
[0030] It should be noted that the first front-end entry file refers to a file used to initialize the front-end application or load front-end resources in the application project to be built, such as index.html or app.js. A placeholder refers to a mark reserved in the first front-end entry file for subsequent replacement with version information, such as a version number placeholder, an application name placeholder, a build time placeholder, etc. The second front-end entry file refers to a new front-end entry file generated after the placeholder is replaced with the version information, which is used to replace the original front-end entry file (ie, the first front-end entry file) so that the latest version information can be included when loading the application. The developer tools of the preset browser refer to a set of development tools built into modern web browsers, designed to help developers debug, analyze and optimize web pages and web applications. The console refers to a debugging interface provided by the browser for outputting logs, error messages, debugging information, etc.
[0031] In addition, it should be noted that after obtaining the version information in step S01, the front-end entry file of the application project to be built is traversed. The file is pre-designed with placeholders for inserting version information. The preset placeholders are searched in the front-end entry file. For each identified placeholder, the corresponding field value in the version information obtained in step S01 is used to replace it. For example, the version number corresponds to the version number placeholder, the application name corresponds to the application name placeholder, etc. The replaced front-end entry file overwrites the first front-end entry file. This replaced front-end entry file is the second front-end entry file.
[0032] It is understandable that in the traditional application version maintenance mechanism, it is necessary to manually modify the code to update the version number, which not only increases the workload but also easily leads to omissions or erroneous updates, which hinders the subsequent location of the root cause of the problem. Therefore, step S02 is performed to dynamically embed the front-end application version information by automatically replacing the placeholder with version information in the front-end entry file, which greatly simplifies the version information update process, reduces human errors, and improves the intelligence level of application version maintenance.
[0033] In a feasible implementation, the application project to be constructed further includes a configuration file, in which a subprocess module is pre-set, and the version information includes at least a version number. In step S01, the step of obtaining the version information of the application project to be constructed includes steps A01 to A02: Step A01, determining the subprocess module in the configuration file; It should be noted that the version control system parses the configuration file (webpack.config.js) in the project. The configuration file is an important part of the application project to be built. It contains various configuration information required for project construction and operation, such as environment variables, dependencies, script calling instructions, etc. It is used to indicate how to call the child process module to obtain version information. By reading the relevant parts of the configuration file, it identifies and determines which modules or scripts are marked as child process modules (child_process modules). The child process module is a copy of the Node.js process and can run in different Node.js instances, allowing the execution of system commands, running other programs, and parallel processing of tasks.
[0034] Step A02, in the sub-process module, obtain the version number, wherein the version number uniquely identifies the version information.
[0035] It should be noted that the version number (such as CommitId in Git) is a unique identifier representing the current code status, which is used to track the code change history and ensure that each build corresponds to a specific code version. The version number can be replaced with a unique identifier such as date and time, custom version, random string, etc.
[0036] In addition, it should be noted that once the sub-process module used to obtain version information is determined, the system executes the commands or scripts defined in the sub-process module. These commands or scripts usually interact with the version control system or other systems that store version information, obtain the current version number from the version control system, and record or display it as part of the version information.
[0037] Exemplarily, the "execSync" method in the child_process module of Node.js is used to synchronously execute the Git command "git rev-parse HEAD", which is used to obtain the ID of the last commit (ie, the commit hash value) of the current Git repository as the version number.
[0038] In this implementation, by automatically obtaining the version number from the version control system as version information, the system can more intelligently track and manage application version changes, while reducing the possibility of errors introduced by manual operations and improving the accuracy and reliability of version information.
[0039] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 In step S02, after the step of generating the second front-end entry file, steps S11 to S13 are also included: Step S11, determining whether an abnormal problem occurs after the application project to be built is deployed online; It should be noted that an abnormal problem refers to an unexpected program behavior or error that occurs during the operation of an application, which may be caused by code errors, insufficient resources, external service failures, etc. Through the monitoring tool in the preset browser, the running status data of the application project to be built, such as CPU usage, memory usage, response time, error log, etc., is collected in real time, and reasonable abnormal threshold indicators are defined for the running status data. When these running status data exceed the abnormal threshold indicators, it is determined that an abnormal problem has occurred.
[0040] Step S12, if an abnormal problem occurs after the application project to be built is deployed online, search for target version information related to the abnormal problem in the application log collected based on the application project to be built; It should be noted that the application log is a file or database that records events, errors, warnings and other important information that occurs during the operation of the application. The target version information refers to the specific version information of the application project related to the abnormal problems detected during the build process.
[0041] In addition, it should be noted that when an exception occurs in the application project to be built, the log analysis tool is used to search and filter the collected application logs, find log entries related to the exception problem, match specific error codes, exception stack information or keywords, and further extract the target version information from the log entries related to the exception problem, including version number, build time, etc.
[0042] Step S13, retrieving the submission record corresponding to the target version information, and feeding back the submission record to the console.
[0043] It should be noted that the commit record refers to the record left by the developer when submitting the code changes to the warehouse in the version control system. According to the target version information confirmed in step S12, the commit record corresponding to the target version information is retrieved in the version control system, the retrieved commit records are sorted, key information such as the submitter, submission time, submission instructions, changed files, etc. are extracted, and the sorted commit records are fed back to the console.
[0044] In this implementation, by introducing an automated monitoring mechanism, real-time tracking and anomaly detection of the application's running status are achieved, so that problems can be discovered and responded to in a timely manner. Log analysis technology is used to find target version information related to abnormal problems, and version information is automatically extracted from logs to quickly locate the problem version. By automatically retrieving and feeding back submission records, the specific code changes that caused the problem can be quickly found, providing important clues for quickly locating and fixing the problem, thereby accelerating the problem-solving process.
[0045] In a feasible implementation, the submission record includes the program name, submitter, submission information, and code change information. In step S13, the step of feeding back the submission record to the console includes step A11: Step A11, feedback the program name, submitter, submission information, and code change information to the console to determine the scope of the abnormal problem. The submission information at least includes the submission purpose and submission content. The code change information at least includes the file modification record and code modification record. The program name, submitter, submission information, and code change information are interrelated.
[0046] It should be noted that the program name refers to the name of the application where the abnormal problem occurred, the submitter refers to the identification of the developer or team member who submitted or changed the code, and the submission information is used to explain the intention and main content of the code change, including the purpose of the submission (the direct reason or goal of the code submission) and the submission content (a brief overview or description of the changes made to the submission). The code change information describes the specific content of the code change in detail, including file modification records (a record that lists all modified files and their modification time, modifier and other information) and code modification records (recording the specific details of which code lines are added, deleted or modified).
[0047] In addition, it should be noted that when a developer submits a project source code to a version control system, the submitted project source code includes the program name, and the system records the identity information of the submitter (i.e., the submitter). At the same time, the developer needs to provide a descriptive information for this submission (i.e., the submission information), which usually includes the purpose of the submission, the main changes or the issues fixed, etc. In addition, the system will also record in detail which files have been modified, and which lines of code have been added, deleted or modified (i.e., code change information).
[0048] For example, when an exception occurs, the specific application where the exception occurs can be determined by the program name, and the submitter is directly associated with a specific developer or team member. This makes it possible to quickly find the relevant responsible person when a problem is discovered. By associating the submission information and code change information, the specific content and purpose of each submission can be determined, thereby identifying which changes may be related to the current exception problem. By associating the exception with a specific program name, submission time, and code change, we can greatly narrow the search scope of the problem, thereby quickly developing a repair plan and repairing the affected code.
[0049] In this implementation, by centrally feeding back submission records to the console, the information island problem is solved, the availability and relevance of information are improved, and a clear problem context is provided for developers and operation and maintenance personnel, which helps to quickly locate the root cause of the problem. At the same time, the intelligence of the application version maintenance mechanism is enhanced, making problem diagnosis more accurate and efficient.
[0050] Based on the first embodiment and / or the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those of the above-mentioned first and second embodiments can refer to the above introduction, and will not be repeated later. Figure 3 In step S02, before the step of replacing the placeholder of the first front-end entry file in the application project to be built with the version information, steps S21 to S23 are also included: Step S21, determining whether the version information complies with a preset rule; It should be noted that preset rules refer to rules pre-defined in the system for verifying version information, including but not limited to whether the version number format complies with the semantic version control specification, the allowed character set (such as whether it only contains numbers, letters and periods), and the version number length limit. Regular expressions, string processing functions or other logic are used to compare the obtained version information with the preset rules to determine whether it meets the requirements.
[0051] Step S22, if the version information does not conform to the preset rule, the version information is recorded as error version information, and the error version information is fed back to the application log of the application project to be built; It should be noted that incorrect version information refers to information that does not comply with preset rules and cannot pass verification, including but not limited to incorrect version information, specific reasons for verification failure (such as format errors, illegal characters, etc.) and the time when the error occurred. This version information may be caused by input errors, format errors or data corruption.
[0052] In addition, it should be noted that according to the verification result of step S21, if the version information does not comply with the preset rules, it will be marked as erroneous version information, and a detailed log entry will be generated based on the recorded erroneous version information, including the error type, error description, related file path, version number, etc. The generated log entry will be written into the application log file of the application project to be built. This log file is usually located in a specific directory of the project for the convenience of developers to review.
[0053] Step S23, if the version information complies with the preset rules, a step of replacing the placeholder of the first front-end entry file in the application project to be built with the version information is executed.
[0054] It should be noted that according to the project structure and configuration file of the application to be built, the first front-end entry file in the application project to be built is located, and the preset placeholder is searched in the front-end entry file, and the found placeholder is replaced with the version information verified in step S21.
[0055] In this implementation, by automatically verifying the validity and correctness of version information, it is ensured that only legal version information can be further processed, thereby improving the reliability of the entire build and deployment process. By recording and feeding back erroneous version information to the application log, automatic recording and rapid response to problems are achieved. Developers can quickly locate version information errors by checking the logs and take corresponding solutions, greatly improving the efficiency and timeliness of problem handling.
[0056] In a feasible implementation, in step S21, the step of determining whether the version information complies with a preset rule includes steps A21 to A23: Step A21, determining the structural organization, version character set and version length of the version information; It should be noted that the version control system parses the version information, extracts the structural organization, version character set and version length limit. The structural organization refers to the arrangement and separators of the various components in the version information (such as major version number, minor version number, revision number), the version character set refers to the character types contained in the version information, such as numbers, letters and specific separators, and the version length refers to the total length of the version information.
[0057] Step A22, determining whether the structure organization conforms to the preset format, whether the version character set conforms to the preset character set, and whether the version length conforms to the preset length limit; It should be noted that the preset rules include at least a preset format, a preset character set and a preset length limit. The preset format refers to the specific structure or template that the version information should follow, such as "major version number. Minor version number. Revision number". The preset character set defines the range of characters that can be included in the version information, such as numbers, letters and periods. The preset length limit limits the total length of the version information or the length of each component.
[0058] In addition, it is necessary to verify whether the structural organization of the version information complies with the arrangement and separator requirements in the preset format, whether each character in the version information belongs to the preset character set, and whether the total length of the version information or the length of each component complies with the preset length limit.
[0059] Step A23: If the structure organization conforms to the preset format, the version character set conforms to the preset character set, and the version length conforms to the preset length limit, it is determined that the version information conforms to the preset rule.
[0060] It should be noted that the system will make a judgment based on the verification result of step A22. Only when the structural organization of the version information conforms to the preset format, the version character set conforms to the preset character set, and the version length conforms to the preset length limit, will the system determine that the version information conforms to the preset rules. All three conditions are indispensable.
[0061] In this implementation, through comprehensive preset rule verification, the possible omissions or inconsistencies in version information verification in traditional applications are solved, the comprehensiveness and accuracy of version information are ensured, the intelligence level and reliability of version maintenance are improved, and at the same time, a more solid foundation is provided for subsequent version control, release and rollback operations.
[0062] For example, to help understand the implementation process of the version injection method, please refer to Figure 4 , Figure 4 A brief flow chart of a version injection method is provided, specifically: The developer pre-adds a version information placeholder in the front-end entry file. After the system automatically obtains the version information (step S01), the pre-added version information placeholder in the front-end entry file is replaced (step S02). After the application project to be built is deployed and launched, it is determined whether an abnormal problem occurs (step S11). When an abnormal problem occurs, the system automatically feeds back the abnormal problem to the console and attaches the version information when feeding back the abnormal problem (steps S12~S13), so that the developer can directly view the version information, thereby quickly locating the abnormal problem and solving it.
[0063] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the version injection method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0064] This application also provides a version injection device, please refer to Figure 5 The version injection device is applied to the construction process in the software development process and is suitable for various construction scenarios. The version injection device includes: The acquisition module 10 is used to obtain the version information of the application project to be built; The replacement module 20 is used to replace the placeholder of the first front-end entry file in the application project to be built with version information, and generate a second front-end entry file, so that after the preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
[0065] Optionally, the application project to be constructed further includes a configuration file, in which a subprocess module is pre-set, and the version information includes at least a version number. The acquisition module 10 is further used for: Determine the subprocess module in the configuration file; In the child process module, obtain the version number, where the version number uniquely identifies the version information.
[0066] Optionally, the version injection device further includes a feedback module 30, and the feedback module 30 is further used for: Determine whether any abnormal problems occur after the application project to be built is deployed and launched; If an abnormal problem occurs after the application project to be built is deployed and launched, the target version information related to the abnormal problem is found in the application logs collected based on the application project to be built; Retrieve the commit record corresponding to the target version information and feed the commit record back to the console.
[0067] Optionally, the submission record includes the program name, submitter, submission information, and code change information. The feedback module 30 is further used to: Feedback the program name, submitter, submission information, and code change information to the console to determine the scope of the abnormal problem. The submission information at least includes the submission purpose and submission content. The code change information at least includes the file modification record and code modification record. The program name, submitter, submission information, and code change information are interrelated.
[0068] Optionally, the version injection device further includes a verification module 40, and the verification module 40 is further used to: Determine whether the version information complies with the preset rules; If the version information does not conform to the preset rules, the version information is recorded as error version information, and the error version information is fed back to the application log of the application project to be built; If the version information complies with the preset rules, the step of replacing the placeholder of the first front-end entry file in the application project to be built with the version information is executed.
[0069] Optionally, the verification module 40 is further configured to: Determine the structural organization of version information, version character set and version length; Determine whether the structure organization conforms to the preset format, whether the version character set conforms to the preset character set, and whether the version length conforms to the preset length limit; If the structural organization conforms to the preset format, the version character set conforms to the preset character set, and the version length conforms to the preset length limit, then it is determined that the version information conforms to the preset rules.
[0070] The version injection device provided by the present application adopts the version injection method in the above embodiment, which can solve the technical problem that most traditional application version information injection mechanisms have insufficient intelligence in the update process. Compared with the prior art, the beneficial effects of the version injection device provided by the present application are the same as those of the version injection method provided by the above embodiment, and other technical features in the version injection device are the same as those disclosed in the above embodiment method, which will not be described in detail here.
[0071] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the version injection method in the above-mentioned embodiment 1.
[0072] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, notebook computers, PADs (Portable Application Description: tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0073] like Figure 6As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0074] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0075] The electronic device provided by the present application adopts the version injection method in the above embodiment, which can solve the technical problem that most traditional application version information injection mechanisms have an update process that is not intelligent enough. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the version injection method provided by the above embodiment, and other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0076] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0077] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0078] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the version injection method in the above-mentioned embodiment.
[0079] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0080] The computer-readable storage medium may be included in the version injection device; or may exist independently without being assembled into the version injection device.
[0081] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the version injection device, the version injection device: obtains the version information of the application project to be built; replaces the placeholder of the first front-end entry file in the application project to be built with the version information, and generates a second front-end entry file, so that after the preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
[0082] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0083] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0084] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0085] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned version injection method, and can solve the technical problem that most traditional application version information injection mechanisms have insufficient intelligence in the update process. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as those of the version injection method provided by the above-mentioned embodiment, and will not be elaborated here.
[0086] The present application also provides a computer program product, including a computer program, which implements the steps of the version injection method as described above when the computer program is executed by a processor.
[0087] The computer program product provided by this application can solve the technical problem that most traditional application version information injection mechanisms have insufficient intelligence in the update process. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as those of the version injection method provided in the above embodiment, and will not be repeated here.
[0088] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A version injection method, characterized in that: The version injection method includes: Get the version information of the application project to be built; The placeholder of the first front-end entry file in the application project to be built is replaced with the version information to generate a second front-end entry file, so that after the preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
2. The version injection method according to claim 1, characterized in that: The application project to be built also includes a configuration file, in which a subprocess module is pre-set, and the version information includes at least a version number. The step of obtaining the version information of the application project to be built includes: Determine the subprocess module in the configuration file; In the sub-process module, the version number is obtained, wherein the version number uniquely identifies the version information.
3. The version injection method according to claim 1, characterized in that: The step of generating the second front-end entry file further includes: Determine whether any abnormal problems occur after the application project to be built is deployed and launched; If an abnormal problem occurs after the application project to be built is deployed online, search for target version information related to the abnormal problem in the application logs collected based on the application project to be built; Retrieve the submission record corresponding to the target version information, and feed the submission record back to the console.
4. The version injection method according to claim 3, characterized in that: The submission record includes the program name, submitter, submission information, and code change information. The step of feeding back the submission record to the console includes: The program name, the submitter, the submission information, and the code change information are fed back to the console to determine the scope of the abnormal problem, the submission information at least includes the submission purpose and the submission content, the code change information at least includes the file modification record and the code modification record, and the program name, the submitter, the submission information, and the code change information are related to each other.
5. The version injection method according to claim 1, characterized in that: Before the step of replacing the placeholder of the first front-end entry file in the application project to be built with the version information, the following step is further included: Determining whether the version information complies with a preset rule; If the version information does not conform to the preset rule, the version information is recorded as error version information, and the error version information is fed back to the application log of the application project to be built; If the version information complies with the preset rule, a step of replacing the placeholder of the first front-end entry file in the application project to be built with the version information is executed.
6. The version injection method according to claim 5, characterized in that: The step of determining whether the version information complies with a preset rule comprises: Determining the structural organization, version character set and version length of the version information; Determine whether the structural organization conforms to a preset format, whether the version character set conforms to a preset character set, and whether the version length conforms to a preset length limit; If the structural organization conforms to the preset format, the version character set conforms to the preset character set, and the version length conforms to the preset length limit, then it is determined that the version information conforms to the preset rule.
7. A version injection device, characterized in that: The version injection device comprises: The acquisition module is used to obtain the version information of the application project to be built; A replacement module is used to replace the placeholder of the first front-end entry file in the application project to be built with the version information, and generate a second front-end entry file, so that after the preset browser loads the application project to be built, the version information of the second front-end entry file is output through the console of the developer tool of the preset browser.
8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the version injection method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the version injection method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the version injection method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Software fault positioning and repairing method and system
CN114328101A
Version information generation method and device of front-end Vue project, equipment and storage medium
CN117421039A
Version identification generation method and device, electronic equipment, medium and program product
CN118034775A
