Front-end code deployment inspection method, device, equipment and medium

By automatically accessing and compiling front-end code and combining target configuration files, the problem of low efficiency of front-end code deployment and deployment inspection is solved, automated deployment and inspection is realized, and human resource consumption is reduced.

CN117215909BActive Publication Date: 2024-11-01CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310938128.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-26
Publication Date
2024-11-01
Estimated Expiration
2043-07-26

AI Technical Summary

Technical Problem

In the prior art, the deployment and deployment verification of front-end code requires manual intervention, which is inefficient and consumes a lot of human resources.

Method used

By determining the target configuration file, automatically accessing the initial page, compiling and deploying front-end code, and determining the deployment results based on the page information, the automated deployment and deployment verification of front-end code is achieved.

Benefits of technology

It improves the efficiency of front-end code deployment and deployment inspection, reduces human resources consumption, and realizes automated processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117215909B_ABST
    Figure CN117215909B_ABST
Patent Text Reader

Abstract

The disclosed embodiments relate to a front-end code deployment inspection method, device, equipment and medium, and relate to the field of computer technology. The method comprises: determining a target configuration file, accessing an initial page according to the target configuration file, and obtaining first page information of the initial page; compiling a preset target front-end code according to the target configuration file to obtain a compilation folder; deploying the compilation folder to a target server according to the target configuration file; accessing a deployment completion page corresponding to the target front-end code according to the target configuration file, and obtaining second page information of the deployment completion page; and determining a front-end code deployment inspection result according to the first page information and the second page information. The disclosed embodiments realize the automated deployment and automated deployment inspection of the front-end code, improve the deployment efficiency and deployment inspection efficiency of the front-end code, and reduce the consumption of human resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a front-end code deployment inspection method, device, equipment and medium. Background Art

[0002] After completing code editing, developers need to deploy the code to the corresponding server to check whether the code can run normally.

[0003] In the related art, developers need to manually deploy the code and manually check whether the code is deployed successfully. However, the deployment and deployment inspection of the code involve multiple processes, and the manual deployment and deployment inspection are inefficient and consume a lot of human resources. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a front-end code deployment inspection method, device, equipment and medium.

[0005] The present disclosure provides a method for verifying the deployment of a front-end code, including:

[0006] Determine a target configuration file, access an initial page according to the target configuration file, and obtain first page information of the initial page;

[0007] Compile the preset target front-end code according to the target configuration file to obtain a compilation folder;

[0008] Deploying the compiled folder to a target server according to the target configuration file; wherein the target server is a server determined according to the target configuration file;

[0009] Accessing a deployment completion page according to the target configuration file, and acquiring second page information of the deployment completion page;

[0010] Determine a deployment verification result of the front-end code according to the first page information and the second page information.

[0011] The present disclosure also provides a front-end code deployment verification device, including:

[0012] A first acquisition module, configured to determine a target configuration file, access an initial page according to the target configuration file, and acquire first page information of the initial page;

[0013] A compiling module, used to compile the preset target front-end code according to the target configuration file to obtain a compilation folder; wherein the target front-end code is a code for adjusting the initial page;

[0014] A deployment module, configured to deploy the compiled folder to a target server according to the target configuration file; wherein the target server is a server determined according to the target configuration file;

[0015] A second acquisition module is used to access the deployment completion page corresponding to the target front-end code according to the target configuration file, and obtain second page information of the deployment completion page;

[0016] A verification module is used to determine a deployment verification result of the target front-end code based on the first page information and the second page information.

[0017] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the deployment verification method of the front-end code provided in the embodiment of the present disclosure.

[0018] The embodiment of the present disclosure also provides a computer-readable storage medium, which stores a computer program, and the computer program is used to execute the deployment verification method of the front-end code provided by the embodiment of the present disclosure.

[0019] The technical solution provided by the embodiment of the present disclosure has the following advantages over the prior art: the deployment inspection solution of the front-end code provided in the embodiment of the present disclosure, the method includes: determining the target configuration file, accessing the initial page according to the target configuration file, and obtaining the first page information of the initial page; compiling the pre-set target front-end code according to the target configuration file to obtain a compiled folder; wherein the target front-end code is the code for adjusting the initial page; deploying the compiled folder to the target server according to the target configuration file; wherein the target server is the server determined according to the target configuration file; accessing the deployment completion page corresponding to the target front-end code according to the target configuration file, and obtaining the second page information of the deployment completion page; determining the deployment inspection result of the target front-end code according to the first page information and the second page information. Adopting the above technical solution, the front-end code is automatically packaged and deployed to the target server based on the target configuration file, the page information before and after the deployment is determined based on the target configuration file, and the deployment inspection result is generated based on the page information before and after the deployment, realizing the automatic deployment and automatic deployment inspection of the front-end code, improving the deployment efficiency and deployment inspection efficiency of the front-end code, and reducing the consumption of human resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0021] In order to more clearly illustrate the embodiments of the present invention 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 labor.

[0022] Figure 1 A schematic diagram of a flow chart of a front-end code deployment verification method provided in an embodiment of the present disclosure;

[0023] Figure 2 A flowchart of another front-end code deployment verification method provided by an embodiment of the present disclosure;

[0024] Figure 3 A schematic diagram of a process flow of another front-end code deployment verification provided by an embodiment of the present disclosure;

[0025] Figure 4 A flowchart of another front-end code deployment verification method provided in an embodiment of the present disclosure;

[0026] Figure 5 A schematic diagram of the structure of a front-end code deployment inspection device provided in an embodiment of the present disclosure;

[0027] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0029] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0030] In order to solve the above problems, the embodiments of the present disclosure provide a deployment verification method for front-end code, which is introduced below in conjunction with specific embodiments.

[0031] Figure 1 The present invention provides a flow chart of a front-end code deployment verification method. The front-end code deployment verification device can be implemented by software and / or hardware. The front-end code deployment verification device can generally be integrated into an electronic device. Figure 1 As shown, the deployment verification method of the front-end code includes:

[0032] Step 101: determine a target configuration file, access an initial page according to the target configuration file, and obtain first page information of the initial page.

[0033] Among them, the target configuration file can be a file for parameter configuration of the deployment and deployment verification of the front-end code. The target configuration file can be set according to user needs, etc., and this embodiment does not limit it. The initial page can be a page displayed based on the old version of the front-end code before the new version of the front-end code (i.e., the target front-end code) is deployed. The first page information can be information determined based on the initial page. There are many types of the first page information, which are not limited in this embodiment. For example, the first page information can include one or more of text information, color information, menu bar information, and code information.

[0034] In the embodiment of the present disclosure, the deployment verification device of the front-end code can determine the target configuration file based on the default configuration information and the configuration information input by the user, and access the initial page according to the Internet Protocol (IP) address recorded in the target configuration file, parse the initial page, and generate the first page information based on one or more of the text information, color information, menu bar information, and code information of the initial page.

[0035] In an optional implementation, the first page information may be a screenshot of the initial page. Specifically, the deployment verification device may jump to the initial page according to the Internet Protocol address in the target configuration file, and take a screenshot of the initial page, and use the screenshot of the initial page as the first page information.

[0036] In some embodiments of the present disclosure, determining a target configuration file includes: initializing a default configuration file; obtaining input configuration information input by a user, merging the input configuration information into the default configuration file, and obtaining a target configuration file; wherein the input configuration information includes: one or more of a server name, a server alias, a compilation instruction, a server address, a server port, a user name, a local directory, a server directory, and a backup instruction.

[0037] Among them, the default configuration file can be a file for default parameter configuration of the deployment and deployment verification of the front-end code. This embodiment does not limit the property configuration of the default configuration file. For example, the property configuration of the default configuration file can be a deployed property configuration. The default configuration file includes a preset default configuration file or a custom default configuration file, wherein the preset default configuration file can be a file with a deployed property configuration, and the preset default configuration file can support different extensions. The custom default configuration file can be initialized by running the npx deployed-cliinit command or the npx deployed-clii command in the command line, and running npxdeployed-cli[deploy]--config-file. <path>Command or npx deployed-cli [deploy] -c <path>command, and pass --config-file <path> |-c <path>Parameter to specify the file path of the custom default configuration file. The path corresponding to the path in the above command is a relative path.

[0038] The input configuration information may be parameter configuration information input into the deployment inspection device by voice input or keyboard input, etc. The server name may be the official name of the server where the code is deployed, the server alias may be the common name of the server where the code is deployed, the compilation instruction may be a computer instruction instructing to compile the code, the server address may be the Internet Protocol address of the server where the code is deployed, the server port may be the network port of the server where the code is deployed, the user name may be the login user name of the server where the code is deployed, the local directory may be the local file path of the deployment inspection device for storing the packaged code, the server directory may be the file path of the deployed code in the server, and the backup instruction may be a computer instruction instructing whether to back up the old version of the code in the server.

[0039] In this embodiment, the deployment verification device can initialize the default configuration file in advance. And obtain the input configuration information entered by the user through the command line window, combine the customized input configuration information with the default configuration file, and obtain the target configuration file. In an optional implementation, during the process of the user entering the input configuration information, the scheme check can be used to check whether the characters entered by the user are within the preset character range. If not, the user is prompted with an input prompt message that the input is wrong.

[0040] In the above scheme, the target configuration file is obtained by combining the default configuration file and the input configuration information, thereby achieving flexible acquisition of the target configuration file, making the application scenario of the deployment verification method more extensive.

[0041] Step 102, compile the preset target front-end code according to the target configuration file to obtain a compilation folder; wherein the target front-end code is the code for adjusting the initial page.

[0042] The front-end code may be the code of the front-end part of the website, the target front-end code may be the front-end code that needs to be deployed, and the compilation folder may be the folder obtained after packaging and compiling the target front-end code.

[0043] In the disclosed embodiment, the user can modify the old version of the front-end code that constructs the initial page. The modified code is the target front-end code, and the pre-set target front-end code is compiled and packaged according to the information in the target configuration file to obtain a compiled folder.

[0044] In some embodiments of the present disclosure, a pre-set target front-end code is compiled according to a target configuration file to obtain a compiled folder, including: executing the compilation instructions in the target configuration file for the front-end code, compiling the target front-end code to a local directory in the target configuration file, and obtaining a compiled folder.

[0045] Among them, the target configuration file includes compilation instructions and local directories. The compilation instructions can be set according to the language type of the target front-end code, etc., and this embodiment does not limit it. For example, the compilation instruction can be: npm run build.

[0046] In this embodiment, the deployment verification device can read the compilation instructions and local directory in the target configuration file, execute the compilation instructions on the target front-end code, compile the target front-end code into the local directory of the deployment verification device, and generate a successfully compiled folder in the local directory.

[0047] Step 103, deploying the compiled folder to the target server according to the target configuration file; wherein the target server is a server determined according to the target configuration file.

[0048] The target server may be a server where the code is deployed.

[0049] In the disclosed embodiment, the deployment verification device may determine the target server according to information such as the server address and the server port in the target configuration file, and deploy the compiled folder stored in the local directory to the target server.

[0050] Figure 2 A flow chart of another front-end code deployment verification method provided by the embodiment of the present disclosure is as follows: Figure 2 As shown, deploy the compiled folder to the target server according to the target configuration file, including:

[0051] Step 201, read the compilation folder in the local directory in the target configuration file, and package the compilation folder through a preset packaging program to obtain a code compression file corresponding to the target front-end code.

[0052] The preset packaging program may be a pre-set program with a packaging and compression function. The preset packaging program and the compression level in the preset packaging program may be set according to user requirements, etc., and this embodiment does not limit this. For example, the preset packaging program may be an archiver packaging program. The code compression file may be a file obtained after compiling and compressing the target front-end code once. The file format of the code compression file may correspond to the type of the preset packaging program. For example, if the preset packaging program is an archiver packaging program, the file format of the code compression file may be in tar format.

[0053] In this embodiment, after generating the compilation folder, the deployment verification device can read the compilation folder, and package and compress the compilation folder through a preset packaging program to obtain a code compression file, and also save the code compression file in a local directory.

[0054] Step 202, connecting to the target server.

[0055] In this embodiment, in order to transmit the compressed code file to the target server, the deployment verification device may establish a connection between itself and the target server.

[0056] In the embodiments of the present disclosure, there are many methods for deploying the inspection device to connect to the target server, which are not limited in this embodiment. Examples are as follows:

[0057] In an optional implementation, connecting to a target server includes: determining a target port of the target server based on a server address and a server port in a target configuration file; sending a server private key pre-set in the target configuration file to the target port so that the target server verifies the server private key; if the verification passes, allowing establishment of a connection between the target server and the deployment inspection device; if the verification fails, refusing to establish a connection between the target server and the deployment inspection device.

[0058] In another optional implementation, connecting to the target server includes: determining the target port of the target server based on the server address and server port of the target configuration file; displaying the user name of the target configuration file, obtaining the user password entered by the user, generating a connection request including the user name and the user password, and sending the connection request to the target port of the target server, so that the target server allows the connection if the user name and user password are verified.

[0059] The connection request is a request for establishing a connection with a server.

[0060] In this embodiment, the deployment verification device can read the server address and server port in the target configuration file, determine the target server according to the server address, and determine the target port of the target server according to the server port. In addition, the user name in the target configuration file is read, and the user name is displayed to the user in the form of a window or the like. After the user sees the user name, the user enters the user password corresponding to the user name. In response to the user's password input operation, the deployment verification device obtains the user password entered by the user. A connection request is generated in combination with the user name in the target configuration file and the user password entered by the user, and the connection request is sent to the target port of the determined target server. After receiving the connection request, the target server parses the connection request, obtains the user name and user password in the connection request, and attempts to log in with the user name and user password. If the login is successful, it means that the user name and user password have passed the verification of the target server, and the connection between the deployment verification device and the target server is allowed to be established; if the login fails, it means that the user name and user password verification have not passed the verification of the target server, and the connection between the deployment verification device and the target server is not allowed to be established.

[0061] Step 203: Send the code compression file and the server directory in the target configuration file to the target server, so that the target server decompresses the code compression file into the server directory.

[0062] In this embodiment, after establishing a connection between the deployment verification device and the target server, the deployment verification device can send the code compression file obtained by compiling and packaging the target front-end code and the server directory in the target configuration file to the target server. After the target server receives the code compression file, it stores the code compression file in the server directory, and determines the target decompression program according to the file format of the code compression file, and decompresses the code compression file in the server directory through the target decompression program.

[0063] Step 104: Access the deployment completion page corresponding to the target front-end code according to the target configuration file, and obtain the second page information of the deployment completion page.

[0064] The deployment completion page may be a page displayed based on the new version of the front-end code after the new version of the front-end code is deployed, and the deployment completion page and the initial page may correspond to the same Internet Protocol address. The second page information may be information determined based on the deployment completion page. There are multiple types of the second page information, which are not limited in this embodiment. For example, the second page information may include one or more of text information, color information, menu bar information, and code information. The second page information may correspond to the first page information.

[0065] In the disclosed embodiment, the front-end code deployment verification device can access the deployment completion page according to the Internet Protocol address recorded in the target configuration file, parse the deployment completion page, and generate second page information based on the text information, color information, menu bar information, code information, etc. of the initial page.

[0066] In an optional implementation, the second page information may be a screenshot of the deployment completion page. Specifically, the deployment verification device may jump to the deployment completion page according to the Internet Protocol address in the target configuration file, and take a screenshot of the deployment completion page, and use the screenshot of the deployment completion page as the second page information.

[0067] Step 105: Determine the deployment verification result of the front-end code according to the first page information and the second page information.

[0068] Among them, the deployment verification result can indicate whether the target front-end code is effective after deployment, and the deployment verification result can include: deployment success, deployment failure, etc.

[0069] In the embodiment of the present disclosure, there are multiple methods for determining the deployment verification result according to the first page information and the second page information, which are not limited in this embodiment. Examples are described as follows:

[0070] In an optional implementation, the deployment verification device may compare the first page information with the second page information. If the comparison result is consistent, it means that the page information has not changed before and after the front-end code deployment, and the deployment verification result is determined to be a deployment failure.

[0071] In another optional implementation, the first page information is a first page screenshot of the initial page, and the second page information is a second page screenshot of the deployment completion page. The deployment verification device can send the first page screenshot and the second page screenshot to a pre-set user mailbox by email. After the user receives the email, the user can judge whether the deployment of the front-end code is successful based on the first page screenshot and the second page screenshot, generate a corresponding judgment result, and send the judgment result to the deployment verification device by email or other means. The deployment verification device uses the judgment result as the deployment verification result.

[0072] Figure 3 A schematic diagram of a process flow of another front-end code deployment inspection provided by an embodiment of the present disclosure, such as Figure 3 As shown, the deployment inspection result of the front-end code is determined according to the first page information and the second page information, including:

[0073] Step 301, determining the update attribute corresponding to the target front-end code.

[0074] Among them, the update attribute can be an attribute that represents the update dimension of the front-end code, and the update attribute can correspond to the target front-end code. For example, if the color of the initial page is modified in the target front-end code, the update attribute can be a color attribute.

[0075] In an embodiment of the present disclosure, a user can set update attributes corresponding to the target front-end code, or a deployment verification device can obtain an old version of the front-end code deployed in the target server, compare the old version of the front-end code with the target front-end code in multiple dimensions, and determine the dimension whose dimensional parameters have changed as an update attribute.

[0076] Step 302: extract first update information corresponding to the update attribute in the first page information and second update information corresponding to the update attribute in the second page information.

[0077] The first update information may be an attribute value determined based on the first page information, and the second update information may be an attribute value determined based on the second page information.

[0078] In this embodiment, the deployment verification device can determine the first update information matching the update attribute in the first page information, and determine the second update information matching the update attribute in the second page information. For example, if the update attribute is a color attribute, the color of each position in the first page information is extracted to obtain the first update information, and the color of each position in the second page information is extracted to obtain the second update information.

[0079] Step 303: If the first update information and the second update information are the same, determine that the deployment verification result is deployment failure.

[0080] In this embodiment, the deployment verification device can compare the first update information and the second update information. If the first update information and the second update information are the same, it means that the content related to the update attributes in the page has not changed before and after the target front-end code is deployed, and the deployment verification result is determined to be a deployment failure.

[0081] If the first update information and the second update information are not the same, the deployment verification result is determined to be a successful deployment. Alternatively, if the first update information and the second update information are not the same, the first update information and the second update information are sent to a preset mailbox in the form of emails, so that the user can determine whether the target code is successfully deployed through the first update information and the second update information.

[0082] The deployment and verification method of the front-end code provided by the embodiment of the present disclosure includes: determining a target configuration file, accessing the initial page according to the target configuration file, and obtaining the first page information of the initial page; compiling the pre-set target front-end code according to the target configuration file to obtain a compiled folder; wherein the target front-end code is the code for adjusting the initial page; deploying the compiled folder to the target server according to the target configuration file; wherein the target server is the server determined according to the target configuration file; accessing the deployment completion page corresponding to the target front-end code according to the target configuration file, and obtaining the second page information of the deployment completion page; determining the deployment and verification result of the target front-end code according to the first page information and the second page information. By adopting the above technical scheme, the front-end code is automatically packaged and deployed to the target server based on the target configuration file, the page information before and after the deployment is determined based on the target configuration file, and the deployment and verification result is generated based on the page information before and after the deployment, thereby realizing the automated deployment and automated deployment and verification of the front-end code, improving the deployment efficiency and deployment and verification efficiency of the front-end code, and reducing the consumption of human resources.

[0083] In some embodiments of the present disclosure, the front-end code deployment verification method further includes: receiving feedback information sent by a preset feedback library, and displaying the feedback information; wherein the preset feedback library can be a database connected to the deployment verification device and / or the target server for monitoring the code deployment process and feeding back information. The feedback information includes, but is not limited to, one or more of the following information: compilation success information, compilation failure information, compression success information, compression failure information, server connection success information, server connection failure information, user secret error prompt information, file upload information, file upload server failure information, file upload server success information, backup information, backup success information, backup failure information, deployment success information, deployment failure information.

[0084] In some embodiments of the present disclosure, the deployment verification method of the front-end code also includes: sending the clear instruction in the target configuration file to the target server, so that the target server clears the files in the server directory according to the clear instruction; or, sending the backup instruction in the target configuration file to the target server, so that the target server backs up the files in the server directory to a preset backup directory according to the backup instruction.

[0085] Among them, the clear instruction can be an instruction for instructing to clear the files in the folder, and the clear instruction can be set according to the operating system of the target server, etc., and this embodiment does not limit it. For example, the clear instruction can be an rm-rf instruction. The backup instruction can be an instruction for instructing to back up the files in the folder, and the backup instruction can be set according to the operating system of the target server, etc., and this embodiment does not limit it. The preset backup directory can be a preset directory where the backed-up files are saved. The preset backup directory can be set according to user needs, etc., and this embodiment does not limit it. For example, the preset backup directory can be / opt / cestc_deploy / middle-images / nginx / volume / html / backups. Optionally, the preset backup directory can be a default directory pre-set in the target server, or the preset backup directory can be a directory set in the target configuration file, and the preset backup directory can be sent to the target server together with the backup instruction.

[0086] In this embodiment, the deployment inspection device can realize the clearing and / or backup of files. Specifically, the deployment inspection device can read the target configuration file. If a clear instruction is read, the clear instruction is sent to the target server. After receiving the clear instruction, the target server executes the clear instruction in the server directory, deletes the old version of the code file previously deployed in the server directory, and then realizes a full update. The deployment inspection device can read the target configuration file. If a backup instruction is read, the backup instruction is sent to the target server. After receiving the backup instruction, the target server determines whether the preset backup directory exists. If the preset backup directory exists, the old version of the code file in the current server directory is backed up to the backup directory; if the preset backup directory does not exist, the target server creates the preset backup directory through the execCommand instruction of the Secure Shell Protocol (SSH) and compresses the old version of the code file in the server directory to obtain a compressed file, and then backs up the compressed file in the server directory to the newly created backup directory. Among them, the name of the compressed file can be set according to the compression time, etc., and the format of the compressed file can be .tar.gz format.

[0087] In the above scheme, by configuring the clearing instruction and the backup instruction in the configuration file, the old version of the code file in the target server is cleared or backed up before the target front-end code is configured on the target server, creating conditions for the subsequent configuration of the target front-end code.

[0088] Next, the deployment verification method of the front-end code in the embodiment of the present disclosure is further described by using a specific example. Figure 4 A flow chart of another front-end code deployment verification method provided in an embodiment of the present disclosure is shown as follows: Figure 4 As shown:

[0089] Step 401, initializing a default configuration file.

[0090] The default configuration file can be any of the preset default configuration files and the custom default configuration files:

[0091] The preset default configuration file may be a file with a deployed property configuration, and the preset default configuration file may support different extensions (e.g., a .deployedrc extension and / or a .js extension) through a cosmiconfig function. For example, the preset default configuration file may be a Package.json file with a deployed property configuration.

[0092] To customize the default configuration file, you can initialize the custom default configuration file by running the npx deployed-cliinit command or the npx deployed-clii command on the command line, and run npx deployed-cli[deploy]--config-file <path>Command or npx deployed-cli [deploy] -c <path>Command via --config-file <path> |-c <path>The parameter is used to specify the file path of the custom default configuration file. The path in the above command corresponds to a relative path. For example, running the npx deployed-cli [deploy] --config-file command can create a custom default configuration file in the root directory of the project in the deployment inspection device.

[0093] Step 402, determine input configuration information, and generate a target configuration file according to the input configuration information and a default configuration file.

[0094] The input configuration information includes but is not limited to: deployment platform (i.e., server) name, deployment platform alias, compilation instructions, server address, server port, user name, local directory, server directory. In addition, in the process of obtaining the input configuration information, a scheme check can be added to prevent the user from making mistakes in the process of adding the input configuration information. If the input configuration information is wrong, an error message is generated and displayed through the scheme check.

[0095] Step 403, compile the target front-end code according to the target configuration file to obtain a compiled folder.

[0096] Identify the compilation instruction in the target configuration file, which can be npm run build. Execute the compilation instruction in the deployment inspection device, and output the compiled compilation folder dist in the root directory of the project. During the compilation process, the compilation result is fed back through a preset feedback library (for example, Ora spinner). If the compilation is successful, it prompts that the project compilation is successful, and if the compilation fails, it prompts that the project compilation fails, so that the user can perform the next step according to the compilation result.

[0097] Step 404, compress the compilation folder according to the target configuration file to obtain a code compression folder.

[0098] Specifically, the compilation folder is packaged through a third-party package (for example, an archiver package), and the maximum compression level is predefined. The compilation folder is compressed and packaged into a code compressed file in tar format, and the code compressed file is saved in the current project directory. During the compression process, the compression result is fed back using a preset feedback library. If the compression is successful, the project compression is successful, and if the compression fails, the project compression fails.

[0099] Step 405: Establish a connection with the target server.

[0100] The target server is logged in by means of a private key or a password. Specifically, the target server is logged in by means of a private key, which may include: encrypting and decrypting the password phrase of the private key using a passphrase. The target server is logged in by means of a password, which may include: enabling the user to interact with a command line through an inquirer toolkit, and prompting the user to enter a password corresponding to the user name in the target server. In the process of establishing a connection, a preset feedback library is used to provide feedback on the connection result, and a successful connection prompts the target server to be successfully connected, a failed connection prompts the target server to be unsuccessful, and an incorrect user password prompts the password to be incorrect, thereby maintaining good interactivity with the target server.

[0101] Step 406, upload the code compressed file to the target server.

[0102] Upload the compressed code file to the server directory of the target server. For example, upload the compressed code folder to the / opt / cestc_deploy / middle-images / nginx / volume / html / dportrait path of the target server. Use the preset feedback library to provide feedback on the upload result of the compressed code file. If it is uploading, it will prompt "Uploading in progress", if it is successful, it will prompt "Upload success", if it fails, it will prompt "Upload failure" and delete the compressed code file.

[0103] Step 407, back up the old version of the code file.

[0104] Specifically, the preset backup directory in the target configuration file is sent to the target server, and the preset backup directory can be: / opt / cestc_deploy / middle-images / nginx / volume / html / backups. The target server obtains the preset backup directory and determines whether the preset backup directory exists. If the preset backup directory does not exist, the execCommand instruction of the secure shell protocol is used to switch to the parent directory of the server directory and create a preset backup directory under the parent directory of the server directory. The files in the server directory are compressed into a compressed backup file in .tar.gz format with the current time as the name, and the compressed backup file is saved to the preset backup directory. The Oraspinner library is used to feedback the backup results of the old version of the code file. If the backup is in progress, it will prompt that the upload is in progress. If the backup is successful, it will prompt that the backup is successful. If the backup fails, it will prompt that the backup fails and delete the compressed backup file.

[0105] Step 408, in response to a deployment completion instruction sent by the target server after the target front-end code is deployed, disconnecting from the target server.

[0106] Step 409, checking whether the deployment is successful.

[0107] Specifically, firstly, a smoke test is performed according to the smoke instruction in the target configuration file. The smoke instruction can be nginx-t. By running the smoke instruction, it is determined whether nginx is successfully started. A connectivity test is performed according to the connectivity instruction in the target configuration file. The connectivity instruction can be successfully completed by pinging and the server address group of the target server. Through the connectivity test, it can be determined whether the target server address can be connected. If it can be connected, it means that the target server can be started normally, which provides a basis for deploying the target front-end code to the target server. Further, the nodemailer tool is used to feedback the deployment results. Specifically, the address of nodemailer.createTransport in the nodemailer tool is pre-configured as the server address, the port is the server port, the account is the user name, and the password is the user password. Further, the mail sender parameters and mail receiver parameters in mailOptions are configured to specify the source and destination of the mail, and determine the content of the mail. The content of the mail can be: Congratulations, the project has been successfully deployed. The content of the mail can also be real-time feedback extracted from the Ora spinner library.

[0108] In the above solution, the front-end code is automatically compiled, compressed, backed up, uploaded, deployed, and deployed. The verification operation is realized, which reduces the time consumption of code deployment and deployment verification, reduces the error rate in the process of code deployment and deployment verification, improves the efficiency of deployment and deployment verification, reduces the back-end knowledge required for front-end code deployment and deployment verification, and reduces labor costs and knowledge requirements for labor.

[0109] Figure 5 A schematic diagram of the structure of a front-end code deployment verification device provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and the device can also be integrated in an electronic device.

[0110] like Figure 5 As shown, the device comprises:

[0111] A first acquisition module 501 is used to determine a target configuration file, access an initial page according to the target configuration file, and acquire first page information of the initial page;

[0112] A compiling module 502 is used to compile a preset target front-end code according to the target configuration file to obtain a compilation folder; wherein the target front-end code is a code for adjusting the initial page;

[0113] A deployment module 503, configured to deploy the compiled folder to a target server according to the target configuration file; wherein the target server is a server determined according to the target configuration file;

[0114] The second acquisition module 504 is used to access the deployment completion page corresponding to the target front-end code according to the target configuration file, and obtain the second page information of the deployment completion page;

[0115] The verification module 505 is used to determine the deployment verification result of the target front-end code according to the first page information and the second page information.

[0116] Optionally, the first acquisition module 501 is used to:

[0117] Initialize the default configuration file;

[0118] Obtain input configuration information input by the user, merge the input configuration information into the default configuration file, and obtain the target configuration file; wherein the input configuration information includes: one or more of: server name, server alias, compilation instruction, server address, server port, user name, local directory, server directory, and backup instruction.

[0119] Optionally, the compiling module 502 is used to:

[0120] The compile instruction in the target configuration file is executed for the target front-end code, and the target front-end code is compiled into a local directory in the target configuration file to obtain the compiled folder.

[0121] Optionally, the deployment module 503 includes:

[0122] A packaging unit is used to read the compiled folder in the local directory of the target configuration file, and package the compiled folder through a preset packaging program to obtain a code compression file corresponding to the target front-end code;

[0123] A connection unit, used for connecting to the target server;

[0124] The sending unit is used to send the code compression file and the server directory in the target configuration file to the target server, so that the target server decompresses the code compression file into the server directory.

[0125] Optionally, the connecting unit is used to:

[0126] Determine the target port of the target server according to the server address and server port of the target configuration file;

[0127] The user name of the target configuration file is displayed, a user password input by the user is obtained, a connection request including the user name and the user password is generated, and the connection request is sent to the target port of the target server, so that the target server allows the connection if the user name and the user password are verified.

[0128] Optionally, the device further comprises:

[0129] a clearing module, configured to send a clearing instruction in the target configuration file to the target server, so that the target server clears the files in the server directory according to the clearing instruction; and / or,

[0130] The backup module is used to send the backup instruction in the target configuration file to the target server, so that the target server backs up the files in the server directory to a preset backup directory according to the backup instruction.

[0131] Optionally, the inspection module 505 is used to:

[0132] Determine the update attribute corresponding to the target front-end code;

[0133] Extracting first update information corresponding to the update attribute in the first page information, and second update information corresponding to the update attribute in the second page information;

[0134] If the first update information and the second update information are the same, it is determined that the deployment verification result is deployment failure.

[0135] The front-end code deployment verification device provided in the embodiment of the present disclosure can execute the front-end code deployment verification method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0136] Figure 6 The structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in FIG. Figure 6 As shown, the electronic device 600 includes one or more processors 601 and a memory 602 .

[0137] The processor 601 may be a central processing unit (CPU) or other forms of processing units having front-end code deployment inspection capability and / or instruction execution capability, and may control other components in the electronic device 600 to perform desired functions.

[0138] The memory 602 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 601 may run the program instructions to implement the deployment inspection method of the front-end code of the embodiment of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0139] In one example, the electronic device 600 may further include: an input device 603 and an output device 604 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0140] In addition, the input device 603 may also include, for example, a keyboard, a mouse, and the like.

[0141] The output device 604 can output various information to the outside, including the determined distance information, direction information, etc. The output device 604 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0142] Of course, to simplify, Figure 6 Only some of the components related to the present disclosure in the electronic device 600 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 600 may also include any other appropriate components.

[0143] In addition to the above-mentioned methods and devices, the embodiments of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the deployment verification method of the front-end code provided by the embodiments of the present disclosure.

[0144] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0145] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the deployment verification method of the front-end code provided by the embodiment of the present disclosure.

[0146] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0147] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0148] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.< / path> < / path> < / path> < / path> < / path> < / path> < / path> < / path>

Claims

1. A deployment verification method for front-end code, It is characterized in that include: Determine a target configuration file, access an initial page according to the target configuration file, and obtain first page information of the initial page; wherein the target configuration file is used to configure parameters for deployment and deployment verification of a target front-end code; Compiling the preset target front-end code according to the target configuration file to obtain a compilation folder; wherein the target front-end code is a code for adjusting the initial page; Deploying the compiled folder to a target server according to the target configuration file; wherein the target server is a server determined according to the target configuration file; Access the deployment completion page corresponding to the target front-end code according to the target configuration file, and obtain second page information of the deployment completion page; wherein the second page information corresponds to the first page information; Determine a deployment verification result of the target front-end code according to the first page information and the second page information; Among them, determining the deployment verification result of the target front-end code based on the first page information and the second page information includes: determining the update attributes corresponding to the target front-end code; extracting the first update information corresponding to the update attributes in the first page information, and the second update information corresponding to the update attributes in the second page information; if the first update information and the second update information are the same, determining that the deployment verification result is a deployment failure.

2. The method according to claim 1, It is characterized in that The determining of the target configuration file comprises: Initialize the default configuration file; Obtain input configuration information input by the user, merge the input configuration information into the default configuration file, and obtain the target configuration file; wherein the input configuration information includes: one or more of: server name, server alias, compilation instruction, server address, server port, user name, local directory, server directory, and backup instruction.

3. The method according to claim 1, It is characterized in that The pre-set target front-end code is compiled according to the target configuration file to obtain a compilation folder, including: The compile instruction in the target configuration file is executed for the target front-end code, and the target front-end code is compiled into a local directory in the target configuration file to obtain the compiled folder.

4. The method according to claim 1, It is characterized in that The step of deploying the compiled folder to the target server according to the target configuration file includes: Read the compiled folder in the local directory in the target configuration file, and package the compiled folder through a preset packaging program to obtain a code compression file corresponding to the target front-end code; Connecting to the target server; The code compressed file and the server directory in the target configuration file are sent to the target server, so that the target server decompresses the code compressed file into the server directory.

5. The method according to claim 4, It is characterized in that The connecting to the target server comprises: Determine the target port of the target server according to the server address and server port of the target configuration file; The user name of the target configuration file is displayed, a user password input by the user is obtained, a connection request including the user name and the user password is generated, and the connection request is sent to the target port of the target server, so that the target server allows the connection if the user name and the user password are verified.

6. The method according to claim 4, It is characterized in that The method further comprises: Sending the clearing instruction in the target configuration file to the target server, so that the target server clears the files in the server directory according to the clearing instruction; and / or, The backup instruction in the target configuration file is sent to the target server, so that the target server backs up the files in the server directory to a preset backup directory according to the backup instruction.

7. A deployment inspection device for front-end code, It is characterized in that include: A first acquisition module is used to determine a target configuration file, access an initial page according to the target configuration file, and acquire first page information of the initial page; wherein the target configuration file is used to configure parameters for deployment and deployment verification of a target front-end code; A compiling module, used to compile the preset target front-end code according to the target configuration file to obtain a compilation folder; wherein the target front-end code is a code for adjusting the initial page; A deployment module, configured to deploy the compiled folder to a target server according to the target configuration file; wherein the target server is a server determined according to the target configuration file; A second acquisition module is used to access the deployment completion page corresponding to the target front-end code according to the target configuration file, and acquire second page information of the deployment completion page; wherein the second page information corresponds to the type of the first page information; A verification module, used to determine a deployment verification result of the target front-end code according to the first page information and the second page information; Among them, the verification module is used to: determine the update attributes corresponding to the target front-end code; extract the first update information corresponding to the update attributes in the first page information, and the second update information corresponding to the update attributes in the second page information; if the first update information and the second update information are the same, determine that the deployment verification result is a deployment failure.

8. An electronic device, It is characterized in that The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the front-end code deployment verification method described in any one of claims 1-6 above.

9. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, and the computer program is used to execute the deployment verification method of the front-end code described in any one of claims 1-6 above.