Project file processing method and apparatus, computer device, and storage medium
Patent Information
- Application Number
- CN202510422918.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2026-10-16
AI Technical Summary
[0002]在应用程序的开发项目中,资源管理和项目文件配置是两个关键环节,尤其是在多版本项目、复杂项目和页面切换频繁的项目中,随着项目规模的不断扩大和功能的日益丰富,导致资源管理和文件配置难度的提升
[0018]上述项目文件处理方法、装置、计算机设备、存储介质和计算机程序产品,通过获取开发项目的项目文件,并根据针对开发项目的操作配置信息,确定针对项目文件的目标操作;按照目标操作针对项目文件进行解析,获得目标操作所需的操作数据;按照目标操作基于操作数据进行操作执行,得到目标操作的操作执行结果;将操作执行结果添加到项目文件中,得到针对开发项目的项目构建包;基于开发项目的操作配置信息有针对性的确定目标操作,按照目标操作针对项目文件进行解析以获取对应的操作数据,按照目标操作基于操作数据进行操作执行,并将得到的操作执行结果添加到项目文件中,可以简化针对项目文件的处理过程,有利于提高针对项目文件的处理效率。
Smart Images

Figure CN122925314A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a project document processing method, apparatus, computer equipment, storage medium, and computer program product. Background Technology
[0002] In application development projects, resource management and project file configuration are two key aspects, especially in multi-version projects, complex projects, and projects with frequent page switching. As the project scale continues to expand and the functionality becomes increasingly rich, the difficulty of resource management and file configuration increases.
[0003] In existing technologies, file processing procedures such as resource management and project file configuration are cumbersome, requiring a large number of tedious and repetitive steps, which is time-consuming and labor-intensive, resulting in low efficiency in processing project files during resource management and file configuration. Summary of the Invention
[0004] Therefore, it is necessary to provide a project document processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the efficiency of project document processing in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a project document processing method, the method comprising:
[0006] Obtain the project files of the development project, and determine the target operation for the project files based on the operation configuration information for the development project;
[0007] The project file is parsed according to the target operation to obtain the operation data required for the target operation.
[0008] The target operation is performed based on the operation data to obtain the operation execution result of the target operation.
[0009] The result of the operation is added to the project file to obtain the project build package for the development project.
[0010] Secondly, this application also provides a project document processing apparatus, the apparatus comprising:
[0011] The operation determination module is used to obtain the project files of the development project and determine the target operation for the project files based on the operation configuration information for the development project.
[0012] The file parsing module is used to parse the project file according to the target operation to obtain the operation data required by the target operation;
[0013] An operation execution module is used to perform an operation based on the operation data according to the target operation, and obtain the operation execution result of the target operation;
[0014] The results integration module is used to add the operation execution results to the project file to obtain a project build package for the development project.
[0015] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the above-described project file processing method.
[0016] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described project file processing method.
[0017] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described project file processing method.
[0018] The aforementioned project file processing method, apparatus, computer equipment, storage medium, and computer program product, by acquiring the project file of a development project and determining the target operation for the project file based on the operation configuration information for the development project; parsing the project file according to the target operation to obtain the operation data required for the target operation; executing the operation based on the operation data according to the target operation to obtain the operation execution result of the target operation; and adding the operation execution result to the project file to obtain the project build package for the development project, can simplify the project file processing process and improve the efficiency of project file processing by selectively determining the target operation based on the operation configuration information of the development project, parsing the project file according to the target operation to obtain the corresponding operation data, executing the operation based on the operation data according to the target operation, and adding the obtained operation execution result to the project file. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is an application environment diagram of a project file processing method in one embodiment;
[0021] Figure 2 This is a flowchart illustrating a project file processing method in one embodiment;
[0022] Figure 3 This is a flowchart illustrating the process of determining the target operation in one embodiment;
[0023] Figure 4 This is a schematic diagram of the process for generating a routing path in one embodiment;
[0024] Figure 5 This is a flowchart illustrating the process of generating a page configuration image in one embodiment.
[0025] Figure 6 This is a schematic diagram illustrating the process of generating a project build package in one embodiment;
[0026] Figure 7 This is a structural block diagram of a project file processing device in one embodiment;
[0027] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0029] The project file processing method provided in this application embodiment can be applied to, for example, Figure 1 The application environment shown in the diagram includes a terminal 102 and a server 104. The terminal 102 communicates with the server 104 via a network. A data storage system stores the data that the server 104 needs to process. The data storage system can be set up separately, integrated into the server 104, or placed in the cloud or on another server. The server 104 obtains the project file of the development project sent by the terminal 102 and determines the target operation for the project file based on the operation configuration information for the development project. Then, the server 104 uses a project building tool to parse the project file according to the target operation to obtain the operation data required for the target operation. Next, the server 104 uses the project building tool to execute the operation based on the operation data according to the target operation to obtain the operation execution result of the target operation. Finally, the server 104 uses the project building tool to add the operation execution result to the project file to obtain the project build package for the development project.
[0030] The terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster composed of multiple servers, or it can be a cloud server.
[0031] In one embodiment, such as Figure 2 As shown, a project file processing method is provided. This method is executed by a computer device, specifically by a computer device such as terminal 102 or server 104 alone, or by both terminal 102 and server 104. In this embodiment, the method is described using a computer device as an example, including the following steps 202 to 208. Wherein:
[0032] Step 202: Obtain the project files for the development project and determine the target operation for the project files based on the operation configuration information for the development project.
[0033] In this context, a development project refers to a project that builds or deploys a required application based on a development program. The development program refers to the tools or integrated development environment (IDE) used to create, edit, manage, and maintain the project to accomplish its development tasks. The development program integrates project build tools that can automate build operations, including but not limited to configuring various resources and manipulating files, to improve project build efficiency. Specifically, the development program may include, but is not limited to, at least one of various project build tools such as Webpack, Parcel, Rollup, Vite, Snowpack, and Esbuild. The application can include web applications, mobile applications, desktop applications, and other types of applications. A web application is an application that can run in a web browser, accessible to users via the internet or internal network without requiring the installation of specific software. For example, a development project could be building an e-commerce website, or it could be building an online education website.
[0034] Project files refer to the various files used to build a development project. Project files can include, but are not limited to, at least one of the following: source code files, resource files, configuration files, etc. Source code files are used to implement the application's functionality and interface; resource files provide resources such as images, text, audio, and video for the application's construction. For example, in a web application development project, resource files can include, but are not limited to, static resource files, page component files, and style files; configuration files are used to configure the application's runtime parameters. In an application example, in the development project of an educational website, project files can include multiple file directories, such as a static resource directory, a page component directory, a style file directory, and a configuration information directory. The static resource directory stores static resource files, including but not limited to image resources and font resources; the page component directory stores page component files, including but not limited to homepage components and course detail page components; the style file directory stores style files, including but not limited to global style sheets and style variable files; and the configuration information directory stores configuration files, including but not limited to routing configuration files.
[0035] Operation configuration information includes configuration parameters required when building or deploying the application to instruct the development process to determine the operations to be performed on the project files according to the configuration parameters. Target operations include the specific operations to be performed on the project files as determined by the operation configuration information; for example, target operations may include, but are not limited to, one or more of the following: route configuration operations, site map generation operations, image generation operations, file management operations, file compression operations, and file encryption operations.
[0036] For example, a computer device can determine a development project that requires file processing. This could be achieved by obtaining a project processing request and determining the specific development project requiring file processing based on the request. The computer device can also obtain the project files for the development project, such as by querying the project files based on the project identifier. Furthermore, the computer device can determine operation configuration information for the development project, such as by retrieving the corresponding operation configuration information from the project processing request. Finally, the computer device can determine the target operation for the project file based on the operation configuration information, such as by parsing the operation configuration information to obtain the target operation for the project file.
[0037] In one application example, such as Figure 3As shown, when the development project includes a web application development project, the user sends a processing request for the project file to the computer device through the terminal. The computer device receives the processing request for the project file. When the computer device obtains the processing request for the project file, it retrieves the project file of the web application from the data storage system. Upon receiving the project file returned by the data storage system, it determines the target operation for the project file based on the operation configuration information for the web application.
[0038] In one exemplary embodiment, the development project includes a web application development project. Project files are typically stored in a folder containing the web application project files, usually located in the server's root directory, the web application's root directory, or another designated location. Computer devices can access and manage project files via FTP (File Transfer Protocol) or SSH (Secure Shell), or through a management interface provided by the development program; they can also access and manage project files through source code management tools, programming methods, or the server's file system. In specific implementations, the computer device can determine the access and management method for project files based on the actual development environment.
[0039] In one exemplary embodiment, the operation configuration information can be an operation command initiated by the user through a terminal during the current development phase. This operation command carries an operation request or operation identifier to instruct the computer device to determine the target operation for the project file. The operation request may include requests containing specific operation information, such as "configure routing for the homepage, details page, and shopping cart page," "generate a site map for the e-commerce website," or "generate responsive images of different sizes." The computer device can identify the operation information to parse out the target operation. The operation identifier can be an information code or string composed of letters, numbers, etc., used to distinguish different operations. By identifying the operation identifier, the target operation can be accurately determined.
[0040] In other embodiments, operation configuration information can also be obtained by analyzing source code files, resource files, configuration files, etc., in the project file using computer equipment, in order to extract the target operation to be performed for the project file from the source code, configuration parameters, and other information. In other embodiments, when determining the target operation, the computer equipment can also make a comprehensive judgment based on the operation command initiated by the user and the source code, configuration parameters, and other information automatically obtained from the project file analysis. During the judgment, a weighted method can be used to determine the final target operation. In addition, during the weighting process, the current development environment can be integrated for comprehensive determination, so as to flexibly configure the target operation and thus cope with the ever-changing development needs during the project development process.
[0041] Step 204: Parse the project file according to the target operation to obtain the operation data required for the target operation.
[0042] Parsing project files refers to the process of analyzing the file structure information of project files to extract operational data related to the target operation. Operational data refers to the data obtained after parsing the file structure information of the project files, which is used for the targeted execution of the target operation.
[0043] For example, a computer device can parse a project file according to a determined target operation. This includes determining the file structure information of the project file and parsing it according to the target operation. The computer device can obtain the operation data required for the target operation. For instance, it can determine the operation data required for the target operation from the parsing results obtained by parsing at least one of the following: site information, page image information, file directory, etc.
[0044] In an exemplary embodiment, file structure information may include, but is not limited to, at least one of the following: site information, file directory, and page image information. Operational data may include, but is not limited to, at least one of the following: page structure information and page link information required for site map generation, the original path required for route configuration, and the original page image required for image generation. When parsing the file structure information of a project file, the computer device can obtain different operational data based on different file structure information to achieve different operations. For example, for a site map generation operation, the computer device can parse the site information of the project file to obtain the page structure information and page link information related to the site map generation operation. Similarly, for a route configuration operation, the computer device can parse the file directory of the project file to obtain the original path related to the route configuration. Furthermore, for an image generation operation, the computer device can parse the page image information of the project file to obtain the original page image related to the image generation operation.
[0045] Step 206: Perform the operation based on the operation data according to the target operation to obtain the operation execution result of the target operation.
[0046] Operation execution refers to the actual processing of operation data according to the target operation. Operation execution may include at least one of the following: route configuration operation, site map generation operation, and image generation operation. Operation execution result refers to the result obtained after executing at least one of the following operations: route configuration operation, site map generation operation, and image generation operation.
[0047] For example, after obtaining operation data, the computer device can perform corresponding operations on the operation data according to the target operation. For instance, the computer device can perform operations on the operation data corresponding to each of the following operations: routing configuration, site map generation, and image generation, to obtain the corresponding operation execution file. The computer device can then obtain the operation execution result corresponding to the target operation based on the operation execution file. For example, the computer device can obtain the respective operation execution results for the routing configuration, site map generation, and image generation operations based on the corresponding operation execution files for each operation.
[0048] Step 208: Add the operation execution results to the project file to obtain the project build package for the development project.
[0049] Among them, the project build package refers to the file package obtained by integrating the operation execution results into the project file after the target operation is completed. The project build package is used to execute the final application output.
[0050] For example, the computer device determines the output directory of the project files, such as by determining the output directory of the project files based on their file directory. The computer device adds the operation execution results to the project files to obtain a project build package for the development project, such as by adding the operation execution results to the output directory of the project files using file management operations to obtain a project build package for the development project.
[0051] The above-described project file processing method involves obtaining the project file of the development project and determining the target operation for the project file based on the operation configuration information of the development project; parsing the project file according to the target operation to obtain the operation data required for the target operation; executing the operation based on the operation data according to the target operation to obtain the operation execution result of the target operation; and adding the operation execution result to the project file to obtain the project build package for the development project. This method simplifies the project file processing process by selectively determining target operations based on the operation configuration information of the development project, parsing the project file according to the target operation to obtain the corresponding operation data, executing the operation based on the operation data according to the target operation, and adding the obtained operation execution result to the project file. This approach is beneficial for improving the efficiency of project file processing.
[0052] In one embodiment, the target operation includes a site map generation operation.
[0053] The sitemap generation operation refers to the process of generating a sitemap for the application. A sitemap is a list or file containing links to all or most of the pages in an application. Generating a sitemap facilitates search engines' retrieval of the application's content. Specifically, taking a file-based sitemap as an example, the sitemap file can be a file constructed based on at least one of the following formats: XML (eXtensible Markup Language), HTML (Hypertext Markup Language), and TXT (Text File).
[0054] If the target operation includes site map generation, the project file is parsed according to the target operation to obtain the operation data required for the target operation, including:
[0055] The site map generation process parses the site information in the project file to obtain the page structure and link information required for the site map generation operation.
[0056] Parsing the site information in the project files refers to the process of analyzing the page structure and page links of the application's site information according to the site map generation operation, in order to obtain the page structure information and page link information required for the site map generation operation. Page structure information refers to the page attributes used to describe the application's site pages. This information may include, but is not limited to, at least one of the following: URL (Uniform Resource Locator) path information and page attribute information. For example, in the development project of an educational website, URL path information may include at least one of the path information for pages such as the website homepage, course pages, and learning resource pages; page attribute information may include at least one of the following: title, description, keywords, update time, update frequency, etc., for each page on the website. Page link information refers to the link addresses used to describe the application's site pages.
[0057] For example, when the target operation includes a site map generation operation, the computer device can obtain site information from the project file according to the site map generation operation. For instance, the computer device can obtain site information for each site page from the page component files in the project file according to the site map generation operation. The computer device can parse the site information in the project file; for example, the computer device can identify and analyze the page structure and page links based on the site information according to the site map generation operation to obtain the page structure information and page link information required for the site map generation operation.
[0058] In an exemplary embodiment, an application typically contains multiple site pages. For each site page, there is usually corresponding page structure information. The multiple page structure information usually exists in the form of an array. Each page structure information includes the URL path in the URL path information of the corresponding site page, as well as information such as the last modified date, update frequency, and priority in the page attribute information. The URL path represents the path of the site page, used to locate the site page's storage location; the last modified date refers to the time when the site page was last modified, used to determine the actual update frequency of the site page, so as to obtain the latest page structure information according to the actual update frequency; the update frequency refers to the expected update frequency of the site page, which may include, but is not limited to, always, hourly, daily, weekly, monthly, yearly, and never. Always means that the content of the site page changes frequently and is different with each visit, hourly means that the content of the site page is updated every hour, and so on. By obtaining the expected update frequency of the site page, the changes of the site page can be estimated, which makes it easier to determine the frequency of obtaining, parsing and obtaining page structure information when generating a site map; priority refers to the importance of a certain site page among other site pages in the same application, so as to determine which site pages can be given priority when generating a site map with limited resources.
[0059] Furthermore, after obtaining the page structure and link information required for the site map generation operation, the operation is executed based on the operation data according to the target operation, and the operation execution result of the target operation is obtained, including:
[0060] Based on the site map format generated by the site map generation operation, structured description information for each page is generated based on page structure information and page link information, and the operation execution result is obtained based on the structured description information of each page.
[0061] Site map format refers to the presentation of the site map, which can include, but is not limited to, at least one of XML, HTML, and TXT formats. Structured description information refers to the information obtained after structuring page structure and link information; this information is constructed according to the site map format. During site map generation, each site page corresponds to a set of structured description information. In the case of site map generation, the execution result is based on the structured description information. Specifically, the execution result can be the structured description information itself, such as directly adding the generated XML, HTML, or TXT structured description information to the project file. Alternatively, the execution result can be obtained by running the structured description information on a computer, such as further processing or deployment. This processing or deployment can include at least one of file management, compression, splitting, or merging operations, which are then added to the project file after processing or deploying the structured description information.
[0062] For example, a computer device can generate structured description information for each page based on a defined site map format and page structure and link information. The computer device can then obtain operation execution results based on the structured description information of each page; for instance, the computer device can determine the structured description information of each page as the operation execution result.
[0063] In this embodiment, by parsing the site information in the project file, the page structure information and page link information required to generate a sitemap can be determined. This eliminates the need for manual input or organization, improving the efficiency and accuracy of sitemap generation. Furthermore, generating structured description information based on the page structure and link information standardizes the sitemap generation process, enhancing its flexibility. For different applications, input parameters can be defined accordingly to migrate the sitemap generation operation across different applications. In addition, the generated sitemap helps search engines discover and index website content more effectively, thereby improving search engine optimization (SEO) and increasing website exposure and traffic.
[0064] In one embodiment, based on the site map format of the site map generation operation, structured description information for each page is generated based on page structure information and page link information, and the operation execution result is obtained based on the structured description information of each page, including:
[0065] The process involves determining the site map format for the site map generation operation, and then, based on the site map format, identifying the structured parameters for each page from the page structure information and page link information. Based on these structured parameters, the process generates structured description information for each page. Finally, it generates a site map file based on the structured description information for each page, and obtains the operation execution result from the site map file.
[0066] Structured parameters refer to the URL path information and page attribute information extracted from page structure information and page link information, used to describe the site pages; for example, structured parameters include, but are not limited to, at least one of the following: URL path information (URL path information), and page attribute information (last modification date, update frequency, and priority). A sitemap file is a file generated based on structured description information, used to describe the structure and content of each site page within the entire application.
[0067] For example, the computer device can determine the site map format for the site map generation operation. This can be done by considering the generation environment and operating system of the site map generation operation. The computer device can determine the structured parameters of each page from the page structure information and page link information based on the site map format. For instance, based on the determined site map format, the computer device can determine at least one of the structured parameters for each page, such as the URL path, last modified date, update frequency, and priority. The computer device generates structured description information for each page based on these structured parameters. This can be done by considering at least one of the structured parameters for each page, such as the URL path, last modified date, update frequency, and priority. The computer device can generate a site map file based on the structured description information of each page and obtain the operation execution result based on the site map file. For example, the computer device can generate an application's site map file according to the corresponding site map format based on the structured description information of each page and obtain the operation execution result based on the site map file.
[0068] When determining structured parameters, computer equipment can obtain them based on the input parameters of a predefined site map generation operation. The input parameters of the site map generation operation are used to define the structured parameters for generating structured description information.
[0069] In one application example, the input parameters for the site map generation operation are defined, including:
[0070] Define the main domain from which the sitemap will be generated; define the file name of the generated sitemap; define an array containing multiple page structure information.
[0071] The main domain refers to the base URL portion, which can be obtained from the base URL portion of the page link information. For example, the main domain of an educational website can be represented as "https: / / www.jiaoyu.com", and all URL paths are built based on this base URL. The file name refers to the name of the generated sitemap file, for example, sitemap.xml (an XML-formatted sitemap).
[0072] An array of page structure information refers to a data collection containing multiple page structure information. The page structure information corresponding to each site page in the application is represented as an element in the array. Each element defines the structured parameters of the corresponding site page, such as URL path, last modified date, update frequency, and page priority. For example, an element in the array of page structure information might be represented as: {loc: ' / ', lastmod: '2022-01-01', changefreq:'daily', priority: '1.0'}; loc represents the URL path, loc: ' / ' means the path is relative to the main domain's homepage; lastmod represents the last modification date, lastmod: '2022-01-01' means the last modification date was January 1, 2022; changefreq represents the update frequency, changefreq: 'daily' means the update frequency is daily; priority represents the page priority, priority: '1.0' means the page priority is 1.0. Typically, page priority ranges from 0.0 to 1.0, with higher values indicating higher page priority.
[0073] In an exemplary embodiment, when generating structured description information based on structured parameters, the computer device can traverse the structured parameters corresponding to each site page, and generate a parameter identifier corresponding to each structured parameter for each site page. For example, taking the structured parameters as including URL path, last modified date, update frequency, and page priority, the computer device can generate an address information identifier for the URL path, a modification information identifier corresponding to the last modified date, an update information identifier corresponding to the update frequency, and a priority identifier corresponding to the page priority, respectively. For each site page, the computer device can construct the structured description information of each site page based on the address information identifier, modification information identifier, update information identifier, and priority identifier, respectively.
[0074] In one application example, taking the generation of a site map using XML format as an example, during the generation of a site map for an educational website, hook functions registered in the computer device are used to construct structured description information. The structured description information contains all the information of the pages listed in the site map, namely the URL path identified by each information identifier, the last modified date, the update frequency, and the page priority, etc.
[0075] Address information identifiers can be represented as <loc> ${domain}${path.loc}< / loc> . <loc> Tags and< / loc> The `<path>` tag represents the URL path used to locate web pages in the sitemap's XML file. By reading the URL path pointed to by the `<path>` tag, the web page content can be obtained and indexed. `${domain}` refers to the main domain placeholder in the structured description information. When generating the sitemap, the main domain placeholder is assigned the actual domain name string, i.e., the main domain defined in the input parameters, such as 'https: / / jiaoyu.com'. Therefore, `domain` in `${domain}` will be assigned 'https: / / jiaoyu.com'. `${path.loc}` refers to the path placeholder in the structured description information. When generating the sitemap, the path placeholder is assigned the path of the web page relative to the main domain, i.e., the page address information in the page information, i.e., the URL path pointed to by 'loc' in the defined input parameters, such as ' / ', ' / pages / about', etc. Therefore, `path.loc` in `${path.loc}` will be assigned ' / ' or ' / pages / about', etc. After the assignment operation, the address information identifier can be represented as... <loc> ${https: / / jiaoyu.com}${ / pages / about}< / loc> .
[0076] Similar to address information identifiers, modification information identifiers can be represented as <lastmod> ${path.lastmod}< / lastmod>When generating the site map, after assigning a value to `path.lastmod` in `${path.lastmod}`, the information identifier is modified to... <lastmod> ${2022-01-01}< / lastmod> The update frequency identifier can be represented as: <changefreq> ${path.changefreq}< / changefreq> When generating the site map, after assigning a value to `path.changefreq` in `${path.changefreq}`, the update frequency flag is represented as follows: <changefreq> ${daily}< / changefreq> Priority identifiers can be represented as... <priority> ${path.priority}< / priority> When generating the site map, after assigning a value to `path.priority` in `${path.priority}`, the priority indicator is represented as follows: <priority> ${1.0}< / priority> .
[0077] After assigning values to each information identifier, the structured description information of the site page, constructed in XML format, is represented as follows: <url> <loc> ${domain}${path.loc}< / loc> <lastmod> ${path.lastmod}< / lastmod> <changefreq> ${path.changefreq}< / changefreq> <priority> ${path.priority}< / priority> < / url> According to the definition of the input parameters, after the assignment operation, the structured description information of the educational website's homepage can be represented as follows: <url> <loc> ${https: / / jiaoyu.com}${path.loc}< / loc> <lastmod> ${2022-01-01}< / lastmod> <changefreq> ${daily}< / changefreq> <priority> ${1.0}< / priority> < / url> .
[0078] In an exemplary embodiment, when generating a site map file based on structured description information, taking XML format as an example, firstly, the computer device pre-builds an initial site map file with the .xml extension; a file format declaration is added to the initial site map file. Then, a root element is defined for the initial site map file, and structured description information based on structured parameters is added to each site page within the root element. After all structured description information has been added, the root element is closed to obtain the target site map file.
[0079] The initial sitemap file is a pre-built file containing the basic structure of a sitemap, including file format declarations and root elements. It stores structured descriptions of each site page. The target sitemap file is obtained after all structured descriptions for all site pages have been generated and stored. The target sitemap file is the file containing complete site information, obtained by adding various structured descriptions.
[0080] The file format declaration refers to the use of XML declarations to specify the XML version and encoding method of the XML string during construction, ensuring that the parser can correctly parse the subsequent XML content. For example,<?xml version="1.0" encoding="UTF-8"?> `version="1.0"` indicates that the XML version is 1.0, and `encoding="UTF-8"` indicates that the encoding method is UTF-8 (Unicode Transformation Format-8, which is a method used to encode characters in the Unicode character set into byte sequences). The root element refers to the element that encapsulates the entire site map content, usually represented as `<root>`. <urlset>,exist <urlset>Inside the element, there are attributes that specify the protocol standard and structured description information for each page, which are used to provide the structural framework of the site map so as to contain and organize information of each page in the website.
[0081] In other embodiments, the computer device may also determine the specific format for generating structured description information based on the development environment and development requirements of the development project. It may also use HTML format to generate structured description information, and may use the corresponding protocol and syntax to construct the string.
[0082] In this embodiment, structured parameters are extracted from page structure information and page link information to generate corresponding structured description information for each page. Then, a site map is automatically constructed based on the structured description information. This not only ensures the integrity and accuracy of the site map, but also effectively improves the efficiency and quality of site map generation, thereby effectively improving the search engine's acquisition and indexing of the site.
[0083] In one embodiment, the target operation includes a route configuration operation.
[0084] Routing configuration refers to the process of defining navigation paths between different pages or components in a web application. In practice, routing configuration typically includes setting route paths and specifying corresponding page components. A route path is the address to which a page or component navigates, serving as the entry point for accessing different pages or components in the web application. A page component is the basic unit that constitutes the user interface of a web application; each page component typically corresponds to one or more page component files. When configuring routes, each page component needs to be associated with its corresponding route path so that when a user accesses a certain path, the corresponding page component can be loaded and rendered.
[0085] Furthermore, if the target operation includes a routing configuration operation, the project file is parsed according to the target operation to obtain the operation data required by the target operation, including:
[0086] The routing configuration is used to parse the file directory of the project files and determine the original path of each page component file relative to the file directory.
[0087] In this context, the file directory refers to the folder structure that stores project files, defining the hierarchical relationship and location of various project files. For example, it may include at least one of the following: static resource directory, page component directory, style file directory, configuration information directory, etc. By traversing the project files according to the file directory, the page component files related to the configuration routes can be located. Page component files are a type of project file; they are the code files that constitute the pages of a web application, used to implement the page's layout, style, and functionality.
[0088] In an exemplary embodiment, when determining the page component file, the computer device traverses the project files and matches the file extensions of the project files with preset file extensions during the traversal. If a match is successful, it means that the project file needs to be converted into a route; otherwise, the project file is skipped and the next file is matched until all project files in all file directories are matched, thus obtaining the final page component file that needs to be converted into a route.
[0089] The original path refers to the complete path of the page component file relative to the file directory. The original path is usually an absolute path and is used to define the location of the page component file within the entire project file. For example, in the development of an educational website, the original path of the homepage component or page can be represented as ` / education-website / src / pages / Home.jsx`, which means the page component file `Home.jsx` is located in the page component directory (second-level directory) under the source code directory (first-level directory) of the educational website project file. Similarly, the entry page file for the route configuration file's "About" page can be represented as ` / education-website / src / pages / about / index.js`, which means the entry file `index.js` is located in the page component directory (second-level directory) under the source code directory `src` of the educational website project file (first-level directory) and then in the "About" page directory (third-level directory).
[0090] In an exemplary embodiment, when recording the original path of a page component file, if a certain project file is determined to be a page component file that needs to be routed, the original path is recorded level by level according to the file name and the file directory to which the project file belongs, from smallest to largest.
[0091] For example, the computer device can determine the file directory of the project file, such as by using the directory structure of the project file. The computer device parses the file directory of the project file according to the routing configuration to determine the original path of each page component file relative to its directory. For instance, the computer device can traverse the file directory of the project file according to the routing configuration, using file extensions as criteria to identify page component files within the project file, and then record the original paths level by level according to the filename and directory of each page component file, from smallest to largest.
[0092] In an optional embodiment, when traversing project files, the computer device can traverse project files according to a specific file directory in a specified manner, such as traversing project files under the page component directory according to the page component directory, in order to obtain the page component files targeted by the route configuration operation, thereby improving the efficiency of traversal and performing targeted route configuration.
[0093] In one application example, when the user specifies the file directory to be traversed, this directory can contain the file directories of all project files, or it can contain the file directories of specific project files, such as the file directories containing page components. The computer device recursively traverses the file directories. During the traversal, the fs module of the Node.js file integrated in the project build tool can be used to find all JS files (JavaScript, i.e., script files containing JavaScript code) in the file directories. The file extension of JS files is usually .js or .jsx. During the traversal, the computer device identifies the page component files by searching for project files with the file extension .js or .jsx, and then determines the file directories of the page component files level by level, obtaining the original paths of each page component file that needs to be converted into routes.
[0094] After obtaining the original path required for the routing configuration operation, the operation is executed based on the operation data according to the target operation, and the operation execution result of the target operation is obtained, including:
[0095] Each original path is converted into a route path relative to the page directory to which the page component file belongs, and the operation execution result is obtained based on each route path.
[0096] The route path refers to the URL path entered by the user in the web browser's address bar. The route path corresponds to a page component file in the application; accessing the route path allows the corresponding page component file to be accessed and loaded. In the case of route configuration operations, the route configuration execution result refers to the execution result obtained based on the route path.
[0097] For example, a computer device can determine the page directory to which a page component file belongs. For instance, the computer device can analyze the file directory of a project file to obtain the page directory to which the page component file belongs. The computer device can then convert each original path into a routing path relative to the page directory to which the page component file belongs, and obtain the operation execution result based on each routing path. For example, the computer device can convert each original path into a routing path relative to the page directory to which the page component file belongs based on the path information of the original path, and obtain the operation execution result based on each routing path.
[0098] In this embodiment, by automatically parsing project files, page component files and their original paths are determined. These original paths are then converted into routing paths relative to the page directory to which the page component files belong. Routing configuration operations are then performed based on these routing paths. This not only reduces the error rate of manual configuration but also simplifies the routing configuration process and improves efficiency. Furthermore, when matching page component files requiring routing conversion, recursive traversal and file extension-based matching are used. The parsing rules are simple, and when the application changes, the file extensions to be matched can be modified to quickly adapt to different project structures and file directories, achieving universality and flexibility across different applications.
[0099] In one embodiment, each original path is converted into a routing path relative to the page directory to which the page component file belongs, and the operation execution result is obtained based on each routing path, including:
[0100] For each page component file, determine the page directory to which the page component file belongs, and convert the original path of the page component file into a route path relative to the page directory; based on the route path and the page component file, construct the route configuration object for the page component file; generate a route configuration file according to the route configuration object of each page component file, and obtain the operation execution result according to the route configuration file.
[0101] In this context, a route configuration object is a data structure that describes the routing rules in an application. A route configuration object is typically represented as an array or an object, where each element represents a specific route. The route configuration object includes the route path and the page component file loaded by that route path. The route configuration object serves as the basis for generating route configuration files, specifying which page component the application should load when a user accesses a specific route path. A route configuration file is a file containing all route configuration objects, used to define the mapping relationship between the web application's navigation structure and page components. In practice, the result of an operation can be the route configuration file itself, such as adding the generated route configuration file directly to the project file; alternatively, the result can be obtained after performing one or more operations on the route configuration file using a computer device, such as merging, format conversion, or injecting environment variables.
[0102] For example, the computer device can determine the page directory to which each page component file belongs. This can be achieved by obtaining the file directory of each page component file and determining the page directory from that directory. The computer device can convert the original path of the page component file into a routing path relative to the page directory. This can be achieved by removing redundant path information from the original path of the page component file to obtain the routing path relative to the page directory. Based on the routing path and the page component file, the computer device can construct a routing configuration object for that page component file. This can be achieved by creating a routing configuration object and writing the routing path and the page component file into it. The computer device can generate a routing configuration file based on the routing configuration objects of each page component file and obtain the operation execution result based on the routing configuration file. This can be achieved by integrating the routing configuration objects of each page component file to obtain a routing configuration file containing all page component files and obtaining the operation execution result based on the routing configuration file.
[0103] In an exemplary embodiment, when converting the original path of the target page component file into a routing path relative to the page directory, since the original path is usually an absolute path relative to the file directory, during the routing conversion, the original path can first be converted into a page path relative to the page directory to which the page component file belongs, and then the page path can be mapped into a routing path.
[0104] The page path refers to the path relative to the page directory to which the page component file belongs, obtained after path conversion from the original path of the page component file. The original path is typically the absolute path of the page component file within the file system relative to the entire development project's file directory. The page path, on the other hand, is the relative path of the page component file within the file system relative to its page directory. The page path is simpler than the original path, making it easier to identify and reference in project file management and processing. When converting the original path to a page path relative to the page directory of the page component file, one or more methods can be used, including but not limited to removing unnecessary directory levels from the original path, replacing path separators, and adding specific prefixes or suffixes. When mapping the page path to a route path, one or more methods can be used, including but not limited to removing file extensions, replacing directory separators with forward slashes, and adding specific route prefixes.
[0105] In one application example, such as Figure 4 As shown, when converting the original path of a page component file into a page path based on the page directory to which the page component file belongs, taking the removal of directory levels before the page directory in the original path as an example, if the original path of a homepage file is / education-website / src / pages / Home.jsx, it is converted into a relative path relative to the pages directory. First, the page directory to which the page component file belongs in the original path is determined to be / education-website / src / pages / . According to the conversion rule of removing unnecessary directory levels in the original path, all directory levels before the page directory to which the page component file belongs in the original path, including all directory levels from the beginning of the original path to the pages directory, are removed, i.e., / education-website / src / is removed. Then, the remaining path is pages / Home.jsx. Since this example uses the pages directory as the starting point of the relative path, it needs to be removed. The resulting relative path of the homepage relative to the pages directory is / Home.jsx.
[0106] For example, if the original path of a header file is ` / education-website / src / pages / components / Header.jsx`, we need to convert it to a relative path relative to the `pages` directory. First, we determine the directory containing the page component file in the original path as ` / education-website / src / pages / `. Then, we remove unnecessary directory levels from the original path, that is, all directory levels before the directory containing the page component file, including all directory levels from the beginning of the original path up to the `pages` directory, i.e., removing ` / education-website / src / `. Next, we get the remaining path `pages / components / Header.jsx`. Since this example uses the `pages` directory as the starting point of the relative path, it needs to be removed. Therefore, the relative path of the homepage relative to the `pages` directory is ` / components / Header.jsx`.
[0107] When converting page paths to route paths, taking the removal of file extensions and replacement of directory separators with forward slashes as examples, to convert the relative path of the homepage file / Home.jsx to a route path, first, determine if there are separators in the relative path. If so, convert all separators to forward slashes " / ", and remove the homepage file's file extension. Thus, the route path for the homepage file is / Home. Similarly, to convert the relative path of the header file / components / Header.jsx to a route path, first, determine if there are separators in the relative path. If so, convert all separators to forward slashes " / ", and remove the header file's file extension. Thus, the route path for the header file is / components / Header. Furthermore, when converting route paths, for some special filenames, such as the route entry file index.js, if the relative path of the route entry file is / about / index.js, since the route entry file already represents the default route of its directory, the resulting route path for the route entry file is / about / . In some other embodiments, when performing route path transformation, the page path can also be used as the final route path for route configuration operations.
[0108] In one application example, when generating the route configuration file, all route configuration objects can be compiled into React components. These React components then use react-router-dom's Route and Switch (or Routes) methods to generate the route configuration file. For example, a new initial route configuration file is created, importing react-router-dom's Route and Switch (or Routes) methods and route configuration objects into it. Then, the route configuration objects are iterated through. For each route configuration object, a React component is generated, and react-router-dom's Route and Switch (or Routes) methods are used to render routes for each React component, resulting in the target route configuration file, which is the final route configuration file.
[0109] In an optional embodiment, the page component files are loaded using a dynamic loading mode. Dynamic loading mode means that the page component files are loaded into the browser only when needed. That is, when the route path of a certain page component file is accessed, the corresponding page component file will be loaded. In this way, the loading time of the page component files can be optimized.
[0110] In this embodiment, by generating a route path relative to the page directory to each page component file, and using this path to construct a route configuration object, a unified route configuration file is generated, which can effectively simplify the route configuration process and improve development efficiency.
[0111] In one embodiment, the target operation includes an image generation operation. The project file is parsed according to the target operation to obtain the operation data required for the target operation, including:
[0112] The page image generation process parses the page image information in the project file to determine the original page image.
[0113] Page image information refers to information describing the storage location and content of the original images on the page. This information can include the page image file and its path. The image path information allows you to locate the storage location of the page image file, and retrieving the page image file allows you to obtain the original page image. A page image file is an image resource file used for display within an application. These files are typically stored in specific directories, such as images and assets, and are referenced and displayed on the application's pages using front-end technologies. For example, page image files can be images used for background decoration, images embedded in page content (such as product images, illustrations, etc.), icon and button images (used for page interface elements, such as navigation bar images, button background images, etc.), and other decorative images. Image path information refers to the address or path pointing to the page image file, including relative and absolute paths, so that the original page image file itself can be retrieved. The original page image is the page image file directly obtained through the image path information. When determining the original image of a page based on a page image file, the original image can be the page image file itself, or it can be an image obtained by processing the path and resolution of an image file within the page image file.
[0114] For example, a computer device can parse the page image information in a project file according to the page image generation operation. For instance, the computer device can parse the page image information in the project file to obtain the page image files and image path information contained in the page image information. The computer device can determine the original page image; for example, the computer device can determine the storage location of the page image file based on the image path information, and determine the original page image based on the page image file.
[0115] In one application example, the original image of the page can be determined by a loader in the computer device. The computer device processes the page image files from the static resource directory through a file access system to obtain the original image of the page.
[0116] Furthermore, after obtaining the original image of the page, the operation is executed based on the operation data according to the target operation, and the operation execution result of the target operation is obtained, including:
[0117] Convert the original image on the page to at least one image format to obtain the operation result.
[0118] The image format can include, but is not limited to, the storage format or resolution parameters of the image file. Converting an image according to its format refers to changing the original image on the page according to its storage format or resolution parameters. For example, converting the storage format of the original image from JPEG (Joint Photographic Experts Group) to PNG (Portable Network Graphics), or converting the resolution parameter of the original image from 300px to 600px. In the case of image generation operations, the operation result refers to the result obtained based on the format-converted image file. In practice, the operation result can be based on the format-converted image file itself, such as directly adding the format-converted image file as the operation result to the project file; or the operation result can be the result obtained after the computer device optimizes (e.g., compresses, transcodes, etc.) the format-converted image file.
[0119] For example, a computer device can convert the original image of a page according to at least one image format to obtain the operation execution result. For instance, the computer device can convert the storage format or resolution parameters of the original image of the page based on a determined storage format or resolution parameter, and obtain the operation execution result based on the converted image file.
[0120] In this embodiment, by parsing the page image information in the project file, the storage path of the original page image to be processed can be obtained, and the original page image can be obtained based on the storage path. Subsequently, by processing the original page image according to a determined image format, the process of image generation can be simplified, the tediousness of manual operation can be reduced, and the efficiency of image generation can be improved. Furthermore, by flexibly generating image files of different image formats based on the original page image, the applicability of the image generation operation can be improved, as well as the diversity and applicability of the applications supported by the image generation operation can be increased.
[0121] In one embodiment, the original image of the page is converted according to at least one image format to obtain the operation execution result, including:
[0122] Determine at least one image format, convert the original page image according to the at least one image format to obtain a page configuration image of at least one image format; generate an image configuration file based on the page configuration image of at least one image format and its respective image attribute information, and obtain the operation execution result based on the image configuration file.
[0123] Page configuration images refer to page images that have undergone format conversion to meet image format requirements. Page configuration images have different attributes such as resolution and storage format. Image attribute information includes loading attributes describing the page configuration image when it is loaded. This image attribute information is determined based on the image loading requirements of the application, which refer to the loading characteristics of the page configuration image on the terminal devices supporting the application's operation (such as screen size, network connection speed, etc.). Image attribute information can include at least one of the following: image source set attribute and image source attribute. The image source set attribute describes the provision of page configuration images in different image formats for different terminal devices, enabling the application to select and load appropriate page configuration images based on the display capabilities or operating system of different terminal devices. The image source attribute specifies the URL address of the page configuration image, ensuring that the image is loaded according to its URL address after the page configuration image to be loaded is determined. Image configuration files are files containing multiple page configuration images in different image formats. These files also include image source collection attributes and image source attributes related to the page configuration images, enabling the application to automatically select and load appropriate page configuration images based on different loading requirements. In practice, a custom loader can be used to generate a JavaScript module based on the configured page configuration images to obtain the image configuration files.
[0124] For example, a computer device can determine at least one image format. For instance, the computer device can determine at least one image format that can be loaded and displayed on different terminal devices based on the operating environment or display capabilities of the terminal device supporting the application. The computer device can convert the original page image according to at least one image format to obtain page configuration images of at least one image format. For instance, the computer device can convert the storage format or resolution parameters of the original page image according to different image formats to obtain multiple page configuration images with different image formats. The computer device can generate an image configuration file based on the page configuration images of at least one image format and their respective image attribute information, and obtain the operation execution result based on the image configuration file. For instance, the computer device can determine the image attribute information of each page configuration image based on the image loading requirements of the page configuration images on different terminal devices or applications, and generate an image configuration file based on the page configuration images of different image formats and their corresponding image attribute information, and obtain the operation execution result based on the image configuration file.
[0125] In one application example, such as Figure 5 As shown, taking the generation of multiple page configuration images for different terminal devices as an example, when converting the format of the original page image, the computer device can determine the size of the window area of each terminal device and the image storage format supported by the operating system of each terminal device to obtain a series of target sizes or target storage formats as processing targets. For target sizes, for example, target sizes may include, but are not limited to, 300px, 600px, 1200px, etc. Using each target size as the target for format conversion, the resolution of the original page image is converted to generate multiple page configuration images, thus reflecting the needs of different terminal devices and window area sizes. For target storage formats, for example, target storage formats may include, but are not limited to, JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphics), GIF (Graphics Interchange Format), BMP (Bitmap Image File), etc. Using each target storage format as the target for format conversion, the storage format of the original page image is converted to generate multiple page configuration images, reflecting the image storage and display requirements supported by the operating systems of different terminal devices. In some embodiments, the target size and target storage format can be used together as processing targets to obtain a page configuration image that meets the requirements.
[0126] In this embodiment, the original image is processed for resolution based on the window area size of different terminal devices to generate matching image versions. By configuring the image source collection attribute and image source attribute, a responsive image collection file containing multiple versions is created. This allows the web application to be flexibly displayed according to different loading requirements when running on different terminal devices, thereby improving the display effect of images on different terminal devices.
[0127] In one embodiment, the operation execution result is added to the project file to obtain a project build package for the development project, including:
[0128] The operation execution result is added to the project file to obtain the intermediate build file; when the encryption trigger condition is met, the intermediate build file is encrypted to obtain the encrypted file; the project build package for the development project is obtained based on the encrypted file.
[0129] Intermediate build files refer to the intermediate files obtained after adding the results of operations to the initial project files during application development. Intermediate build files can be used directly as the project build package, or they can be used as the project build package after encryption and file management operations. Encryption trigger conditions are used to determine whether a certain intermediate build file meets the conditions or rules for triggering encryption. If an intermediate build file meets the encryption trigger conditions, an encryption operation will be triggered on that intermediate build file; otherwise, the intermediate build file will be skipped. Specifically, encryption trigger conditions can be based on at least one of the following fields: filename, file extension, etc. In other embodiments, encryption trigger conditions may also include determination based on a specific format of the filename, included keywords, or other characteristics. An encrypted file refers to the encrypted intermediate build file. When encrypting intermediate build files, preset encryption rules can be used, which include, but are not limited to, at least one of the following elements: encryption algorithm, key management, encryption strength, etc. In practice, the encryption algorithm and key can be determined based on the nature of the intermediate build file to be encrypted and the importance of the file. For example, symmetric encryption algorithms, asymmetric encryption algorithms, hash algorithms, etc. can be used. The key can be set to 'your-secret-key' or a temporarily generated string.
[0130] For example, a computer device can add the results of operation execution to a project file to obtain an intermediate build file. For instance, the computer device can add the execution results of routing configuration operations, site map generation operations, and image generation operations to the project file to obtain an intermediate build file. The computer device can determine whether the intermediate build file needs encryption. If the intermediate build file meets the encryption trigger conditions, it can encrypt the intermediate build file to obtain an encrypted file. For example, the computer device can determine whether the intermediate build file needs encryption based on its field information. If the intermediate build file meets the encryption trigger conditions, the computer device can encrypt the intermediate build file using an encryption algorithm and a key. The computer device can then obtain a project build package for the development project based on the encrypted file.
[0131] In one application example, encryption of intermediate build files is triggered before the project build package is formed, which can be implemented based on the emit hook function. For instance, when the operation result is added to the project file to obtain the intermediate build file, the hook's callback function iterates through all intermediate build files. It determines which intermediate build files need encryption by matching their filenames with preset names of files to be encrypted. Then, for each intermediate build file to be encrypted, its original content is read by a computer device, and the original content is encrypted using an encryption algorithm and key. After encryption, the encrypted content replaces the original content, resulting in an encrypted file. This encrypted file is then assigned back to the corresponding intermediate build file to obtain the project build package.
[0132] The filename of an intermediate build file is a string or character sequence used to identify and distinguish different files. Typically, the filename may include attribute information about the intermediate build file, such as whether a file with a certain file extension needs to be encrypted, or whether a file with a certain file extension needs to be moved, copied, or deleted. This information is used to determine whether a particular intermediate build file requires specific file processing or operations to be included in the project build package. In practice, file extensions that require encryption or other operations can be pre-defined. By iterating through the filenames of various intermediate build files, the intermediate build files requiring encryption or other operations can be identified and then processed accordingly.
[0133] In this embodiment, by integrating the operation execution results into the project file to form an intermediate build file, and conditionally encrypting the intermediate build file to obtain an encrypted file, and then obtaining the project build package based on the encrypted file, the security of the application during the development process can be improved. Furthermore, selective encryption can also improve encryption efficiency. At the same time, the intermediate build files that need to be encrypted are determined and encrypted by automatic matching, which can reduce manual intervention and further improve development efficiency.
[0134] In one embodiment, when the encryption trigger condition is met, the intermediate build file is encrypted to obtain an encrypted file, including:
[0135] When the first file in the intermediate build files meets the encryption trigger condition, the first file is encrypted to obtain the encrypted file.
[0136] The first file refers to the file in the intermediate build files that meets the encryption triggering conditions; that is, the first file can be a file that needs to be encrypted.
[0137] For example, when the first file in the intermediate build files meets the encryption triggering condition, the computer device can encrypt the first file to obtain an encrypted file. For example, the computer device can obtain the file content of the first file and encrypt the file content of the first file using the selected encryption method and key to obtain an encrypted file corresponding to the first file.
[0138] Furthermore, after obtaining the encrypted file, a project build package for the development project is obtained based on the encrypted file, including:
[0139] Delete the first file from the intermediate build file and copy the encrypted file into the intermediate build file; based on the encrypted file and the second file in the intermediate build file, obtain the project build package for the development project.
[0140] Here, "delete" refers to the file management operation performed on the first file to remove it from the intermediate build files. "Copy" refers to the file management operation performed on the encrypted file to copy it to the file path of the deleted first file. The second file refers to a file in the intermediate build files that does not meet the encryption trigger conditions; that is, the second file can be a file that does not need to be encrypted.
[0141] For example, a computer device can delete a first file from an intermediate build file. This could be done by obtaining the first file from the intermediate build file and performing a deletion operation on it. Alternatively, the computer device can obtain a project build package for the development project based on an encrypted file and a second file from the intermediate build file. This could be done by obtaining the encrypted file and performing a copy operation on it, copying the encrypted file from its original path to the path of the corresponding first file before deletion, thus obtaining a project build package for the development project.
[0142] In one application example, such as Figure 6 As shown, the intermediate build files include a first file and a second file. When the project build package is obtained, the computer device obtains the first file from the intermediate build files and encrypts the first file. After the first file is encrypted, the computer device deletes the original first file corresponding to the encrypted file. At this time, the original storage path of the first file is empty. The computer device then copies the encrypted file to the original storage path of the corresponding first file so that it can be used together with the second file to form the project build package.
[0143] In an exemplary embodiment, file operations can be automatically implemented by configuring corresponding operation item files when performing file management operations. For example, a copy operation can be represented as copy:{from: '...', to:'...'}, where copy defines the copy operation, {from: '...', to: '...'} are the configuration items for the copy operation, from: '...' indicates the specified source file path, i.e., the current storage location of the encrypted file, and to: '...' indicates the specified target file path, i.e., the storage location after the file is copied, which is also the storage path of the first file corresponding to the encrypted file before deletion. For example, copying the img1.jpg file (such as the encrypted file) from the static resource directory under the source code directory to the static resource directory under the output directory can be represented as copy: {from: 'src / assets / img1.jpg', to: 'dist / assets / img1.jpg'}, that is, copying img1.jpg from the src / assets directory to the dist / assets directory.
[0144] For example, the deletion operation is represented as delete:{'...'}, where delete is used to define the deletion operation, {'...'} is the configuration item for the deletion operation, and '...' is used to specify the file path to be deleted; for instance, deleting the first file in the output directory can be represented as delete:{'dist / oldfile.js'}, which means deleting oldfile.js in the dist directory.
[0145] In an optional embodiment, file management operations for encrypted files may further include a renaming operation. Specifically, the renaming operation can be represented as `rename:{from: '...', to: '...'}`, where `rename` defines the renaming operation, `{from: '...', to: '...'}` are configuration items for the renaming operation, `from: '...'` represents the specified original file path, i.e., the current location of the file to be renamed, and `to: '...'` represents the specified new file path, i.e., the new location where the file needs to be moved after renaming. For example, renaming an encrypted file in the source code directory and moving the renamed encrypted file to the output directory can be represented as `rename:{from: 'src / temp.js' , to: 'dist / renamed.js'}`, which means renaming `temp.js` in the `src` directory to `renamed.js` and moving it to the `dist` directory.
[0146] In other embodiments, file management operations such as deletion, copying, and renaming can also be used for site map files, route configuration files, image configuration files, and other files generated during site map generation, route configuration, and image generation operations, so as to adopt unified file operations in the process of project file processing and increase the difficulty and complexity of file management.
[0147] In this embodiment, a condition-triggered encryption mechanism is used to encrypt the first file in the intermediate build files. The encrypted file is then used to replace the first file and integrated with the unencrypted second file to obtain the project build package. This improves the security of the project files while ensuring that the integrity of the project files is not affected.
[0148] In an optional embodiment, the above method further includes compressing the files by using methods such as Gzip (GNU zip, a compression algorithm) or Brotli (a lossless data compression algorithm) to compress the files when generating various types of files, so as to improve the file processing speed and thus further improve development efficiency.
[0149] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0150] Based on the same inventive concept, this application also provides a project file processing apparatus for implementing the project file processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more project file processing apparatus embodiments provided below can be found in the limitations of the project file processing method described above, and will not be repeated here.
[0151] In one exemplary embodiment, such as Figure 7 As shown, a project file processing device is provided, including: an operation determination module 702, a file parsing module 704, an operation execution module 706, and a result integration module 708. Wherein:
[0152] The operation determination module 702 is used to obtain the project file of the development project and determine the target operation for the project file based on the operation configuration information for the development project.
[0153] The file parsing module 704 is used to parse the project file according to the target operation to obtain the operation data required by the target operation.
[0154] The operation execution module 706 is used to perform operation execution based on operation data according to the target operation and obtain the operation execution result of the target operation.
[0155] The result integration module 708 is used to add the operation execution results to the project file to obtain the project build package for the development project.
[0156] In an optional embodiment, the target operation includes a site map generation operation; the file parsing module 704 is further configured to parse the site information in the project file according to the site map generation operation to obtain the page structure information and page link information required for the site map generation operation; the operation execution module 706 is further configured to generate structured description information for each page based on the page structure information and page link information according to the site map format of the site map generation operation, and obtain the operation execution result based on the structured description information of each page.
[0157] In an optional embodiment, the operation execution module 706 is further configured to determine the site map format for the site map generation operation, and determine the structured parameters of each page from the page structure information and page link information according to the site map format; generate the structured description information of each page according to the structured parameters of each page; generate a site map file based on the structured description information of each page; and obtain the operation execution result based on the site map file.
[0158] In an optional embodiment, the target operation includes a routing configuration operation; the file parsing module 704 is further configured to parse the file directory of the project file according to the routing configuration operation to determine the original path of each page component file in the project file relative to the file directory; the operation execution module 706 is further configured to convert each original path into a routing path relative to the page directory to which the page component file belongs, and obtain the operation execution result based on each routing path.
[0159] In an optional embodiment, the operation execution module 706 is further configured to, for each page component file, determine the page directory to which the targeted page component file belongs, and convert the original path of the targeted page component file into a routing path relative to the page directory; construct a routing configuration object for the targeted page component file based on the routing path and the targeted page component file; generate a routing configuration file according to the routing configuration object of each page component file, and obtain the operation execution result according to the routing configuration file.
[0160] In an optional embodiment, the target operation includes a page image generation operation; the file parsing module 704 is further configured to parse the page image information in the project file according to the page image generation operation to determine the original page image; the operation execution module 706 is further configured to convert the original page image according to at least one image format to obtain the operation execution result.
[0161] In an optional embodiment, the operation execution module 706 is further configured to determine at least one image format, perform format conversion on the original page image according to the at least one image format to obtain a page configuration image of at least one image format; generate an image configuration file according to the page configuration image of at least one image format and the image attribute information of the page configuration image of at least one image format, and obtain the operation execution result according to the image configuration file.
[0162] In an optional embodiment, the result integration module 708 is further configured to add the operation execution result to the project file to obtain an intermediate build file; when the encryption trigger condition is met, encrypt the intermediate build file to obtain an encrypted file; and obtain a project build package for the development project based on the encrypted file.
[0163] In an optional embodiment, the result integration module 708 is further configured to: encrypt the first file when the first file in the intermediate build file meets the encryption trigger condition, and obtain an encrypted file; delete the first file from the intermediate build file and copy the encrypted file to the intermediate build file; and obtain a project build package for the development project based on the encrypted file and the second file in the intermediate build file, wherein the second file is a file in the intermediate build file that does not meet the encryption trigger condition.
[0164] Each module in the aforementioned project document processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0165] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores project files, file directories, operation configuration information, target operations, site information, page image information, and other data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a project file processing method.
[0166] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0167] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0168] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0169] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0170] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0171] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units, etc., and are not limited to these.
[0172] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0173] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.< / urlset> < / urlset>
Claims
1. A method for processing project documents, characterized in that, The method includes: Obtain the project files of the development project, and determine the target operation for the project files based on the operation configuration information for the development project; The project file is parsed according to the target operation to obtain the operation data required for the target operation. The target operation is performed based on the operation data to obtain the operation execution result of the target operation. The result of the operation is added to the project file to obtain the project build package for the development project.
2. The method according to claim 1, characterized in that, The target operation includes a site map generation operation; the step of parsing the project file according to the target operation to obtain the operation data required for the target operation includes: The site map generation operation is performed to parse the site information in the project file to obtain the page structure information and page link information required for the site map generation operation. The step of performing the operation based on the operation data according to the target operation to obtain the operation execution result of the target operation includes: Based on the site map format of the site map generation operation, structured description information for each page is generated based on the page structure information and the page link information, and the operation execution result is obtained based on the structured description information of each page.
3. The method according to claim 2, characterized in that, The process of generating a site map based on the site map format generated by the site map generation operation, generating structured description information for each page based on the page structure information and the page link information, and obtaining the operation execution result based on the structured description information of each page includes: Determine the site map format for the site map generation operation, and based on the site map format, determine the structured parameters of each page from the page structure information and the page link information respectively; Based on the structured parameters of each page, generate structured description information for each page. A site map file is generated based on the structured description information of each page, and the operation execution result is obtained based on the site map file.
4. The method according to claim 1, characterized in that, The target operation includes a routing configuration operation; the step of parsing the project file according to the target operation to obtain the operation data required for the target operation includes: The routing configuration operation is performed to parse the file directory of the project file and determine the original path of each page component file in the project file relative to the file directory. The step of performing the operation based on the operation data according to the target operation to obtain the operation execution result of the target operation includes: Each of the original paths is converted into a routing path relative to the page directory to which the page component file belongs, and the operation execution result is obtained based on each of the routing paths.
5. The method according to claim 4, characterized in that, The step of converting each of the original paths into a routing path relative to the page directory to which the page component file belongs, and obtaining the operation execution result based on each of the routing paths, includes: For each page component file, determine the page directory to which the page component file belongs, and convert the original path of the page component file into a routing path relative to the page directory; Based on the routing path and the target page component file, construct the routing configuration object for the target page component file; A route configuration file is generated based on the route configuration object of each of the page component files, and the operation execution result is obtained based on the route configuration file.
6. The method according to claim 1, characterized in that, The target operation includes a page image generation operation; the step of parsing the project file according to the target operation to obtain the operation data required for the target operation includes: The page image generation operation is performed to parse the page image information in the project file and determine the original page image. The step of performing the operation based on the operation data according to the target operation to obtain the operation execution result of the target operation includes: The original image of the page is converted according to at least one image format to obtain the operation execution result.
7. The method according to claim 6, characterized in that, The step of converting the original image of the page according to at least one image format to obtain the operation execution result includes: Determine at least one image format, and perform format conversion on the original image of the page according to the at least one image format to obtain the page configuration image of the at least one image format; Based on the page configuration images of at least one image format and their respective image attribute information, an image configuration file is generated, and the operation execution result is obtained based on the image configuration file.
8. The method according to any one of claims 1 to 7, characterized in that, Adding the result of the operation to the project file to obtain the project build package for the development project includes: The results of the operation are added to the project file to obtain an intermediate build file; When the encryption trigger condition is met, the intermediate build file is encrypted to obtain an encrypted file; Based on the encrypted file, a project build package for the development project is obtained.
9. The method according to claim 8, characterized in that, When the encryption trigger condition is met, the intermediate build file is encrypted to obtain an encrypted file, including: When the first file in the intermediate build files meets the encryption trigger condition, the first file is encrypted to obtain an encrypted file; Based on the encrypted file, a project build package for the development project is obtained, including: Delete the first file from the intermediate build file and copy the encrypted file into the intermediate build file; Based on the encrypted file and the second file in the intermediate build file, a project build package for the development project is obtained, wherein the second file is a file in the intermediate build file that does not meet the encryption triggering condition.
10. A project document processing device, characterized in that, The device includes: The operation determination module is used to obtain the project files of the development project and determine the target operation for the project files based on the operation configuration information for the development project. The file parsing module is used to parse the project file according to the target operation to obtain the operation data required by the target operation; An operation execution module is used to perform an operation based on the operation data according to the target operation, and obtain the operation execution result of the target operation; The results integration module is used to add the operation execution results to the project file to obtain a project build package for the development project.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.