CN116107543A - Project changing method and device based on VUE engineering code project - Google Patents

Project changing method and device based on VUE engineering code project Download PDF

Info

Publication number
CN116107543A
CN116107543A CN202211548041.5A CN202211548041A CN116107543A CN 116107543 A CN116107543 A CN 116107543A CN 202211548041 A CN202211548041 A CN 202211548041A CN 116107543 A CN116107543 A CN 116107543A
Authority
CN
China
Prior art keywords
vue
project
item
application
micro
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.)
Pending
Application number
CN202211548041.5A
Other languages
Chinese (zh)
Inventor
张国强
兰文进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BOE Technology Group Co Ltd
Original Assignee
BOE Technology Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BOE Technology Group Co Ltd filed Critical BOE Technology Group Co Ltd
Priority to CN202211548041.5A priority Critical patent/CN116107543A/en
Publication of CN116107543A publication Critical patent/CN116107543A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/10Requirements analysis; Specification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Abstract

The invention discloses a project changing method and a project changing device based on a VUE project code project, wherein the project changing method of one embodiment comprises the following steps: forming an abstract syntax tree by a VUE compiler according to js object literal format based on an original VUE engineering code item comprising a main application and at least one micro-application; responding to item change options set by a user, analyzing the abstract syntax tree through a VUE analyzer and generating a keyword identifier; and carrying out item conversion on the original VUE engineering code item through a VUE converter according to the keyword identification so as to generate and store a VUE engineering code updating item. The project changing method provided by the invention can realize the adaptive compiling conversion and project dependent addition of the configuration file, so that the combination or the splitting of VUE and the frame project can be realized through the structural modification of the VUE engineering file, the maintenance cost is effectively reduced, the development efficiency is improved, the workload is reduced, and the method has practical application value.

Description

Project changing method and device based on VUE engineering code project
Technical Field
The invention relates to the technical field of Internet, in particular to a project changing method and device based on a VUE engineering code project.
Background
In actual project development, business and project demand change will cause problems of project splitting or reorganization and reconstruction, for example, in independent project deployment, micro-applications in main applications need to be deployed and maintained separately, and the project basic framework, the splitting aggregation dependence, the configuration file modification, the project adaptation isolation and the like need to be modified manually, so that the problems of high maintenance cost and high error rate exist, and the required workload is increased and the working efficiency is reduced due to manual reorganization of a plurality of projects.
How to realize convenient and rapid splitting or merging of the main application and the micro application becomes a technical problem to be solved by the technicians in the field.
Disclosure of Invention
To solve at least one of the above problems, a first aspect of the present invention provides an item changing method based on a VUE project code item, including:
forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application;
responding to item change options set by a user, analyzing the abstract syntax tree through a VUE analyzer and generating a keyword identifier;
And carrying out item conversion on the original VUE engineering code item through a VUE converter according to the keyword identification so as to generate and store a VUE engineering code updating item.
Further, forming, by the VUE compiler, an abstract syntax tree according to js object literal format based on the original VUE engineering code item further includes:
traversing a main application of the original VUE engineering code item and a first engineering file of each micro application by the VUE compiler to acquire the relation information of the original VUE engineering code item;
and forming an abstract syntax tree according to the js object literal format by a VUE compiler according to the relation information.
Further, responding to the project changing option set by the user as a merging option, the parsing the abstract syntax tree by the VUE parser and generating the keyword identifier further comprises:
analyzing the abstract syntax tree according to a VUE engineering framework by a VUE analyzer according to a preset merging strategy to obtain the resource information of the main application and each micro application of the original VUE engineering code item and integrating resources;
packaging each micro application into a component package named by project name according to a preset merging strategy, and forming a first updating configuration file of the VUE engineering code updating project;
And generating a first keyword identifier according to the resource information of each micro application and at least one of a module type, a source, an isolation strategy and a merging mode according to a preset merging strategy.
Further, the generating the resource information of each micro application according to the preset merging strategy and at least one of the module type, the source, the isolation strategy and the merging mode to generate the first keyword identifier further comprises at least one of the following steps:
generating a merging module type identifier according to the module type by using the resource information of each micro application according to a preset merging strategy;
generating a module source identifier according to the source of the resource information of each micro application according to a preset merging strategy;
generating a merging and isolating mode identifier according to the preset merging strategy and the resource information of each micro application according to the isolating strategy;
and generating a packaging mode identifier according to the resource information of each micro application according to the merging mode according to a preset merging strategy.
Further, the packaging each micro application into a package named by the project name according to the preset merging strategy further comprises:
And based on the nesting relation between the main application and each micro application in the merging strategy, packaging each micro application into a component package named by the project name.
Further, the performing, by the VUE converter, item conversion on the original VUE project code item according to the keyword identifier to generate and store a VUE project code update item further includes:
establishing a second engineering file of the VUE engineering code updating project through a VUE converter, wherein the second engineering file comprises a plurality of folders;
searching the first keyword identification through a VUE converter, acquiring first dependence attribution information of the VUE engineering code updating item, merging and deduplicating according to the first dependence attribution information, the main application and resource information of each micro application to generate a resource file of the VUE engineering code updating item, and storing the resource file into a corresponding folder in the second engineering file;
generating configuration items of the VUE project code update items according to the first update configuration file through a VUE converter and storing the configuration items into corresponding folders in the second project file;
and generating other files of the VUE project code updating project through a VUE converter according to the original VUE project code project, and storing the files into corresponding folders in the second project file.
Further, responding to the project change option set by the user as a split option, the parsing the abstract syntax tree by the VUE parser and generating the keyword identifier further comprises:
according to a preset splitting strategy, analyzing the abstract syntax tree by a VUE analyzer according to a VUE engineering framework to obtain the resource information of the main application and each micro application of the original VUE engineering code item and splitting resources;
generating a plurality of page outlets named by item names, main application names or corresponding micro-application names according to a preset splitting strategy, and forming a second updating configuration file of the VUE engineering code updating item, wherein the second updating configuration file comprises a first sub-updating configuration file of the split main application and a second sub-updating configuration file of each micro-application;
and generating a second keyword identifier according to the resource information of each micro application and at least one of a module type, a source, an isolation strategy and a splitting mode according to a preset splitting strategy.
Further, the generating the resource information of each micro application according to the preset splitting policy and at least one of the module type, the source, the isolation policy and the splitting mode to generate a second key word identifier, further includes at least one of the following steps:
Generating a splitting module type identifier according to the module type by using the resource information of each micro application according to a preset splitting strategy;
generating a module source identifier according to the source of the resource information of each micro application according to a preset splitting strategy;
generating a splitting isolation mode identifier according to the resource information of each micro application and the isolation policy according to a preset splitting policy;
and generating a packaging mode identifier according to the resource information of each micro application according to the splitting mode according to a preset splitting strategy.
Further, the generating the plurality of page outlets named by the project name, the main application name or the corresponding micro-application name according to the preset splitting policy further includes:
and generating a plurality of page outlets named by item names, main application names or corresponding micro-application names based on the nesting relation between the main application and each micro-application in the original VUE engineering code item and the splitting requirement of the splitting strategy.
Further, the performing, by the VUE converter, item conversion on the original VUE project code item according to the keyword identifier to generate and store a VUE project code update item further includes:
Establishing a third engineering file of the VUE engineering code updating project through a VUE converter, wherein the third engineering file comprises a plurality of folders;
searching the second keyword identifier through a VUE (virtual machine) converter, acquiring second dependence attribution information of the VUE project code updating project, splitting and adding according to the second dependence attribution information, the main application and resource information of each micro application to generate a resource file of the VUE project code updating project, and storing the resource file into a corresponding folder in the third project file;
generating configuration items of the VUE project code update items according to the second update configuration file through a VUE converter and storing the configuration items into corresponding folders in the third project file;
and generating other files of the VUE project code updating project through a VUE converter according to the original VUE project code project, and storing the other files into a corresponding folder in the third project file.
A second aspect of the present invention provides an item changing apparatus based on a VUE engineering code item, including a VUE compiler, a VUE parser, a VUE converter, and a controller, wherein the controller is configured to:
forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application;
Responding to item change options set by a user, analyzing and processing data of the abstract syntax tree through a VUE analyzer to generate a keyword identifier;
and carrying out item conversion by a VUE converter according to the keyword identification to generate and store a VUE engineering code updating item.
A third aspect of the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method as described in the first aspect.
A fourth aspect of the invention provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method according to the first aspect when executing the program.
The beneficial effects of the invention are as follows:
aiming at the existing problems at present, the invention establishes a project changing method and a changing device based on the VUE engineering code project, and realizes the adaptive compiling conversion and project dependent addition of configuration files through the VUE compiler, the VUE parser and the VUE converter, thereby realizing the combination or splitting of VUE and frame projects through the structural modification of the VUE engineering files, conveniently and rapidly realizing the construction requirements of main applications and micro applications in different projects, effectively reducing maintenance cost, improving development efficiency, reducing workload and having practical application value.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a flow chart of a method of item change according to an embodiment of the invention;
FIG. 2 illustrates a schematic diagram of a specific framework structure of a VUE project code item;
3a-3e illustrate schematic diagrams of VUE engineering code items of a separately deployed host application and at least one micro-application according to one embodiment of the invention;
FIG. 4 illustrates a schematic diagram of an abstract syntax tree according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a merge reconstructed page file according to one embodiment of the invention;
FIG. 6 is a block diagram showing the construction of an item changing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a computer device according to another embodiment of the present invention.
Detailed Description
In order to more clearly illustrate the present invention, the present invention will be further described with reference to preferred embodiments and the accompanying drawings. Like parts in the drawings are denoted by the same reference numerals. It is to be understood by persons skilled in the art that the following detailed description is illustrative and not restrictive, and that this invention is not limited to the details given herein.
Aiming at the problems in the related art, the inventor has proved that the manual combination or the splitting has the defects through a large number of researches and experiments that the resources and the configurations of all the micro applications are required to be integrated to form uniform resources and configurations during the combination, and each independent micro application is required to be added with the respective resources and configurations during the splitting, so that the workload is increased, the error is prone and the working efficiency is reduced.
In accordance with the above-described problems and the causes thereof, as shown in fig. 1, an embodiment of the present invention provides an item changing method based on a VUE project code item, including: forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application; responding to item change options set by a user, analyzing the abstract syntax tree through a VUE analyzer and generating a keyword identifier; and carrying out item conversion on the original VUE engineering code item through a VUE converter according to the keyword identification so as to generate and store a VUE engineering code updating item.
The Vue is a set of progressive JS (JavaScript) framework for constructing a user interface, is designed to be applied layer by layer from bottom to top, and is core-reflected in data-driven view, MVVM mode (M data model, V view page view, and VM data model and view controller view model), and component development, so that development efficiency can be effectively improved. Wherein, javaScript is a lightweight, interpreted or just-in-time compiled programming language with function priority.
In this embodiment, a file type framework based on VUE engineering is formed by a VUE compiler according to an original VUE engineering code item to form an abstract syntax tree including a main application and at least one micro application representing the original engineering, then the abstract syntax tree is parsed by the VUE parser according to a merging or splitting instruction to generate a keyword identifier for merging or splitting, and finally the original engineering is converted by the VUE converter according to the file type framework of the VUE engineering and a new engineering is generated. According to the method and the device, according to the merging or splitting instruction, through adaptive compiling conversion and project dependent addition of the configuration file and through modification of the structure based on the VUE engineering file, the merging or splitting of VUE and the frame project is achieved, automatic construction of the original VUE engineering is completed, so that construction requirements of main application and micro application in different projects are conveniently and rapidly achieved, maintenance cost is effectively reduced, development efficiency is improved, workload is reduced, and practical application value is achieved.
In a specific example, in a case that the main application and each micro application in the VUE engineering code item are deployed separately, a process of integrating and reconstructing the main application and each micro application is described, which specifically includes:
First, forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application.
In this embodiment, as shown in fig. 2, a specific frame structure of the VUE project code item package json includes a plurality of folders and file types, for example, an interface file api, a resource file packages, a layout file layout, a routing file router, a style file style, and the like, which are used to describe specific information of the VUE project code item package json. As shown in fig. 3a-3e, the original VUE engineering code item includes a main application and at least one micro application, and specifically, as shown in fig. 3a, according to a specific frame structure of the VUE engineering, a main application a, and a micro application B and a micro application C are formed; as shown in fig. 3b, the folder of the main application a has the page files, the resource files assets, the route files router and other files; as shown in fig. 3c, the folder of the micro application B has a set of independent page files, resource file assets, routing files, etc.; as shown in fig. 3d, the folder of the micro application C has a set of independent page files, resource file assets, routing files, etc.; as shown in fig. 3e, the specific content of the page file of the main application a is shown, where the micro app of the micro views includes a micro application B and a micro application C, and as can be seen in fig. 3a-3e, the micro apps are stored under different folders under the VUE project code item package. In other words, the micro application B and the micro application C each include a plurality of folders that are independent for storing the configuration files of the micro application B and the micro application C, respectively. The abstract syntax tree is used for representing the VUE engineering code item, and the abstract syntax tree AST is essentially a JS object and is expressed in the form of a character string. In other words, the abstract syntax tree AST serves the compilation of the VUE project code items, which can be converted by the VUE compiler into abstract syntax tree AST, including the JS object literal in the form of a character string, including the logical relationships of the host application and the micro-applications.
The forming, by the VUE compiler, the abstract syntax tree concrete according to the js object literal format according to the embodiment includes:
firstly, traversing a main application of the original VUE engineering code item and a first engineering file of each micro application by the VUE compiler to acquire the relation information of the original VUE engineering code item.
In this embodiment, the first project file includes project engineering, configuration file and directory structure of original VUE project code project, and the relationship information includes dependency relationship, packaging policy and deployment rule of the main application and each micro application. Specifically, the VUE compiler obtains main dependency relations, packaging strategies and deployment rules in the directory structure and the like of the original VUE engineering code item by traversing main application and micro application project package.
And secondly, forming an abstract syntax tree according to the js object literal format by a VUE compiler according to the relation information.
In this embodiment, an abstract syntax tree AST is generated by a VUE compiler according to js object literal format mapping, where the abstract syntax tree AST is a json or js file based on descriptions including nested relationships, routing/resource/data state configuration, related dependency collection, directory structure, formatting functions, and the like.
As shown in fig. 4, the abstract syntax tree is a character string format based on an object, wherein the name of the main application a is "main a", the dependency relationship dependency includes the name of the micro application B is "main B", the dependency relationship dependency and the configuration list configList of the micro application B, and the configuration list configList, the route file route and the resource file assembly of the main application a are shown in fig. 4.
In this embodiment, an abstract syntax tree including a main application and at least one micro application characterizing an original project is formed by a VUE compiler according to an original VUE project code item, so that the VUE parser parses according to the abstract syntax tree.
And secondly, responding to item change options set by a user, analyzing the abstract syntax tree through a VUE analyzer and generating a keyword identifier.
In this embodiment, the VUE parser parses the abstract syntax tree to obtain resource allocation of the original VUE project code item, and performs a preparation operation of resource reorganization by generating a keyword identifier according to the item change option.
The method specifically comprises the following steps:
firstly, according to a preset merging strategy, analyzing the abstract syntax tree through a VUE analyzer according to a VUE engineering framework to obtain the resource information of the main application and each micro application of the original VUE engineering code item and integrating resources.
In this embodiment, the VUE parser parses the abstract syntax tree according to a VUE engineering framework, which specifically includes parsing an AST description file according to policies such as a file type (VUE, html, css, js, image, etc.), a module reference dependency relationship, an application isolation, etc. of the VUE engineering framework, so as to obtain a master application of the original VUE engineering code item and resource information of each micro application, where the resource information includes related files such as a routing file, a configuration file, and a resource file of the master application.
In this embodiment, according to the merging operation and the parameter options related to the merging operation selected by the user through the visual interface, or according to the merging operation and the parameter options related to the merging operation characterized by the user through the instruction, the VUE analyzer integrates the resources of the main application and the resource information of each micro application, which are obtained by analyzing the AST description file, according to the merging operation and the parameter options.
In particular, and still taking the independent deployment of the main application a and the micro applications B and C as shown in fig. 3a-3e as an example, the main application a includes the micro applications B and C, and the micro applications B and C are in parallel structure, and the VUE parser is related to all the containing applications, that is, related to the micro applications B and C, through the main application main dependency chain according to the merging operation and the parameter options to realize the similar combination.
And secondly, packaging each micro application into a component package named by the project name according to a preset merging strategy, and forming a first updating configuration file of the VUE engineering code updating project.
In this embodiment, the VUE parser packages each micro application according to the project name according to the rule of the merging operation, for example, packages the micro application B and the micro application C to form a package named by the project name. Meanwhile, aiming at the combined micro-application B and the micro-application C, a first update configuration file of the VUE engineering code update item is formed, namely, based on the configuration file of the original VUE engineering code item, the combined update configuration file is formed according to a combining strategy, namely, the VUE engineering comprises a vue.config.js file. Considering that each micro-application under a main application is in a nested structure, in an alternative embodiment, each micro-application is packaged into a package named by a project name based on the nesting relationship between the main application and each micro-application in the merging strategy.
In this embodiment, for example, the host application a includes a micro application B and a micro application C, where the micro application B and the micro application C are nested, and for example, the micro application B includes a micro application C. At this time, packaging is performed in a nested relationship of the micro application B and the micro application C, the formed package includes the nested relationship of the two, and the package is named by using the item name.
And generating a first keyword identifier according to the resource information of each micro application and at least one of the module type, the source, the isolation strategy and the merging mode according to a preset merging strategy.
In the embodiment, a module type identifier (including micro application, main application, component and the like) related to resource integration is generated based on the module type related to resource integration by a VUE (virtual user equipment) analyzer according to a merging strategy, for example, according to the type: micro/main/component file content, and the like, and the integration of the same type of modules is indicated by the identifier; and generating a module source identifier based on sources involved in resource integration, for example, according to from: appA/main A file content, by which the same module source is indicated to be integrated; generating a combined isolation mode identifier (comprising a strict mode and an experimental mode for example) based on an isolation strategy related to resource integration, for example, according to the content of a sacdbox: struct/experimental and active rule: [ url1, url2] file, and integrating the same mode module by the identifier; and generating a package mode identifier (including a dependency package, a fusion package, a unpacking package and a plug-in package, for example) based on a combined combination mode related to resource integration, for example, according to a schema, so as to generate a keyword identifier according to at least one identifier, thereby facilitating item conversion by the VUE converter.
And thirdly, carrying out item conversion on the original VUE engineering code item through a VUE converter according to the keyword identification so as to generate and store a VUE engineering code updating item.
In this embodiment, the VUE converter performs a substantial operation of file reorganization according to the keyword identifier generated by the VUE parser, that is, performs item conversion according to the original VUE project code item to generate a VUE project code update item. The method specifically comprises the following steps:
first, a second project file of the VUE project code update item is established by a VUE transformer, the second project file including a plurality of folders.
In this embodiment, the VUE converter is used to build a project file of the reorganization project, that is, a new project file is formed according to the VUE project framework, where each folder included in the project file is empty.
And secondly, searching the first keyword identifier through a VUE (virtual machine) converter, acquiring first dependence attribution information of the VUE engineering code updating item, merging and deduplicating according to the first dependence attribution information, the main application and resource information of each micro application to generate a resource file of the VUE engineering code updating item, and storing the resource file into a corresponding folder in the second engineering file.
In this embodiment, the VUE converter retrieves the dependency attribution information of the main application and each micro application according to the keyword identifier generated by the VUE parser, for example, according to the specific identifier such as the module type, the source, the isolation policy, the merge combination mode, and the like, merges the information about the main application and each micro application, performs package. Json integration, de-duplication, and generates a merged resource file, and stores the merged resource file under the corresponding folder of the new project file to fill the second project file of the VUE project code update item.
In particular, the independent deployment of the main application a, the micro application B and the micro application C as shown in fig. 3a-3e is taken as an example, in the original VUE engineering code project, the main application a includes own resource files, the micro application B and the micro application C also include respective resource files, in the merging process, the resource files of the main application a, the micro application B and the micro application C are integrated, and the overlapped resource files are removed to generate updated resource files, so that on one hand, the accurate operation of the main application a, the micro application B and the micro application C can be ensured, meanwhile, the operation error caused by resource redundancy is avoided, and the occupation of the space by the resource files is further reduced; on the other hand, the maintenance, upgrading and deployment are convenient through a single resource file, the maintenance cost of the VUE engineering code project is effectively reduced, and the development efficiency of research and development personnel is improved.
And generating configuration items of the VUE project code updating project according to the first updating configuration file through a VUE converter, and storing the configuration items into corresponding folders in the second project file.
In this embodiment, on the basis of generating a new resource file, the combined configuration item file is generated by the VUE converter according to the update configuration file generated by the VUE parser, and the combined configuration item file is stored under the corresponding folder of the new engineering file to fill the second engineering file of the VUE engineering code update item.
And finally, generating other files of the VUE project code updating project through a VUE converter according to the original VUE project code project, and storing the files into a corresponding folder in the second project file.
In this embodiment, the original VUE project code item is further converted by the VUE converter, and the second project file of the VUE project code update item is filled, specifically, for example, files such as lib, public, src, components, config, router, store, assets, fetch, common, tools, types, constant, VUE.
Specifically, as shown in fig. 5, the page file of the combined VUE project code update item includes multiple combined pages sub-items, where an entry address entry, a template and a file name file of a main application main are defined, and meanwhile, the page file also includes a combined micro application B, where the micro application includes an entry address entry, a template and a file name file. As can be seen from the figure, after the independently configured main application and micro application are combined and reconstructed, a unified configured combined page file is formed, including the page settings of the main application and the micro application.
Thus, the process of combining and reconstructing the main application and each micro application is completed. According to the method, the device and the system, the adaptation compiling conversion and the project dependent addition of the configuration files are realized through the VUE compiler, the VUE parser and the VUE converter, so that the combination of VUE and a frame project is realized through the structural modification of the VUE project file, the construction requirements of the main application and the micro application in different projects can be conveniently and rapidly realized, the maintenance cost is effectively reduced, the development efficiency is improved, and the workload is reduced.
In another specific example, in the case that the main application and each micro application in the VUE engineering code project are deployed as a whole, a process of splitting and reconstructing the main application and each micro application is described, which specifically includes:
first, forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application.
In this embodiment, the VUE compiler traverses the main application of the original VUE project code item and the first project file of each micro application to obtain the relationship information of the original VUE project code item, and forms an abstract syntax tree according to js object literal quantity format. Specifically, the original VUE engineering code item comprises a main application and at least one micro application, and the main application a, the micro application B and the micro application C are formed by setting different folders according to the specific framework structure of the VUE engineering. The main application a, the micro application B and the micro application C in this embodiment are deployed uniformly, that is, stored under a unified folder under the VUE project code item package.
The specific implementation manner of this embodiment is the same as that of the foregoing embodiment, and will not be described herein.
And secondly, responding to item change options set by a user, analyzing the abstract syntax tree through a VUE analyzer and generating a keyword identifier.
In this embodiment, the VUE parser parses the abstract syntax tree to obtain resource allocation of the original VUE project code item, and performs a preparation operation of resource reorganization by generating a keyword identifier according to the item change option.
The method specifically comprises the following steps:
firstly, analyzing the abstract syntax tree according to a VUE engineering framework by a VUE analyzer according to a preset splitting strategy to obtain the resource information of the main application and each micro application of the original VUE engineering code item and splitting the resources.
In this embodiment, the VUE parser parses the abstract syntax tree according to a VUE engineering framework, which specifically includes parsing an AST description file according to policies such as a file type (VUE, html, css, js, image, etc.), a module reference dependency relationship, an application isolation, etc. of the VUE engineering framework, so as to obtain unified resource information of a main application and each micro application of the original VUE engineering code item, where the resource information includes related files such as a routing file, a configuration file, and a resource file of the main application and each micro application.
In this embodiment, according to the splitting operation and the parameter options related to the splitting operation selected by the user through the visual interface, or according to the splitting operation and the parameter options related to the splitting operation characterized by the user through the instruction, the VUE analyzer performs resource splitting on the main application and the resource information of each micro application obtained by analyzing the AST description file according to the splitting operation and the parameter options.
Specifically, taking the unified deployment of the main application a, the micro application B and the micro application C as shown in fig. 5 as an example, the main application a includes the micro application B and the micro application C, the micro application B and the micro application C are in parallel structures, and the VUE parser is related to all the applications included through a main application main dependency chain according to the splitting operation and the parameter options, that is, the micro application B and the micro application C are respectively related to implement the splitting operation.
And secondly, generating a plurality of page outlets named by item names, main application names or corresponding micro-application names according to a preset splitting strategy, and forming a second updating configuration file of the VUE engineering code updating item, wherein the second updating configuration file comprises a first sub-updating configuration file of the split main application and a second sub-updating configuration file of each micro-application.
In this embodiment, the VUE parser splits according to the rule of the splitting operation, and according to the project name, the main application name, or the corresponding micro application, for example, the main application a, the micro application B, and the micro application C are split and form different page outlets respectively, and naming is performed by using different names. Specifically, the micro application B and the micro application C are respectively split from the main application A, wherein the independent page outlet of the main application A is named by the project name and the main application name, the independent page outlet of the micro application B is named by the project name and the micro application B, and the independent page outlet of the micro application C is named by the project name and the micro application C. Meanwhile, aiming at the split relatively independent main application A, the micro application B and the micro application C, a second update configuration file of the VUE engineering code update item is formed, namely, on the basis of the configuration file of the original VUE engineering code item, the split update configuration file is formed according to a splitting strategy and comprises a plurality of sub update configuration files, namely, the VUE engineering comprises a plurality of vue.config.js files stored in different applications.
Considering that each micro-application under the main application is in a nested structure, in an alternative embodiment, a plurality of page outlets named by item names, main application names or corresponding micro-application names are generated based on the nested relation between the main application and each micro-application in the original VUE engineering code item and the splitting requirement of the splitting strategy.
In this embodiment, for example, the host application a includes a micro application B and a micro application C, where the micro application B and the micro application C are nested, and for example, the micro application B includes a micro application C. At this time, the micro application B is split from the main application a, and then the micro application C is split from the micro application B, so as to form page outlets of the main application a, the micro application B and the micro application C which are configured independently of each other, and the page outlets are named respectively.
And generating a second keyword identifier according to the resource information of each micro application and at least one of the module type, the source, the isolation strategy and the splitting mode according to a preset splitting strategy.
In the embodiment, a splitting module type identifier is generated by the VUE analyzer based on the module type related to resource splitting according to a splitting strategy, for example, according to the type, namely micro/main/component file content, and splitting of the same type module is indicated by the identifier; and generating a module source identifier based on the source involved in the resource splitting, for example, according to from: appA/main A file content, by which the splitting of the same module source is indicated; generating a splitting isolation mode identifier (comprising a strict mode and an experimental mode for example) based on an isolation strategy related to resource splitting, for example, according to the content of a file [ url1, url2] of a sacdbox: struct/exact and active rule, wherein the identifier indicates that the same mode module is split; and generating a package mode identifier (including a dependency package, a fusion package, a package-splitting package and a plug-in package, for example) based on a split combination mode related to resource splitting, for example, according to a schema, so as to generate a keyword identifier according to at least one identifier to facilitate item conversion by the VUE converter.
And thirdly, carrying out item conversion on the original VUE engineering code item through a VUE converter according to the keyword identification so as to generate and store a VUE engineering code updating item.
In this embodiment, the VUE converter performs a substantial operation of file reorganization according to the keyword identifier generated by the VUE parser, that is, performs item conversion according to the original VUE project code item to generate a VUE project code update item. The method specifically comprises the following steps:
first, a third project file of the VUE project code update item is created by a VUE transformer, the third project file including a plurality of folders.
In this embodiment, the VUE converter is used to build a project file of the reorganization project, that is, a new project file is formed according to the VUE project framework, where each folder included in the project file is empty.
And secondly, searching the second keyword identifier through a VUE (user Equipment) converter, acquiring second dependence attribution information of the VUE engineering code updating item, splitting and adding according to the second dependence attribution information, the main application and resource information of each micro application to generate a resource file of the VUE engineering code updating item, and storing the resource file into a corresponding folder in the third engineering file.
In this embodiment, the VUE converter retrieves the dependency attribution information of the main application and each micro application according to the keyword identifier generated by the VUE analyzer, for example, according to the specific identifier such as the module type, the source, the isolation policy, the splitting combination mode, and the like, splits the package.
Specifically, the description is given taking unified deployment of the main application A, the micro application B and the micro application C as an example, in the original VUE engineering code project, the main application A, the micro application B and the micro application C have unified resource files, in the splitting process, the main application A, the micro application B and the micro application C respectively form respective resource files, the unified resource files are added in a separating mode, and updated multiple resource files are generated respectively, so that on one hand, accurate operation of the main application A, the micro application B and the micro application C after splitting can be ensured, on the other hand, reverse multi-page application separation into multiple micro applications can be realized, the workload of research personnel can be effectively reduced, and the development efficiency of the research personnel can be improved.
And generating configuration items of the VUE project code updating project according to the second updating configuration file through a VUE converter, and storing the configuration items into corresponding folders in the third project file.
In this embodiment, on the basis of generating a new resource file, a plurality of split configuration item files are generated through the VUE converter according to the update configuration file generated by the VUE parser, and are stored under the corresponding folders of the new engineering file to fill the third engineering file of the VUE engineering code update item.
And finally, generating other files of the VUE project code updating project through a VUE converter according to the original VUE project code project, and storing the files into a corresponding folder in the third project file.
In this embodiment, the original VUE project code item is further converted by the VUE converter, and the third project file of the VUE project code update item is filled, specifically, for example, files such as lib, public, src, components, config, router, store, assets, fetch, common, tools, types, constant, VUE.
So far, the process of splitting and reconstructing the unified deployed main application and each micro application is completed. According to the method, the device and the system, the adaptation compiling conversion and the project dependent addition of the configuration files are realized through the VUE compiler, the VUE parser and the VUE converter, so that the combination of VUE and a frame project is realized through the structural modification of the VUE project file, the construction requirements of the main application and the micro application in different projects can be conveniently and rapidly realized, the maintenance cost is effectively reduced, the development efficiency is improved, and the workload is reduced.
In correspondence with the project changing method provided in the foregoing embodiments, an embodiment of the present application further provides a project changing device applying the project changing method, and since the project changing device provided in the embodiment of the present application corresponds to the project changing method provided in the foregoing embodiments, the foregoing embodiment is also applicable to the project changing device provided in the embodiment, and will not be described in detail in the embodiment.
As shown in fig. 6, an embodiment of the present application further provides an item changing device applying the above item changing method, including a VUE compiler, a VUE parser, a VUE converter, and a controller, where the controller is configured to: forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application; responding to item change options set by a user, analyzing and processing data of the abstract syntax tree through a VUE analyzer to generate a keyword identifier; and carrying out item conversion by a VUE converter according to the keyword identification to generate and store a VUE engineering code updating item.
In this embodiment, the project changing device controls the VUE compiler, the VUE parser and the VUE converter through the controller to implement adaptive compiling conversion and project dependent addition of the configuration file, so that the combination or splitting of VUE and the frame project can be implemented through structural modification of the VUE project file, the construction requirements of different projects on the main application and the micro application can be conveniently and rapidly implemented, the maintenance cost is effectively reduced, the development efficiency is improved, the workload is reduced, and the project changing device has practical application value.
Another embodiment of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements: forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application; responding to item change options set by a user, analyzing the abstract syntax tree through a VUE analyzer and generating a keyword identifier; and carrying out item conversion on the original VUE engineering code item through a VUE converter according to the keyword identification so as to generate and store a VUE engineering code updating item.
In practical applications, the computer-readable storage medium may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this embodiment, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
As shown in fig. 7, another embodiment of the present invention provides a schematic structural diagram of a computer device. The computer device 12 shown in fig. 7 is only an example and should not be construed as limiting the functionality and scope of use of embodiments of the invention.
As shown in fig. 7, the computer device 12 is in the form of a general purpose computing device. Components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 7, commonly referred to as a "hard disk drive"). Although not shown in fig. 7, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and/or any devices (e.g., network card, modem, etc.) that enable the computer device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Moreover, computer device 12 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 20. As shown in fig. 7, the network adapter 20 communicates with other modules of the computer device 12 via the bus 18. It should be appreciated that although not shown in fig. 7, other hardware and/or software modules may be used in connection with computer device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processor unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing a VUE project code project-based project change method provided by embodiments of the present invention.
It should be understood that the foregoing examples of the present invention are provided merely for clearly illustrating the present invention and are not intended to limit the embodiments of the present invention, and that various other changes and modifications may be made therein by one skilled in the art without departing from the spirit and scope of the present invention as defined by the appended claims.

Claims (13)

1. A method for changing an item based on a VUE project code item, comprising:
forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application;
responding to item change options set by a user, analyzing the abstract syntax tree through a VUE analyzer and generating a keyword identifier;
And carrying out item conversion on the original VUE engineering code item through a VUE converter according to the keyword identification so as to generate and store a VUE engineering code updating item.
2. The method of claim 1, wherein forming, by the VUE compiler, the abstract syntax tree in js object literal format based on the original VUE project code item further comprises:
traversing a main application of the original VUE engineering code item and a first engineering file of each micro application by the VUE compiler to acquire the relation information of the original VUE engineering code item;
and forming an abstract syntax tree according to the js object literal format by a VUE compiler according to the relation information.
3. The method of claim 1, wherein in response to the user setting the item change option as a merge option, the parsing the abstract syntax tree by the VUE parser and generating a keyword identifier further comprises:
analyzing the abstract syntax tree according to a VUE engineering framework by a VUE analyzer according to a preset merging strategy to obtain the resource information of the main application and each micro application of the original VUE engineering code item and integrating resources;
Packaging each micro application into a component package named by project name according to a preset merging strategy, and forming a first updating configuration file of the VUE engineering code updating project;
and generating a first keyword identifier according to the resource information of each micro application and at least one of a module type, a source, an isolation strategy and a merging mode according to a preset merging strategy.
4. The method for changing an item according to claim 3, wherein generating the first key identifier according to the resource information of each micro application and at least one of a module type, a source, an isolation policy and a merge mode according to a preset merge policy, further comprises at least one of the following steps:
generating a merging module type identifier according to the module type by using the resource information of each micro application according to a preset merging strategy;
generating a module source identifier according to the source of the resource information of each micro application according to a preset merging strategy;
generating a merging and isolating mode identifier according to the preset merging strategy and the resource information of each micro application according to the isolating strategy;
and generating a packaging mode identifier according to the resource information of each micro application according to the merging mode according to a preset merging strategy.
5. The method of claim 3, wherein packaging the micro-applications into component packages named by project name according to a preset merge policy further comprises:
and based on the nesting relation between the main application and each micro application in the merging strategy, packaging each micro application into a component package named by the project name.
6. The method of claim 3, wherein said performing, by a VUE transformer, project transformations on said original VUE project code project based on said keyword identification to generate and store a VUE project code update project further comprises:
establishing a second engineering file of the VUE engineering code updating project through a VUE converter, wherein the second engineering file comprises a plurality of folders;
searching the first keyword identification through a VUE converter, acquiring first dependence attribution information of the VUE engineering code updating item, merging and deduplicating according to the first dependence attribution information, the main application and resource information of each micro application to generate a resource file of the VUE engineering code updating item, and storing the resource file into a corresponding folder in the second engineering file;
Generating configuration items of the VUE project code update items according to the first update configuration file through a VUE converter and storing the configuration items into corresponding folders in the second project file;
and generating other files of the VUE project code updating project through a VUE converter according to the original VUE project code project, and storing the files into corresponding folders in the second project file.
7. The method of claim 1, wherein in response to the user setting the item change option as a split option, the parsing the abstract syntax tree by the VUE parser and generating a keyword identifier further comprises:
according to a preset splitting strategy, analyzing the abstract syntax tree by a VUE analyzer according to a VUE engineering framework to obtain the resource information of the main application and each micro application of the original VUE engineering code item and splitting resources;
generating a plurality of page outlets named by item names, main application names or corresponding micro-application names according to a preset splitting strategy, and forming a second updating configuration file of the VUE engineering code updating item, wherein the second updating configuration file comprises a first sub-updating configuration file of the split main application and a second sub-updating configuration file of each micro-application;
And generating a second keyword identifier according to the resource information of each micro application and at least one of a module type, a source, an isolation strategy and a splitting mode according to a preset splitting strategy.
8. The method for changing an item according to claim 7, wherein generating the resource information of each micro application according to at least one of a module type, a source, an isolation policy and a splitting mode to generate a second key identifier according to a preset splitting policy, further comprises at least one of the following steps:
generating a splitting module type identifier according to the module type by using the resource information of each micro application according to a preset splitting strategy;
generating a module source identifier according to the source of the resource information of each micro application according to a preset splitting strategy;
generating a splitting isolation mode identifier according to the resource information of each micro application and the isolation policy according to a preset splitting policy;
and generating a packaging mode identifier according to the resource information of each micro application according to the splitting mode according to a preset splitting strategy.
9. The method of claim 7, wherein generating a plurality of page outlets named by item names, main application names, or corresponding micro-application names according to a preset splitting policy further comprises:
And generating a plurality of page outlets named by item names, main application names or corresponding micro-application names based on the nesting relation between the main application and each micro-application in the original VUE engineering code item and the splitting requirement of the splitting strategy.
10. The method of claim 7, wherein said performing, by a VUE transformer, project transformations on said original VUE project code project based on said key identification to generate and store a VUE project code update project further comprises:
establishing a third engineering file of the VUE engineering code updating project through a VUE converter, wherein the third engineering file comprises a plurality of folders;
searching the second keyword identifier through a VUE (virtual machine) converter, acquiring second dependence attribution information of the VUE project code updating project, splitting and adding according to the second dependence attribution information, the main application and resource information of each micro application to generate a resource file of the VUE project code updating project, and storing the resource file into a corresponding folder in the third project file;
generating configuration items of the VUE project code update items according to the second update configuration file through a VUE converter and storing the configuration items into corresponding folders in the third project file;
And generating other files of the VUE project code updating project through a VUE converter according to the original VUE project code project, and storing the other files into a corresponding folder in the third project file.
11. A VUE engineering code item based item altering device comprising a VUE compiler, a VUE parser, a VUE converter, and a controller, wherein the controller is configured to:
forming an abstract syntax tree according to js object literal format by a VUE compiler based on an original VUE engineering code item, wherein the original VUE engineering code item comprises a main application and at least one micro application;
responding to item change options set by a user, analyzing and processing data of the abstract syntax tree through a VUE analyzer to generate a keyword identifier;
and carrying out item conversion by a VUE converter according to the keyword identification to generate and store a VUE engineering code updating item.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any one of claims 1-10.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1-10 when the program is executed by the processor.
CN202211548041.5A 2022-12-05 2022-12-05 Project changing method and device based on VUE engineering code project Pending CN116107543A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211548041.5A CN116107543A (en) 2022-12-05 2022-12-05 Project changing method and device based on VUE engineering code project

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211548041.5A CN116107543A (en) 2022-12-05 2022-12-05 Project changing method and device based on VUE engineering code project

Publications (1)

Publication Number Publication Date
CN116107543A true CN116107543A (en) 2023-05-12

Family

ID=86266564

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211548041.5A Pending CN116107543A (en) 2022-12-05 2022-12-05 Project changing method and device based on VUE engineering code project

Country Status (1)

Country Link
CN (1) CN116107543A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117075956A (en) * 2023-09-04 2023-11-17 上海易立德信息技术股份有限公司 Configuration plug method and system applied to modularized project

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117075956A (en) * 2023-09-04 2023-11-17 上海易立德信息技术股份有限公司 Configuration plug method and system applied to modularized project

Similar Documents

Publication Publication Date Title
CN108140007B (en) Securely deploying applications across deployment locations
US11163739B2 (en) Database table format conversion based on user data access patterns in a networked computing environment
CN108279932B (en) Method and device for dynamically configuring user interface of mobile terminal
US9977770B2 (en) Conversion of a presentation to Darwin Information Typing Architecture (DITA)
CN110968325B (en) Applet conversion method and device
CN113126990B (en) Page development method, device, equipment and storage medium
CN110688142A (en) Method, device and storage medium for publishing application programming interface
US10430501B2 (en) Mapping of documents with global tagging map
US10970047B2 (en) Lossless bi-directional formatting of program source code
US20210279400A1 (en) Memory-efficient document processing
CN101901265A (en) Objectification management system of virtual test data
CN110442344A (en) Method, apparatus, system and medium for cross-platform conversion application
CN111125064A (en) Method and device for generating database mode definition statement
CN116107543A (en) Project changing method and device based on VUE engineering code project
US8683425B2 (en) System for generating application architecture design work products
CN113962597A (en) Data analysis method and device, electronic equipment and storage medium
CN112052011A (en) Method and device for combining small programs, electronic equipment and medium
CN111580804A (en) Software project development method and device
CN116431155A (en) Front-end application construction method, medium, device and computing equipment
CN116360741A (en) Applet development method, system, device and storage medium
US8856152B2 (en) Apparatus and method for visualizing data
JP2017524211A (en) Method for unifying information and tools from a plurality of information sources, and computer program product and apparatus applying said method
US9141342B2 (en) Programmatic conversion of support documentation into executable programs
CN113568622A (en) Method and device for converting codes and electronic equipment
US20140074869A1 (en) Autoclassifying compound documents for enhanced metadata search

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