WO2022121971A1 - Front-end project processing method and apparatus, device, management system, and storage medium - Google Patents

Front-end project processing method and apparatus, device, management system, and storage medium Download PDF

Info

Publication number
WO2022121971A1
WO2022121971A1 PCT/CN2021/136647 CN2021136647W WO2022121971A1 WO 2022121971 A1 WO2022121971 A1 WO 2022121971A1 CN 2021136647 W CN2021136647 W CN 2021136647W WO 2022121971 A1 WO2022121971 A1 WO 2022121971A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
source code
project
target source
package
Prior art date
Application number
PCT/CN2021/136647
Other languages
French (fr)
Chinese (zh)
Inventor
张旭
Original Assignee
百果园技术(新加坡)有限公司
张旭
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 百果园技术(新加坡)有限公司, 张旭 filed Critical 百果园技术(新加坡)有限公司
Priority to CN202180075173.8A priority Critical patent/CN117693734A/en
Publication of WO2022121971A1 publication Critical patent/WO2022121971A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Definitions

  • the present application relates to the field of computer technology, for example, to a front-end item processing method, apparatus, device, management system, and storage medium.
  • the present application provides a front-end project processing method, apparatus, device, management system and storage medium, which can simplify the development scheme of similar projects of multiple business lines.
  • the application provides a front-end project processing method, the method includes:
  • a construction operation is performed based on the target source code, and a construction product corresponding to the target project is obtained, wherein the construction product includes a plurality of webpage files corresponding to the plurality of business lines respectively, and a plurality of business lines corresponding to the plurality of business lines.
  • public static resources
  • the classification of the construction product is published to the server.
  • the application provides a front-end item processing device, the device includes:
  • the target source code obtaining module is set to obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built;
  • a project building module configured to perform a construction operation based on the target source code to obtain a construction product corresponding to the target project, wherein the construction product includes a plurality of webpage files corresponding to the plurality of business lines respectively, and the Public static resources corresponding to multiple business lines;
  • a construction product release module is configured to release the construction product classification to the server.
  • the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and running on the processor, where the processor implements the above-mentioned front-end item processing method when executing the computer program.
  • the present application provides a project management system, including computer equipment, a warehouse management system, and a server provided by the embodiments of the present application, wherein the warehouse management system is configured to manage a target source code storage warehouse, and the server is configured as a storage server Received build artifacts.
  • the present application provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned front-end item processing method is implemented.
  • FIG. 1 is a schematic flowchart of a front-end item processing method provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of another front-end item processing method provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a project construction process provided by an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of another front-end item processing method provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a project development and construction process provided by an embodiment of the present application.
  • FIG. 6 is a structural block diagram of a front-end item processing apparatus provided by an embodiment of the present application.
  • FIG. 7 is a structural block diagram of a computer device according to an embodiment of the present application.
  • Fig. 1 is a schematic flow chart of a front-end item processing method provided by an embodiment of the application, and the method can be executed by a front-end item processing apparatus, wherein the apparatus can be realized by software and/or hardware, and can generally be integrated in computer equipment.
  • a build script may be written, and the method in the embodiments of the present application may be implemented by executing the build script. As shown in Figure 1, the method includes:
  • Step 101 Obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed.
  • Internet companies may develop different applications for different business lines.
  • the same Internet company may have short video services, live broadcast services, and personalized video recommendation services at the same time, and can develop different applications for different business lines for users to use, that is, each application can be considered to correspond to
  • the application program here can be an application program installed in the terminal that runs independently and can access Internet web pages, or it can be a web page (Web) application program accessed through a browser.
  • the target source code corresponding to multiple business lines in the embodiment of the present application can also be understood as the target source code corresponding to different application programs, that is, the source code obtained by developing for different application programs.
  • one of the pages or web pages can correspond to a project.
  • Each business line has its own development process. Developers of different business lines may adopt similar development methods and similar build tools, but there are some differences between different business lines. For different business lines, sometimes there is a need to add similar functions, for example, some new activities or gameplays will be launched. At this time, the same gameplay may need to be used on different business lines at the same time, and the gameplay may correspond to one or more web pages.
  • Each webpage can be developed as a separate project and applied to multiple application programs, and the project with the above-mentioned development requirements can become the target project in the embodiment of the present application, that is, the target project in the embodiment of the present application can be understood For any one or more projects that currently need to be built that exist in multiple lines of business but have individual differences for different lines of business.
  • the source code storage warehouse may exist in a warehouse management system, and the embodiments of the present application do not limit the implementation manner and type of the warehouse management system, for example, it may be Gitlab.
  • Gitlab is an open source project for warehouse management system. It uses git as a code management tool and builds web services on this basis. Gitlab provides functions such as group and project warehouses to facilitate project management. A runner tool is provided to help build.
  • build scripts can be executed by runners.
  • the target source code storage warehouse can be understood as the source code storage warehouse corresponding to the target project.
  • each project corresponds to an independent source code storage warehouse, which is implemented in a group, such as a gitlab group.
  • the group contains all projects, which can effectively reduce the warehouse volume, and users (ie, Developers) when they need to pull the source code of the current project, they can only pull the code of the current project from the corresponding warehouse of the current project to improve the pulling efficiency, while all projects in related technologies are stored in one warehouse, and the warehouse volume will increase over time. It is getting bigger and bigger, and every time you pull the code, you need to pull down all the projects, which is cumbersome and time-consuming.
  • the warehouse management system may also include a template warehouse, and developers can pre-write the code of the initialization project (act_demo) and store them in the template warehouse.
  • developers can use front-end scaffolding tools (such as fed-cli, etc.) pull the code in act_demo to the local, as the initial code of the new project, and create the corresponding source code storage warehouse in the warehouse management system by remote means. Developers can develop multiple business lines for the target project locally. After the development is completed, the corresponding code is submitted to the corresponding source code storage warehouse, and the target source code corresponding to the target project is stored in the source code storage warehouse.
  • the target source code corresponding to multiple business lines can be obtained from the target source code storage warehouse corresponding to the target project to be constructed, and the construction conditions can be set according to actual requirements.
  • Step 102 Perform a corresponding construction operation based on the target source code to obtain a construction product corresponding to the target project, wherein the construction product includes a plurality of webpage files corresponding to the plurality of business lines, and the plurality of Public static resources corresponding to each business line.
  • the construction operation is not limited in the embodiment of the present application, and may be set according to the construction tool used and the actual situation of the target project, which may generally be completed by a front-end construction machine.
  • the build products are generally static resources, including web page (html) files and other static resources.
  • the html file may refer to a file in Hyper Text Markup Language (HTML) format, with .html as the file suffix.
  • Other static resources may include, for example, css files and js files. Since the target project exists in multiple lines of business, that is, multiple applications have web pages corresponding to the same function, there are many static resources that are the same or similar, and these static resources can be called corresponding to multiple lines of business. Public static resources.
  • Step 103 Publish the construction product classification to the server.
  • the construction product after completing the construction operation and obtaining the corresponding construction product, the construction product can be classified and then directly published to the corresponding server; or after the classification is completed, it can be respectively submitted to the corresponding construction product storage warehouse, Then submit the resources in the build product storage warehouse (for example, through the code publisher) to the corresponding server.
  • the construction product storage warehouse may also exist in the warehouse management system.
  • classifying the construction product it can be divided into web page files and public static resources, and can also be classified for public static resources, which is not limited in this embodiment.
  • the target source code corresponding to multiple business lines is obtained from the target source code storage warehouse corresponding to the target project to be built, and the corresponding construction operation is performed based on the target source code to obtain the construction corresponding to the target project.
  • product wherein the construction product includes multiple webpage files corresponding to multiple business lines and public static resources corresponding to multiple business lines, submit the construction product classification to the corresponding product storage warehouse, and store the resources in the product storage warehouse Published to the server, wherein the server uses a preset directory structure to store the plurality of webpage files and the public static resources separately.
  • the corresponding target source code can be stored in the target source code storage warehouse corresponding to the project in advance, and when the project is constructed, multiple projects can be constructed at one time.
  • Multiple webpage files corresponding to business lines and public static resources corresponding to each other are published to the server, which simplifies the construction process, improves construction efficiency, reduces development costs, and speeds up business iteration.
  • constructing multiple webpage files corresponding to the multiple business lines based on the target source code includes: determining the target quantity according to the total number of the multiple business lines; The template is copied for a preset number of times to obtain the initial webpage files of the target number, wherein the preset number of times is equal to the target number; and the webpages corresponding to the plurality of business lines in the target source code are read respectively. file configuration information; correspondingly configure the target number of initial webpage files according to the webpage file configuration information corresponding to the multiple business lines respectively, and obtain multiple webpage files corresponding to the multiple business lines respectively.
  • the advantage of this setting is that developers can uniformly develop a template corresponding to a webpage file.
  • the webpages of the target projects corresponding to different business lines are relatively similar, the differences between different webpage files are also small. Therefore, it is possible to only target the difference parts.
  • Write web page file configuration information to save development costs and improve development efficiency.
  • the webpage file template is copied multiple times, and corresponding configuration is performed according to the webpage file configuration information, so that multiple webpage files corresponding to different business lines can be quickly and accurately constructed.
  • the target quantity is generally equal to the total number of multiple business lines, that is, each business line corresponds to an initial web page file.
  • the details of the corresponding configuration of the initial webpage file according to the webpage file configuration information are not limited, for example, modifications such as addition, deletion, and replacement may be included.
  • the configuration information of the webpage file includes replacement configuration information; and the corresponding configuration of the initial webpage file according to the configuration information of the webpage file includes: setting a value in a preset field in the initial webpage file
  • the initial content is replaced with the corresponding target content in the replacement configuration information.
  • the obtaining target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built includes: obtaining project information corresponding to the target project to be built; judging according to the project information Whether the preset automatic construction conditions are met, and if the preset automatic construction conditions are met, the target source code corresponding to multiple business lines is obtained from the target source code storage warehouse corresponding to the target project.
  • the advantage of this setting is that the automatic build conditions can be set in advance. When the conditions are met, the subsequent related build operations can be directly performed, which saves labor costs and improves the timeliness of project construction.
  • the preset automatic construction conditions can be set according to actual needs, such as considering the actual use environment or the stage of the business.
  • the project information includes a branch identifier; the judging whether a preset automatic construction condition is satisfied according to the project information includes: judging whether the branch corresponding to the target project is a test environment branch according to the branch identifier Or a grayscale environment branch, if the branch corresponding to the target item is a test environment branch or a grayscale environment branch, it is determined that the preset automatic construction condition is satisfied.
  • the advantage of this setting is that, for the test environment, the resources finally released to the server will generally not be put into use, that is, the user will not obtain the corresponding resources, which is in the experimental stage and will not have adverse effects on the user.
  • the project information may include a project name and a branch name, and the branch name may include a test environment branch, a grayscale environment branch, a production environment branch, and the like.
  • the dependent package can be understood as the package that depends on the development and deployment. Generally, it is stored in the node_modules folder in the project root directory. The package version number is saved through package.json, and the npm install command is used to install it. .
  • the required dependency package installation file can be downloaded from the project package management tool (Node Package Manager, NPM), and the dependency package installation file can be installed to obtain this time. Build the required dependencies.
  • NPM Node Package Manager
  • the version information of the dependency package can include, for example, the version number.
  • the saved version information of the dependency package and the dependency package can be used for reference in the next build operation. or use.
  • the method before performing the corresponding construction operation based on the target source code, the method further includes: judging whether the version of the dependency package in the target source code is consistent with the version of the dependency package when the construction operation was performed last time, and if so If the version of the dependency package in the target source code is consistent with the version of the dependency package when the build operation was performed last time, the locally installed dependency package is determined as the target dependency package; correspondingly, the corresponding build operation is performed based on the target source code. , including: performing a corresponding construction operation based on the target source code and the target dependency package.
  • the advantage of this setting is that when the version of the dependency package used in this build operation is the same as the version of the dependency package used in the previous build operation, the installed corresponding dependency package can be directly determined as the target dependency package, that is, The installed dependency package that is consistent with the version of the dependency package in the target source code is determined as the target dependency package and participates in the subsequent build operations.
  • the method further includes: if the version of the dependency package in the target source code is the same as the last time the build operation is performed If the version of the dependency package during the construction operation is inconsistent, download the corresponding dependency package installation file according to the version of the dependency package in the target source code, and install the dependency package installation file to obtain the target dependency package; The dependent package version and the target dependent package are stored.
  • a new dependency package installation file that is consistent with the version of the dependency package in the target source code may be downloaded from NPM, and installed, and the dependency package obtained after installation is applied to the subsequent build operations.
  • the method further includes: if the preset automatic construction conditions are not met, determining that the branch corresponding to the target project is a production environment branch; When it is detected that the preset build event is triggered, the target source code corresponding to the multiple business lines is obtained from the target source code storage warehouse corresponding to the target project to be built.
  • the production environment is the production environment other than the test environment and the grayscale environment.
  • the production environment branch can also be called the official branch, that is, the branch that needs to be officially put into use. After the corresponding resources are released, all users can generally use the corresponding applications and Obtain the corresponding resources.
  • the triggering conditions of the preset build events can be set according to actual needs, for example, they can be manually triggered by workers. Taking Gitlab as an example, you can manually enter build instructions on the Gitlab page to trigger preset build events.
  • the method before performing the corresponding construction operation based on the target source code, the method further includes: judging whether there is a dependency package of the installed grayscale environment locally, if there is no local dependency of the installed grayscale environment If there is an installed dependency package of the grayscale environment locally, then judge whether the version of the dependency package in the target source code is the same as the dependency package of the dependency package of the grayscale environment when the build operation was performed last time. The versions are consistent. If the version of the dependency package in the target source code is the same as the version of the dependency package of the grayscale environment when the build operation was performed last time, the locally installed dependency package is determined as the target dependency package.
  • the public static resources include a resource map file
  • publishing the construction product classification to the server includes: removing the resource map file from the plurality of webpage files and the public static resources Publish resources other than the resource map file to the first server; publish the resource map file in the resource map file storage warehouse to the second server.
  • the advantage of this setting is that the resource map file (sourcemap) is generally used for business monitoring by staff and has nothing to do with the user's use. Therefore, it can be released to different servers separately from other static resources to avoid excessive occupation of the first Server-side storage resources.
  • the first server is a Content Delivery Network (CDN) server
  • CDN is an intelligent virtual network built on a network basis, relying on edge servers deployed in multiple places, through the load balancing of the central platform. , content distribution, scheduling and other functional modules to enable users to obtain the required content nearby, reduce network congestion, and improve user access response speed and hit rate.
  • the positive effect is that there are benefits such as speeding up the display speed of web pages.
  • the second server can be a business log monitoring server, which can be set according to the actual situation, for example, it can be a sentry machine.
  • the server uses a relative path to store the plurality of webpage files and the public static resources separately.
  • a relative path storage method can be used to store multiple webpage files and public static resources separately.
  • the advantage of using a relative path is that when the domain name is the same, the relative path can make the page more flexible.
  • the domain name is blocked, because the relative path inherits the domain name of the main domain of the page without additional processing, there is no need to worry about static resources due to the blocked domain name.
  • the page can be used.
  • the main domain name can be configured and replaced at the entrance, and there is no need to develop and manually replace it when the domain name is blocked.
  • a preset directory structure is used to store multiple webpage files and public static resources separately, and the preset directory structure can be set according to actual requirements.
  • rollback is considered. If there is a problem with publishing, only the html file needs to be rolled back. Since the html file introduces different static resources, only the html file can be rolled back. All rollback is convenient and quick; on the other hand, it is for the consideration of directory allocation, because different business lines need to apply different html files, but there is only one public static resource, and it is more convenient for directory management to separate html files and other static resources. .
  • FIG. 2 is a schematic flowchart of another front-end project processing method provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of a project construction process provided by an embodiment of the present application. Refer to FIG. 3 to understand the embodiment of the present application, as shown in FIG. 2 As shown, the method may include:
  • Step 201 Obtain the branch identifier corresponding to the target project to be constructed.
  • variables to be used may be obtained first, which may be called project information, and the project information may include branch names (ie, branch identifiers) and project names, etc., and then determine whether the branch is reasonable.
  • project information may include branch names (ie, branch identifiers) and project names, etc., and then determine whether the branch is reasonable.
  • Step 202 Determine whether the branch corresponding to the target item is a test environment branch or a grayscale environment branch according to the branch identifier. If the branch corresponding to the target item is a test environment branch or a grayscale environment branch, perform step 203; if the branch corresponding to the target item Step 207 is performed without branching for the test environment or the grayscale environment.
  • the branch identification includes formal branch, gray branch and test branch. If the branch identifier is a grayscale branch or a test branch, the target project can be automatically built; if the branch identifier is an official branch, the target project can be manually triggered to build.
  • Step 203 Obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project.
  • the corresponding folder can be searched according to the project name. If the corresponding folder already exists, it means that the target project has been built, and the corresponding Gitlab repository (That is, the target source code storage warehouse) to pull the code, if the corresponding folder does not exist, it proves that it is the first time to build the target project, and you need to copy the code from the target source code storage warehouse.
  • the corresponding Gitlab repository That is, the target source code storage warehouse
  • Step 204 Determine whether the version of the dependency package in the target source code is consistent with the version of the dependency package when the build operation was performed last time. If the version of the dependency package in the target source code is consistent with the version of the dependency package when the build operation was performed last time, step 205 is performed. ; If the version of the dependent package in the target source code is inconsistent with the version of the dependent package when the build operation was performed last time, step 206 is executed.
  • the version of the dependency package in the target source code can be included in the package.json file, therefore, it can be determined by comparing whether the package.json file is the same or not to determine the version of the dependency package in the target source code and the dependency package when the last build operation was performed. Is the version consistent.
  • the version is inconsistent.
  • Step 205 Determine the locally installed corresponding dependency package as the first target dependency package, and perform a corresponding construction operation based on the target source code and the first target dependency package.
  • Step 206 Download the corresponding dependency package installation file according to the dependency package version in the target source code, and install the dependency package installation file to obtain a second target dependency package, and perform a corresponding construction operation based on the target source code and the second target dependency package.
  • Step 207 Determine that the branch corresponding to the target project is the production environment branch.
  • Step 208 determine whether the preset build event is triggered, if the preset build event is triggered, then execute step 209; if the preset build event is not triggered, repeat step 208.
  • Step 209 Obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed.
  • Step 210 Determine whether there is an installed dependency package of the grayscale environment locally, if there is a locally installed dependency package of the grayscale environment, go to step 211; if there is no locally installed dependency package of the grayscale environment, execute Step 214.
  • Step 211 Determine whether the version of the dependency package in the target source code is consistent with the version of the previous dependency package. If the version of the dependency package in the target source code is consistent with the version of the previous dependency package, step 212 is executed; if the version of the dependency package in the target source code is the same as If the version of the last dependent package is inconsistent, step 214 is executed.
  • the last dependency package version refers to the dependency package version of the dependency package of the grayscale environment when the build operation was performed last time.
  • the official branch that is, the production environment branch
  • Step 212 Determine the locally installed dependency package of the corresponding grayscale environment as the third target dependency package, and perform a corresponding construction operation based on the target source code and the third target dependency package.
  • Step 213 classify and publish the construction product corresponding to the target project to the server.
  • the construction product includes multiple webpage files corresponding to the multiple business lines respectively, and public static resources corresponding to the multiple business lines.
  • Step 214 returning the construction failure information.
  • the front-end project processing method on the basis of the above-mentioned optional embodiments, it is first determined whether to support automatic construction of the target project according to the branch identifier, and if automatic construction of the target project is supported, the construction of the target project is automatically started.
  • the target project you need to build the target project after triggering the preset build event, so as to control the start of the build process more reasonably.
  • the corresponding judgment is also made for the dependent package. Under the official branch, if there is no dependency package of the grayscale environment or the dependency package in the target source code is inconsistent with the dependency package of the grayscale environment, the build target is not allowed.
  • FIG. 4 is a schematic flowchart of another front-end project processing method provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of a project development and construction process provided by an embodiment of the present application. Refer to FIG. 5 for understanding of the embodiment of the present application. As shown in Figure 4, the method includes:
  • Step 401 Obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed.
  • a developer can create a project through fed-cli before development, and a gitlab group is formed in gitlab in the form of fed-activity.
  • the gitlab group includes a template repository for storing act_demo and a source code repository for storing the source code of multiple projects (the number is not limited, only 3 projects are schematically listed in Figure 5, project1, project2 and project3) , a static resource storage warehouse for storing public static assets of preset types (release-assets) to be released, an html storage warehouse for storing web page files (release-pages) to be released, and a resource map for storing to-be-released resources
  • the sourcemap of files (release-maps) is stored in the repository.
  • the local development connects to the packaging and compilation server (webpack-dev-server), and firstly determines whether it is a gray branch (gray), a test branch (test) or a production branch (prod) through the front-end construction machine, and supports different branches according to the branch type.
  • the build trigger method after triggering the build, obtain the target source code from the source code storage warehouse.
  • Step 402 Determine the target dependency package according to the dependency package version in the target source code.
  • the target dependency package here can be the dependency package stored after the last build, or the dependency package that has been downloaded and installed again.
  • the determination method please refer to the relevant content above, and will not be repeated here.
  • Step 403 Perform a corresponding construction operation based on the target source code and the target dependency package to obtain a construction product corresponding to the target project.
  • the process of constructing multiple webpage files corresponding to multiple business lines based on the target source code and the target dependency package may include: determining the number of targets according to the total number of multiple business lines, and performing the same steps on the webpage file templates in the target source code as the number of targets.
  • the preset number of times of copying read the replacement configuration information corresponding to multiple business lines in the target source code, replace the initial content in the preset field in the initial web page file with the corresponding target content in the replacement configuration information, and obtain multiple Multiple webpage files corresponding to business lines respectively.
  • the text to be replaced (that is, the initial content) can be expressed as AAA__REPLACEMENT, and a double underscore can be used between the two to avoid duplication with other texts.
  • replacement configuration information can include the following:
  • the replacement method can be:
  • Step 404 Divide the construction product into multiple webpage files, resource map files and preset type public static resources corresponding to multiple business lines respectively.
  • the resource map file and the preset type public static resource together constitute the public static resource.
  • the build products are divided into html, sourcemap and assets.
  • Step 405 Submit the webpage file to the corresponding webpage storage warehouse, submit the resource map file to the corresponding resource map storage warehouse, and submit the preset type public static resources to the corresponding static resource storage warehouse.
  • html is submitted to the html storage warehouse
  • sourcemap is submitted to the sourcemap storage warehouse
  • assets are submitted to the assets storage warehouse.
  • Step 406 Publish the resources in the webpage storage warehouse to the content distribution network server, publish the resources in the resource map storage warehouse to the business log monitoring server, and publish the resources in the static resource storage warehouse to the content distribution network server.
  • the resources in the html storage warehouse are synchronized (rsync) to the CDN source
  • the resources in the sourcemap storage warehouse are synchronized to the senry machine
  • the resources in the assets storage warehouse are synchronized to the CDN source.
  • the launch time of target projects in different business lines may be different.
  • the name of the business line can be filled in during construction. Modifying the html file corresponding to the entered business line name will not affect other business lines that do not need to be changed.
  • a preset directory structure may be used to store webpage files and public static resources of preset types separately by adopting a relative path.
  • the front-end project processing method provided by the embodiments of this application realizes that a set of codes is used by multiple business lines, reduces development costs, and speeds up business iteration. Developers only need to develop one set of codes, and finally construct multiple html files for different business lines. Different business lines can be used in different business lines, and different business lines can be introduced into different resources by text replacement, so as to realize the differentiated processing of different business lines.
  • the warehouse volume is reduced. Therefore, the speed of pulling the code becomes faster, and the dependency package is saved. When the version of the dependency package remains unchanged, there is no need to download the dependency package again.
  • the dependency package of the grayscale environment is used in the production environment, the production The environment does not need to install dependency packages, and the packaging is faster.
  • the static resources introduced are relative paths, there is no need to worry about the static resources being unavailable due to the banned domain name. As long as the main domain domain name is available, the page can be used.
  • FIG. 6 is a structural block diagram of a front-end item processing apparatus provided by an embodiment of the present application.
  • the apparatus can be implemented by software and/or hardware, and can generally be integrated in computer equipment.
  • the front-end item processing method can be executed to perform front-end item correlation. deal with.
  • the device includes:
  • the target source code acquisition module 601 is configured to obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed;
  • the project construction module 602 is configured to perform corresponding construction operations based on the target source code, and obtain The construction product corresponding to the target project, wherein the construction product includes multiple webpage files corresponding to the multiple business lines respectively, and public static resources corresponding to the multiple business lines;
  • the front-end project processing device obtains target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built, and performs corresponding construction operations based on the target source code to obtain the construction corresponding to the target project.
  • product wherein the construction product includes multiple webpage files corresponding to multiple business lines and public static resources corresponding to multiple business lines, submit the construction product classification to the corresponding product storage warehouse, and store the resources in the product storage warehouse Published to the server, wherein the server uses a preset directory structure to store the plurality of webpage files and the public static resources separately.
  • the corresponding target source code can be stored in the target source code storage warehouse corresponding to the project in advance, and when the project is constructed, multiple projects can be constructed at one time.
  • Multiple webpage files corresponding to business lines and public static resources corresponding to each other are published to the server, which simplifies the construction process, improves construction efficiency, reduces development costs, and speeds up business iteration.
  • FIG. 7 is a structural block diagram of a computer device according to an embodiment of the present application.
  • the computer device 700 includes a memory 701, a processor 702, and a computer program that is stored in the memory 701 and can run on the processor 702.
  • the processor 702 executes the computer program, the front-end item processing method provided by the embodiment of the present application is implemented. .
  • the embodiments of the present application provide a project management system, including the computer equipment, the warehouse management system, and the server provided by the embodiments of the present application, wherein the warehouse management system is set to manage a target source code storage warehouse, and the server is set to a storage service The build product received by the end.
  • Embodiments of the present application further provide a storage medium containing computer-executable instructions, where the computer-executable instructions, when executed by a computer processor, are used to execute the front-end item processing method provided by the embodiments of the present application.
  • the storage medium may be a non-transitory storage medium.
  • the front-end item processing apparatus, device, and storage medium provided in the foregoing embodiments can execute the front-end item processing method provided by any embodiment of the present application, and have corresponding functional modules and effects for executing the method.
  • the front-end item processing method provided by any embodiment of the present application can execute the front-end item processing method provided by any embodiment of the present application, and have corresponding functional modules and effects for executing the method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

Disclosed herein are a front-end project processing method and apparatus, a device, a management system, and a storage medium. The front-end project processing method comprises: acquiring target source code corresponding to multiple service lines from within a target source code storage warehouse corresponding to a target project to be constructed; performing a construction operation on the basis of the target source code to obtain a construction product corresponding to the target project, the construction product comprising multiple web page files respectively corresponding to the multiple service lines and public static resources corresponding to the multiple service lines; and classifying and publishing the construction product to a server end.

Description

前端项目处理方法、装置、设备、管理系统及存储介质Front-end item processing method, device, equipment, management system and storage medium
本申请要求在2020年12月10日提交中国专利局、申请号为202011457915.7的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with application number 202011457915.7 filed with the China Patent Office on December 10, 2020, the entire contents of which are incorporated herein by reference.
技术领域technical field
本申请涉及计算机技术领域,例如涉及前端项目处理方法、装置、设备、管理系统及存储介质。The present application relates to the field of computer technology, for example, to a front-end item processing method, apparatus, device, management system, and storage medium.
背景技术Background technique
随着互联网技术的快速发展,许多互联网公司的业务范围越来越广泛,针对不同的业务线可以开发出不同的应用程序。公司内部每条业务线都有自己的开发流程,不同业务线的开发人员可能采用相似的开发方式以及相似的构建工具,但不同业务线之间又存在一些不同之处。With the rapid development of Internet technology, the business scope of many Internet companies has become more and more extensive, and different applications can be developed for different business lines. Each business line within a company has its own development process. Developers of different business lines may adopt similar development methods and similar construction tools, but there are some differences between different business lines.
为了满足用户的使用需求,增强应用的新鲜感,互联网公司通常会增加一些新的功能,例如会上线一些新的活动或玩法,这时,同一个玩法可能需要同时在不同业务线上使用,该玩法可能对应一个或多个页面,每个页面可以作为一个单独的项目进行开发。开发方案中,需要针对每个业务线进行开发,这样每个项目就需要开发多次,或者在一条业务线上开发完毕后,从这条业务线的代码仓库复制代码到另一条业务线的代码仓库里,然后修改为契合另一条业务线的代码。这样的迁移仍然需要花一定的时间去完成,而且由于代码分成了两套,在后续的更新迭代中需要同时维护两套代码。In order to meet the needs of users and enhance the freshness of the application, Internet companies usually add some new functions, such as launching some new activities or gameplays. At this time, the same gameplay may need to be used on different business lines at the same time. The gameplay may correspond to one or more pages, and each page can be developed as a separate project. In the development plan, it is necessary to develop for each business line, so that each project needs to be developed multiple times, or after the development of one business line is completed, copy the code from the code repository of this business line to the code of another business line In the warehouse, and then modify it to fit the code of another business line. Such migration still takes a certain amount of time to complete, and since the code is divided into two sets, both sets of code need to be maintained in subsequent update iterations.
可见,在多条业务线中存在相似开发需求时,开发流程繁琐费时,效率低下,需要改进。It can be seen that when there are similar development requirements in multiple business lines, the development process is cumbersome, time-consuming, inefficient, and needs to be improved.
发明内容SUMMARY OF THE INVENTION
本申请提供了前端项目处理方法、装置、设备、管理系统及存储介质,可以简化多个业务线的相近项目的开发方案。The present application provides a front-end project processing method, apparatus, device, management system and storage medium, which can simplify the development scheme of similar projects of multiple business lines.
本申请提供了一种前端项目处理方法,该方法包括:The application provides a front-end project processing method, the method includes:
从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码;Obtain the target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built;
基于所述目标源码进行构建操作,得到所述目标项目对应的构建产物,其中,所述构建产物中包括所述多个业务线分别对应的多个网页文件,以及所述 多个业务线对应的公用静态资源;A construction operation is performed based on the target source code, and a construction product corresponding to the target project is obtained, wherein the construction product includes a plurality of webpage files corresponding to the plurality of business lines respectively, and a plurality of business lines corresponding to the plurality of business lines. public static resources;
将所述构建产物分类发布至服务端。The classification of the construction product is published to the server.
本申请提供了一种前端项目处理装置,该装置包括:The application provides a front-end item processing device, the device includes:
目标源码获取模块,设置为从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码;The target source code obtaining module is set to obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built;
项目构建模块,设置为基于所述目标源码进行构建操作,得到所述目标项目对应的构建产物,其中,所述构建产物中包括所述多个业务线分别对应的多个网页文件,以及所述多个业务线对应的公用静态资源;A project building module, configured to perform a construction operation based on the target source code to obtain a construction product corresponding to the target project, wherein the construction product includes a plurality of webpage files corresponding to the plurality of business lines respectively, and the Public static resources corresponding to multiple business lines;
构建产物发布模块,设置为将所述构建产物分类发布至服务端。A construction product release module is configured to release the construction product classification to the server.
本申请提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述的前端项目处理方法。The present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and running on the processor, where the processor implements the above-mentioned front-end item processing method when executing the computer program.
本申请提供了一种项目管理系统,包括本申请实施例提供的计算机设备、仓库管理系统和服务器,其中,所述仓库管理系统设置为于管理目标源码存放仓库,所述服务器设置为存储服务端接收的构建产物。The present application provides a project management system, including computer equipment, a warehouse management system, and a server provided by the embodiments of the present application, wherein the warehouse management system is configured to manage a target source code storage warehouse, and the server is configured as a storage server Received build artifacts.
本申请提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述的前端项目处理方法。The present application provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned front-end item processing method is implemented.
附图说明Description of drawings
图1为本申请实施例提供的一种前端项目处理方法的流程示意图;1 is a schematic flowchart of a front-end item processing method provided by an embodiment of the present application;
图2为本申请实施例提供的另一种前端项目处理方法的流程示意图;2 is a schematic flowchart of another front-end item processing method provided by an embodiment of the present application;
图3为本申请实施例提供的一种项目构建过程示意图;3 is a schematic diagram of a project construction process provided by an embodiment of the present application;
图4为本申请实施例提供的另一种前端项目处理方法的流程示意图;4 is a schematic flowchart of another front-end item processing method provided by an embodiment of the present application;
图5为本申请实施例提供的一种项目开发构建过程示意图;5 is a schematic diagram of a project development and construction process provided by an embodiment of the present application;
图6为本申请实施例提供的一种前端项目处理装置的结构框图;6 is a structural block diagram of a front-end item processing apparatus provided by an embodiment of the present application;
图7为本申请实施例提供的一种计算机设备的结构框图。FIG. 7 is a structural block diagram of a computer device according to an embodiment of the present application.
具体实施方式Detailed ways
下面结合附图和实施例对本申请进行说明。此处所描述的具体实施例仅仅用于解释本申请。为了便于描述,附图中仅示出了与本申请相关的部分。The present application will be described below with reference to the accompanying drawings and embodiments. The specific embodiments described herein are merely used to explain the present application. For the convenience of description, only the parts related to the present application are shown in the drawings.
图1为本申请实施例提供的一种前端项目处理方法的流程示意图,该方法 可以由前端项目处理装置执行,其中该装置可由软件和/或硬件实现,一般可集成在计算机设备中。可选的,可编写构建脚本,通过执行该构建脚本来实现本申请实施例中的方法。如图1所示,该方法包括:Fig. 1 is a schematic flow chart of a front-end item processing method provided by an embodiment of the application, and the method can be executed by a front-end item processing apparatus, wherein the apparatus can be realized by software and/or hardware, and can generally be integrated in computer equipment. Optionally, a build script may be written, and the method in the embodiments of the present application may be implemented by executing the build script. As shown in Figure 1, the method includes:
步骤101、从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码。Step 101: Obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed.
示例性的,互联网公司可针对不同的业务线开发出不同的应用程序。例如,同一个互联网公司可能会同时拥有短视频业务、直播业务以及个性化视频推荐业务等,可以针对不同的业务线分别开发不同的应用程序供用户使用,也即,每个应用程序可以认为对应一个业务线,这里的应用程序可以是安装在终端中的独立运行的可以访问互联网网页的应用程序,也可以是通过浏览器访问的网页(Web)应用程序。本申请实施例中的对应多个业务线的目标源码,也可以理解为对应不同应用程序的目标源码,也即针对不同应用程序进行开发得到的源代码。在进行应用程序开发时,其中的一个页面或网页可以对应一个项目。Exemplarily, Internet companies may develop different applications for different business lines. For example, the same Internet company may have short video services, live broadcast services, and personalized video recommendation services at the same time, and can develop different applications for different business lines for users to use, that is, each application can be considered to correspond to For a line of business, the application program here can be an application program installed in the terminal that runs independently and can access Internet web pages, or it can be a web page (Web) application program accessed through a browser. The target source code corresponding to multiple business lines in the embodiment of the present application can also be understood as the target source code corresponding to different application programs, that is, the source code obtained by developing for different application programs. During application development, one of the pages or web pages can correspond to a project.
每条业务线都有自己的开发流程,不同业务线的开发人员可能采用相似的开发方式以及相似的构建工具,但不同业务线之间又存在一些不同之处。对于不同的业务线,有时存在增加相似功能的需求,例如会上线一些新的活动或玩法,这时,同一个玩法可能需要同时在不同业务线上使用,该玩法可能对应一个或多个网页,每个网页可以作为一个单独的项目进行开发并应用到多个应用程序中,存在上述开发需求的项目可以成为本申请实施例中的目标项目,也即,本申请实施例中的目标项目可以理解为当前需要进行构建的存在于多个业务线中但针对不同业务线存在个性化差异的任意一个或多个项目。Each business line has its own development process. Developers of different business lines may adopt similar development methods and similar build tools, but there are some differences between different business lines. For different business lines, sometimes there is a need to add similar functions, for example, some new activities or gameplays will be launched. At this time, the same gameplay may need to be used on different business lines at the same time, and the gameplay may correspond to one or more web pages. Each webpage can be developed as a separate project and applied to multiple application programs, and the project with the above-mentioned development requirements can become the target project in the embodiment of the present application, that is, the target project in the embodiment of the present application can be understood For any one or more projects that currently need to be built that exist in multiple lines of business but have individual differences for different lines of business.
示例性的,源码存放仓库可以存在于仓库管理系统中,本申请实施例对仓库管理系统的实现方式和类型等不做限定,例如可以是Gitlab。Gitlab是一个用于仓库管理系统的开源项目,使用git作为代码管理工具,并在此基础上搭建起来的web服务,Gitlab提供了组(group)、项目(project)仓库等功能方便管理项目,同时提供了runner工具帮助构建。可选的,构建脚本可以由runner来执行。目标源码存放仓库可理解为目标项目对应的源码存放仓库。可选的,在仓库管理系统中,每个项目对应一个独立的源码存放仓库,通过组的方式实现,如gitlab组,组中包含所有项目,这样可以有效减少仓库体积,且使用者(也即开发人员)在需要拉取当前项目的源码时,可以从当前项目对应的仓库中仅拉取当前项目的代码,提高拉取效率,而相关技术中所有项目都存放在一个仓库里,久而久之仓库体积越来越大,每次拉取代码则需要将所有项目全部拉取下来,繁琐费时。Exemplarily, the source code storage warehouse may exist in a warehouse management system, and the embodiments of the present application do not limit the implementation manner and type of the warehouse management system, for example, it may be Gitlab. Gitlab is an open source project for warehouse management system. It uses git as a code management tool and builds web services on this basis. Gitlab provides functions such as group and project warehouses to facilitate project management. A runner tool is provided to help build. Optionally, build scripts can be executed by runners. The target source code storage warehouse can be understood as the source code storage warehouse corresponding to the target project. Optionally, in the warehouse management system, each project corresponds to an independent source code storage warehouse, which is implemented in a group, such as a gitlab group. The group contains all projects, which can effectively reduce the warehouse volume, and users (ie, Developers) when they need to pull the source code of the current project, they can only pull the code of the current project from the corresponding warehouse of the current project to improve the pulling efficiency, while all projects in related technologies are stored in one warehouse, and the warehouse volume will increase over time. It is getting bigger and bigger, and every time you pull the code, you need to pull down all the projects, which is cumbersome and time-consuming.
示例性的,仓库管理系统还可以包含模板仓库,开发人员可以预先编写初 始化项目的代码(act_demo)存放于模板仓库中,在需要开发一个项目时,开发人员进行开发之前,可以使用前端脚手架工具(如fed-cli等)将act_demo里的代码拉取到本地,作为新项目的初始代码,并通过远程方式在仓库管理系统中创建对应的源码存放仓库。开发人员可以在本地针对目标项目进行多个业务线的开发,开发完成后,将对应的代码提交到对应的源码存放仓库,则源码存放仓库中存储了目标项目对应的目标源码。Exemplarily, the warehouse management system may also include a template warehouse, and developers can pre-write the code of the initialization project (act_demo) and store them in the template warehouse. When a project needs to be developed, developers can use front-end scaffolding tools ( Such as fed-cli, etc.) pull the code in act_demo to the local, as the initial code of the new project, and create the corresponding source code storage warehouse in the warehouse management system by remote means. Developers can develop multiple business lines for the target project locally. After the development is completed, the corresponding code is submitted to the corresponding source code storage warehouse, and the target source code corresponding to the target project is stored in the source code storage warehouse.
本申请实施例中,可以在满足目标项目的构建条件时,从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码,构建条件可以根据实际需求设置。In the embodiment of the present application, when the construction conditions of the target project are satisfied, the target source code corresponding to multiple business lines can be obtained from the target source code storage warehouse corresponding to the target project to be constructed, and the construction conditions can be set according to actual requirements.
步骤102、基于所述目标源码进行相应的构建操作,得到所述目标项目对应的构建产物,其中,所述构建产物中包括所述多个业务线分别对应的多个网页文件,以及所述多个业务线对应的公用静态资源。Step 102: Perform a corresponding construction operation based on the target source code to obtain a construction product corresponding to the target project, wherein the construction product includes a plurality of webpage files corresponding to the plurality of business lines, and the plurality of Public static resources corresponding to each business line.
本申请实施例中对构建操作不做限定,可以根据所采用的构建工具以及目标项目实际情况进行设置,一般可以通过前端构建机完成。构建产物一般为静态资源,包括网页(html)文件和其他静态资源。这里html文件可以指超文本标记语言(Hyper Text Markup Language,HTML)格式的文件,以.html为文件后缀。其他静态资源例如可包括css文件和js文件等。由于目标项目存在于多个业务线中,也即多个应用程序中都有对应同一功能的网页,因此,存在很多相同或相近的静态资源,可以将这些静态资源称为多个业务线对应的公用静态资源。另外,目标项目在不同业务线中又存在个性化差异,该差异主要体现在html文件中,本申请实施例中,不同的业务线需要对应不同的html文件,这样设置考虑的是,一方面,网页有默认标题的限制,默认标题固化在html文件里,不同业务线一般需要实现默认标题的不同,因此就需要不同的html文件,另一方面,不同业务线在公用静态资源库中也可以存在少量的不同引入需求的静态资源,而不同html文件可以引入不同的静态资源,因此也方便了在不同业务线引入公用静态资源库中的不同静态资源。The construction operation is not limited in the embodiment of the present application, and may be set according to the construction tool used and the actual situation of the target project, which may generally be completed by a front-end construction machine. The build products are generally static resources, including web page (html) files and other static resources. Here, the html file may refer to a file in Hyper Text Markup Language (HTML) format, with .html as the file suffix. Other static resources may include, for example, css files and js files. Since the target project exists in multiple lines of business, that is, multiple applications have web pages corresponding to the same function, there are many static resources that are the same or similar, and these static resources can be called corresponding to multiple lines of business. Public static resources. In addition, there are individual differences in target items in different business lines, which are mainly reflected in html files. In the embodiment of the present application, different business lines need to correspond to different html files. This setting considers that, on the one hand, Web pages are limited by default titles. The default titles are solidified in html files. Different business lines generally need to implement different default titles, so different html files are required. On the other hand, different business lines can also exist in public static resource libraries. A small number of static resources with different import requirements, and different html files can import different static resources, so it is also convenient to introduce different static resources in the public static resource library in different business lines.
步骤103、将所述构建产物分类发布至服务端。Step 103: Publish the construction product classification to the server.
示例性的,在完成构建操作并得到相应的构建产物后,可以对构建产物进行分类,然后直接发布至对应的服务端;也可在分类完成后,分别提交到对应的构建产物存放仓库中,再将构建产物存放仓库中的资源提交(如通过代码发布器提交)到对应的服务端。其中,构建产物存放仓库也可存在于仓库管理系统中。在对构建产物进行分类时,可以分为网页文件和公用静态资源,还可针对公用静态资源进行分类,本实施例对此不做限定。Exemplarily, after completing the construction operation and obtaining the corresponding construction product, the construction product can be classified and then directly published to the corresponding server; or after the classification is completed, it can be respectively submitted to the corresponding construction product storage warehouse, Then submit the resources in the build product storage warehouse (for example, through the code publisher) to the corresponding server. Among them, the construction product storage warehouse may also exist in the warehouse management system. When classifying the construction product, it can be divided into web page files and public static resources, and can also be classified for public static resources, which is not limited in this embodiment.
本申请实施例中提供的前端项目处理方法,从待构建的目标项目对应的目 标源码存放仓库中获取对应多个业务线的目标源码,基于目标源码进行相应的构建操作,得到目标项目对应的构建产物,其中,构建产物中包括多个业务线分别对应的多个网页文件,以及多个业务线对应的公用静态资源,将构建产物分类提交至对应的产物存放仓库,将产物存放仓库中的资源发布至服务端,其中,服务端采用预设目录结构对多个网页文件和所述公用静态资源进行分开存储。通过采用上述技术方案,针对一个前端项目对应多个业务线开发需求的情况,可以预先将对应的目标源码存放至该项目对应的目标源码存放仓库,在进行项目构建时,一次性构建出多个业务线分别对应的多个网页文件以及共同对应的公用静态资源并发布至服务端,简化了构建流程,提高构建效率,可减少开发成本,加快业务迭代速度。In the front-end project processing method provided in the embodiment of the present application, the target source code corresponding to multiple business lines is obtained from the target source code storage warehouse corresponding to the target project to be built, and the corresponding construction operation is performed based on the target source code to obtain the construction corresponding to the target project. product, wherein the construction product includes multiple webpage files corresponding to multiple business lines and public static resources corresponding to multiple business lines, submit the construction product classification to the corresponding product storage warehouse, and store the resources in the product storage warehouse Published to the server, wherein the server uses a preset directory structure to store the plurality of webpage files and the public static resources separately. By adopting the above technical solution, for the situation that a front-end project corresponds to the development requirements of multiple business lines, the corresponding target source code can be stored in the target source code storage warehouse corresponding to the project in advance, and when the project is constructed, multiple projects can be constructed at one time. Multiple webpage files corresponding to business lines and public static resources corresponding to each other are published to the server, which simplifies the construction process, improves construction efficiency, reduces development costs, and speeds up business iteration.
在一些实施例中,基于所述目标源码构建所述多个业务线分别对应的多个网页文件,包括:按照所述多个业务线的总数确定目标数量;对所述目标源码中的网页文件模板进行预设次数的复制,得到所述目标数量的初始网页文件,其中,所述预设次数与所述目标数量相等;读取所述目标源码中的所述多个业务线分别对应的网页文件配置信息;根据所述多个业务线分别对应的网页文件配置信息对所述目标数量的初始网页文件进行相应配置,得到所述多个业务线分别对应的多个网页文件。这样设置的好处在于,可以由开发人员统一开发一个网页文件对应的模板,由于不同业务线对应的目标项目的网页比较相似,不同网页文件之间的差异也较小,因此,可以仅针对差异部分编写网页文件配置信息,节省开发成本,提高开发效率。在进行构建时,对网页文件模板进行多次复制,并根据网页文件配置信息进行相应的配置,即可快速准确地构建出不同业务线分别对应的多个网页文件。其中,目标数量一般等于多个业务线的总数,也即每个业务线对应一个初始网页文件。根据网页文件配置信息对初始网页文件进行相应配置的细节不做限定,例如可包括增加、删除以及替换等修改。In some embodiments, constructing multiple webpage files corresponding to the multiple business lines based on the target source code includes: determining the target quantity according to the total number of the multiple business lines; The template is copied for a preset number of times to obtain the initial webpage files of the target number, wherein the preset number of times is equal to the target number; and the webpages corresponding to the plurality of business lines in the target source code are read respectively. file configuration information; correspondingly configure the target number of initial webpage files according to the webpage file configuration information corresponding to the multiple business lines respectively, and obtain multiple webpage files corresponding to the multiple business lines respectively. The advantage of this setting is that developers can uniformly develop a template corresponding to a webpage file. Since the webpages of the target projects corresponding to different business lines are relatively similar, the differences between different webpage files are also small. Therefore, it is possible to only target the difference parts. Write web page file configuration information to save development costs and improve development efficiency. During construction, the webpage file template is copied multiple times, and corresponding configuration is performed according to the webpage file configuration information, so that multiple webpage files corresponding to different business lines can be quickly and accurately constructed. The target quantity is generally equal to the total number of multiple business lines, that is, each business line corresponds to an initial web page file. The details of the corresponding configuration of the initial webpage file according to the webpage file configuration information are not limited, for example, modifications such as addition, deletion, and replacement may be included.
在一些实施例中,所述网页文件配置信息包括替换配置信息;所述根据所述网页文件配置信息对所述初始网页文件进行相应配置,包括:将所述初始网页文件中预设字段中的初始内容替换为所述替换配置信息中对应的目标内容。这样设置的好处在于,采用字段内容直接替换的方式,可以快速实现网页文件的个性化配置。其中,初始内容可以理解为占位内容,目标内容为对应当前业务线的真实内容,例如,当需要对应用名称进行替换时,可以在对应的字段设置初始内容为“APP__REPLACEMENT”,目标内容可以是当前业务线实际对应的应用名称,如“XXLIVE”等。In some embodiments, the configuration information of the webpage file includes replacement configuration information; and the corresponding configuration of the initial webpage file according to the configuration information of the webpage file includes: setting a value in a preset field in the initial webpage file The initial content is replaced with the corresponding target content in the replacement configuration information. The advantage of this setting is that, by directly replacing the field content, the personalized configuration of the web page file can be quickly realized. Among them, the initial content can be understood as placeholder content, and the target content is the real content corresponding to the current business line. For example, when the application name needs to be replaced, the initial content can be set to "APP__REPLACEMENT" in the corresponding field, and the target content can be The actual corresponding application name of the current business line, such as "XXLIVE".
在一些实施例中,所述从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码,包括:获取待构建的目标项目对应的项目信息;根据所述项目信息判断是否满足预设自动构建条件,若满足预设自动构建条件, 则从所述目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码。这样设置的好处在于,可以预先设置自动构建条件,在满足该条件时,可以直接进行后面的相关构建操作,节省人力成本,提高项目构建的时效性。预设自动构建条件可以根据实际需求进行设置,如考虑实际的使用环境或业务所处阶段等。In some embodiments, the obtaining target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built includes: obtaining project information corresponding to the target project to be built; judging according to the project information Whether the preset automatic construction conditions are met, and if the preset automatic construction conditions are met, the target source code corresponding to multiple business lines is obtained from the target source code storage warehouse corresponding to the target project. The advantage of this setting is that the automatic build conditions can be set in advance. When the conditions are met, the subsequent related build operations can be directly performed, which saves labor costs and improves the timeliness of project construction. The preset automatic construction conditions can be set according to actual needs, such as considering the actual use environment or the stage of the business.
在一些实施例中,所述项目信息包含分支标识;所述根据所述项目信息判断是否满足预设自动构建条件,包括:根据所述分支标识判断所述目标项目对应的分支是否为测试环境分支或灰度环境分支,若所述目标项目对应的分支为测试环境分支或灰度环境分支,则确定满足预设自动构建条件。这样设置的好处在于,对于测试环境,最终发布到服务端的资源一般不会真正投入使用,也即用户不会获取到相应的资源,属于实验阶段,不会对用户产生不良影响,因此,为了提高测试时效和效率,减少测试人员的手动操作,可以设置为自动构建;对于灰度环境,最终发布到服务端的资源仅用于灰度实验,也即参与灰度实验的灰度用户才会获取到相应的资源,不会对大量用户产生不良影响,因此,为了提高灰度实验时效和效率,减少实验人员的手动操作,可以设置为自动构建。其中,项目信息可以包括项目名称和分支名称等,分支名称可以包括测试环境分支、灰度环境分支和生产环境分支等。In some embodiments, the project information includes a branch identifier; the judging whether a preset automatic construction condition is satisfied according to the project information includes: judging whether the branch corresponding to the target project is a test environment branch according to the branch identifier Or a grayscale environment branch, if the branch corresponding to the target item is a test environment branch or a grayscale environment branch, it is determined that the preset automatic construction condition is satisfied. The advantage of this setting is that, for the test environment, the resources finally released to the server will generally not be put into use, that is, the user will not obtain the corresponding resources, which is in the experimental stage and will not have adverse effects on the user. Therefore, in order to improve the Test the timeliness and efficiency, reduce the manual operation of testers, and can be set to automatic construction; for the grayscale environment, the resources finally released to the server are only used for grayscale experiments, that is, grayscale users who participate in the grayscale experiments will get it Corresponding resources will not have adverse effects on a large number of users. Therefore, in order to improve the timeliness and efficiency of grayscale experiments and reduce the manual operation of experimenters, automatic construction can be set. The project information may include a project name and a branch name, and the branch name may include a test environment branch, a grayscale environment branch, a production environment branch, and the like.
在对项目进行构建时,有时可能需要使用依赖包。以node项目为例,依赖包可以理解为在开发和部署上线时所依赖的包,一般保存在项目根目录下的node_modules文件夹下,通过package.json保存包版本号,通过npm install命令进行安装。在一些实施例中,在针对目标项目进行首次构建操作时,可以从项目包管理工具(Node Package Manager,NPM)下载所需要的使用的依赖包安装文件,并安装依赖包安装文件,得到本次构建所需的依赖包。在完成首次构建操作后,可以对所安装的依赖包和依赖包版本信息进行存储,依赖包版本信息例如可以包括版本号,所保存的依赖包和依赖包版本信息可以供下一次构建操作时参考或使用。When building a project, you may sometimes need to use dependency packages. Taking the node project as an example, the dependent package can be understood as the package that depends on the development and deployment. Generally, it is stored in the node_modules folder in the project root directory. The package version number is saved through package.json, and the npm install command is used to install it. . In some embodiments, when the first build operation is performed for the target project, the required dependency package installation file can be downloaded from the project package management tool (Node Package Manager, NPM), and the dependency package installation file can be installed to obtain this time. Build the required dependencies. After the first build operation is completed, the installed dependency package and the version information of the dependency package can be stored. The version information of the dependency package can include, for example, the version number. The saved version information of the dependency package and the dependency package can be used for reference in the next build operation. or use.
在一些实施例中,在所述基于所述目标源码进行相应的构建操作之前,还包括:判断所述目标源码中的依赖包版本是否与上一次执行构建操作时的依赖包版本一致,若所述目标源码中的依赖包版本与上一次执行构建操作时的依赖包版本一致,则将本地已安装的依赖包确定为目标依赖包;相应的,所述基于所述目标源码进行相应的构建操作,包括:基于所述目标源码和所述目标依赖包进行相应的构建操作。这样设置的好处在于,在本次构建操作所使用的依赖包的版本与上一次构建操作时使用的依赖包版本一致时,可以直接将已安装的对应的依赖包确定为目标依赖包,也即将已经安装的与目标源码中的依赖包版本一致的依赖包确定为目标依赖包,并参与后面的构建操作。In some embodiments, before performing the corresponding construction operation based on the target source code, the method further includes: judging whether the version of the dependency package in the target source code is consistent with the version of the dependency package when the construction operation was performed last time, and if so If the version of the dependency package in the target source code is consistent with the version of the dependency package when the build operation was performed last time, the locally installed dependency package is determined as the target dependency package; correspondingly, the corresponding build operation is performed based on the target source code. , including: performing a corresponding construction operation based on the target source code and the target dependency package. The advantage of this setting is that when the version of the dependency package used in this build operation is the same as the version of the dependency package used in the previous build operation, the installed corresponding dependency package can be directly determined as the target dependency package, that is, The installed dependency package that is consistent with the version of the dependency package in the target source code is determined as the target dependency package and participates in the subsequent build operations.
在一些实施例中,在所述判断所述目标源码中的依赖包版本是否与上一次执行构建操作时的依赖包版本一致之后,还包括:若所述目标源码中的依赖包版本与上一次执行构建操作时的依赖包版本不一致,则根据所述目标源码中的依赖包版本下载相应的依赖包安装文件,并安装所述依赖包安装文件,得到目标依赖包;对所述目标源码中的依赖包版本和所述目标依赖包进行存储。这样设置的好处在于,若所述目标源码中的依赖包版本与上一次执行构建操作时的依赖包版本不一致,则说明本次构建操作所需要依赖的依赖包发生了变化,需要重新安装,保证构建操作的准确性。示例性的,可以从NPM中下载与目标源码中的依赖包版本一致的新的依赖包安装文件,并进行安装,将安装后得到的依赖包应用于后面的构建操作。In some embodiments, after judging whether the version of the dependency package in the target source code is consistent with the version of the dependency package when the build operation was performed last time, the method further includes: if the version of the dependency package in the target source code is the same as the last time the build operation is performed If the version of the dependency package during the construction operation is inconsistent, download the corresponding dependency package installation file according to the version of the dependency package in the target source code, and install the dependency package installation file to obtain the target dependency package; The dependent package version and the target dependent package are stored. The advantage of this setting is that if the version of the dependent package in the target source code is inconsistent with the version of the dependent package when the build operation was performed last time, it means that the dependent package required for this build operation has changed and needs to be reinstalled to ensure that Accuracy of build operations. Exemplarily, a new dependency package installation file that is consistent with the version of the dependency package in the target source code may be downloaded from NPM, and installed, and the dependency package obtained after installation is applied to the subsequent build operations.
在一些实施例中,在所述根据所述项目信息判断是否满足预设自动构建条件之后,还包括:若不满足预设自动构建条件,则确定所述目标项目对应的分支是生产环境分支;在检测到预设构建事件被触发时,从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码。一般的,测试环境和灰度环境以外即生成环境,生产环境分支也可称为正式分支,也即需要正式投入使用的分支,相应的资源发布后,所有用户一般都可以使用对应的应用程序并获取到相应的资源。对于生产环境,若发布后出现问题,则会影响所有用户的使用,因此,一般不会自动构建,而是需要另行触发。预设构建事件的触发条件可以根据实际需求设置,例如可以由工作人员手动触发。以Gitlab为例,可以在Gitlab页面中手动输入构建指令,触发预设构建事件。In some embodiments, after judging whether the preset automatic construction conditions are met according to the project information, the method further includes: if the preset automatic construction conditions are not met, determining that the branch corresponding to the target project is a production environment branch; When it is detected that the preset build event is triggered, the target source code corresponding to the multiple business lines is obtained from the target source code storage warehouse corresponding to the target project to be built. In general, the production environment is the production environment other than the test environment and the grayscale environment. The production environment branch can also be called the official branch, that is, the branch that needs to be officially put into use. After the corresponding resources are released, all users can generally use the corresponding applications and Obtain the corresponding resources. For the production environment, if there is a problem after the release, it will affect the use of all users. Therefore, it is generally not automatically built, but needs to be triggered separately. The triggering conditions of the preset build events can be set according to actual needs, for example, they can be manually triggered by workers. Taking Gitlab as an example, you can manually enter build instructions on the Gitlab page to trigger preset build events.
在一些实施例中,在所述基于所述目标源码进行相应的构建操作之前,还包括:判断本地是否存在已安装的灰度环境的依赖包,若本地不存在已安装的灰度环境的依赖包,则返回构建失败信息;若本地存在已安装的灰度环境的依赖包,则判断所述目标源码中的依赖包版本是否与上一次执行构建操作时的灰度环境的依赖包的依赖包版本一致,若所述目标源码中的依赖包版本与上一次执行构建操作时的灰度环境的依赖包的依赖包版本一致,则将本地已安装的依赖包确定为目标依赖包,若所述目标源码中的依赖包版本与上一次执行构建操作时的灰度环境的依赖包的依赖包版本不一致,则返回构建失败信息。这样设置的好处在于,对于生产环境,可以设定一些条件,避免构建完成后无法进行发布,导致构建操作变得没有意义,降低无谓的生产成本。对于生产环境来说,若本地并不存在已安装的灰度环境的依赖包,说明该依赖包版本没有经过灰度验证,而没有经过灰度验证的代码若直接发布到线上,则可能造成较大范围的不良影响,因此,可设计为不允许发布,因此,也不进行构建操作,可以返回构建失败信息。另外,若存在已安装的灰度环境的依赖包,但是与目标源码中的依赖包版本不一致,同样说明当前构建操作所需依赖的依赖包未进行灰度验 证,可以返回构建失败信息。In some embodiments, before performing the corresponding construction operation based on the target source code, the method further includes: judging whether there is a dependency package of the installed grayscale environment locally, if there is no local dependency of the installed grayscale environment If there is an installed dependency package of the grayscale environment locally, then judge whether the version of the dependency package in the target source code is the same as the dependency package of the dependency package of the grayscale environment when the build operation was performed last time. The versions are consistent. If the version of the dependency package in the target source code is the same as the version of the dependency package of the grayscale environment when the build operation was performed last time, the locally installed dependency package is determined as the target dependency package. If the If the version of the dependent package in the target source code is inconsistent with the version of the dependent package of the grayscale environment when the last build operation was performed, a build failure message will be returned. The advantage of this setting is that for the production environment, some conditions can be set to avoid the inability to publish after the build is completed, resulting in the build operation becoming meaningless and reducing unnecessary production costs. For the production environment, if there is no local dependency package of the installed grayscale environment, it means that the version of the dependency package has not been grayscale verified, and if the code without grayscale verification is directly published online, it may cause A wide range of adverse effects, therefore, can be designed to not allow publishing, therefore, no build operation is performed, and a build failure message can be returned. In addition, if there is an installed dependency package of the grayscale environment, but the version of the dependency package in the target source code is inconsistent, it also means that the dependency package required for the current build operation has not been grayscale verified, and a build failure message can be returned.
在一些实施例中,所述公用静态资源中包括资源地图文件;将所述构建产物分类发布至服务端,包括:将所述多个网页文件和所述公用静态资源中除所述资源地图文件之外的资源发布至第一服务端;将资源地图文件存放仓库中的所述资源地图文件发布至第二服务端。这样设置的好处在于,资源地图文件(sourcemap)一般用于工作人员进行业务监控,与用户的使用无关,因此,可以将其与其他静态资源分开发布至不同的服务端,避免过多占用第一服务端的存储资源。可选的,第一服务端为内容分发网络(Content Delivery Network,CDN)服务端,CDN是构建在网络基础之上的智能虚拟网络,依靠部署在多地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞,提高用户访问响应速度和命中率,本申请实施例中采用CDN来存放与用户相关的静态资源,对页面性能有正面的影响,也即存在加快网页显示速度等好处。第二服务端可以为业务日志监控服务端,可根据实际情况设置,例如可以是sentry机器等。In some embodiments, the public static resources include a resource map file; and publishing the construction product classification to the server includes: removing the resource map file from the plurality of webpage files and the public static resources Publish resources other than the resource map file to the first server; publish the resource map file in the resource map file storage warehouse to the second server. The advantage of this setting is that the resource map file (sourcemap) is generally used for business monitoring by staff and has nothing to do with the user's use. Therefore, it can be released to different servers separately from other static resources to avoid excessive occupation of the first Server-side storage resources. Optionally, the first server is a Content Delivery Network (CDN) server, and CDN is an intelligent virtual network built on a network basis, relying on edge servers deployed in multiple places, through the load balancing of the central platform. , content distribution, scheduling and other functional modules to enable users to obtain the required content nearby, reduce network congestion, and improve user access response speed and hit rate. The positive effect is that there are benefits such as speeding up the display speed of web pages. The second server can be a business log monitoring server, which can be set according to the actual situation, for example, it can be a sentry machine.
在一些实施例中,所述服务端采用相对路径对所述多个网页文件和所述公用静态资源进行分开存储。例如,在CDN中,可以采用相对路径的存储方式来分开存储多个网页文件和公用静态资源。采用相对路径的好处在于,域名相同的情况下,相对路径可以使页面更加灵活,在域名封禁的时候由于相对路径继承页面主域域名而无需额外处理,因此无需担心由于封禁域名导致的静态资源无法使用的情况,只要主域域名可用,页面即可用,主域域名可在入口处配置下发替换,在域名封禁的时候无需开发手动进行替换。可选的,采用预设目录结构来分开存储多个网页文件和公用静态资源,预设目录结构可以根据实际需求设置。将html文件与其他静态资源分开的好处在于:一方面是考虑到回滚,如果发布出现问题,只需要回滚html文件,由于html文件引入了不同的静态资源,只回滚html文件即可实现全部回滚,方便快捷;另一方面是出于目录的分配考虑,因为不同的业务线要应用不同的html文件,但是公用静态资源只有一份,分离开html文件与其他静态资源更方便目录管理。In some embodiments, the server uses a relative path to store the plurality of webpage files and the public static resources separately. For example, in a CDN, a relative path storage method can be used to store multiple webpage files and public static resources separately. The advantage of using a relative path is that when the domain name is the same, the relative path can make the page more flexible. When the domain name is blocked, because the relative path inherits the domain name of the main domain of the page without additional processing, there is no need to worry about static resources due to the blocked domain name. In the case of use, as long as the main domain name is available, the page can be used. The main domain name can be configured and replaced at the entrance, and there is no need to develop and manually replace it when the domain name is blocked. Optionally, a preset directory structure is used to store multiple webpage files and public static resources separately, and the preset directory structure can be set according to actual requirements. The advantages of separating html files from other static resources are: on the one hand, rollback is considered. If there is a problem with publishing, only the html file needs to be rolled back. Since the html file introduces different static resources, only the html file can be rolled back. All rollback is convenient and quick; on the other hand, it is for the consideration of directory allocation, because different business lines need to apply different html files, but there is only one public static resource, and it is more convenient for directory management to separate html files and other static resources. .
图2为本申请实施例提供的另一种前端项目处理方法的流程示意图,图3为本申请实施例提供的一种项目构建过程示意图,可参考图3对本申请实施例进行理解,如图2所示,该方法可包括:FIG. 2 is a schematic flowchart of another front-end project processing method provided by an embodiment of the present application, and FIG. 3 is a schematic diagram of a project construction process provided by an embodiment of the present application. Refer to FIG. 3 to understand the embodiment of the present application, as shown in FIG. 2 As shown, the method may include:
步骤201、获取待构建的目标项目对应的分支标识。Step 201: Obtain the branch identifier corresponding to the target project to be constructed.
示例性的,可以先获取需要用到的变量,可称为项目信息,项目信息中可包括分支名(也即分支标识)和项目名等,然后判断分支是否合理。Exemplarily, variables to be used may be obtained first, which may be called project information, and the project information may include branch names (ie, branch identifiers) and project names, etc., and then determine whether the branch is reasonable.
步骤202、根据分支标识判断目标项目对应的分支是否为测试环境分支或灰 度环境分支,若目标项目对应的分支为测试环境分支或灰度环境分支,则执行步骤203;若目标项目对应的分支不为测试环境分支或灰度环境分支,执行步骤207。Step 202: Determine whether the branch corresponding to the target item is a test environment branch or a grayscale environment branch according to the branch identifier. If the branch corresponding to the target item is a test environment branch or a grayscale environment branch, perform step 203; if the branch corresponding to the target item Step 207 is performed without branching for the test environment or the grayscale environment.
如图3所示,分支标识包括正式分支、灰度分支和测试分支。若分支标识是灰度分支或测试分支,则可以对目标项目进行自动构建,若分支标识是正式分支,则可以手动触发构建目标项目。As shown in Figure 3, the branch identification includes formal branch, gray branch and test branch. If the branch identifier is a grayscale branch or a test branch, the target project can be automatically built; if the branch identifier is an official branch, the target project can be manually triggered to build.
步骤203、从目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码。Step 203: Obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project.
示例性的,若可以对目标项目进行项目构建,则可以根据项目名查找对应的文件夹,若对应的文件夹已存在,则说明已经对目标项目进行过项目构建,则从对应的Gitlab仓库(也即目标源码存放仓库)拉取代码,如果对应的文件夹不存在,则证明是第一次构建目标项目,则需要从目标源码存放仓库拷贝代码。Exemplarily, if the target project can be built, the corresponding folder can be searched according to the project name. If the corresponding folder already exists, it means that the target project has been built, and the corresponding Gitlab repository ( That is, the target source code storage warehouse) to pull the code, if the corresponding folder does not exist, it proves that it is the first time to build the target project, and you need to copy the code from the target source code storage warehouse.
步骤204、判断目标源码中的依赖包版本是否与上一次执行构建操作时的依赖包版本一致,若目标源码中的依赖包版本与上一次执行构建操作时的依赖包版本一致,则执行步骤205;若目标源码中的依赖包版本与上一次执行构建操作时的依赖包版本不一致,执行步骤206。Step 204: Determine whether the version of the dependency package in the target source code is consistent with the version of the dependency package when the build operation was performed last time. If the version of the dependency package in the target source code is consistent with the version of the dependency package when the build operation was performed last time, step 205 is performed. ; If the version of the dependent package in the target source code is inconsistent with the version of the dependent package when the build operation was performed last time, step 206 is executed.
示例性的,目标源码中的依赖包版本可以包含于package.json文件中,因此,可以通过比较package.json文件是否相同来确定目标源码中的依赖包版本与上一次执行构建操作时的依赖包版本是否一致。如图3所示,对于灰度分支,可以比较当前package.json和灰度环境的package.json是否相同,若当前package.json和灰度环境的package.json相同,则说明版本一致,若当前package.json和灰度环境的package.json不同,则版本不一致。对于测试分支,可以比较当前package.json和测试环境的package.json是否相同,若当前package.json和测试环境的package.json相同,则说明版本一致,若当前package.json和测试环境的package.json不同,则版本不一致。Exemplarily, the version of the dependency package in the target source code can be included in the package.json file, therefore, it can be determined by comparing whether the package.json file is the same or not to determine the version of the dependency package in the target source code and the dependency package when the last build operation was performed. Is the version consistent. As shown in Figure 3, for the grayscale branch, you can compare whether the current package.json and the package.json of the grayscale environment are the same. If the current package.json and the package.json of the grayscale environment are the same, the version is the same. If the package.json is different from the package.json of the grayscale environment, the version is inconsistent. For the test branch, you can compare whether the current package.json is the same as the test environment's package.json. If the current package.json is the same as the test environment's package.json, the version is the same. If the current package.json is the test environment's package.json. If the json is different, the version is inconsistent.
步骤205、将本地已安装的对应的依赖包确定为第一目标依赖包,基于目标源码和第一目标依赖包进行相应的构建操作。Step 205: Determine the locally installed corresponding dependency package as the first target dependency package, and perform a corresponding construction operation based on the target source code and the first target dependency package.
步骤206、根据目标源码中的依赖包版本下载相应的依赖包安装文件,并安装依赖包安装文件,得到第二目标依赖包,基于目标源码和第二目标依赖包进行相应的构建操作。Step 206: Download the corresponding dependency package installation file according to the dependency package version in the target source code, and install the dependency package installation file to obtain a second target dependency package, and perform a corresponding construction operation based on the target source code and the second target dependency package.
步骤207、确定目标项目对应的分支是生产环境分支。Step 207: Determine that the branch corresponding to the target project is the production environment branch.
步骤208、判断预设构建事件是否被触发,若预设构建事件被触发,则执行 步骤209;若预设构建事件不被触发,重复执行步骤208。 Step 208, determine whether the preset build event is triggered, if the preset build event is triggered, then execute step 209; if the preset build event is not triggered, repeat step 208.
步骤209、从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码。Step 209: Obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed.
步骤210、判断本地是否存在已安装的灰度环境的依赖包,若本地存在已安装的灰度环境的依赖包,则执行步骤211;若本地不存在已安装的灰度环境的依赖包,执行步骤214。Step 210: Determine whether there is an installed dependency package of the grayscale environment locally, if there is a locally installed dependency package of the grayscale environment, go to step 211; if there is no locally installed dependency package of the grayscale environment, execute Step 214.
步骤211、判断目标源码中的依赖包版本是否与上一依赖包版本一致,若目标源码中的依赖包版本与上一依赖包版本一致,则执行步骤212;若目标源码中的依赖包版本与上一依赖包版本不一致,执行步骤214。Step 211: Determine whether the version of the dependency package in the target source code is consistent with the version of the previous dependency package. If the version of the dependency package in the target source code is consistent with the version of the previous dependency package, step 212 is executed; if the version of the dependency package in the target source code is the same as If the version of the last dependent package is inconsistent, step 214 is executed.
上一依赖包版本指上一次执行构建操作时的灰度环境的依赖包的依赖包版本。The last dependency package version refers to the dependency package version of the dependency package of the grayscale environment when the build operation was performed last time.
示例性的,对于正式分支,也即生产环境分支,可以比较当前package.json和灰度环境的package.json是否相同,若当前package.json和灰度环境的package.json相同,则说明版本一致,若当前package.json和灰度环境的package.json不同,则版本不一致。Exemplarily, for the official branch, that is, the production environment branch, you can compare whether the current package.json and the package.json of the grayscale environment are the same. If the current package.json and the package.json of the grayscale environment are the same, the versions are consistent , if the current package.json and the package.json of the grayscale environment are different, the versions are inconsistent.
步骤212、将本地已安装的对应的灰度环境的依赖包确定为第三目标依赖包,基于目标源码和第三目标依赖包进行相应的构建操作。Step 212: Determine the locally installed dependency package of the corresponding grayscale environment as the third target dependency package, and perform a corresponding construction operation based on the target source code and the third target dependency package.
步骤213、将目标项目对应的构建产物分类发布至服务端。 Step 213 , classify and publish the construction product corresponding to the target project to the server.
构建产物中包括所述多个业务线分别对应的多个网页文件,以及所述多个业务线对应的公用静态资源。The construction product includes multiple webpage files corresponding to the multiple business lines respectively, and public static resources corresponding to the multiple business lines.
步骤214、返回构建失败信息。 Step 214, returning the construction failure information.
本申请实施例提供的前端项目处理方法,在上述可选实施例基础上,先根据分支标识确定是否支持自动构建目标项目,若支持自动构建目标项目则自动开始构建目标项目,若不支持自动构建目标项目,则需要在触发预设构建事件后进行构建目标项目,更加合理地控制构建流程的启动。在执行构建操作前,还针对依赖包进行相应的判断,在正式分支下,若不存在灰度环境的依赖包或目标源码中的依赖包与灰度环境的依赖包不一致,则不允许构建目标项目,避免未经灰度验证的依赖包参与发布目标项目,而在其他分支下,若当前依赖包版本对应的依赖包已成功安装,则可直接进行构建目标项目,避免重新安装依赖包,提高构建效率,可减少开发成本,加快业务迭代速度。In the front-end project processing method provided by the embodiment of the present application, on the basis of the above-mentioned optional embodiments, it is first determined whether to support automatic construction of the target project according to the branch identifier, and if automatic construction of the target project is supported, the construction of the target project is automatically started. For the target project, you need to build the target project after triggering the preset build event, so as to control the start of the build process more reasonably. Before executing the build operation, the corresponding judgment is also made for the dependent package. Under the official branch, if there is no dependency package of the grayscale environment or the dependency package in the target source code is inconsistent with the dependency package of the grayscale environment, the build target is not allowed. project, to avoid non-gray-verified dependency packages participating in the release target project, and under other branches, if the dependency package corresponding to the current dependency package version has been successfully installed, you can directly build the target project to avoid reinstalling the dependency package and improve Building efficiency can reduce development costs and speed up business iteration.
图4为本申请实施例提供的另一种前端项目处理方法的流程示意图,图5为本申请实施例提供的一种项目开发构建过程示意图,可参考图5进行本申请 实施例进行理解,如图4所示,该方法包括:FIG. 4 is a schematic flowchart of another front-end project processing method provided by an embodiment of the present application, and FIG. 5 is a schematic diagram of a project development and construction process provided by an embodiment of the present application. Refer to FIG. 5 for understanding of the embodiment of the present application. As shown in Figure 4, the method includes:
步骤401、从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码。Step 401: Obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed.
示例性的,如图5所示,开发者在开发之前可以通过fed-cli创建项目,gitlab中以fed-activity形式形成gitlab组。gitlab组中包含了用于存放act_demo的模板仓库、用于存放多个项目源码的源码存放仓库(数量不做限定,图5中仅示意性地列出了3个项目,project1、project2和project3)、用于存放待发布的预设类型公用静态资源(release-assets)的静态资源存放仓库、用于存放待发布的网页文件(release-pages)的html存放仓库以及用于存放待发布的资源地图文件(release-maps)的sourcemap存放仓库。开发者创建项目后,从模板仓库拉去代码初始化本地项目,开发完成后将源码推送(push)到相应的源码存放仓库(图中以project1为例)。随后,本地开发连接打包编译服务器(webpack-dev-server),并通过前端构建机先确定当前是灰度分支(gray)、测试分支(test)还是生产分支(prod),根据分支类型支持不同的构建触发方式,在触发构建后,从源码存放仓库获取目标源码。Exemplarily, as shown in Figure 5, a developer can create a project through fed-cli before development, and a gitlab group is formed in gitlab in the form of fed-activity. The gitlab group includes a template repository for storing act_demo and a source code repository for storing the source code of multiple projects (the number is not limited, only 3 projects are schematically listed in Figure 5, project1, project2 and project3) , a static resource storage warehouse for storing public static assets of preset types (release-assets) to be released, an html storage warehouse for storing web page files (release-pages) to be released, and a resource map for storing to-be-released resources The sourcemap of files (release-maps) is stored in the repository. After the developer creates the project, he pulls the code from the template warehouse to initialize the local project, and after the development is completed, pushes the source code to the corresponding source code storage warehouse (project1 is taken as an example in the figure). Then, the local development connects to the packaging and compilation server (webpack-dev-server), and firstly determines whether it is a gray branch (gray), a test branch (test) or a production branch (prod) through the front-end construction machine, and supports different branches according to the branch type. The build trigger method, after triggering the build, obtain the target source code from the source code storage warehouse.
步骤402、根据目标源码中的依赖包版本确定目标依赖包。Step 402: Determine the target dependency package according to the dependency package version in the target source code.
此处的目标依赖包可以是上一次构建后存储的依赖包,也可以是重新下载并安装的依赖包,确定方式可参考前文相关内容,此处不再赘述。The target dependency package here can be the dependency package stored after the last build, or the dependency package that has been downloaded and installed again. For the determination method, please refer to the relevant content above, and will not be repeated here.
步骤403、基于目标源码和目标依赖包进行相应的构建操作,得到目标项目对应的构建产物。Step 403: Perform a corresponding construction operation based on the target source code and the target dependency package to obtain a construction product corresponding to the target project.
基于目标源码和目标依赖包构建多个业务线分别对应的多个网页文件的过程中,可以包括:按照多个业务线的总数确定目标数量,对目标源码中的网页文件模板进行与目标数量相同的预设次数的复制,读取目标源码中的多个业务线分别对应的替换配置信息,将初始网页文件中预设字段中的初始内容替换为替换配置信息中对应的目标内容,得到多个业务线分别对应的多个网页文件。The process of constructing multiple webpage files corresponding to multiple business lines based on the target source code and the target dependency package may include: determining the number of targets according to the total number of multiple business lines, and performing the same steps on the webpage file templates in the target source code as the number of targets. The preset number of times of copying, read the replacement configuration information corresponding to multiple business lines in the target source code, replace the initial content in the preset field in the initial web page file with the corresponding target content in the replacement configuration information, and obtain multiple Multiple webpage files corresponding to business lines respectively.
示例性的,当参数(也即预设字段)为AAA的时候,需要替换的文本(也即初始内容)可表示为AAA__REPLACEMENT,两者中间可以使用双下划线,避免和其他文本重复。Exemplarily, when the parameter (that is, the preset field) is AAA, the text to be replaced (that is, the initial content) can be expressed as AAA__REPLACEMENT, and a double underscore can be used between the two to avoid duplication with other texts.
例如,替换配置信息可以包括如下内容:For example, replacement configuration information can include the following:
Figure PCTCN2021136647-appb-000001
Figure PCTCN2021136647-appb-000001
Figure PCTCN2021136647-appb-000002
Figure PCTCN2021136647-appb-000002
如果读到以上配置信息,则替换的方式可以为:If you read the above configuration information, the replacement method can be:
将blive文件夹下的html中的TITLE__REPLACEMENT文本替换为'BLIVE';将llive文件夹下的html中的TITLE__REPLACEMENT文本替换为'LLIVE';将blive文件夹下的html中的APP__REPLACEMENT文本替换为'blive';将llive文件夹下的html中的APP__REPLACEMENT文本替换为'llive'。Replace the TITLE__REPLACEMENT text in the html under the blive folder with 'BLIVE'; replace the TITLE__REPLACEMENT text in the html under the llive folder with 'LLIVE'; replace the APP__REPLACEMENT text in the html under the blive folder with 'blive' ; Replace the APP__REPLACEMENT text in the html under the llive folder with 'llive'.
步骤404、将构建产物划分为多个业务线分别对应的多个网页文件、资源地图文件以及预设类型公用静态资源。Step 404: Divide the construction product into multiple webpage files, resource map files and preset type public static resources corresponding to multiple business lines respectively.
资源地图文件和预设类型公用静态资源共同构成公用静态资源。如图5所示,将构建产物划分为html、sourcemap和assets。The resource map file and the preset type public static resource together constitute the public static resource. As shown in Figure 5, the build products are divided into html, sourcemap and assets.
步骤405、将网页文件提交至对应的网页存放仓库,将资源地图文件提交至对应的资源地图存放仓库,将预设类型公用静态资源提交至对应的静态资源存放仓库。Step 405: Submit the webpage file to the corresponding webpage storage warehouse, submit the resource map file to the corresponding resource map storage warehouse, and submit the preset type public static resources to the corresponding static resource storage warehouse.
如图5所示,将html提交至html存放仓库、将sourcemap提交至sourcemap存放仓库以及将assets提交至assets存放仓库。As shown in Figure 5, html is submitted to the html storage warehouse, sourcemap is submitted to the sourcemap storage warehouse, and assets are submitted to the assets storage warehouse.
步骤406、将网页存放仓库中的资源发布至内容分发网络服务端,将资源地图存放仓库中的资源发布至业务日志监控服务端,将静态资源存放仓库中的资源发布至内容分发网络服务端。Step 406: Publish the resources in the webpage storage warehouse to the content distribution network server, publish the resources in the resource map storage warehouse to the business log monitoring server, and publish the resources in the static resource storage warehouse to the content distribution network server.
如图5所示,将html存放仓库中的资源同步(rsync)到CDN源、将sourcemap存放仓库中的资源同步到senry机器以及将assets存放仓库中的资源同步到CDN源。As shown in Figure 5, the resources in the html storage warehouse are synchronized (rsync) to the CDN source, the resources in the sourcemap storage warehouse are synchronized to the senry machine, and the resources in the assets storage warehouse are synchronized to the CDN source.
可选的,不同业务线中目标项目的上线时间可能不同,为了保证在发布一个业务线的代码的时候不影响其他业务线,在构建的时候可以填入业务线名称,在需要修改时,只修改所填入业务线名称对应的html文件,不会影响到其他不需要变更的业务线。Optionally, the launch time of target projects in different business lines may be different. In order to ensure that the release of the code of one business line does not affect other business lines, the name of the business line can be filled in during construction. Modifying the html file corresponding to the entered business line name will not affect other business lines that do not need to be changed.
示例性的,在CDN源中,可以利用预设目录结构采用相对路径对网页文件和预设类型公用静态资源进行分开存储。Exemplarily, in the CDN source, a preset directory structure may be used to store webpage files and public static resources of preset types separately by adopting a relative path.
示例性的,下面提供一种目录结构的示意性说明:Exemplarily, a schematic description of a directory structure is provided below:
根目录Root directory
--as--as
----assets----assets
------project1------project1
--------css--------css
----------style.css----------style.css
--------js--------js
----------js.js----------js.js
------project2------project2
----libs----libs
------lib1------lib1
--------v1.1.0--------v1.1.0
--------v1.1.1--------v1.1.1
------lib2------lib2
--pages--pages
----project1----project1
------app1------app1
--------index.html--------index.html
------app2------app2
----project2----project2
下面对上述目录结构进行解释说明:The above directory structure is explained below:
as:为asia缩写,是图片缩放转换的规则要求;assets:存放css格式以及js格式等文件;project1:项目名称;libs:共用库的目录,共用库可能需要引入多个项目,可以放在外面,同时为了维护方便,可以进行版本控制,如其下面的v1.1.0和v1.1.1。pages:存放html格式的文件;app1:业务线名称。as: the abbreviation of asia, which is the rule requirement for image scaling and conversion; assets: stores files in css format and js format; project1: project name; libs: the directory of the shared library, the shared library may need to introduce multiple projects, which can be placed outside , and at the same time, for the convenience of maintenance, version control can be performed, such as v1.1.0 and v1.1.1 below. pages: stores files in html format; app1: business line name.
本申请实施例提供的前端项目处理方法,实现了一套代码由多个业务线使 用,减少开发成本,加快业务迭代速度,开发者只需要开发一套代码,最终构建出多个html文件给不同的业务线使用,且可以通过文本替换的方式让不同业务线引入不同的资源从而实现了不同业务线的差异化处理,通过将不同项目的源码存放在不同的仓库中,减小了仓库体积,因此拉取代码的速度变快了,且对依赖包进行了保存,在依赖包版本不变的时候不需要去再次下载依赖包,同时由于在生产环境中使用灰度环境的依赖包,因此生产环境无需安装依赖包,打包更快捷,另外,由于引入的静态资源全部为相对路径,因此无需担心由于封禁域名导致的静态资源无法使用的情况,只要主域域名可用,页面即可用。The front-end project processing method provided by the embodiments of this application realizes that a set of codes is used by multiple business lines, reduces development costs, and speeds up business iteration. Developers only need to develop one set of codes, and finally construct multiple html files for different business lines. Different business lines can be used in different business lines, and different business lines can be introduced into different resources by text replacement, so as to realize the differentiated processing of different business lines. By storing the source code of different projects in different warehouses, the warehouse volume is reduced. Therefore, the speed of pulling the code becomes faster, and the dependency package is saved. When the version of the dependency package remains unchanged, there is no need to download the dependency package again. At the same time, because the dependency package of the grayscale environment is used in the production environment, the production The environment does not need to install dependency packages, and the packaging is faster. In addition, since all the static resources introduced are relative paths, there is no need to worry about the static resources being unavailable due to the banned domain name. As long as the main domain domain name is available, the page can be used.
图6为本申请实施例提供的一种前端项目处理装置的结构框图,该装置可由软件和/或硬件实现,一般可集成在计算机设备中,可通过执行前端项目处理方法来进行前端项目的相关处理。如图6所示,该装置包括:FIG. 6 is a structural block diagram of a front-end item processing apparatus provided by an embodiment of the present application. The apparatus can be implemented by software and/or hardware, and can generally be integrated in computer equipment. The front-end item processing method can be executed to perform front-end item correlation. deal with. As shown in Figure 6, the device includes:
目标源码获取模块601,设置为从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码;项目构建模块602,设置为基于所述目标源码进行相应的构建操作,得到所述目标项目对应的构建产物,其中,所述构建产物中包括所述多个业务线分别对应的多个网页文件,以及所述多个业务线对应的公用静态资源;构建产物发布模块603,设置为将所述构建产物分类发布至服务端。The target source code acquisition module 601 is configured to obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed; the project construction module 602 is configured to perform corresponding construction operations based on the target source code, and obtain The construction product corresponding to the target project, wherein the construction product includes multiple webpage files corresponding to the multiple business lines respectively, and public static resources corresponding to the multiple business lines; the construction product publishing module 603, It is set to publish the classification of the construction product to the server.
本申请实施例中提供的前端项目处理装置,从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码,基于目标源码进行相应的构建操作,得到目标项目对应的构建产物,其中,构建产物中包括多个业务线分别对应的多个网页文件,以及多个业务线对应的公用静态资源,将构建产物分类提交至对应的产物存放仓库,将产物存放仓库中的资源发布至服务端,其中,服务端采用预设目录结构对多个网页文件和所述公用静态资源进行分开存储。通过采用上述技术方案,针对一个前端项目对应多个业务线开发需求的情况,可以预先将对应的目标源码存放至该项目对应的目标源码存放仓库,在进行项目构建时,一次性构建出多个业务线分别对应的多个网页文件以及共同对应的公用静态资源并发布至服务端,简化了构建流程,提高构建效率,可减少开发成本,加快业务迭代速度。The front-end project processing device provided in the embodiment of the present application obtains target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built, and performs corresponding construction operations based on the target source code to obtain the construction corresponding to the target project. product, wherein the construction product includes multiple webpage files corresponding to multiple business lines and public static resources corresponding to multiple business lines, submit the construction product classification to the corresponding product storage warehouse, and store the resources in the product storage warehouse Published to the server, wherein the server uses a preset directory structure to store the plurality of webpage files and the public static resources separately. By adopting the above technical solution, for the situation that a front-end project corresponds to the development requirements of multiple business lines, the corresponding target source code can be stored in the target source code storage warehouse corresponding to the project in advance, and when the project is constructed, multiple projects can be constructed at one time. Multiple webpage files corresponding to business lines and public static resources corresponding to each other are published to the server, which simplifies the construction process, improves construction efficiency, reduces development costs, and speeds up business iteration.
本申请实施例提供了一种计算机设备,该计算机设备中可集成本申请实施例提供的前端项目处理装置。图7为本申请实施例提供的一种计算机设备的结构框图。计算机设备700包括存储器701、处理器702及存储在存储器701上并可在处理器702上运行的计算机程序,所述处理器702执行所述计算机程序时实现本申请实施例提供的前端项目处理方法。The embodiments of the present application provide a computer device, in which the front-end item processing apparatus provided by the embodiments of the present application can be integrated. FIG. 7 is a structural block diagram of a computer device according to an embodiment of the present application. The computer device 700 includes a memory 701, a processor 702, and a computer program that is stored in the memory 701 and can run on the processor 702. When the processor 702 executes the computer program, the front-end item processing method provided by the embodiment of the present application is implemented. .
本申请实施例提供了一种项目管理系统,包括本申请实施例提供的计算机 设备、仓库管理系统和服务器,其中,所述仓库管理系统设置为管理目标源码存放仓库,所述服务器设置为存储服务端接收的构建产物。The embodiments of the present application provide a project management system, including the computer equipment, the warehouse management system, and the server provided by the embodiments of the present application, wherein the warehouse management system is set to manage a target source code storage warehouse, and the server is set to a storage service The build product received by the end.
本申请实施例还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行本申请实施例提供的前端项目处理方法。其中,所述存储介质可以为非暂态存储介质。Embodiments of the present application further provide a storage medium containing computer-executable instructions, where the computer-executable instructions, when executed by a computer processor, are used to execute the front-end item processing method provided by the embodiments of the present application. Wherein, the storage medium may be a non-transitory storage medium.
上述实施例中提供的前端项目处理装置、设备以及存储介质可执行本申请任意实施例所提供的前端项目处理方法,具备执行该方法相应的功能模块和效果。未在上述实施例中详尽描述的技术细节,可参见本申请任意实施例所提供的前端项目处理方法。The front-end item processing apparatus, device, and storage medium provided in the foregoing embodiments can execute the front-end item processing method provided by any embodiment of the present application, and have corresponding functional modules and effects for executing the method. For technical details not described in detail in the foregoing embodiments, reference may be made to the front-end item processing method provided by any embodiment of the present application.

Claims (15)

  1. 一种前端项目处理方法,包括:A front-end project processing method, including:
    从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码;Obtain the target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built;
    基于所述目标源码进行构建操作,得到所述目标项目对应的构建产物,其中,所述构建产物中包括所述多个业务线分别对应的多个网页文件,以及所述多个业务线对应的公用静态资源;A construction operation is performed based on the target source code, and a construction product corresponding to the target project is obtained, wherein the construction product includes a plurality of webpage files corresponding to the plurality of business lines respectively, and a plurality of business lines corresponding to the plurality of business lines. public static resources;
    将所述构建产物分类发布至服务端。The classification of the construction product is published to the server.
  2. 根据权利要求1所述的方法,其中,基于所述目标源码进行构建操作,得到所述多个业务线分别对应的多个网页文件,包括:The method according to claim 1, wherein a construction operation is performed based on the target source code to obtain a plurality of webpage files corresponding to the plurality of business lines, comprising:
    按照所述多个业务线的总数确定目标数量;determining the target quantity according to the total number of the plurality of business lines;
    对所述目标源码中的网页文件模板进行预设次数的复制,得到所述目标数量的初始网页文件,其中,所述预设次数与所述目标数量相等;Copying the webpage file template in the target source code for a preset number of times to obtain the initial webpage file of the target number, wherein the preset number of times is equal to the target number;
    读取所述目标源码中的所述多个业务线分别对应的网页文件配置信息;Read the webpage file configuration information corresponding to the multiple business lines in the target source code;
    根据所述多个业务线分别对应的网页文件配置信息对所述目标数量的初始网页文件进行配置,得到所述多个业务线分别对应的多个网页文件。The initial webpage files of the target number are configured according to the webpage file configuration information corresponding to the multiple business lines respectively, to obtain multiple webpage files corresponding to the multiple business lines respectively.
  3. 根据权利要求2所述的方法,其中,所述网页文件配置信息包括替换配置信息;The method of claim 2, wherein the webpage file configuration information includes replacement configuration information;
    所述根据所述多个业务线分别对应的网页文件配置信息对所述目标数量的初始网页文件进行配置,包括:The configuring the initial webpage files of the target number according to the webpage file configuration information corresponding to the plurality of business lines respectively includes:
    将所述初始网页文件中预设字段中的初始内容替换为所述初始网页文件对应的替换配置信息中的目标内容。The initial content in the preset field in the initial web page file is replaced with the target content in the replacement configuration information corresponding to the initial web page file.
  4. 根据权利要求1所述的方法,其中,所述从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码,包括:The method according to claim 1, wherein the obtaining the target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be constructed comprises:
    获取所述待构建的目标项目对应的项目信息;Obtain project information corresponding to the target project to be constructed;
    根据所述项目信息判断是否满足预设自动构建条件,响应于满足所述预设自动构建条件,从所述待构建的目标项目对应的目标源码存放仓库中获取对应所述多个业务线的目标源码。According to the project information, it is determined whether the preset automatic construction conditions are met, and in response to the preset automatic construction conditions being met, the targets corresponding to the multiple business lines are obtained from the target source code storage warehouse corresponding to the target project to be constructed. source code.
  5. 根据权利要求4所述的方法,其中,所述项目信息包含分支标识;The method of claim 4, wherein the project information includes a branch identification;
    所述根据所述项目信息判断是否满足预设自动构建条件,包括:The judging whether the preset automatic construction conditions are met according to the project information includes:
    根据所述分支标识判断所述待构建的目标项目对应的分支是否为测试环境 分支或灰度环境分支,响应于所述待构建的目标项目对应的分支为所述测试环境分支或所述灰度环境分支,确定满足所述预设自动构建条件。Determine whether the branch corresponding to the target project to be built is a test environment branch or a grayscale environment branch according to the branch identifier, and respond that the branch corresponding to the target project to be built is the test environment branch or the grayscale environment branch The environment branch determines that the preset automatic construction condition is satisfied.
  6. 根据权利要求5所述的方法,在所述基于所述目标源码进行构建操作之前,还包括:The method according to claim 5, before the building operation based on the target source code, further comprising:
    判断所述目标源码中的依赖包版本是否与上一次执行构建操作的情况下的依赖包版本一致,响应于所述目标源码中的依赖包版本与所述上一次执行构建操作的情况下的依赖包版本一致,将本地已安装的依赖包确定为目标依赖包;Judging whether the version of the dependent package in the target source code is consistent with the version of the dependent package in the case of the last execution of the build operation, in response to the version of the dependent package in the target source code and the version of the dependent package in the case of the last execution of the construction operation The package version is the same, and the locally installed dependency package is determined as the target dependency package;
    所述基于所述目标源码进行构建操作,包括:The building operation based on the target source code includes:
    基于所述目标源码和所述目标依赖包进行构建操作。The construction operation is performed based on the target source code and the target dependency package.
  7. 根据权利要求6所述的方法,在所述判断所述目标源码中的依赖包版本是否与上一次执行构建操作的情况下的依赖包版本一致之后,还包括:The method according to claim 6, after judging whether the version of the dependent package in the target source code is consistent with the version of the dependent package in the case of the last execution of the build operation, further comprising:
    响应于所述目标源码中的依赖包版本与所述上一次执行构建操作的情况下的依赖包版本不一致,根据所述目标源码中的依赖包版本下载依赖包安装文件,并安装所述依赖包安装文件,得到所述目标依赖包;In response to the inconsistency between the version of the dependent package in the target source code and the version of the dependent package in the case of the last execution of the build operation, download the dependent package installation file according to the version of the dependent package in the target source code, and install the dependent package Install the file to obtain the target dependency package;
    对所述目标源码中的依赖包版本和所述目标依赖包进行存储。Store the dependency package version in the target source code and the target dependency package.
  8. 根据权利要求4所述的方法,在所述根据所述项目信息判断是否满足预设自动构建条件之后,还包括:The method according to claim 4, after judging whether a preset automatic construction condition is satisfied according to the project information, further comprising:
    响应于不满足所述预设自动构建条件,确定所述目标项目对应的分支是生产环境分支;In response to not satisfying the preset automatic construction condition, determining that the branch corresponding to the target project is a production environment branch;
    在检测到预设构建事件被触发的情况下,从所述待构建的目标项目对应的目标源码存放仓库中获取对应所述多个业务线的目标源码。When it is detected that a preset construction event is triggered, the target source code corresponding to the multiple business lines is obtained from the target source code storage warehouse corresponding to the target project to be built.
  9. 根据权利要求8所述的方法,在所述基于所述目标源码进行构建操作之前,还包括:The method according to claim 8, before the building operation based on the target source code, further comprising:
    判断本地是否存在已安装的灰度环境的依赖包,响应于本地不存在已安装的灰度环境的依赖包,返回构建失败信息;响应于本地存在已安装的灰度环境的依赖包,判断所述目标源码中的依赖包版本是否与上一次执行构建操作的情况下的灰度环境的依赖包的依赖包版本一致,响应于所述目标源码中的依赖包版本与所述上一次执行构建操作的情况下的灰度环境的依赖包的依赖包版本一致,将本地已安装的依赖包确定为目标依赖包,响应于所述目标源码中的依赖包版本与所述上一次执行构建操作的情况下的灰度环境的依赖包的依赖包版本不一致,返回构建失败信息。Determine whether there is a dependency package of the installed grayscale environment locally, and in response to the absence of a locally installed dependency package of the grayscale environment, return the build failure information; In response to the existence of a locally installed dependency package of the grayscale environment, determine the Whether the version of the dependent package in the target source code is consistent with the version of the dependent package of the grayscale environment in the case of the last execution of the build operation, in response to the version of the dependent package in the target source code and the last execution of the build operation In the case of the grayscale environment, the dependency package version of the dependency package is consistent, and the locally installed dependency package is determined as the target dependency package, in response to the dependency package version in the target source code and the last execution of the build operation. The version of the dependent packages of the dependent packages under the grayscale environment is inconsistent, and the build failure information is returned.
  10. 根据权利要求1所述的方法,其中,所述公用静态资源中包括资源地图文件;The method according to claim 1, wherein the public static resource includes a resource map file;
    所述将所述构建产物分类发布至服务端,包括:The classification and publishing of the construction product to the server includes:
    将所述多个网页文件和所述公用静态资源中除所述资源地图文件之外的资源发布至内容分发网络服务端;Publishing resources other than the resource map file in the plurality of webpage files and the public static resources to the content distribution network server;
    将资源地图文件存放仓库中的所述资源地图文件发布至业务日志监控服务端。The resource map file in the resource map file storage warehouse is published to the business log monitoring server.
  11. 根据权利要求1所述的方法,其中,所述服务端采用相对路径对所述多个网页文件和所述公用静态资源进行分开存储。The method according to claim 1, wherein the server uses a relative path to store the plurality of webpage files and the public static resources separately.
  12. 一种前端项目处理装置,包括:A front-end item processing device, comprising:
    目标源码获取模块,设置为从待构建的目标项目对应的目标源码存放仓库中获取对应多个业务线的目标源码;The target source code obtaining module is set to obtain target source code corresponding to multiple business lines from the target source code storage warehouse corresponding to the target project to be built;
    项目构建模块,设置为基于所述目标源码进行构建操作,得到所述目标项目对应的构建产物,其中,所述构建产物中包括所述多个业务线分别对应的多个网页文件,以及所述多个业务线对应的公用静态资源;A project building module, configured to perform a construction operation based on the target source code to obtain a construction product corresponding to the target project, wherein the construction product includes a plurality of webpage files corresponding to the plurality of business lines, and the Public static resources corresponding to multiple business lines;
    构建产物发布模块,设置为将所述构建产物分类发布至服务端。A construction product release module is configured to release the construction product classification to the server.
  13. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如权利要求1-11中任一项所述的前端项目处理方法。A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the computer program as described in claims 1-11 when the processor executes the computer program Any one of the front-end item processing methods.
  14. 一种项目管理系统,包括如权利要求13所述的计算机设备、仓库管理系统和服务器,其中,所述仓库管理系统设置为管理目标源码存放仓库,所述服务器设置为存储服务端接收的构建产物。A project management system, comprising computer equipment as claimed in claim 13, a warehouse management system and a server, wherein the warehouse management system is set to manage a target source code storage warehouse, and the server is set to store the build products received by the server .
  15. 一种计算机可读存储介质,存储有计算机程序,其中,所述程序被处理器执行时实现如权利要求1-11中任一所述的前端项目处理方法。A computer-readable storage medium storing a computer program, wherein when the program is executed by a processor, the front-end item processing method according to any one of claims 1-11 is implemented.
PCT/CN2021/136647 2020-12-10 2021-12-09 Front-end project processing method and apparatus, device, management system, and storage medium WO2022121971A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202180075173.8A CN117693734A (en) 2020-12-10 2021-12-09 Front-end item processing method, device, equipment, management system and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011457915 2020-12-10
CN202011457915.7 2020-12-10

Publications (1)

Publication Number Publication Date
WO2022121971A1 true WO2022121971A1 (en) 2022-06-16

Family

ID=81974244

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/136647 WO2022121971A1 (en) 2020-12-10 2021-12-09 Front-end project processing method and apparatus, device, management system, and storage medium

Country Status (2)

Country Link
CN (1) CN117693734A (en)
WO (1) WO2022121971A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116069325A (en) * 2023-01-28 2023-05-05 深圳市明源云采购科技有限公司 Front-end project construction method, device, equipment and computer readable storage medium
CN116627419A (en) * 2023-07-24 2023-08-22 中国电信股份有限公司 Front-end service packaging method and related equipment
CN117421039A (en) * 2023-12-18 2024-01-19 北京中诺链捷数字科技有限公司 Version information generation method, device and equipment of front-end Vue engineering and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130117733A1 (en) * 2011-11-09 2013-05-09 Microsoft Corporation Simultaneously targeting multiple homogeneous and heterogeneous runtime environments
CN109634647A (en) * 2018-12-25 2019-04-16 苏州思必驰信息科技有限公司 The construction method and system of large-scale front end project
CN110413272A (en) * 2019-07-30 2019-11-05 广州市百果园信息技术有限公司 Front end project build method, apparatus, storage medium and equipment
CN111273898A (en) * 2020-02-25 2020-06-12 安徽以萨数据技术有限公司 Web front-end code automatic construction method, system and storage medium
CN111352649A (en) * 2018-12-24 2020-06-30 北京嘀嘀无限科技发展有限公司 Code processing method, device, server and readable storage medium
CN111813379A (en) * 2019-04-11 2020-10-23 阿里巴巴集团控股有限公司 Application deployment method and device, electronic equipment and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130117733A1 (en) * 2011-11-09 2013-05-09 Microsoft Corporation Simultaneously targeting multiple homogeneous and heterogeneous runtime environments
CN111352649A (en) * 2018-12-24 2020-06-30 北京嘀嘀无限科技发展有限公司 Code processing method, device, server and readable storage medium
CN109634647A (en) * 2018-12-25 2019-04-16 苏州思必驰信息科技有限公司 The construction method and system of large-scale front end project
CN111813379A (en) * 2019-04-11 2020-10-23 阿里巴巴集团控股有限公司 Application deployment method and device, electronic equipment and computer readable storage medium
CN110413272A (en) * 2019-07-30 2019-11-05 广州市百果园信息技术有限公司 Front end project build method, apparatus, storage medium and equipment
CN111273898A (en) * 2020-02-25 2020-06-12 安徽以萨数据技术有限公司 Web front-end code automatic construction method, system and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CAI BING , WANG XIAONAN: "Front-end Engineering Implementation of Mobile Web Applications", JOURNAL OF CHANGSHA UNIVERSITY, vol. 34, no. 5, 15 September 2020 (2020-09-15), pages 48 - 51, XP055941435, ISSN: 1008-4681 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116069325A (en) * 2023-01-28 2023-05-05 深圳市明源云采购科技有限公司 Front-end project construction method, device, equipment and computer readable storage medium
CN116069325B (en) * 2023-01-28 2023-08-04 深圳市明源云采购科技有限公司 Front-end project construction method, device, equipment and computer readable storage medium
CN116627419A (en) * 2023-07-24 2023-08-22 中国电信股份有限公司 Front-end service packaging method and related equipment
CN117421039A (en) * 2023-12-18 2024-01-19 北京中诺链捷数字科技有限公司 Version information generation method, device and equipment of front-end Vue engineering and storage medium
CN117421039B (en) * 2023-12-18 2024-02-27 北京中诺链捷数字科技有限公司 Version information generation method, device and equipment of front-end Vue engineering and storage medium

Also Published As

Publication number Publication date
CN117693734A (en) 2024-03-12

Similar Documents

Publication Publication Date Title
WO2022121971A1 (en) Front-end project processing method and apparatus, device, management system, and storage medium
US10379845B2 (en) Source to image transformation pipeline for a platform-as-a-service system
US9367305B1 (en) Automatic container definition
US9582268B2 (en) Automatic communications graphing for a source application
US9262193B2 (en) Multi-tier platform-as-a-service deployment reduced to single-tier architecture for development
US8370802B2 (en) Specifying an order for changing an operational state of software application components
EP3035191B1 (en) Identifying source code used to build executable files
US10540147B2 (en) Add-on image for a platform-as-a-service system
CN107783816A (en) The method and device that creation method and device, the big data cluster of virtual machine create
US11714747B2 (en) Executing integration scenario regression tests in customer landscapes
US11580008B2 (en) Method and system for synchronous development and testing of live, multi-tenant microservices based SaaS systems
US11853752B2 (en) Migration of web applications between different web application frameworks
CN116301951B (en) Micro-service application installation upgrading method and device based on kubernetes
Freeman Essential docker for asp. net Core mvc
US20230083849A1 (en) Parsing tool for optimizing code for deployment on a serverless platform
US8700693B2 (en) Extensible mechanism for executing server side code
Sebastian Transform monolith into microservices using docker
US10768911B2 (en) Managing software components for software application development
Anurag Distributed computing with Go: practical concurrency and parallelism for Go applications
US11966723B2 (en) Automatic management of applications in a containerized environment
Yli-Länttä Docker container environment for SoC SW development
CN107092470B (en) Widget registration method and device
Nelson Starting Development
Edge et al. A Culture of Automation and Continual Testing
CN113553065A (en) Code file publishing method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21902676

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180075173.8

Country of ref document: CN

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21902676

Country of ref document: EP

Kind code of ref document: A1