CN110413272B - Front-end project construction method, device, storage medium and equipment - Google Patents
Front-end project construction method, device, storage medium and equipment Download PDFInfo
- Publication number
- CN110413272B CN110413272B CN201910697468.3A CN201910697468A CN110413272B CN 110413272 B CN110413272 B CN 110413272B CN 201910697468 A CN201910697468 A CN 201910697468A CN 110413272 B CN110413272 B CN 110413272B
- Authority
- CN
- China
- Prior art keywords
- target
- configuration information
- page
- construction
- current
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
- 238000010276 construction Methods 0.000 title claims abstract description 173
- 238000000034 method Methods 0.000 claims abstract description 63
- 230000006870 function Effects 0.000 claims description 13
- 230000008859 change Effects 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 9
- 230000008569 process Effects 0.000 abstract description 27
- 230000008901 benefit Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 6
- 238000001514 detection method Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
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
Description
技术领域Technical field
本发明实施例涉及计算机技术领域,尤其涉及前端项目构建方法、装置、存储介质及设备。Embodiments of the present invention relate to the field of computer technology, and in particular to front-end project construction methods, devices, storage media and equipment.
背景技术Background technique
前端开发包括创建Web页面等前端界面呈现给用户的过程,实现互联网产品的用户界面交互。Web应用程序是一种可以通过Web访问的应用程序,目前,Web页面应用程序包括单页面应用程序(Single Page Application,SPA)和多页面应用程序(Muti-pageApplication,MPA)。SPA指整个Web应用程序只有一个页面,内容的切换通过局部更新的形式实现。MPA指整个Web应用程序由多个页面组成,内容的切换主要通过切换不同页面实现。Front-end development includes the process of creating front-end interfaces such as Web pages to present to users, and realizing user interface interaction of Internet products. A web application is an application that can be accessed through the Web. Currently, web page applications include single page applications (Single Page Application, SPA) and multi-page applications (Muti-page Application, MPA). SPA means that the entire web application has only one page, and content switching is implemented in the form of partial updates. MPA means that the entire web application is composed of multiple pages, and content switching is mainly achieved by switching between different pages.
当前主流前端框架的构建实现多以SPA项目为目标,而在实际业务项目中,有的项目中不同页面之间业务关联较少,互相之间跳转少,用户访问一个或几个页面即可达到目的,这种项目比较适合于MPA来实现。目前,MPA也主要采用支持SPA的前端框架,一些开发者继续使用SPA原有的构建工具,为了支持多页面的构建,往往采用两种方式实现:第一种,所有入口程序与模板全部在配置中直接声明;第二种,在构建启动时按从约定的目录里收集入口程序与模板页面并写入配置中。这两种方案中均只有一套配置,灵活性差,需要改进。The construction and implementation of current mainstream front-end frameworks mostly target SPA projects. However, in actual business projects, in some projects, there are few business relationships between different pages and few jumps between each other. Users only need to visit one or several pages. To achieve the goal, this kind of project is more suitable for MPA to implement. At present, MPA also mainly uses the front-end framework that supports SPA. Some developers continue to use the original construction tools of SPA. In order to support the construction of multi-pages, it is often implemented in two ways: first, all entry programs and templates are configured directly declare in; second, collect the entry program and template page from the agreed directory when the build is started and write them into the configuration. Both solutions have only one set of configurations, which have poor flexibility and need to be improved.
发明内容Contents of the invention
本发明实施例提供了前端项目构建方法、装置、存储介质及设备,可以解决现有技术中多页面应用程序项目的构建过程灵活性差的问题。Embodiments of the present invention provide front-end project construction methods, devices, storage media and equipment, which can solve the problem of poor flexibility in the construction process of multi-page application projects in the prior art.
第一方面,本发明实施例提供了一种前端项目构建方法,该方法包括:In a first aspect, embodiments of the present invention provide a front-end project construction method, which method includes:
确定待构建的目标项目中的当前目标页面,其中,所述目标项目中包含至少两个目标页面;Determine the current target page in the target project to be built, wherein the target project contains at least two target pages;
合并所述当前目标页面对应的子配置信息,得到目标配置信息,其中,所述子配置信息包括公有构建配置信息和私有构建配置信息,所述公有构建配置信息包括所述目标项目中所有目标页面共用的构建配置信息,所述私有构建配置信息包括当前目标页面相比于所述目标项目中的其他目标页面所特有的构建配置信息;Merge the sub-configuration information corresponding to the current target page to obtain target configuration information, where the sub-configuration information includes public build configuration information and private build configuration information, and the public build configuration information includes all target pages in the target project Shared build configuration information, the private build configuration information includes build configuration information unique to the current target page compared to other target pages in the target project;
根据所述目标配置信息针对所述当前目标页面进行相应的构建操作。Perform corresponding construction operations on the current target page according to the target configuration information.
第二方面,本发明实施例提供了一种前端项目构建装置,该装置包括:In a second aspect, embodiments of the present invention provide a front-end project construction device, which includes:
页面确定模块,用于确定待构建的目标项目中的当前目标页面,其中,所述目标项目中包含至少两个目标页面;A page determination module, used to determine the current target page in the target project to be built, wherein the target project contains at least two target pages;
配置合并模块,用于合并所述当前目标页面对应的子配置信息,得到目标配置信息,其中,所述子配置信息包括公有构建配置信息和私有构建配置信息,所述公有构建配置信息包括所述目标项目中所有目标页面共用的构建配置信息,所述私有构建配置信息包括当前目标页面相比于所述目标项目中的其他目标页面所特有的构建配置信息;The configuration merging module is used to merge the sub-configuration information corresponding to the current target page to obtain the target configuration information, wherein the sub-configuration information includes public build configuration information and private build configuration information, and the public build configuration information includes the Build configuration information common to all target pages in the target project, and the private build configuration information includes build configuration information unique to the current target page compared to other target pages in the target project;
构建模块,用于根据所述目标配置信息针对所述当前目标页面进行相应的构建操作。A construction module, configured to perform corresponding construction operations on the current target page according to the target configuration information.
第三方面,本发明实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本发明实施例提供的前端项目构建方法。In a third aspect, embodiments of the present invention provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the front-end project construction method provided by the embodiment of the present invention is implemented.
第四方面,本发明实施例提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如本发明实施例提供的前端项目构建方法。In a fourth aspect, embodiments of the present invention provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the present invention is implemented. The front-end project construction method provided by the embodiment.
本发明实施例中提供的前端项目构建方案,在进行多页面应用程序项目的构建过程中,确定待构建的目标项目中的当前目标页面,合并当前目标页面对应的子配置信息,得到目标配置信息,其中,子配置信息包括公有构建配置信息和私有构建配置信息,公有构建配置信息包括目标项目中所有目标页面共用的构建配置信息,私有构建配置信息包括当前目标页面相比于目标项目中的其他目标页面所特有的构建配置信息,根据目标配置信息针对当前目标页面进行相应的构建操作。通过采用上述技术方案,目标项目中的各目标页面不需要完全公用同一套配置,通过私有构建配置信息实现了各目标页面的个性化配置,改善了多页面应用程序项目构建过程的灵活性。The front-end project construction solution provided in the embodiment of the present invention determines the current target page in the target project to be built during the construction process of the multi-page application project, and merges the sub-configuration information corresponding to the current target page to obtain the target configuration information. , among which, the sub-configuration information includes public build configuration information and private build configuration information. The public build configuration information includes the build configuration information common to all target pages in the target project. The private build configuration information includes the current target page compared to other targets in the target project. Build configuration information unique to the target page, and perform corresponding build operations for the current target page based on the target configuration information. By adopting the above technical solution, each target page in the target project does not need to completely share the same set of configurations. The personalized configuration of each target page is achieved through private build configuration information, which improves the flexibility of the multi-page application project construction process.
附图说明Description of the drawings
图1为本发明实施例一提供的一种前端项目构建方法的流程示意图;Figure 1 is a schematic flow chart of a front-end project construction method provided by Embodiment 1 of the present invention;
图2为本发明实施例二提供的一种前端项目构建方法的流程示意图;Figure 2 is a schematic flow chart of a front-end project construction method provided in Embodiment 2 of the present invention;
图3为本发明实施例三提供的一种前端项目构建方法的流程示意图;Figure 3 is a schematic flow chart of a front-end project construction method provided in Embodiment 3 of the present invention;
图4为本发明实施例三提供的一种目标项目的文件目录结构示意图;Figure 4 is a schematic diagram of the file directory structure of a target project provided in Embodiment 3 of the present invention;
图5为本发明实施例四提供的一种前端项目构建方法的流程示意图;Figure 5 is a schematic flow chart of a front-end project construction method provided in Embodiment 4 of the present invention;
图6为本发明实施例五提供的一种前端项目构建装置的结构框图;Figure 6 is a structural block diagram of a front-end project construction device provided in Embodiment 5 of the present invention;
图7为本发明实施例七提供的一种计算机设备的结构框图。Figure 7 is a structural block diagram of a computer device provided in Embodiment 7 of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。此外,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互组合。The present invention will be further described in detail below in conjunction with the accompanying drawings and examples. It can be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention. In addition, it should be noted that, for convenience of description, only some but not all structures related to the present invention are shown in the drawings. In addition, the embodiments and features of the embodiments of the present invention may be combined with each other without conflict.
在更加详细地讨论示例性实施例之前应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各步骤描述成顺序的处理,但是其中的许多步骤可以被并行地、并发地或者同时实施。此外,各步骤的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。Before discussing example embodiments in more detail, it should be mentioned that some example embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts depict steps as a sequential process, many of the steps may be performed in parallel, concurrently, or simultaneously. Additionally, the order of steps can be rearranged. The process may be terminated when its operation is completed, but may also have additional steps not included in the figures. The processing may correspond to a method, function, procedure, subroutine, subroutine, or the like.
实施例一Embodiment 1
图1为本发明实施例一提供的一种前端项目构建方法的流程示意图,该方法可以由前端项目构建装置执行,其中该装置可由软件和/或硬件实现,一般可集成在计算机设备中。如图1所示,该方法包括:Figure 1 is a schematic flowchart of a front-end project construction method provided in Embodiment 1 of the present invention. The method can be executed by a front-end project construction device, where the device can be implemented by software and/or hardware, and can generally be integrated in a computer device. As shown in Figure 1, the method includes:
步骤101、确定待构建的目标项目中的当前目标页面,其中,目标项目中包含至少两个目标页面。Step 101: Determine the current target page in the target project to be built, where the target project contains at least two target pages.
示例性的,本发明实施例中的项目可以包括多页面Web应用程序,简称多页面应用程序或MPA,目标项目可以是当前需要进行构建的多页面应用程序。目标页面可以包括目标项目中需要采用本发明实施例的技术方案进行构建的页面,目标项目中包括多个页面,目标页面可以是目标项目中包含的全部页面或部分页面,也即目标项目中可以包含目标页面以外的其他页面,其他页面可以采用本发明实施例以外的技术方案进行构建,本发明实施例不做具体限定。For example, the project in the embodiment of the present invention may include a multi-page Web application, referred to as a multi-page application or MPA, and the target project may be a multi-page application that currently needs to be built. The target page may include pages in the target project that need to be constructed using the technical solution of the embodiment of the present invention. The target project may include multiple pages, and the target page may be all or part of the pages included in the target project. That is, the target project may Including other pages other than the target page, other pages can be constructed using technical solutions other than the embodiments of the present invention, and are not specifically limited in the embodiments of the present invention.
示例性的,当前目标页面可以指当前需要进行构建的目标页面,可以预先规定目标项目中各目标页面的构建顺序,依据该构建顺序来确定当前目标页面。可选的,也可以采用其他方式确定当前目标页面,如由开发者指定等,本发明实施例不做具体限定。For example, the current target page may refer to the target page that currently needs to be constructed. The construction order of each target page in the target project may be predetermined, and the current target page may be determined based on the construction order. Optionally, other methods may be used to determine the current target page, such as being specified by a developer, which is not specifically limited in this embodiment of the present invention.
示例性的,本发明实施例中可以采用自创的构建工具,也可以在已有的构建工具基础上进行改进,如Vue框架的构建工具Vue webpack等。具体的构建工具本发明实施例不做限定。For example, in the embodiment of the present invention, a self-created construction tool can be used, or an existing construction tool can be improved, such as Vue webpack, a Vue framework construction tool. The specific construction tool is not limited in the embodiment of the present invention.
步骤102、合并当前目标页面对应的子配置信息,得到目标配置信息。Step 102: Merge the sub-configuration information corresponding to the current target page to obtain the target configuration information.
其中,所述子配置信息包括公有构建配置信息和私有构建配置信息,所述公有构建配置信息包括所述目标项目中所有目标页面共用的构建配置信息,所述私有构建配置信息包括当前目标页面相比于所述目标项目中的其他目标页面所特有的构建配置信息。Wherein, the sub-configuration information includes public build configuration information and private build configuration information. The public build configuration information includes build configuration information common to all target pages in the target project. The private build configuration information includes the current target page. Build configuration information unique to other target pages in the target project.
相关技术中,在进行Web应用程序构建时,会涉及到入口程序和模板页面。入口程序指应用进程最先执行的程序,前端构建工具往往需要指明入口程序才能正确工作。SPA具有单个主入口程序,MPA一般每个页面都有一个入口程序。模板页面指生成实际页面的模板,SPA一般只有一个模板页面,MPA具有多个模板页面。在构建MPA项目时,一般会采用支持SPA的前端框架,开发者继续使用SPA原有的构建工具,为了支持多页面的构建,一般采用将所有入口程序与模板全部在配置中直接声明的手动方式,或者在构建启动时按从约定的目录里收集入口程序与模板页面并写入配置中的自动方式,上述两种方式均只有一套配置,灵活性差,为了实现不同页面之间的配置差异,可能需要在配置中做很多的条件判断,随着项目壮大,可能造成构建配置越来越复杂,影响开发和构建效率,此外,在增加页面等情况时,还需要对整个配置进行改动,进一步影响了构建的灵活性和效率。In related technologies, when building a web application, an entry program and a template page will be involved. The entry program refers to the program that is first executed by the application process. Front-end construction tools often need to specify the entry program to work correctly. SPA has a single main entrance program, and MPA generally has one entrance program for each page. The template page refers to the template that generates the actual page. SPA generally has only one template page, and MPA has multiple template pages. When building an MPA project, a front-end framework that supports SPA is generally used. Developers continue to use SPA's original construction tools. In order to support multi-page construction, a manual method is generally adopted in which all entry programs and templates are directly declared in the configuration. , or the automatic method of collecting entry programs and template pages from the agreed directory and writing them into the configuration when the build is started. The above two methods only have one set of configurations and have poor flexibility. In order to realize the configuration differences between different pages, It may be necessary to make a lot of conditional judgments in the configuration. As the project grows, the build configuration may become more and more complex, affecting development and construction efficiency. In addition, when adding pages, etc., the entire configuration needs to be changed, further affecting the for flexibility and efficiency in construction.
本发明实施例中,针对一个目标页面设置了两部分子配置信息,一部分是目标项目中所有目标页面共用的构建配置信息,本发明实施例中称为公有构建配置信息或基础构建配置信息,在构建每个目标页面时,都会用到公有构建配置信息。另外,为了保证项目构建的灵活性,同时兼顾每个目标页面的个性化差异,另一部分是当前目标页面相比于目标项目中的其他目标页面所特有的构建配置信息,本发明实施例中称为私有构建配置信息,在当前目标页面的构建过程中需要用到其对应的私有构建配置信息,而在其他目标页面的构建过程中不需要当前目标页面对应的构建配置信息。在需要针对当前目标页面进行构建时,可以获取当前目标页面对应的子配置信息并进行合并,或者将之前获取到的当前目标页面对应的子配置信息直接进行合并,得到当前目标页面对应的目标配置信息。其中,合并操作可以通过构建工具中的已有函数或接口实现,也可通过在构建工具中编写用于合并子配置信息的函数,可称为合并函数,将当前目标页面对应的子配置信息输入至合并函数中,得到目标配置信息。In the embodiment of the present invention, two parts of sub-configuration information are set for a target page. One part is the build configuration information common to all target pages in the target project. In the embodiment of the present invention, it is called public build configuration information or basic build configuration information. Public build configuration information is used when building each target page. In addition, in order to ensure the flexibility of project construction and take into account the personalized differences of each target page, the other part is the unique construction configuration information of the current target page compared with other target pages in the target project. In the embodiment of the present invention, it is called For private build configuration information, the corresponding private build configuration information is needed during the construction process of the current target page, but the corresponding build configuration information of the current target page is not required during the construction process of other target pages. When you need to build for the current target page, you can obtain the sub-configuration information corresponding to the current target page and merge it, or directly merge the previously obtained sub-configuration information corresponding to the current target page to obtain the target configuration corresponding to the current target page. information. Among them, the merge operation can be implemented through existing functions or interfaces in the build tool, or by writing a function in the build tool for merging sub-configuration information, which can be called a merge function, and inputs the sub-configuration information corresponding to the current target page. Go to the merge function to get the target configuration information.
步骤103、根据目标配置信息针对当前目标页面进行相应的构建操作。Step 103: Perform corresponding construction operations on the current target page according to the target configuration information.
示例性的,可以启动当前目标页面的构建实例,根据目标配置信息对当前目标页面进行构建。具体的,可以将目标配置信息传入预设构建函数,以实现对当前目标页面的构建。预设构建函数可以理解为构建程序,由该构建程序自动完成相应的构建操作。在构建过程中还可能涉及到当前目标页面对应的页面模板文件、入口文件(及上文所述的入口程序)以及其他源文件或源代码等等,本发明实施例不做具体限定。For example, a construction instance of the current target page can be started, and the current target page can be built according to the target configuration information. Specifically, the target configuration information can be passed into the preset construction function to realize the construction of the current target page. The preset build function can be understood as a build program, which automatically completes the corresponding build operations. The construction process may also involve page template files, entry files (and entry programs mentioned above) corresponding to the current target page, other source files or source codes, etc., which are not specifically limited in the embodiment of the present invention.
本发明实施例中提供的前端项目构建方法,在进行多页面应用程序项目的构建过程中,确定待构建的目标项目中的当前目标页面,合并当前目标页面对应的子配置信息,得到目标配置信息,其中,子配置信息包括公有构建配置信息和私有构建配置信息,公有构建配置信息包括目标项目中所有目标页面共用的构建配置信息,私有构建配置信息包括当前目标页面相比于目标项目中的其他目标页面所特有的构建配置信息,根据目标配置信息针对当前目标页面进行相应的构建操作。通过采用上述技术方案,目标项目中的各目标页面不需要完全公用同一套配置,通过私有构建配置信息实现了各目标页面的个性化配置,改善了多页面应用程序项目构建过程的灵活性。The front-end project construction method provided in the embodiment of the present invention determines the current target page in the target project to be built during the construction process of the multi-page application project, and merges the sub-configuration information corresponding to the current target page to obtain the target configuration information. , among which, the sub-configuration information includes public build configuration information and private build configuration information. The public build configuration information includes the build configuration information common to all target pages in the target project. The private build configuration information includes the current target page compared to other targets in the target project. Build configuration information unique to the target page, and perform corresponding build operations for the current target page based on the target configuration information. By adopting the above technical solution, each target page in the target project does not need to completely share the same set of configurations. The personalized configuration of each target page is achieved through private build configuration information, which improves the flexibility of the multi-page application project construction process.
在上述实施例基础上,可进一步优化,基于目标模块对目标页面进行划分,并将私有构建配置信息进一步细化为包括模块构建配置信息和页面构建配置信息,从而进一步提升多页面应用程序项目构建过程的灵活性,并能够满足不同程度的差异化需求。Based on the above embodiments, further optimization can be performed to divide the target page based on the target module, and further refine the private build configuration information to include module build configuration information and page build configuration information, thereby further improving multi-page application project construction. Process flexibility and the ability to meet varying degrees of differentiated needs.
示例性的,所述目标项目包括至少两个目标模块,每个目标模块中包含至少两个目标页面,所述私有构建配置信息包括模块构建配置信息和页面构建配置信息,所述模块构建配置信息包括当前目标模块相比于所述目标项目中的其他目标模块所特有的且所述当前目标模块中的所有目标页面共用的构建配置信息,所述页面构建配置信息包括当前目标页面相比于所属目标模块中的其他目标页面所特有的构建配置信息。其中,模块可以指同属相同类别的页面集合,如同属于某块业务。基于模块进行划分,使得页面能够按照模块组织,页面结构清晰,一目了然,便于开发和构建。目标模块可以是目标项目中需要构建的模块。对于一个目标模块中包含目标页面来说,由于类别相同,一般会有部分相同的配置,因此,本发明实施例可以进一步将同一个目标模块中所有目标页面共用的配置信息抽离出来,作为模块构建配置信息,将一个目标页面所需的剩余配置信息作为该目标页面特有的配置信息,称为页面构建配置信息。这样,可以将构建一个目标页面所需要的配置信息做更深层次的划分,从而进一步提升多页面应用程序项目构建过程的灵活性,满足不同程度的差异化需求,且能够避免在配置中设置过多的条件判断,简化配置的逻辑,有利于提高开发和构建效率。Exemplarily, the target project includes at least two target modules, each target module contains at least two target pages, the private build configuration information includes module build configuration information and page build configuration information, and the module build configuration information It includes construction configuration information that is unique to the current target module compared to other target modules in the target project and common to all target pages in the current target module. The page construction configuration information includes construction configuration information that is unique to the current target page compared to the belonging to it. Build configuration information unique to other target pages in the target module. Among them, a module can refer to a collection of pages belonging to the same category, as if they belong to a certain business. Dividing based on modules allows pages to be organized according to modules. The page structure is clear and visible at a glance, making it easy to develop and build. The target module can be the module that needs to be built in the target project. For a target module containing a target page, due to the same category, there will generally be some identical configurations. Therefore, embodiments of the present invention can further extract the configuration information common to all target pages in the same target module as a module To build configuration information, the remaining configuration information required for a target page is used as the unique configuration information of the target page, which is called page building configuration information. In this way, the configuration information required to build a target page can be divided into deeper layers, thereby further improving the flexibility of the multi-page application project construction process, meeting different levels of differentiated needs, and avoiding too many settings in the configuration. Conditional judgment and simplified configuration logic are beneficial to improving development and construction efficiency.
图2为本发明实施例二提供的一种前端项目构建方法的流程示意图,在上述实施例基础上进行优化,增加了获取子配置信息对应的配置文件等相关步骤。Figure 2 is a schematic flow chart of a front-end project construction method provided in Embodiment 2 of the present invention. It is optimized based on the above embodiment and adds related steps such as obtaining the configuration file corresponding to the sub-configuration information.
示例性的,在确定待构建的目标项目中的当前目标页面之前,还包括:获取所述目标项目中包含的所有子配置信息对应的配置文件,并将所述配置文件存储于所述目标项目对应的文件目录中。其中,配置文件可以由开发人员在计算机设备中编写,从而使计算机设备获取到配置文件;配置文件也可以是已经编写好的文件,直接传入计算机设备,例如在当前的目标项目与其他项目的框架相同时,可以直接将该其他项目的配置文件传入计算机设备中,此外,也可允许开发人员在计算机设备中对传入的配置文件进行修改,以得到针对当前的目标项目的配置文件。此处改进的好处在于,能够合理地管理目标页面的子配置信息。Exemplarily, before determining the current target page in the target project to be built, the method further includes: obtaining configuration files corresponding to all sub-configuration information contained in the target project, and storing the configuration files in the target project. in the corresponding file directory. Among them, the configuration file can be written by the developer in the computer device, so that the computer device can obtain the configuration file; the configuration file can also be a file that has been written and directly transferred to the computer device, for example, when the current target project and other projects When the framework is the same, the configuration file of the other project can be directly transferred to the computer device. In addition, the developer can also be allowed to modify the incoming configuration file in the computer device to obtain the configuration file for the current target project. The benefit of the improvement here is that the sub-configuration information of the target page can be reasonably managed.
进一步的,在所述合并所述当前目标页面对应的子配置信息之前,还包括:读取所述当前目标页面对应的配置文件,以获取所述当前目标页面对应的子配置信息。这样设置的好处在于,能够明确快速地获取到目标页面对应的子配置信息。本发明实施例对各种子配置信息的获取顺序以及与其他步骤之间的先后关系不做限定,可根据实际需求进行设置。Further, before merging the sub-configuration information corresponding to the current target page, the method further includes: reading the configuration file corresponding to the current target page to obtain the sub-configuration information corresponding to the current target page. The advantage of this setting is that the sub-configuration information corresponding to the target page can be obtained clearly and quickly. The embodiment of the present invention does not limit the order of obtaining various sub-configuration information and the sequence relationship with other steps, and can be set according to actual needs.
可选的,如图2所示,该方法可包括:Optionally, as shown in Figure 2, the method may include:
步骤201、获取待构建的目标项目中包含的所有子配置信息对应的配置文件,并将配置文件存储于目标项目对应的文件目录中。Step 201: Obtain the configuration files corresponding to all sub-configuration information contained in the target project to be built, and store the configuration files in the file directory corresponding to the target project.
示例性的,可预先编写配置文件,并声明写好的配置文件。配置文件可包括公有构建配置文件、模块构建配置文件和页面构建配置文件,分别与公有构建配置信息、模块构建配置信息和页面构建配置信息相对应。可选的,公有构建配置文件可存储于目标项目对应的文件目录中的根目录下,模块构建配置文件可存储于目标模块的文件夹下,目标页面的文件夹为目标模块的文件夹的子文件夹,页面构建配置文件可存储于目标页面的下。For example, the configuration file can be pre-written and the written configuration file can be declared. The configuration file may include a public build configuration file, a module build configuration file and a page build configuration file, respectively corresponding to public build configuration information, module build configuration information and page build configuration information. Optionally, the public build configuration file can be stored in the root directory of the file directory corresponding to the target project, and the module build configuration file can be stored in the folder of the target module. The folder of the target page is a subfolder of the folder of the target module. Folder, page building configuration files can be stored under the target page.
步骤202、读取公有构建配置文件,得到公有构建配置信息。Step 202: Read the public build configuration file and obtain the public build configuration information.
步骤203、确定当前目标模块,并读取当前目标模块对应的模块构建配置文件,得到模块构建配置信息。Step 203: Determine the current target module, and read the module construction configuration file corresponding to the current target module to obtain the module construction configuration information.
步骤204、确定当前目标页面,并读取当前目标页面对应的页面构建配置信息。Step 204: Determine the current target page, and read the page construction configuration information corresponding to the current target page.
步骤205、合并公有构建配置信息、模块构建配置信息和页面构建配置信息,得到当前目标页面对应的目标配置信息。Step 205: Merge public build configuration information, module build configuration information, and page build configuration information to obtain target configuration information corresponding to the current target page.
步骤206、将目标配置信息传入预设构建函数,以实现对当前目标页面的构建。Step 206: Pass the target configuration information into the preset construction function to realize the construction of the current target page.
可选的,预设构建函数存储于目标项目对应的文件目录的根目录中,以供目标项目中的所有目标页面共用。这样设置的好处在于,不同模块,不同页面可以共享构建程序,传入自己的配置信息即可完成个性化构建,简化目录结构。Optionally, the default build function is stored in the root directory of the file directory corresponding to the target project so that it can be shared by all target pages in the target project. The advantage of this setting is that different modules and different pages can share the construction program. By passing in your own configuration information, you can complete the personalized construction and simplify the directory structure.
本发明实施例提供的前端项目构建方法,将目标项目中的目标页面的配置信息分成公有构建配置信息、模块构建配置信息和页面构建配置信息,分别预先编写并存储于对应的配置文件中,能够合理地管理目标页面的子配置信息,在需要进行目标页面的构建时,分别从对应的配置文件中快速读取,并进行合并,利用合并后的目标配置信息完成目标页面的构建,可有效提升多页面应用程序项目构建过程的灵活性,并提高开发和构建效率。The front-end project construction method provided by the embodiment of the present invention divides the configuration information of the target page in the target project into public construction configuration information, module construction configuration information and page construction configuration information, and each is pre-written and stored in the corresponding configuration file, which can Reasonably manage the sub-configuration information of the target page. When it is necessary to build the target page, quickly read it from the corresponding configuration files and merge them. Use the merged target configuration information to complete the construction of the target page, which can effectively improve Flexibility in the multi-page application project building process and improve development and build efficiency.
图3为本发明实施例三提供的一种前端项目构建方法的流程示意图,本发明实施例在上述实施例基础上进行优化,完善了目标项目的构建过程。Figure 3 is a schematic flow chart of a front-end project construction method provided in Embodiment 3 of the present invention. The embodiment of the present invention optimizes the method based on the above embodiment and improves the construction process of the target project.
示例性的,所述确定待构建的目标项目中的当前目标页面,包括:根据待构建的目标项目对应的构建目标配置文件确定当前目标页面,其中,所述构建目标配置文件中包含所述目标项目中所有目标模块的属性信息和每个目标模块中所有目标页面的属性信息。其中,属性信息可包括名称或代码等。构建目标配置文件可以理解为目标项目的个性化的配置文件。这样设置的好处在于,通过设置构建目标文件能够合理地管理各目标模块以及各目标页面之间的关系,同时方便确定各目标模块以及各目标页面的构建顺序。Exemplarily, determining the current target page in the target project to be built includes: determining the current target page according to the build target configuration file corresponding to the target project to be built, wherein the build target configuration file contains the target Property information of all target modules in the project and property information of all target pages in each target module. The attribute information may include name or code, etc. The build target configuration file can be understood as a personalized configuration file for the target project. The advantage of this setting is that by setting the build target file, the relationship between each target module and each target page can be reasonably managed, and at the same time, it is convenient to determine the construction sequence of each target module and each target page.
进一步的,在所述根据待构建的目标项目对应的构建目标配置文件确定当前目标页面之前,还包括:获取所述目标项目对应的构建目标配置文件,并将所述构建目标配置文件存储于所述目标项目对应的文件目录中。这样设置的好处在于,方便对目标项目的组织结构进行合理设定,并在构建过程中方便读取。Further, before determining the current target page according to the build target configuration file corresponding to the target project to be built, it also includes: obtaining the build target configuration file corresponding to the target project, and storing the build target configuration file in the in the file directory corresponding to the above target project. The advantage of this setting is that it facilitates reasonable setting of the organizational structure of the target project and makes it easy to read during the build process.
进一步的,在根据所述目标配置信息针对所述当前目标页面进行相应的构建操作之后,还包括:若判断出所述当前目标页面所属目标模块中存在未构建的目标页面,则将下一个目标页面确定为新的当前目标页面,并重复执行合并所述当前目标页面对应的子配置信息的相关操作。这样设置的好处在于,按照预定顺序依次构建目标模块内的目标页面,避免发生遗漏。Further, after performing a corresponding construction operation on the current target page according to the target configuration information, it also includes: if it is determined that there is an unconstructed target page in the target module to which the current target page belongs, then constructing the next target page. The page is determined as the new current target page, and the related operations of merging the sub-configuration information corresponding to the current target page are repeatedly performed. The advantage of this setting is that the target pages in the target module are constructed sequentially in a predetermined order to avoid omissions.
进一步的,在根据所述目标配置信息针对所述当前目标页面进行相应的构建操作之后,还包括:若判断出所述当前目标页面所属目标模块中的所有目标页面已构建完毕,则判断是否存在未构建的目标模块,若存在,则将下一个目标模块中的第一个目标页面确定为新的当前目标页面,并重复执行合并所述当前目标页面对应的子配置信息的相关操作。这样设置的好处在于,按照预定顺序依次构建目标模块,避免发生遗漏。Further, after performing a corresponding construction operation on the current target page according to the target configuration information, it also includes: if it is determined that all target pages in the target module to which the current target page belongs have been constructed, determine whether there is If an unbuilt target module exists, the first target page in the next target module is determined as the new current target page, and the related operations of merging the sub-configuration information corresponding to the current target page are repeatedly performed. The advantage of this setting is that the target modules are built sequentially in a predetermined order to avoid omissions.
可选的,如图3所示,该方法可包括:Optionally, as shown in Figure 3, the method may include:
步骤301、获取待构建的目标项目中包含的所有子配置信息对应的配置文件以及构建目标配置文件,并将配置文件和构建目标配置文件存储于目标项目对应的文件目录中。Step 301: Obtain the configuration files corresponding to all sub-configuration information contained in the target project to be built and the build target configuration file, and store the configuration files and the build target configuration file in the file directory corresponding to the target project.
示例性的,构建目标配置文件中可以设置目标模块和目标页面,指明目标模块的名称以及目标页面的名称(如页标)。例如:For example, the target module and target page can be set in the build target configuration file, indicating the name of the target module and the name of the target page (such as the page title). For example:
{{
moduleA:"*",//构建当前模块的所有页面moduleA:"*",//Build all pages of the current module
moduleB:["pageA","pageB","pageC"]//构建当前模块的指定页面moduleB:["pageA","pageB","pageC"]//Build the specified page of the current module
}}
其中,包含目标模块A和目标模块B,目标模块A中的所有页面为目标页面,目标模块B中的页面A、页面B和页面C为目标页面。It includes target module A and target module B. All pages in target module A are target pages, and page A, page B, and page C in target module B are target pages.
示例性的,图4为本发明实施例三提供的一种目标项目的文件目录结构示意图,如图4所示,公有构建配置文件(即基础构建配置文件)存储于目录结构中的配置文件下,配置文件下还可以有其他供基础构建配置文件引用的其他文件等。以目标模块A(moduleA)为例,moduleA的模块构建配置文件存储于moduleA的文件夹下,moduleA中目标页面A(pageA)的文件夹为moduleA的文件夹的子文件夹,pageA的页面构建配置文件存储于pageA的文件夹下。构建目标配置文件存储于目录结构中的根目录下。Exemplarily, Figure 4 is a schematic diagram of the file directory structure of a target project provided in Embodiment 3 of the present invention. As shown in Figure 4, the public build configuration file (ie, the basic build configuration file) is stored under the configuration file in the directory structure. , there can also be other files under the configuration file that are referenced by the basic construction configuration file. Take target module A (moduleA) as an example. The module construction configuration file of moduleA is stored in the folder of moduleA. The folder of the target page A (pageA) in moduleA is a subfolder of the moduleA folder. The page construction configuration file of pageA is The file is stored in the folder of pageA. Build target configuration files are stored at the root of the directory structure.
步骤302、读取公有构建配置文件,得到公有构建配置信息。Step 302: Read the public build configuration file to obtain the public build configuration information.
步骤303、读取构建目标配置文件,确定目标模块和目标页面。Step 303: Read the build target configuration file and determine the target module and target page.
步骤304、确定当前目标模块,并读取当前目标模块对应的模块构建配置文件,得到模块构建配置信息。Step 304: Determine the current target module, and read the module construction configuration file corresponding to the current target module to obtain the module construction configuration information.
示例性的,在首次执行本步骤时,当前目标模块为构建目标配置文件中指明的第一个目标模块。For example, when this step is executed for the first time, the current target module is the first target module specified in the build target configuration file.
步骤305、依次读取当前目标模块中各目标页面对应的页面构建配置信息。Step 305: Read the page construction configuration information corresponding to each target page in the current target module in sequence.
步骤306、针对当前目标模块中的每个目标页面,合并当前目标页面公有构建配置信息、模块构建配置信息和页面构建配置信息,得到当前目标页面对应的目标配置信息。Step 306: For each target page in the current target module, merge the current target page's public build configuration information, module build configuration information, and page build configuration information to obtain target configuration information corresponding to the current target page.
步骤307、启动当前目标模块的构建实例,以完成当前目标模块中所有目标页面的构建。Step 307: Start the construction instance of the current target module to complete the construction of all target pages in the current target module.
示例性的,可将目标配置信息传入构建程序中,以完成相应的构建操作。如图4所示,构建程序存储于文件目录的根目录下,可以供目标项目中所有目标模块中的目标页面共用。For example, the target configuration information can be passed into the build program to complete the corresponding build operation. As shown in Figure 4, the build program is stored in the root directory of the file directory and can be shared by the target pages in all target modules in the target project.
可选的,也可以每合并一个目标页面对应的子配置信息后即启动该目标页面的构建,构建完毕后,再合并下一个目标页面对应的子配置信息。Optionally, you can also start the construction of a target page after merging the sub-configuration information corresponding to the target page. After the construction is completed, merge the sub-configuration information corresponding to the next target page.
步骤308、判断是否存在未构建的目标模块,若是,则返回执行步骤304;否则,结束流程。Step 308: Determine whether there is an unbuilt target module. If so, return to step 304; otherwise, end the process.
示例性的,可判断步骤303中所确定的目标模块是否均被构建完毕,若是,则不存在未构建的目标模块。For example, it can be determined whether all the target modules determined in step 303 have been built. If so, there are no unbuilt target modules.
本发明实施例提供的前端项目构建方法,通过读取目标项目的构建目标配置文件来确定目标模块和目标页面,并依次完成各目标模块中目标页面的构建,在针对每个目标页面进行构建时,先获取对应的公有构建配置信息、模块构建配置信息和页面构建配置信息,合并成目标配置信息后,通过共用的构建程序完成构建,可以有效提升整个目标项目构建的灵活性以及构建效率。The front-end project construction method provided by the embodiment of the present invention determines the target module and target page by reading the construction target configuration file of the target project, and sequentially completes the construction of the target page in each target module. When building each target page , first obtain the corresponding public build configuration information, module build configuration information, and page build configuration information. After merging into the target configuration information, the construction is completed through a shared build program, which can effectively improve the flexibility and construction efficiency of the entire target project.
图5为本发明实施例四提供的一种前端项目构建方法的流程示意图,本发明实施例在上述实施例基础上进行进一步优化,可以兼顾项目的开发和构建,提高整体效率。Figure 5 is a schematic flowchart of a front-end project construction method provided in Embodiment 4 of the present invention. This embodiment of the present invention further optimizes the method based on the above embodiment, which can take into account both project development and construction and improve overall efficiency.
示例性的,本发明实施例提供的方法还可包括:检测当前是否处于开发阶段;若是,则在监听到所述目标项目中的配置文件或构建目标配置文件发生变化时,确定变更页面;将所述变更页面确定为新的当前目标页面,并重复执行合并所述当前目标页面对应的子配置信息的相关操作。这样设置的好处在于,开发和构建可以独立进行,当开发过程中目标项目中的配置文件或构建目标配置文件发生变化时,可以及时重新构建对应的目标页面,保证项目的更新效率。Exemplarily, the method provided by the embodiment of the present invention may also include: detecting whether it is currently in the development stage; if so, when monitoring changes in the configuration file or build target configuration file in the target project, determine the change page; The changed page is determined as the new current target page, and the related operations of merging the sub-configuration information corresponding to the current target page are repeatedly performed. The advantage of this setting is that development and construction can be carried out independently. When the configuration file in the target project or the build target configuration file changes during the development process, the corresponding target page can be rebuilt in time to ensure the update efficiency of the project.
进一步的,所述检测当前是否处于开发阶段,包括:在确定所述目标项目中的所有目标模块构建完毕时,检测当前是否处于开发阶段。这样设置的好处在于,能够进一步保证构建过程的稳定性。Further, the detecting whether it is currently in the development stage includes: when it is determined that all target modules in the target project have been built, detecting whether it is currently in the development stage. The advantage of this setting is that it can further ensure the stability of the build process.
可选的,如图5所示,该方法可包括:Optionally, as shown in Figure 5, the method may include:
步骤501、获取待构建的目标项目中包含的所有子配置信息对应的配置文件以及构建目标配置文件,并将配置文件和构建目标配置文件存储于目标项目对应的文件目录中。Step 501: Obtain the configuration files corresponding to all sub-configuration information contained in the target project to be built and the build target configuration file, and store the configuration files and the build target configuration file in the file directory corresponding to the target project.
步骤502、读取公有构建配置文件,得到公有构建配置信息。Step 502: Read the public build configuration file and obtain the public build configuration information.
步骤503、读取构建目标配置文件,确定目标模块和目标页面。Step 503: Read the build target configuration file and determine the target module and target page.
步骤504、确定当前目标模块,并读取当前目标模块对应的模块构建配置文件,得到模块构建配置信息。Step 504: Determine the current target module, and read the module construction configuration file corresponding to the current target module to obtain the module construction configuration information.
示例性的,在首次执行本步骤时,当前目标模块为构建目标配置文件中指明的第一个目标模块。For example, when this step is executed for the first time, the current target module is the first target module specified in the build target configuration file.
步骤505、依次读取当前目标模块中各目标页面对应的页面构建配置信息。Step 505: Read the page construction configuration information corresponding to each target page in the current target module in sequence.
步骤506、针对当前目标模块中的每个目标页面,合并当前目标页面的公有构建配置信息、模块构建配置信息和页面构建配置信息,得到当前目标页面对应的目标配置信息。Step 506: For each target page in the current target module, merge the public build configuration information, module build configuration information, and page build configuration information of the current target page to obtain target configuration information corresponding to the current target page.
步骤507、启动当前目标模块的构建实例,以完成当前目标模块中所有目标页面的构建。Step 507: Start the construction instance of the current target module to complete the construction of all target pages in the current target module.
步骤508、判断是否存在未构建的目标模块,若是,则返回执行步骤304;否则,执行步骤509。Step 508: Determine whether there is an unbuilt target module. If so, return to step 304; otherwise, execute step 509.
步骤509、检测当前是否处于开发阶段,若是,则执行步骤510;否则,结束路程。Step 509: Check whether it is currently in the development stage. If so, execute step 510; otherwise, end the journey.
步骤510、监听目标项目中的配置文件或构建目标配置文件是否发生变化,若是,则执行步骤511;否则,结束流程。Step 510: Monitor whether the configuration file in the target project or the build target configuration file has changed. If so, execute step 511; otherwise, end the process.
示例性的,本发明实施例中,项目开发和项目构架可并行进行,在项目构建过程中,开发人员可能会更改配置文件的内容,也可能会增加或删减页面等,从而使构建目标配置文件也可能会发生变化。For example, in the embodiment of the present invention, project development and project architecture can be carried out in parallel. During the project construction process, developers may change the content of the configuration file, or add or delete pages, etc., so that the construction target configuration Documentation may also change.
可选的,还可监听源代码等是否发生变化,若是,也可执行步骤511。Optionally, you can also monitor whether the source code has changed, and if so, step 511 can also be performed.
示例性的,可以通过再次读取配置文件以及构建目标配置文件并与之前读取的内容进行比较的方式确定是否发生变化。For example, whether a change has occurred can be determined by reading the configuration file again and building the target configuration file and comparing it with the previously read content.
步骤511、确定变更页面,将变更页面确定为新的当前目标页面,并执行步骤512。Step 511: Determine the changed page, determine the changed page as the new current target page, and execute step 512.
示例性的,可以将再次读取配置文件以及构建目标配置文件所得到的信息与上一次读取时的信息进行比对,筛选出存在差异的地方,再匹配到对应的目标页面,进而确定变更页面。For example, the information obtained by reading the configuration file again and building the target configuration file can be compared with the information obtained the last time it was read, to filter out the differences, and then match them to the corresponding target page to determine the changes. page.
步骤512、合并当前目标页面的公有构建配置信息、模块构建配置信息和页面构建配置信息,得到当前目标页面对应的目标配置信息,并根据该目标配置信息针对当前目标页面进行相应的构建操作。Step 512: Merge the public build configuration information, module build configuration information and page build configuration information of the current target page to obtain the target configuration information corresponding to the current target page, and perform corresponding build operations for the current target page based on the target configuration information.
示例性的,若变更页面不止一个,则可依次完成每个变更页面的构建。For example, if there is more than one change page, the construction of each change page can be completed in sequence.
本发明实施例提供的前端项目构建方法,兼顾了项目的开发和构建,使得开发与构建可以独立进行的同时,还能够及时针对开发对项目构建进行更新,且不需要操作所有页面,相比于相关技术,能够有效提升构建性能并降低耗时,提高整体效率。The front-end project construction method provided by the embodiment of the present invention takes into account both the development and construction of the project, so that while development and construction can be carried out independently, the project construction can also be updated in time for development without the need to operate all pages. Compared with Related technologies can effectively improve construction performance, reduce time consumption, and improve overall efficiency.
图6为本发明实施例五提供的一种前端项目构建装置的结构框图,该装置可由软件和/或硬件实现,一般可集成在计算机设备中,可通过执行前端项目构建方法来进行前端项目的构建。如图6所示,该装置包括:Figure 6 is a structural block diagram of a front-end project construction device provided in Embodiment 5 of the present invention. The device can be implemented by software and/or hardware, and can generally be integrated in computer equipment. The front-end project can be built by executing the front-end project construction method. Construct. As shown in Figure 6, the device includes:
页面确定模块601,用于确定待构建的目标项目中的当前目标页面,其中,所述目标项目中包含至少两个目标页面;The page determination module 601 is used to determine the current target page in the target project to be built, where the target project contains at least two target pages;
配置合并模块602,用于合并所述当前目标页面对应的子配置信息,得到目标配置信息,其中,所述子配置信息包括公有构建配置信息和私有构建配置信息,所述公有构建配置信息包括所述目标项目中所有目标页面共用的构建配置信息,所述私有构建配置信息包括当前目标页面相比于所述目标项目中的其他目标页面所特有的构建配置信息;The configuration merging module 602 is used to merge the sub-configuration information corresponding to the current target page to obtain the target configuration information, wherein the sub-configuration information includes public build configuration information and private build configuration information, and the public build configuration information includes all Build configuration information common to all target pages in the target project, and the private build configuration information includes build configuration information unique to the current target page compared to other target pages in the target project;
构建模块603,用于根据所述目标配置信息针对所述当前目标页面进行相应的构建操作。The construction module 603 is configured to perform corresponding construction operations on the current target page according to the target configuration information.
本发明实施例中提供的前端项目构建装置,在进行多页面应用程序项目的构建过程中,确定待构建的目标项目中的当前目标页面,合并当前目标页面对应的子配置信息,得到目标配置信息,其中,子配置信息包括公有构建配置信息和私有构建配置信息,公有构建配置信息包括目标项目中所有目标页面共用的构建配置信息,私有构建配置信息包括当前目标页面相比于目标项目中的其他目标页面所特有的构建配置信息,根据目标配置信息针对当前目标页面进行相应的构建操作。通过采用上述技术方案,目标项目中的各目标页面不需要完全公用同一套配置,通过私有构建配置信息实现了各目标页面的个性化配置,改善了多页面应用程序项目构建过程的灵活性。The front-end project construction device provided in the embodiment of the present invention determines the current target page in the target project to be built during the construction process of the multi-page application project, and merges the sub-configuration information corresponding to the current target page to obtain the target configuration information. , among which, the sub-configuration information includes public build configuration information and private build configuration information. The public build configuration information includes the build configuration information common to all target pages in the target project. The private build configuration information includes the current target page compared to other targets in the target project. Build configuration information unique to the target page, and perform corresponding build operations for the current target page based on the target configuration information. By adopting the above technical solution, each target page in the target project does not need to share the same set of configurations. The personalized configuration of each target page is achieved through private build configuration information, which improves the flexibility of the multi-page application project construction process.
可选的,所述目标项目包括至少两个目标模块,每个目标模块中包含至少两个目标页面,所述私有构建配置信息包括模块构建配置信息和页面构建配置信息,所述模块构建配置信息包括当前目标模块相比于所述目标项目中的其他目标模块所特有的且所述当前目标模块中的所有目标页面共用的构建配置信息,所述页面构建配置信息包括当前目标页面相比于所属目标模块中的其他目标页面所特有的构建配置信息。Optionally, the target project includes at least two target modules, each target module contains at least two target pages, the private build configuration information includes module build configuration information and page build configuration information, and the module build configuration information It includes construction configuration information that is unique to the current target module compared to other target modules in the target project and common to all target pages in the current target module. The page construction configuration information includes construction configuration information that is unique to the current target page compared to the belonging to it. Build configuration information unique to other target pages in the target module.
可选的,该装置还包括:Optionally, the device also includes:
配置文件获取模块,用于在所述确定待构建的目标项目中的当前目标页面之前,获取所述目标项目中包含的所有子配置信息对应的配置文件,并将所述配置文件存储于所述目标项目对应的文件目录中。A configuration file acquisition module, configured to obtain configuration files corresponding to all sub-configuration information contained in the target project before determining the current target page in the target project to be built, and store the configuration files in the In the file directory corresponding to the target project.
可选的,该装置还包括:Optionally, the device also includes:
配置文件读取模块,用于在所述合并所述当前目标页面对应的子配置信息之前,读取所述当前目标页面对应的配置文件,以获取所述当前目标页面对应的子配置信息。A configuration file reading module, configured to read the configuration file corresponding to the current target page before merging the sub-configuration information corresponding to the current target page, to obtain the sub-configuration information corresponding to the current target page.
可选的,所述确定待构建的目标项目中的当前目标页面,包括:Optionally, determining the current target page in the target project to be built includes:
根据待构建的目标项目对应的构建目标配置文件确定当前目标页面,其中,所述构建目标配置文件中包含所述目标项目中所有目标模块的属性信息和每个目标模块中所有目标页面的属性信息。The current target page is determined according to the build target configuration file corresponding to the target project to be built, wherein the build target configuration file contains the attribute information of all target modules in the target project and the attribute information of all target pages in each target module. .
可选的,该装置还包括:Optionally, the device also includes:
构建目标配置文件获取模块,用于在所述根据待构建的目标项目对应的构建目标配置文件确定当前目标页面之前,获取所述目标项目对应的构建目标配置文件,并将所述构建目标配置文件存储于所述目标项目对应的文件目录中。A build target configuration file acquisition module, configured to obtain the build target configuration file corresponding to the target project and obtain the build target configuration file corresponding to the target project before determining the current target page based on the build target configuration file corresponding to the target project to be built. Stored in the file directory corresponding to the target project.
可选的,该装置还包括:Optionally, the device also includes:
第一判断模块,用于在根据所述目标配置信息针对所述当前目标页面进行相应的构建操作之后,判断所述当前目标页面所属目标模块中存在未构建的目标页面;A first judgment module, configured to judge that there is an unconstructed target page in the target module to which the current target page belongs after performing a corresponding construction operation on the current target page according to the target configuration information;
第一目标页面更新模块,用于当第一判断模块判断出所述当前目标页面所属目标模块中存在未构建的目标页面时,将下一个目标页面确定为新的当前目标页面,并控制配置合并模块及相关模块重复执行合并所述当前目标页面对应的子配置信息的相关操作。The first target page update module is used to determine the next target page as the new current target page and control the configuration merge when the first judgment module determines that there is an unconstructed target page in the target module to which the current target page belongs. The module and related modules repeatedly perform related operations of merging the sub-configuration information corresponding to the current target page.
可选的,该装置还包括:Optionally, the device also includes:
第二判断模块,用于在根据所述目标配置信息针对所述当前目标页面进行相应的构建操作之后,判断所述当前目标页面所属目标模块中的所有目标页面已构建完毕。The second judgment module is configured to judge that all target pages in the target module to which the current target page belongs have been constructed after performing corresponding construction operations on the current target page according to the target configuration information.
第二目标页面更新模块,用于当第二判断模块判断出所述当前目标页面所属目标模块中的所有目标页面已构建完毕,则判断是否存在未构建的目标模块,若存在,则将下一个目标模块中的第一个目标页面确定为新的当前目标页面,并控制配置合并模块及相关模块重复执行合并所述当前目标页面对应的子配置信息的相关操作。The second target page update module is used to determine whether there is an unbuilt target module when the second judgment module determines that all target pages in the target module to which the current target page belongs have been constructed. The first target page in the target module is determined as the new current target page, and the configuration merging module and related modules are controlled to repeatedly perform related operations of merging the sub-configuration information corresponding to the current target page.
可选的,所述根据所述目标配置信息针对所述当前目标页面进行相应的构建操作,包括:Optionally, performing corresponding construction operations on the current target page according to the target configuration information includes:
将所述目标配置信息传入预设构建函数,以实现对所述当前目标页面的构建。The target configuration information is passed into the preset construction function to realize the construction of the current target page.
可选的,所述预设构建函数存储于所述目标项目对应的文件目录的根目录中,以供所述目标项目中的所有目标页面共用。Optionally, the preset construction function is stored in the root directory of the file directory corresponding to the target project so as to be shared by all target pages in the target project.
可选的,该装置还包括:Optionally, the device also includes:
检测模块,用于检测当前是否处于开发阶段;The detection module is used to detect whether it is currently in the development stage;
监听模块,用于在检测模块检测到当前是否处于开发阶段时,则在监听到所述目标项目中的配置文件或构建目标配置文件发生变化时,确定变更页面;The monitoring module is used to determine the change page when the detection module detects whether it is currently in the development stage and detects changes in the configuration file in the target project or the build target configuration file;
第二目标页面更新模块,用于用于将所述变更页面确定为新的当前目标页面,并控制配置合并模块及相关模块重复执行合并所述当前目标页面对应的子配置信息的相关操作。The second target page update module is used to determine the changed page as the new current target page, and control the configuration merging module and related modules to repeatedly perform related operations of merging the sub-configuration information corresponding to the current target page.
可选的,所述检测当前是否处于开发阶段,包括:Optionally, whether the detection is currently in the development stage, including:
在确定所述目标项目中的所有目标模块构建完毕时,检测当前是否处于开发阶段。When it is determined that all target modules in the target project have been built, it is detected whether it is currently in the development stage.
实施例六Embodiment 6
本发明实施例还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行本发明实施例提供的前端项目构建方法,该方法包括:An embodiment of the present invention also provides a storage medium containing computer-executable instructions, which when executed by a computer processor are used to execute the front-end project construction method provided by the embodiment of the present invention. The method includes:
确定待构建的目标项目中的当前目标页面,其中,所述目标项目中包含至少两个目标页面;Determine the current target page in the target project to be built, wherein the target project contains at least two target pages;
合并所述当前目标页面对应的子配置信息,得到目标配置信息,其中,所述子配置信息包括公有构建配置信息和私有构建配置信息,所述公有构建配置信息包括所述目标项目中所有目标页面共用的构建配置信息,所述私有构建配置信息包括当前目标页面相比于所述目标项目中的其他目标页面所特有的构建配置信息;Merge the sub-configuration information corresponding to the current target page to obtain target configuration information, where the sub-configuration information includes public build configuration information and private build configuration information, and the public build configuration information includes all target pages in the target project Shared build configuration information, the private build configuration information includes build configuration information unique to the current target page compared to other target pages in the target project;
根据所述目标配置信息针对所述当前目标页面进行相应的构建操作。Perform corresponding construction operations on the current target page according to the target configuration information.
存储介质——任何的各种类型的存储器设备或存储设备。术语“存储介质”旨在包括:安装介质,例如CD-ROM、软盘或磁带装置;计算机系统存储器或随机存取存储器,诸如DRAM、DDRRAM、SRAM、EDORAM,兰巴斯(Rambus)RAM等;非易失性存储器,诸如闪存、磁介质(例如硬盘或光存储);寄存器或其它相似类型的存储器元件等。存储介质可以还包括其它类型的存储器或其组合。另外,存储介质可以位于程序在其中被执行的第一计算机系统中,或者可以位于不同的第二计算机系统中,第二计算机系统通过网络(诸如因特网)连接到第一计算机系统。第二计算机系统可以提供程序指令给第一计算机用于执行。术语“存储介质”可以包括可以驻留在不同位置中(例如在通过网络连接的不同计算机系统中)的两个或更多存储介质。存储介质可以存储可由一个或多个处理器执行的程序指令(例如具体实现为计算机程序)。Storage media – Any memory device or storage device of any type. The term "storage media" is intended to include: installation media, such as CD-ROM, floppy disks, or tape devices; computer system memory or random access memory, such as DRAM, DDRRAM, SRAM, EDORAM, Rambus RAM, etc.; non- Volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. Additionally, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system connected to the first computer system through a network, such as the Internet. The second computer system may provide program instructions to the first computer for execution. The term "storage media" may include two or more storage media that may reside in different locations (eg, in different computer systems connected by a network). Storage media may store program instructions (eg, embodied as a computer program) executable by one or more processors.
当然,本发明实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的前端项目构建操作,还可以执行本发明任意相应实施例所提供的前端项目构建方法中的相关操作。Of course, the embodiments of the present invention provide a storage medium containing computer-executable instructions. The computer-executable instructions are not limited to the front-end project construction operations described above, and can also execute the front-end projects provided by any corresponding embodiment of the present invention. Related operations in the build method.
实施例七Embodiment 7
本发明实施例提供了一种计算机设备,该设备集成本发明实施例提供的前端项目构建装置。图7为本发明实施例七提供的一种计算机设备的结构框图。计算机设备700包括存储器701、处理器702及存储在存储器701上并可在处理器702上运行的计算机程序,所述处理器702执行所述计算机程序时实现本发明实施例提供的地理位置确定方法。该方法包括:An embodiment of the present invention provides a computer device that integrates the front-end project construction device provided by the embodiment of the present invention. Figure 7 is a structural block diagram of a computer device provided in Embodiment 7 of the present invention. The computer device 700 includes a memory 701, a processor 702, and a computer program stored in the memory 701 and executable on the processor 702. When the processor 702 executes the computer program, it implements the geographical location determination method provided by the embodiment of the present invention. . The method includes:
确定待构建的目标项目中的当前目标页面,其中,所述目标项目中包含至少两个目标页面;Determine the current target page in the target project to be built, wherein the target project contains at least two target pages;
合并所述当前目标页面对应的子配置信息,得到目标配置信息,其中,所述子配置信息包括公有构建配置信息和私有构建配置信息,所述公有构建配置信息包括所述目标项目中所有目标页面共用的构建配置信息,所述私有构建配置信息包括当前目标页面相比于所述目标项目中的其他目标页面所特有的构建配置信息;Merge the sub-configuration information corresponding to the current target page to obtain target configuration information, where the sub-configuration information includes public build configuration information and private build configuration information, and the public build configuration information includes all target pages in the target project Shared build configuration information, the private build configuration information includes build configuration information unique to the current target page compared to other target pages in the target project;
根据所述目标配置信息针对所述当前目标页面进行相应的构建操作。Perform corresponding construction operations on the current target page according to the target configuration information.
本发明实施例提供的计算机设备,目标项目中的各目标页面不需要完全公用同一套配置,通过私有构建配置信息实现了各目标页面的个性化配置,改善了多页面应用程序项目构建过程的灵活性。In the computer equipment provided by the embodiment of the present invention, each target page in the target project does not need to completely share the same set of configurations. The personalized configuration of each target page is realized through private construction configuration information, which improves the flexibility of the multi-page application project construction process. sex.
上述实施例中提供的前端项目构建装置、存储介质以及计算机设备可执行本发明任意实施例所提供的前端项目构建方法,具备执行该方法相应的功能模块和有益效果。未在上述实施例中详尽描述的技术细节,可参见本发明任意实施例所提供的前端项目构建方法。The front-end project construction device, storage medium and computer equipment provided in the above embodiments can execute the front-end project construction method provided by any embodiment of the present invention, and have corresponding functional modules and beneficial effects for executing the method. For technical details that are not described in detail in the above embodiments, please refer to the front-end project construction method provided by any embodiment of the present invention.
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only the preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, it can also include more other equivalent embodiments, and the present invention The scope is determined by the scope of the appended claims.
Claims (13)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910697468.3A CN110413272B (en) | 2019-07-30 | 2019-07-30 | Front-end project construction method, device, storage medium and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910697468.3A CN110413272B (en) | 2019-07-30 | 2019-07-30 | Front-end project construction method, device, storage medium and equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110413272A CN110413272A (en) | 2019-11-05 |
CN110413272B true CN110413272B (en) | 2023-10-13 |
Family
ID=68364324
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910697468.3A Active CN110413272B (en) | 2019-07-30 | 2019-07-30 | Front-end project construction method, device, storage medium and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110413272B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111079062A (en) * | 2019-12-27 | 2020-04-28 | 北京达佳互联信息技术有限公司 | Page creation method, apparatus, electronic device and storage medium |
CN111158680A (en) * | 2019-12-27 | 2020-05-15 | 北京同邦卓益科技有限公司 | Page construction method, device, equipment and storage medium |
CN117693734A (en) * | 2020-12-10 | 2024-03-12 | 百果园技术(新加坡)有限公司 | Front-end item processing method, device, equipment, management system and storage medium |
CN113467823B (en) * | 2021-06-21 | 2024-03-01 | 北京达佳互联信息技术有限公司 | Configuration information acquisition method, device, system and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107704243A (en) * | 2017-10-19 | 2018-02-16 | 用友网络科技股份有限公司 | Construction method and device, the computer equipment and storage medium of front-end interface |
CN109388399A (en) * | 2018-10-25 | 2019-02-26 | 北京字节跳动网络技术有限公司 | The page and Universal page configuration file generation method, device, equipment and medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7188282B2 (en) * | 2002-12-02 | 2007-03-06 | Silverbrook Research Pty Ltd | Tamper resistant shadow memory |
CN109683892B (en) * | 2018-12-11 | 2022-05-31 | 北京城市网邻信息技术有限公司 | Page display method and device, computer equipment and storage medium |
-
2019
- 2019-07-30 CN CN201910697468.3A patent/CN110413272B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107704243A (en) * | 2017-10-19 | 2018-02-16 | 用友网络科技股份有限公司 | Construction method and device, the computer equipment and storage medium of front-end interface |
CN109388399A (en) * | 2018-10-25 | 2019-02-26 | 北京字节跳动网络技术有限公司 | The page and Universal page configuration file generation method, device, equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN110413272A (en) | 2019-11-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110413272B (en) | Front-end project construction method, device, storage medium and equipment | |
CN106897322B (en) | A kind of access method and device of database and file system | |
AU2011323773B2 (en) | Managing data set objects in a dataflow graph that represents a computer program | |
US20180024858A1 (en) | Framework for authoring data loaders and data savers | |
JP2016529574A (en) | Support for a combination of flow-based ETL and entity relationship-based ETL | |
US9009175B2 (en) | System and method for database migration and validation | |
US9195456B2 (en) | Managing a catalog of scripts | |
CN111708764A (en) | A kind of control method and device for database change version | |
CN113297320A (en) | Distributed database system and data processing method | |
WO2020259516A1 (en) | Unit testing system and unit testing method | |
CN115552390A (en) | Server-free data lake indexing subsystem and application programming interface | |
CN106650408B (en) | A method and system for judging whether an Android system has root authority | |
US9448791B1 (en) | Synchronizing source code objects and software development workflow objects | |
CN102215264B (en) | Method and device for supporting multi-tenancy data and service customized running | |
CN106227656A (en) | A kind of data contention sample detecting method based on hardware and thread-local sequential | |
CN114579589A (en) | How to implement Update function in Trino Iceberg connection | |
CN113568605A (en) | Method, device and system for configuring constrained route | |
US9442698B2 (en) | Migration between model elements of different types in a modeling environment | |
CN113835690B (en) | Read-write separation multi-data source component and its working method | |
US20090138846A1 (en) | Extended macro recording | |
CN106776296A (en) | Startup method, device and starting device that coverage rate is detected | |
CN116166275B (en) | A deep learning task composition method, device, and medium | |
US20240045881A1 (en) | System and method for expanding a data transfer framework | |
CN114490523B (en) | Data writing method, device, storage medium and equipment | |
CN114490578B (en) | Data model management method, device and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20241128 Address after: 31a, 15 / F, building 30, maple mall, bangrang Road, Brazil, Singapore Patentee after: Baiguoyuan Technology (Singapore) Co.,Ltd. Country or region after: Singapore Address before: 511400 floor 5-13, West Tower, building C, 274 Xingtai Road, Shiqiao street, Panyu District, Guangzhou City, Guangdong Province Patentee before: GUANGZHOU BAIGUOYUAN INFORMATION TECHNOLOGY Co.,Ltd. Country or region before: China |