A project construction method and device
By setting feature marks in project configuration information and listening to developer operations, dynamically compiling project files, solving the problem that existing build tools manage a single project, cannot flexibly modify webpack configurations, and can only be installed online, achieving efficient management and visual development of multiple project files.
Patent Information
- Application Number
- CN201911165865.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-25
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2039-11-25
AI Technical Summary
Existing build tools can only manage a single project, and cannot flexibly modify webpack configuration. The dependency package can only be installed online, and the development interface is not visible.
By setting feature marks in the project configuration information, and compiling project files based on feature marks, the startup management of multiple project files is realized. At the same time, it monitors developers' operations on project files, dynamically compiles project files, provides plug-in application program interfaces to flexibly modify package configuration information, and has built-in dependency packages for offline installation.
It realizes the startup management of multiple project files, improves compilation efficiency, saves resource overhead, supports visual development, provides flexible packaging configuration modification and offline dependency package installation, significantly improving development efficiency.
Smart Images

Figure CN112835568B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a project construction method and device. Background Art
[0002] In recent years, front-end technology has flourished like mushrooms after rain. With the emergence of new technologies such as ES6 modules, Babel conversion, and webpack packaging, front-end applications can be completed in a modular way, which is easy to maintain. With the continuous development of front-end technology, front-end developers need to spend a lot of energy to focus on processes such as module dependencies and file packaging in the development and construction stages, which reduces development efficiency to a certain extent. Therefore, out-of-the-box construction tools are favored by front-end developers, such as Creat-react-app.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] Existing build tools can only manage a single project; the development interface is not visible; the webpack configuration cannot be flexibly modified; and dependent packages can only be installed online. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a project construction method and device, which sets feature tags for project files in project configuration information to compile project files based on the feature tags, thereby realizing startup management of multiple project files.
[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a project construction method is provided.
[0007] A project construction method according to an embodiment of the present invention includes: obtaining basic project information and a project template, modifying project configuration information according to the basic project information to generate multiple project files; wherein the project configuration information includes feature tags set for the project files; scanning folders belonging to a target directory to determine a project management list according to the feature tags; executing a startup command on the project files belonging to the project management list to use a packaging tool to compile the project files according to predefined packaging configuration information to generate a first static file.
[0008] Optionally, before the step of using a packaging tool to compile the project file according to predefined packaging configuration information, the method further includes: monitoring whether there is a setting operation for the project files belonging to the project management list; if the setting operation is not detected for the project files belonging to the project management list, no processing is performed; using a packaging tool to compile the project file according to the predefined packaging configuration information includes: if the setting operation is detected for the project files belonging to the project management list, using the packaging tool to compile the project file according to the predefined packaging configuration information.
[0009] Optionally, the setting operation is to perform a modification or a saving operation on the project file.
[0010] Optionally, the method further includes: executing a build command on the project files belonging to the project management list, so as to package the project files using a packaging tool to generate a second static file.
[0011] Optionally, the method also includes: detecting and setting a port set, determining a target port, so that when executing the start command, the target port is specified as a port of a local development environment; starting the local development environment, receiving an access request sent through the target port, so as to display the first static file on a browser.
[0012] Optionally, the method further includes: receiving updated packaging configuration information through an application program interface in the form of a plug-in; and compiling the project file according to the predefined packaging configuration information, including: compiling the project file according to the updated packaging configuration information.
[0013] Optionally, the method further comprises: embedding dependency packages used by the local development environment and the production environment to install the dependency packages offline.
[0014] To achieve the above objective, according to another aspect of an embodiment of the present invention, a project construction device is provided.
[0015] A project construction device according to an embodiment of the present invention includes: a project creation module, which is used to obtain basic project information and a project template, and modify project configuration information according to the basic project information to generate multiple project files; wherein the project configuration information includes feature tags set for the project files; a project management module, which is used to scan folders belonging to a target directory to determine a project management list according to the feature tags; and a project startup module, which is used to execute a startup command on a project file belonging to the project management list, so as to use a packaging tool to compile the project file according to predefined packaging configuration information to generate a first static file.
[0016] Optionally, the device also includes: a monitoring processing module, used to monitor whether there is a setting operation in the project files belonging to the project management list; if the setting operation is not detected in the project files belonging to the project management list, no processing is performed; the project startup module is also used to: if the setting operation is detected in the project files belonging to the project management list, use a packaging tool to compile the project files according to predefined packaging configuration information.
[0017] Optionally, the setting operation is to perform a modification or a saving operation on the project file.
[0018] Optionally, the device further comprises: a project construction module, configured to execute a construction command on a project file belonging to the project management list, so as to package the project file using a packaging tool to generate a second static file.
[0019] Optionally, the device also includes: a display module, used to detect a set port set and determine a target port, so that when executing the start command, the target port is specified as the port of the local development environment; start the local development environment, receive an access request sent through the target port, and display the first static file on the browser.
[0020] Optionally, the device further comprises: an information updating module for receiving updated packaging configuration information through an application program interface in the form of a plug-in; compiling the project file according to the predefined packaging configuration information comprises: compiling the project file according to the updated packaging configuration information.
[0021] Optionally, the device further comprises: a built-in module, used to embed dependency packages used by the local development environment and the production environment, so as to install the dependency packages offline.
[0022] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.
[0023] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a project construction method according to an embodiment of the present invention.
[0024] To achieve the above objective, according to another aspect of the embodiments of the present invention, a computer readable medium is provided.
[0025] A computer-readable medium according to an embodiment of the present invention stores a computer program, which, when executed by a processor, implements a project construction method according to an embodiment of the present invention.
[0026] An embodiment of the above invention has the following advantages or beneficial effects: setting feature tags for project files in project configuration information, compiling project files based on feature tags, and realizing startup management of multiple project files; determining the project files that need to be compiled by monitoring whether the developer has set actions on the project files, thereby improving compilation efficiency and saving resource overhead; after the developer completes the development, the build command can be executed to complete the construction of the production environment; starting the server locally, so that the developer can access the server in the browser to view the content of the current project, realizing visual development; providing an application program interface in the form of a plug-in to flexibly modify the packaging configuration information; and having a built-in dependency package to realize offline installation of the dependency package.
[0027] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0029] Figure 1 is a schematic diagram of the main steps of a project construction method according to an embodiment of the present invention;
[0030] Figure 2 is a main flow chart of a project construction method according to another embodiment of the present invention;
[0031] Figure 3 is a schematic diagram of the main flow of a project construction method according to another embodiment of the present invention;
[0032] Figure 4 is a schematic diagram of the main process of a project construction method according to yet another embodiment of the present invention;
[0033] Figure 5 is a schematic diagram of main modules of a project construction device according to an embodiment of the present invention;
[0034] Figure 6 is a schematic diagram of main modules of a project construction device according to another embodiment of the present invention;
[0035] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0036] Figure 8 It is a schematic diagram of the structure of a computer device suitable for implementing the electronic device of the embodiment of the present invention. DETAILED DESCRIPTION
[0037] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0038] The technical terms involved in the present invention are explained below.
[0039] ES6: is the next generation standard of JavaScript language.
[0040] Babel: is a JavaScript compiler.
[0041] Webpack: It mainly packages JavaScript files together, and the packaged files are used in browsers.
[0042] JavaScript: An interpreted scripting language.
[0043] Creact-react-app: Used to build a React development environment. React is a JavaScript library for building user interfaces.
[0044] git: distributed version control system.
[0045] Figure 1 FIG. 1 is a schematic diagram of the main steps of a project construction method according to an embodiment of the present invention. Figure 1 As shown, the project construction method of the embodiment of the present invention mainly includes the following steps:
[0046] Step S101: Obtain basic project information and project templates, and modify project configuration information according to the basic project information to generate multiple project files. This step is used to create a new project. The basic project information includes the project name, project description, etc. The project description includes the executed command and the task that needs to be executed corresponding to the command. The project template is a designed web page. The project configuration information includes the project name, version number, git repository address, feature tags, etc., wherein the feature tags are used to identify whether the project is a project developed by a specified tool. Modifying the project configuration information is to write the project name, project description, version number, etc. based on the basic project information entered by the user. Generate a project file based on the project configuration information and the project template.
[0047] Step S102: Scan the folders belonging to the target directory to determine the project management list according to the feature mark. Scan all the folders under the target directory, each of which contains project configuration information. According to the value of the feature mark of the project configuration information, determine whether the project is a project developed by a specified tool. Extract the projects developed by the specified tool and obtain the project management list. For example, set the feature mark corresponding to the project developed by the specified tool to 1, and set the feature mark corresponding to the project developed by the non-specified tool to 9, then you can extract the project with the feature mark of 1 to obtain the project management list.
[0048] Step S103: Execute a start command on the project files belonging to the project management list, so as to use a packaging tool to compile the project files according to the predefined packaging configuration information to generate a first static file. Executing the start command is to execute the npm start command to start the local development environment, and then use a packaging tool, such as webpack, to compile the project files included in the project management list according to the packaging configuration information to generate a first static file. Among them, the packaging configuration information includes entry files, exit files, loaders, plug-ins, etc., which are used to load resources and package resources. The server can be started locally later, and the developer can access the server in a browser to view the content of the first static file.
[0049] The project developed by the developer may be a complete web application or just a block of a web application. A block is a part of an application that does not have complete application integrity. Developing blocks can facilitate functional reuse, so it is necessary to manage the project, especially the management of projects with multiple block types. Figure 2 Provide detailed explanation.
[0050] Figure 2 FIG. 1 is a schematic diagram of the main flow of a project construction method according to another embodiment of the present invention. Figure 2 As shown, the project construction method (the device and project construction device corresponding to the method) of the embodiment of the present invention mainly includes the following steps:
[0051] Step S201: Obtain the basic information of the project and the project template, and modify the project configuration information according to the basic information of the project to generate multiple project files. The basic information of the project is input by the developer, including the project name, project description, etc. Project description, for example: commit: "git-cz", commit is the command to be executed, and git-cz is the task that the computer operating system will perform when the command is executed. Then copy the project template to the local, where the project template can be custom generated. Modify the project configuration information, and write the project name, project description, version number and other information in the project configuration information according to the developer's input. Determine the dependent packages required for the project based on the project template, and the project configuration information and dependent packages constitute the project files.
[0052] There are multiple projects that developers need to build, and the projects need to be managed. The management content includes project startup, update, and construction. In this embodiment, a feature flag is set in the project configuration information to indicate whether the project is a project created by a specified tool. In a preferred embodiment, the project configuration information is a package.json file, and an attribute field is set in the package.json file to mark whether the project is created by the project construction device of this embodiment.
[0053] Step S202: Scan the folders belonging to the target directory to determine the project management list according to the feature tags of the project configuration information. Scan all folders under the current first-level directory. By default, one folder is one project, and there is a package.json file under each folder. Based on the attribute field in the package.json file, mark whether the project is created by the project construction device of this embodiment. After the scan is completed, the project management list of all projects created by the project construction device of this embodiment under the current first-level directory can be obtained.
[0054] Step S203: Monitor whether there is a setting operation for the project files belonging to the project management list. If there is a setting operation, execute step S204; if there is no setting operation, do not process it. The setting operation is to modify or save the project file. After the project is started, lazy compilation is used by default, that is, all projects are not compiled at the beginning to save time and resource overhead, and this method supports hot updates to improve the developer experience. Specifically: when the developer opens the corresponding code of the project file and modifies or saves the project file code, this implementation can monitor the above behavior of the developer, and then compile the project files with the above behavior, and the remaining project files are not processed.
[0055] Step S204: Read predefined packaging configuration information, execute a startup command on the project file with the setting operation to start the local development environment, and use the packaging tool to generate the first static file. The packaging configuration information is customized by the developer, including entry files, exit files, loaders, plug-ins, etc.
[0056] In the embodiment, the packaging tool is webpack. Execute the npm start command to start the local development environment, use the webpackDevServer command to start the local server, and then use webpack to compile the project file to generate the first static file. Among them, webpackDevServer is a small Express server officially provided by webpack. In a preferred embodiment, when starting the local development environment, the background service can be started to display the configuration information of the current project.
[0057] Step S205: Detect the set port set and determine the target port, so that when executing the start command, the target port is designated as the port of the local server. Detect the currently available ports and determine an available port as the target port. When executing the npm start command, the determined target port is used as the port of the local server.
[0058] Step S206: receiving an access request sent through the target port to display the first static file on the browser. The developer accesses the server of the local development environment through the target port, and the server feeds the first static file back to the browser of the client for display, so that the developer can view the content of the first static file.
[0059] Figure 2 The embodiment shown implements project development in the local development environment, and developers can see the project content through the specified server. After the developer completes the development, he can also build the code for the production environment. After the construction is completed, the developer can upload it to different servers according to his needs for users to browse. Figure 3 Provide detailed explanation.
[0060] Figure 3 FIG. 1 is a schematic diagram of the main flow of a project construction method according to another embodiment of the present invention. Figure 3 As shown, the project construction method of the embodiment of the present invention mainly includes the following steps:
[0061] Step S301: Obtain basic project information and a project template, and modify project configuration information according to the basic project information to generate multiple project files. The implementation process of this step is the same as step S201, and will not be repeated here.
[0062] Step S302: Scan the folders belonging to the target directory to determine the project management list according to the feature mark of the project configuration information. The implementation process of this step is the same as step S202, and will not be repeated here.
[0063] Step S303: monitor whether there is a setting operation for the project file belonging to the project management list, if there is a setting operation, execute step S304; if there is no setting operation, do not process. The implementation process of this step is the same as step S203, and will not be repeated here.
[0064] Step S304: Read the defined packaging configuration information, execute the startup command for the project file with the setting operation, start the local development environment, and use the packaging tool to generate the first static file. The implementation process of this step is the same as step S204, and will not be repeated here.
[0065] Step S305: Detect the set port set and determine the target port, so that when executing the start command, the target port is designated as the port of the local development environment. The implementation process of this step is the same as step S205, and will not be repeated here.
[0066] Step S306: receiving the access request sent through the target port to display the first static file on the browser. The implementation process of this step is the same as step S206, and will not be repeated here.
[0067] Step S307: Read the packaging configuration information, execute the build command for the project file with the setting operation, and use the packaging tool to package the project file to generate a second static file. Execute the nmp build command to complete the construction of the production environment. This command will produce a file with a hash value. In the embodiment, the -nohash parameter can be used to remove the hash value. Code compression, code quality and syntax checking are completed during the construction process. Use webpack to compile the project file to generate the second static file.
[0068] It should be noted that when executing the build command, you can package the specified project files (that is, the project files with set operations), or you can build all project files in the current folder at the same time, which is convenient for managing multiple sub-projects.
[0069] Step S308: deploy the second static file to the server so that the second static file can be browsed through the server. After the construction is completed, the developer can upload it to different servers according to his own needs for users to browse. Assuming that the project file is a code file corresponding to an html (hyper text markup language) web page, the static file is compiled by webpack, and the html web page can be seen by opening the static file in the browser.
[0070] The project created in the above embodiment is mainly developed using the react framework. The supporting dependency packages are react and react-dom. If data management is required, the redux dependency package or the mobxredux dependency package is used; if a ui (user interface) library is required, the antd dependency package is used. The installation of these dependency packages usually requires visiting foreign websites. If installed online, the installation speed is very slow, and the installation fails for a long time. There may be a series of error messages, which wastes a lot of developer time.
[0071] In order to solve the above problems, in a preferred embodiment, the dependency package can be built into the project construction device, and the user can install these dependency packages when installing the project construction device of this embodiment. Specifically, if the local network is abnormal, when the yarn install command is used to install the dependency package, local resources will be used by default, and the dependency package will be directly installed into the project. If the local network is normal, when the yarn install command is used to install the dependency package, local resources will still be used, which greatly reduces the time to install the dependency package and avoids the possibility of installation errors. In addition, for projects of multiple block types, the built-in dependency package method can quickly create blocks without installing dependency packages for each block, thereby improving development efficiency.
[0072] Figure 4 FIG. 1 is a schematic diagram of the main flow of a project construction method according to another embodiment of the present invention. Figure 4 As shown, the project construction method of the embodiment of the present invention mainly includes the following steps:
[0073] Step S401: Install the project building device and initialize the project. Developers can use the npm installrocketact –g command to install globally. The project building device of this embodiment is installed in the global directory, and the device can be used to create, develop, and build projects at any location on the computer.
[0074] Use the rocketact createprojectName command in the project directory to initialize the project. During the initialization process, the project construction device of this embodiment will download the files and dependent packages required for the initialization project. These files include html, css, js and other files, and dependent packages such as react, vue, etc. After the initialization is completed, the project can be developed.
[0075] Step S402: Start the local development project. Before starting the project, it is necessary to agree that the entry file under the page folder of the project root directory is the same as the html file name to facilitate identification by the packaging tool. The entry file is the first file when the system is accessed. In this embodiment, the project can contain a single page or multiple pages. A single page refers to switching different content in only one page by relying on routing, and multiple pages refers to switching content on multiple pages by relying on routing. If the project contains multiple pages, multiple entry files can be created, that is, create an entry file for each page. When using the packaging tool for packaging later, you need to read the directory to determine whether a single page or multiple pages are being built.
[0076] Execute the npm start command to start the local development environment. The local development environment supports basic functions such as SASS precompilation, hot update, code checking, etc. When executing the npm start command at the same time, the port number of the local development environment can be specified. In the embodiment, the port parameter is used as the port number to start the local server and access the port number. After the local development environment is started, a visual web interface will be generated, in which page management and dependency management can be performed, and operations such as upgrading dependency packages, deleting dependency packages, and installing new dependency packages can be completed. And there is no need to close the development environment or open multiple command line windows, which brings great convenience to front-end developers.
[0077] In the development stage, if the img tag references a local image, the ES6 syntax can be used to complete the image import; if the image is introduced from CSS, the relative path reference method can be used to reference it. The project construction device of this embodiment will eventually complete the loading and construction of the image. The specific implementation of this step is shown in step S201 and step S206, which will not be repeated here.
[0078] Step S403: Modify the packaging configuration information. The project construction device contains predefined packaging configuration information. Developers can modify the packaging configuration information in the form of plug-ins. In this embodiment, the plug-ins add the modified configuration to the project construction device in the form of webpack-chain, which is convenient for developers to flexibly customize according to their business needs.
[0079] In the embodiment, the plug-in includes three application programming interfaces (APIs): chainWebpack, registerCommand, and resolveWebpackConfig. Among them, chainWebpack is used to modify the packaging configuration information through chain operations; registerCommand is used to register commands, and when the corresponding command is executed, the registered content can be executed; resolveWebpackConfig is used to retrieve the resolved packaging configuration information.
[0080] Step S404: Build the production environment. After the developer completes the development, the code for the production environment needs to be built. The production environment can be built by executing the npm build command. The specific implementation of this step is shown in steps S307 and S308, which will not be repeated here. The code compression, code quality and syntax check are completed during the construction process. After the construction is completed, the developer can upload it to different servers according to their needs for users to browse.
[0081] It can be seen from the project construction method of the embodiment of the present invention that feature tags are set for project files in the project configuration information, and project files are compiled based on the feature tags, thereby realizing the startup management of multiple project files; by monitoring whether the developer has set actions on the project files, the project files that need to be compiled are determined, thereby improving compilation efficiency and saving resource overhead; after the developer completes the development, the build command can be executed to complete the construction of the production environment; the server is started locally, so that the developer can access the server in a browser to view the content of the current project, thereby realizing visual development; an application program interface in the form of a plug-in is provided to flexibly modify the packaging configuration information; a built-in dependency package is used to realize offline installation of the dependency package.
[0082] Figure 5 FIG. 1 is a schematic diagram of the main modules of a project construction device according to an embodiment of the present invention. Figure 5 As shown, the project construction device 500 of the embodiment of the present invention mainly includes:
[0083] The project creation module 501 is used to obtain basic project information and project templates, and to modify project configuration information according to the basic project information to generate multiple project files. This module is used to create a new project. The basic project information includes the project name, project description, etc. The project description includes the executed command and the task to be executed corresponding to the command. The project template is a web page that has been designed. The project configuration information includes the project name, version number, git repository address, feature tags, etc., wherein the feature tags are used to identify whether the project is a project developed by a specified tool. Modifying the project configuration information is to write the project name, project description, version number, etc. based on the basic project information entered by the user. Generate a project file based on the project configuration information and the project template.
[0084] The project management module 502 is used to scan the folders belonging to the target directory to determine the project management list according to the feature mark. All folders under the target directory are scanned, each of which contains project configuration information. According to the value of the feature mark of the project configuration information, it is determined whether the project is a project developed by a specified tool. The projects developed by the specified tool are extracted to obtain a project management list. For example, the feature mark corresponding to the project developed by the specified tool is set to 1, and the feature mark corresponding to the project developed by the non-specified tool is set to 9, then the project with the feature mark of 1 can be extracted to obtain a project management list.
[0085] The project startup module 503 is used to execute a startup command on the project file belonging to the project management list, so as to use a packaging tool to compile the project file according to the predefined packaging configuration information to generate a first static file. Executing the startup command is to execute the npm start command to start the local development environment. After the local development environment is started, a visual web interface is opened by default, in which page management and dependency management can be performed.
[0086] Then use a packaging tool, such as webpack, to compile the project files included in the project management list according to the packaging configuration information to generate the first static file. The packaging configuration information includes entry files, exit files, loaders, plug-ins, etc., which are used to load resources and package resources. The server can be started locally later, and the developer can access the server in the browser to view the content of the first static file.
[0087] In addition, the project construction device 500 of the embodiment of the present invention may also include: a monitoring processing module, a display module, an information updating module and a built-in module ( Figure 5 The monitoring processing module is used to monitor whether there is a setting operation on the project files belonging to the project management list; if no setting operation is detected on the project files belonging to the project management list, no processing is performed.
[0088] The display module is used to detect the set port set and determine the target port so that when executing the startup command, the target port is specified as the port of the local development environment; the local development environment is started, and an access request sent through the target port is received to display the first static file on the browser.
[0089] The information update module is used to receive updated packaging configuration information through an application program interface in the form of a plug-in; compile the project file according to the predefined packaging configuration information, including: compiling the project file according to the updated packaging configuration information. The built-in module is used to embed the dependency packages used by the local development environment and the production environment to install the dependency packages offline.
[0090] Figure 6 6 is a schematic diagram of the main modules of a project construction device according to another embodiment of the present invention. As shown in FIG6, a project construction device 600 according to an embodiment of the present invention mainly includes: a project creation module 501, a project management module 502, a project startup module 503 and a project construction module 604. The project management module 502 manages the execution of the project startup module 503 and the project construction module 604. Among them, the project construction module 604 is used to execute a construction command on a project file belonging to a project management list, so as to package the project file using a packaging tool to generate a second static file.
[0091] As can be seen from the above description, the present embodiment provides developers with a flexible, convenient, and visual construction tool (i.e., a project construction device), reduces the difficulty of project construction, can support multiple platforms such as Windows and Mac, and can intuitively view the current project page and dependent packages through a visual interface. At the same time, the visual construction tool facilitates developers to flexibly manage pages and dependent packages, and the installation of dependent packages can be completed without closing the current development process. The flexible plug-in mechanism can facilitate developers to customize webpack according to their own business. Provide multi-project management functions to facilitate developers to develop multiple projects at the same time. Provide offline installation functions to provide convenience for developers and improve the work efficiency of developers.
[0092] Figure 7 An exemplary system architecture 700 is shown to which the project construction method or project construction device according to the embodiment of the present invention can be applied.
[0093] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0094] Users can use terminal devices 701, 702, and 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0095] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0096] The server 705 may be a server that provides various services, such as a background management server that an administrator processes the basic project information sent by the terminal devices 701, 702, and 703. The background management server may modify project configuration information, generate project files, scan target directories, execute startup commands, and other data processing, and feed back the processing results (such as the first static file) to the terminal device.
[0097] It should be noted that the project construction method provided in the embodiment of the present application is generally executed by the server 705 , and accordingly, the project construction device is generally set in the server 705 .
[0098] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0099] According to an embodiment of the present invention, the present invention also provides an electronic device and a computer-readable medium.
[0100] The electronic device of the present invention comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a project construction method of an embodiment of the present invention.
[0101] The computer-readable medium of the present invention stores a computer program thereon, and when the program is executed by a processor, a project construction method of an embodiment of the present invention is implemented.
[0102] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 suitable for implementing an electronic device of an embodiment of the present invention. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0103] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the computer system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0104] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0105] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the main step diagram. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0106] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0107] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0108] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a project creation module, a project management module, and a project startup module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the project creation module may also be described as a "module that obtains basic project information and a project template, modifies project configuration information according to the basic project information, and generates multiple project files."
[0109] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining basic project information and project templates, modifying project configuration information according to the basic project information, so as to generate multiple project files; wherein the project configuration information includes feature tags set for the project files; scanning folders belonging to the target directory to determine the project management list according to the feature tags; executing a startup command for the project files belonging to the project management list, so as to use a packaging tool to compile the project files according to the predefined packaging configuration information, and generate a first static file.
[0110] It can be seen from the above description that feature tags are set for project files in the project configuration information so as to compile the project files based on the feature tags, thereby realizing startup management of multiple project files.
[0111] The above product can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.
[0112] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A project construction method, characterized in that: include: Obtaining basic project information and a project template, and modifying project configuration information according to the basic project information to generate a plurality of project files; wherein the project configuration information includes a feature tag set for the project file; the feature tag is used to identify whether the project is a project developed by a specified tool; Scanning folders belonging to the target directory to determine a project management list based on the characteristic tags; Executing a start command on a project file belonging to the project management list, so as to use a packaging tool to compile the project file according to predefined packaging configuration information to generate a first static file; Detecting and setting the port set, determining the target port, so that when executing the start command, the target port is designated as the port of the local development environment; Starting the local development environment and the local server, and receiving an access request sent through the target port, so that the local server feeds the first static file back to the browser, so as to display the first static file on the browser; Execute a build command on the project files belonging to the project management list, so as to package the project files using a packaging tool to generate a second static file; The second static file is deployed to a server so as to browse the second static file through the server.
2. The method according to claim 1, characterized in that Before the step of using a packaging tool to compile the project file according to predefined packaging configuration information, the method further includes: Monitor whether there is a setting operation for the project files belonging to the project management list; If the setting operation is not detected in the project file belonging to the project management list, no processing is performed; Using a packaging tool, compile the project file according to predefined packaging configuration information, including: If it is monitored that the project file belonging to the project management list has the setting operation, a packaging tool is used to compile the project file according to predefined packaging configuration information.
3. The method according to claim 2, characterized in that The setting operation is to perform a modification or a saving operation on the project file.
4. The method according to claim 1, characterized in that: The method further comprises: Receive updated packaging configuration information through a plug-in API; Compiling the project file according to the predefined packaging configuration information includes: compiling the project file according to the updated packaging configuration information.
5. The method according to claim 1, characterized in that: The method further comprises: The dependency packages used by the local development environment and the production environment are built-in to install the dependency packages offline.
6. A project construction device, characterized in that: include: A project creation module, used to obtain basic project information and a project template, and modify project configuration information according to the basic project information to generate a plurality of project files; wherein the project configuration information includes a feature tag set for the project file; the feature tag is used to identify whether the project is a project developed by a specified tool; A project management module, used for scanning the folders belonging to the target directory to determine the project management list according to the characteristic mark; A project startup module, used to execute a startup command on a project file belonging to the project management list, so as to compile the project file using a packaging tool according to predefined packaging configuration information to generate a first static file; A display module is used to detect the set port set and determine the target port, so that when executing the start command, the target port is specified as the port of the local development environment; start the local development environment and the local server, receive the access request sent through the target port, so that the local server feeds the first static file back to the browser, so as to display the first static file on the browser; The project construction module is used to execute a construction command on the project files belonging to the project management list, so as to package the project files with a packaging tool to generate a second static file; and deploy the second static file to a server so as to browse the second static file through the server.
7. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Front-end development engineering system and method
CN106843869A
An update file packaging method and device
CN109710272A