Webpage file script writing method and device, computer equipment and storage medium
Through identification processing and script writing, the problem of unclear file correspondence and unclear path reference in UMI packaging operations is solved, which improves the accuracy and convenience of the operation, and provides developers with more reliable file extraction and path reference methods. .
Patent Information
- Application Number
- CN202411171910.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-24
- Publication Date
- 2024-12-13
AI Technical Summary
The correspondence between the file in the file package generated by the UMI packaging operation and the required file is unclear, and the path reference in the file is unclear, which leads to difficulty in operation.
By obtaining the directory file, identifying the processing folder, determining the web page file to be packaged, performing packaging, and scripting the second directory file, modifying the path reference, generating the target web page file, solving the file correspondence and path reference problems.
Improves operational accuracy and usability, providing developers with more convenient and reliable file extraction and path reference methods.
Smart Images

Figure CN119127143A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence and big data technology, and in particular to a script writing method, device, computer equipment and storage medium for web page files. Background Art
[0002] In the current software development field, there are some tools and technologies for packaging Monorepo projects, including UMI. UMI is a commonly used front-end development framework for building single-page applications. The packaging process of UMI generates a dist directory, which contains the file package of each project, and each file package contains an index.html file.
[0003] However, there is a problem with the current UMI packaging operation, that is, the correspondence between the files in the generated file package and the required files is unclear. Especially when it is necessary to obtain specific files, the operation is more difficult. For example, in Monorepo, we want to obtain the index.html file, index folder, closeAccount.html file and closeAccount folder in the dist folder, but in the prior art, there is no easy way to achieve this goal. In addition, after UMI packaging, the path of other static resources referenced in the index.html file starts with ". / ", which will cause path reference problems in specific scenarios.
[0004] Therefore, there is an urgent need for a script writing method for web page files to solve the problems that the correspondence between the files in the file package generated by the UMI packaging operation and the required files is unclear and the path references in the files are unclear. Summary of the invention
[0005] The purpose of the embodiments of the present application is to propose a script writing method, apparatus, computer equipment and storage medium for web page files, so as to solve the problems that the correspondence between the files in the file package generated by the UMI packaging operation and the required files is unclear, and the path reference in the file is unclear. The main purpose is to improve the accuracy and usability of the operation and provide developers with a more convenient and reliable file extraction and path reference method.
[0006] In order to solve the above technical problems, the present application embodiment provides a script writing method for a web page file, which adopts the following technical solution:
[0007] Get the first directory file;
[0008] Performing identification processing on the first directory file to obtain each folder under the first directory file;
[0009] Based on each of the folders, obtain the web page files in each of the folders and determine the web page files to be packaged;
[0010] Packaging the webpage files to be packaged to obtain a second directory file, wherein the webpage files in the first directory file correspond to the webpage files in the second directory file one by one;
[0011] The second directory file is scripted to obtain a target web page file.
[0012] Further, the obtaining of the first directory file includes:
[0013] Get the dist path;
[0014] Traverse the files under the dist path and obtain the first directory file.
[0015] Further, based on each folder, obtaining the web page files in each folder and determining the web page files to be packaged includes:
[0016] The for loop enters each folder and obtains the web page file index.html in each folder;
[0017] Based on the web page file index.html, determine the web page file index.html to be packaged.
[0018] Furthermore, the webpage files to be packaged are packaged to obtain a second directory file, including:
[0019] Arrange the webpage file index.html to be packaged to obtain an arranged webpage file index.html;
[0020] Move the organized web page file index.html to the new path dist to obtain the second directory file.
[0021] Furthermore, the scripting of the second directory file to obtain the target web page file includes:
[0022] Modifying the original reference path of the second directory file by a preset script writing method to obtain a script reference path;
[0023] Based on the script reference path, script writing is performed on the second directory file to obtain a target web page file.
[0024] Furthermore, the scripting of the second directory file based on the script reference path to obtain the target web page file includes:
[0025] Based on the script reference path, script writing is performed on the second directory file to obtain a written second directory file;
[0026] The file name of the compiled second directory file is changed to obtain a target web page file.
[0027] Furthermore, after scripting the second directory file to obtain the target web page file, the method further includes:
[0028] In response to a user file extraction request, a file extraction process is performed in the target web page file, and a web page file corresponding to the user file extraction request is output.
[0029] In order to solve the above technical problems, the present application also provides a script writing device for a web page file, which adopts the following technical solution:
[0030] A first acquisition module, used to acquire a first directory file;
[0031] An identification processing module, used for performing identification processing on the first directory file to obtain each folder under the first directory file;
[0032] A second acquisition module is used to acquire web page files in each folder based on each folder, and determine the web page files to be packaged;
[0033] A packaging processing module, used for packaging the webpage files to be packaged to obtain a second directory file, wherein the webpage files in the first directory file correspond to the webpage files in the second directory file in a one-to-one manner;
[0034] The script writing module is used to write a script on the second directory file to obtain a target web page file.
[0035] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0036] The computer device includes a memory and a processor, the memory stores computer-readable instructions, and the processor implements the steps of the script writing method for a web page file described in any one of the embodiments of the present application when executing the computer-readable instructions.
[0037] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0038] The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the script writing method for a web page file according to any one of the embodiments of the present invention are implemented.
[0039] Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects: by identifying and processing the first directory file, each folder under the first directory file is obtained, and the web page files in each folder are obtained, the web page files to be packaged are determined, and then the web page files to be packaged are packaged to obtain the second directory file, and finally the second directory file is scripted to obtain the target web page file, which solves the problem that the correspondence between the files in the file package generated by the UMI packaging operation and the required files is unclear, and the path reference in the file is unclear. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0042] Figure 2 is a flow chart of an embodiment of a script writing method for a web page file according to the present application;
[0043] Figure 3 yes Figure 2 A flowchart of a specific implementation of step S201;
[0044] Figure 4 yes Figure 2 A flowchart of a specific implementation method of step S203;
[0045] Figure 5 yes Figure 2 A flowchart of a specific implementation method of step S204;
[0046] Figure 6 yes Figure 2 A flowchart of a specific implementation method of step S205;
[0047] Figure 7 yes Figure 6 A flowchart of a specific implementation method of step S2052;
[0048] Figure 8A storage directory diagram according to an embodiment of a script writing method for a web page file;
[0049] Fig. 9 It is a structural schematic diagram of an embodiment of a script writing device for a web page file according to the present application;
[0050] Fig.10 yes Fig. 9 A structural diagram of a specific implementation of the first acquisition module 901;
[0051] Fig.11 yes Fig. 9 A structural diagram of a specific implementation of the second acquisition module 903;
[0052] Fig.12 yes Fig. 9 A structural diagram of a specific implementation of the packaging processing module 904;
[0053] Fig.13 yes Fig. 9 A structural diagram of a specific implementation of the script writing module 905;
[0054] Fig.14 yes Fig.13 A structural diagram of a specific implementation of the script writing submodule 9052;
[0055] Fig.15 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0057] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0058] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0059] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0060] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0061] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.
[0062] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0063] It should be noted that the script writing method for the web page file provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the script writing device for the web page file is generally set in the server / terminal device.
[0064] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0065] Continue to refer Figure 2 , shows a flow chart of an embodiment of a script writing method for a web page file according to the present application. The script writing method for a web page file comprises the following steps:
[0066] Step S201, obtaining a first directory file.
[0067] In this embodiment, the script writing method of the web page file is executed on the electronic device (eg Figure 1 The server / terminal device shown in the figure can receive the script writing request of the webpage file of the terminal device through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0068] The above-mentioned terminal devices may be terminal devices equipped with remote interaction functions such as personal assistants and intelligent customer service.
[0069] The script writing method of the web page file can be applied to online file query, online file management and other services.
[0070] Specifically, the electronic device can be used for script writing of medical web page files, script writing of insurance web page files, script writing of financial web page files, script writing of store web page files, and other different industry types.
[0071] Specifically, first, get the dist path: path = "${PWD} / .. / dist", and traverse the folder ford in "$path" / * / under dist to get the first directory file.
[0072] The first directory file can be understood as a directory file under the dist path. The first directory file is used as an entry point for a folder to access other files and folders under the file.
[0073] Specifically, starting from the current working directory, enter the folder named "dist" and get the "dist" folder path of the current working directory; use the wildcard * to match all subfolders in the path; the for loop will traverse these subfolders one by one, and in the loop body, you need to write code to get the first directory file.
[0074] Step S202: performing identification processing on the first directory file to obtain each folder under the first directory file.
[0075] In this embodiment, the above identification process can be understood as a process of analyzing or parsing the first directory file to obtain information about the first directory file or the content it contains. For example, the user may want to know the type of the file (a text file, an image file, or other types of files), or which subfolders and files the file contains.
[0076] Each folder under the first directory file can be understood as all folders in the first directory file.
[0077] Specifically, the first directory file may be identified and processed in a recursive or cyclic manner to obtain each folder under the first directory file.
[0078] Step S203, based on each folder, obtain the web page files in each folder and determine the web page files to be packaged.
[0079] In this embodiment, after obtaining each folder, the electronic device can obtain the web page files in each folder according to each folder, and determine the web page files to be packaged.
[0080] In this embodiment, the for loop enters the index.html in each folder, and then determines the index.html in each folder as the web page file to be packaged.
[0081] Step S204, packaging the web page files to be packaged to obtain a second directory file.
[0082] In this embodiment, the web page files in the first directory file correspond one to one with the web page files in the second directory file.
[0083] The above-mentioned packaging process can be understood as a process including compilation, compression, and organization of files to make the files easier to transmit or store.
[0084] The second directory file mentioned above can be understood as a directory structure for storing all web page files and related resources.
[0085] Step S205, scripting the second directory file to obtain a target web page file.
[0086] In this embodiment, after obtaining the second directory file, the electronic device may script the second directory file to obtain the target web page file.
[0087] The script writing can be understood as encoding a series of instructions into a format that can be understood by a computer. The script writing can be performed using the second directory file of the bash script to obtain the target web page file.
[0088] The above-mentioned bash script can be understood as a script file written in the Bash (GNU Bourne Shell) programming language. Bash is a command line interpreter commonly used on Unix-like systems. It provides many functions, such as command substitution, loops, conditional statements, etc., which can easily write automated tasks and system management scripts.
[0089] In this embodiment, the present invention implements the extraction operation of the packaged files by writing a bash script, ensuring that the extraction operation can be correctly executed on all required files.
[0090] The present application identifies and processes the first directory file to obtain each folder under the first directory file, obtains the web page files in each folder, determines the web page files to be packaged, and then packages the web page files to be packaged to obtain the second directory file, and finally scripts the second directory file to obtain the target web page file, which solves the problems of unclear correspondence between files in the file package generated by the existing UMI packaging operation and the required files, and unclear path references in the file, effectively improves the accuracy and usability of the operation, and provides developers with a more convenient and reliable file extraction and path reference method.
[0091] Continue to refer Figure 3 , showing that in Figure 2 Flow chart of a specific implementation of step S201 in FIG. Step S201 specifically includes the following steps:
[0092] Step S2011, obtain the dist path.
[0093] In this embodiment, the above dist can be understood as a directory storing the code of the final release version. The dist folder stores the final release version of the project, not the development version.
[0094] Step S2012, traverse the files under the dist path and obtain the first directory file.
[0095] In this embodiment, after the dist path, the electronic device can traverse the files under the dist path to obtain the first directory file.
[0096] The first directory file can be understood as a directory file under the dist path. The first directory file is used as an entry point for a folder to access other files and folders under the file.
[0097] You can use for d in "$path" / * / to traverse the folders under dist and get the files in the first directory. The above for din "$path" / * / can be understood as an instruction for traversing all subdirectories and files under the specified path. $path is a variable, indicating the path to be traversed, / * / is a regular expression, indicating matching all subdirectories and files, and * can be anything.
[0098] This application obtains the dist path, traverses the files under the dist path, and obtains the first directory file, so that a large amount of data on the file can be easily observed.
[0099] Continue to refer Figure 4 , showing Figure 2 Flow chart of a specific implementation manner of step S203 in FIG. Step S203 specifically includes the following steps:
[0100] Step S2031, for loop enters each folder and obtains the web page file index.html in each folder.
[0101] In this embodiment, the for loop is a commonly used loop structure, which is used to repeatedly execute a section of code a certain number of times. The or loop usually includes three parts: initialization condition, loop body and update condition.
[0102] In the for loop, the program will enter each folder currently traversed. After entering each folder, the program will search for files in the folder. If a file named "index.html" is found, it will be read out.
[0103] Step S2032, based on the web page file index.html, determine the web page file index.html to be packaged.
[0104] In this embodiment, the electronic device can determine the web page file index.html to be packaged by installing the web page file index.html.
[0105] Determine the web page file index.html in each folder as the web page file index.html to be packaged.
[0106] This application enters each folder through a for loop, obtains the web page file index.html in each folder, and determines the web page file index.html to be packaged based on the web page file index.html, so as to facilitate subsequent search and determination of the web page files that need to be updated or packaged.
[0107] Continue to refer Figure 5 , showing Figure 2 Flow chart of a specific implementation manner of step S204 in FIG. Step S204 specifically includes the following steps:
[0108] Step S2041, organize the web page file index.html to be packaged to obtain an organized web page file index.html.
[0109] In this embodiment, the above arrangement can be understood as a process of arrangement and aggregation. During the arrangement process, if duplicate web pages appear, the duplicate web pages are deleted. Removing duplicate web pages can save storage space.
[0110] Step S2042, move the organized web page file index.html to the new path dist to obtain a second directory file.
[0111] In this embodiment, the organized webpage file index.html can be moved to a new path dist to obtain a second directory file.
[0112] The new path above is obtained by modifying the original path. The original file can be referenced from the original path from ". / " to ". / closeAccount / ", where "closeAccount" is the name of each project in the Monorepo (replace it according to the specific name). Doing so ensures that the static resource path referenced in the index.html file is consistent with the extracted file.
[0113] The organized web page file index.html can be moved to the new path dist through the newpath="${d}.. / ${folder}.html" command to obtain the second directory file.
[0114] This application organizes the web page file index.html to be packaged to obtain the organized web page file index.html, and moves the organized web page file index.html to a new path dist to obtain a second directory file. By modifying the static resource reference path in the index.html file, the problem of path reference is solved.
[0115] Continue to refer Figure 6 , showing Figure 2 Flow chart of a specific implementation manner of step S205 in FIG. Step S205 specifically includes the following steps:
[0116] Step S2051: modify the original reference path of the second directory file by a preset script writing method to obtain a script reference path.
[0117] In this embodiment, the above-mentioned preset script writing method can be understood as a script writing method preset by the system, which can be a bash script writing method. Writing a bash script can be understood as a script file written in the Bash (GNU Bourne Shell) programming language. Bash is a command line interpreter commonly used on Unix-like systems. It provides many functions, such as command substitution, loops, conditional statements, etc., which can easily write automated tasks and system management scripts.
[0118] The original reference path can be modified to obtain a new script reference path. The new script reference path ensures the accuracy of the reference, making it easier and more reliable to reference the static resources of a specific project in the index.html page. The original path reference can be modified from ". / " to ". / closeAccount / ", where "closeAccount" is the name of each project in the Monorepo (replace it according to the specific name). Doing so ensures that the static resource path referenced in the index.html file is consistent with the extracted file.
[0119] Step S2052: based on the script reference path, script the second directory file to obtain the target web page file.
[0120] In this embodiment, the second directory file can be scripted according to the script reference path to obtain the target web page file.
[0121] This application modifies the original reference path of the second directory file through a preset script writing method to obtain a script reference path, and scripts the second directory file based on the script reference path to obtain the target web page file, which can ensure that the static resource path referenced in the index.html file is consistent with the extracted web page file.
[0122] Continue to refer Figure 7 , showing Figure 6 Flow chart of a specific implementation method of step S2052 in FIG. Step S2052 specifically includes the following steps:
[0123] Step S20521: based on the script reference path, script the second directory file to obtain the scripted second directory file.
[0124] In this embodiment, the second directory file may be scripted according to the script reference path to obtain the scripted second directory file.
[0125] The above script writing can be understood as encoding a series of instructions into a format that can be understood by a computer.
[0126] Step S20522: Change the file name of the compiled second directory file to obtain the target web page file.
[0127] In this embodiment, the file name of the compiled second directory file can be changed to obtain the target web page file.
[0128] The file name of the second directory file needs to be modified to generate the target web page file, ensuring that the target web page file name is consistent with the file name standard format in the bash script. For example, qrcode / index.html should be modified to qrcode.html.
[0129] It should be noted that the file name is changed through a one-to-one correspondence to ensure that the extracted web page file corresponds to the required file.
[0130] In this embodiment, after obtaining the prepared second directory file, the electronic device may change the file name of the prepared second directory file to obtain the target web page file.
[0131] The present application scripts the second directory file according to the script reference path to obtain the written second directory file, and changes the file name of the written second directory file to obtain the target web page file, thereby improving the work efficiency of script writing of web page files.
[0132] Optionally, after step S204, the method further includes: in response to a user file extraction request, performing file extraction processing in the target web page file, and outputting a web page file corresponding to the user file extraction request.
[0133] In this embodiment, according to the user's file extraction request, the bash script can traverse each file package of the target web page file and identify the web page file corresponding to the user's file extraction request.
[0134] The present application can accurately obtain the required file by performing file extraction processing in the target web page file in response to the user's file extraction request and outputting the web page file corresponding to the user's file extraction request.
[0135] Continue to refer Figure 8, showing a storage directory diagram according to an embodiment of a script writing method for web page files. Specifically, the left figure in the figure is a packaged directory path diagram for Monorepo in the existing UMI packaging operation; the right figure in the figure is a storage directory diagram in the dist package after multi-page packaging in the script writing method for web page files of this application. The present invention uses a bash script to extract the packaged files, so as to accurately obtain the required files and avoid the problem of unclear extraction in the prior art. By modifying the static resource reference path in the index.html file, the problem of path reference in the prior art is solved. The modified path ensures the accuracy of the reference, making it easier and more reliable to reference the static resources of a specific project in Monorepo. After the Monorepo multi-page packaging of the present invention, the content path in the dist folder is the same as the path before replacement, avoiding modification of the nginx entry and reducing the risk of modification.
[0136] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0137] The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning. This application can be applied to the fields of artificial intelligence and big data, thereby promoting the construction of smart cities.
[0138] This application belongs to the field of smart cities, and this solution can promote the construction of smart cities.
[0139] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0140] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0141] Further references Fig. 9 , as a response to the above Figure 2 The present application provides an embodiment of a script writing device for a web page file, and the script writing device embodiment of the web page file is Figure 2 Corresponding to the embodiment of the script writing method for the web page file shown, the device can be specifically applied to various electronic devices.
[0142] like Fig. 9 As shown, the script writing device 900 of the webpage file described in this embodiment includes: a first acquisition module 901, an identification processing module 902, a second acquisition module 903, a packaging processing module 904 and a script writing module 905. Among them:
[0143] A first acquisition module 901, used to acquire a first directory file;
[0144] An identification processing module 902 is used to perform identification processing on the first directory file to obtain each folder under the first directory file;
[0145] The second acquisition module 903 is used to acquire the web page files in each folder based on each folder, and determine the web page files to be packaged;
[0146] A packaging processing module 904 is used to package the webpage files to be packaged to obtain a second directory file, wherein the webpage files in the first directory file correspond to the webpage files in the second directory file in a one-to-one manner;
[0147] The script writing module 905 is used to write a script on the second directory file to obtain a target web page file.
[0148] In this embodiment, by identifying and processing the first directory file, each folder under the first directory file is obtained, and the web page files in each folder are obtained, the web page files to be packaged are determined, and then the web page files to be packaged are packaged to obtain the second directory file, and finally the second directory file is scripted to obtain the target web page file, which solves the problem that the correspondence between the files in the file package generated by the UMI packaging operation and the required files is unclear, and the path reference in the file is unclear, effectively improves the accuracy and usability of the operation, and provides developers with a more convenient and reliable file extraction and path reference method.
[0149] See also Fig.10 ,for Fig. 9 The first acquisition module 901 is a schematic diagram of a specific implementation scheme, wherein the first acquisition module 901 includes a first acquisition submodule 9011 and a second acquisition submodule 9012.
[0150] The first acquisition submodule 9011 is used to obtain the dist path.
[0151] The second acquisition submodule 9012 is used to traverse the files under the dist path and obtain the first directory files.
[0152] In this embodiment, by obtaining the dist path, traversing the files under the dist path, and obtaining the first directory file, a large amount of data on the file can be easily observed.
[0153] See also Fig.11 ,for Fig. 9 The second acquisition module 903 is a schematic structural diagram of a specific implementation method, wherein the second acquisition module 903 includes a third acquisition submodule 9031 and a determination submodule 9032.
[0154] The third acquisition submodule 9031 is used to enter each folder in a for loop and acquire the webpage file index.html in each folder;
[0155] The determination submodule 9032 is used to determine the web page file index.html to be packaged based on the web page file index.html.
[0156] In this embodiment, each folder is entered through a for loop, and the web page file index.html in each folder is obtained, and the web page file index.html to be packaged is determined based on the web page file index.html, which facilitates subsequent search and determination of the web page files that need to be updated or packaged.
[0157] See also Fig.12 ,for Fig. 9The structural diagram of a specific implementation of the packaging processing module 904 is shown in FIG. 9 , wherein the packaging processing module 904 includes a sorting submodule 9041 and a moving submodule 9042.
[0158] Arranging submodule 9041, used for arranging the webpage file index.html to be packaged to obtain an arranged webpage file index.html;
[0159] The moving submodule 9042 is used to move the organized web page file index.html to the new path dist to obtain a second directory file.
[0160] In this embodiment, the web page file index.html to be packaged is organized to obtain an organized web page file index.html, and the organized web page file index.html is moved to a new path dist to obtain a second directory file. The problem of path reference is solved by modifying the static resource reference path in the index.html file.
[0161] See also Fig.13 ,for Fig. 9 The script writing module 905 is a schematic diagram of a specific implementation scheme, wherein the script writing module 905 includes a modification processing submodule 9051 and a script writing submodule 9052.
[0162] The modification processing submodule 9051 is used to modify the original reference path of the second directory file by a preset script writing method to obtain a script reference path;
[0163] The script writing submodule 9052 is used to write a script on the second directory file based on the script reference path to obtain a target web page file.
[0164] In this embodiment, the original reference path of the second directory file is modified by a preset script writing method to obtain a script reference path, and the second directory file is scripted according to the script reference path to obtain the target web page file, which can ensure that the static resource path referenced in the index.html file is consistent with the extracted web page file.
[0165] See also Fig.14 ,for Fig.13 The script writing submodule 9052 is a schematic diagram of a specific implementation of the script writing submodule 9052, wherein the script writing submodule 9052 includes a script writing unit 90521 and a file name changing unit 90522.
[0166] A script writing unit 90521 is used to write a script for the second directory file based on the script reference path to obtain a written second directory file;
[0167] The file name changing unit 90522 is used to change the file name of the compiled second directory file to obtain a target web page file.
[0168] In this embodiment, the script is written for the second directory file according to the script reference path to obtain the written second directory file, and the file name of the written second directory file is changed to obtain the target web page file, which can improve the work efficiency of script writing of web page files.
[0169] Optionally, after step 905, the script writing device 900 for the web page file is further used to respond to a user file extraction request, perform file extraction processing in the target web page file, and output a web page file corresponding to the user file extraction request.
[0170] In this embodiment, by responding to a user's file extraction request, performing file extraction processing in a target web page file, and outputting a web page file corresponding to the user's file extraction request, the required file can be accurately acquired.
[0171] To solve the above technical problems, the present application also provides a computer device. Fig.15 , Fig.15 This is a basic structural block diagram of the computer device in this embodiment.
[0172] The computer device 15 includes a memory 151, a processor 152, and a network interface 153 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 15 with components 151-153, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0173] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0174] The memory 151 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc.
[0175] In some embodiments, the memory 151 may be an internal storage unit of the computer device 15, such as a hard disk or memory of the computer device 15. In other embodiments, the memory 151 may also be an external storage device of the computer device 15, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 15. Of course, the memory 151 may also include both the internal storage unit of the computer device 15 and its external storage device. In this embodiment, the memory 151 is generally used to store the operating system and various application software installed on the computer device 15, such as computer-readable instructions of the script writing method of the web page file, etc. In addition, the memory 151 may also be used to temporarily store various types of data that have been output or are to be output. The processor 152 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 152 is generally used to control the overall operation of the computer device 15. In this embodiment, the processor 152 is used to run the computer-readable instructions or process data stored in the memory 151, such as computer-readable instructions for running the script writing method of the web page file.
[0176] The network interface 153 may include a wireless network interface or a wired network interface. The network interface 153 is generally used to establish a communication connection between the computer device 15 and other electronic devices.
[0177] In this embodiment, the impact data of the system in the knowledge base can be used to generate a script for the web page file affected by the target system to be tested and write it to the user, so that the user can intuitively obtain the impact scope of the target system to be tested. According to the impact scope of the target system to be tested, the impact of the change can be evaluated more accurately and quickly, irrelevant interference points can be eliminated, and regression use cases can be streamlined to avoid omissions of impact points in the early stage of the evaluation, resulting in the subsequent development of various systems. When they are jointly debugged, it is found that some associations have not been processed. In the mildest case, it will take up development time to supplement the logic. In the most serious case, the solution design may need to be overturned and redone, thereby improving the efficiency of project development.
[0178] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the script writing method for the web page file as described above.
[0179] In this embodiment, the impact data of the system in the knowledge base can be used to generate a script for the web page file affected by the target system to be tested and write it to the user, so that the user can intuitively obtain the impact scope of the target system to be tested. According to the impact scope of the target system to be tested, the impact of the change can be evaluated more accurately and quickly, irrelevant interference points can be eliminated, and regression use cases can be streamlined to avoid omissions of impact points in the early stage of the evaluation, resulting in the subsequent development of various systems. When they are jointly debugged, it is found that some associations have not been processed. In the mildest case, it will take up development time to supplement the logic. In the most serious case, the solution design may need to be overturned and redone, thereby improving the efficiency of project development.
[0180] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0181] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A script writing method for a web page file, characterized in that: The steps include: Get the first directory file; Performing identification processing on the first directory file to obtain each folder under the first directory file; Based on each of the folders, obtain the web page files in each of the folders and determine the web page files to be packaged; Packaging the webpage files to be packaged to obtain a second directory file, wherein the webpage files in the first directory file correspond to the webpage files in the second directory file one by one; The second directory file is scripted to obtain a target web page file.
2. The script writing method of a web page file according to claim 1, characterized in that: The step of obtaining the first directory file includes: Get the dist path; Traverse the files under the dist path and obtain the first directory file.
3. The script writing method of a web page file according to claim 2, characterized in that: The step of obtaining web page files in each folder based on each folder and determining web page files to be packaged includes: Enter each folder through a for loop and obtain the web page file index.html in each folder; Based on the web page file index.html, determine the web page file index.html to be packaged.
4. The script writing method of a web page file according to claim 3, characterized in that: The step of packaging the webpage files to be packaged to obtain a second directory file includes: Arrange the webpage file index.html to be packaged to obtain an arranged webpage file index.html; Move the organized web page file index.html to the new path dist to obtain the second directory file.
5. The script writing method of a web page file according to claim 4, characterized in that: The step of scripting the second directory file to obtain a target web page file includes: Modifying the original reference path of the second directory file by a preset script writing method to obtain a script reference path; Based on the script reference path, script writing is performed on the second directory file to obtain a target web page file.
6. The script writing method of a web page file according to claim 5, characterized in that: The step of scripting the second directory file based on the script reference path to obtain a target web page file includes: Based on the script reference path, script writing is performed on the second directory file to obtain a written second directory file; The file name of the compiled second directory file is changed to obtain a target web page file.
7. The script writing method for a web page file according to any one of claims 1 to 6, characterized in that: After scripting the second directory file to obtain the target web page file, the method further includes: In response to a user file extraction request, a file extraction process is performed in the target web page file, and a web page file corresponding to the user file extraction request is output.
8. A script writing device for a web page file, characterized in that: include: A first acquisition module, used to acquire a first directory file; An identification processing module, used for performing identification processing on the first directory file to obtain each folder under the first directory file; A second acquisition module is used to acquire web page files in each folder based on each folder, and determine the web page files to be packaged; A packaging processing module, used for packaging the webpage files to be packaged to obtain a second directory file, wherein the webpage files in the first directory file correspond to the webpage files in the second directory file in a one-to-one manner; The script writing module is used to write a script on the second directory file to obtain a target web page file.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the script writing method for a web page file as claimed in any one of claims 1 to 7 when executing the computer-readable instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the script writing method for a web page file according to any one of claims 1 to 7 are implemented.
