CN111443920A - Frame migration method and device - Google Patents

Frame migration method and device Download PDF

Info

Publication number
CN111443920A
CN111443920A CN202010219977.8A CN202010219977A CN111443920A CN 111443920 A CN111443920 A CN 111443920A CN 202010219977 A CN202010219977 A CN 202010219977A CN 111443920 A CN111443920 A CN 111443920A
Authority
CN
China
Prior art keywords
module
target service
service module
routing information
target
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.)
Granted
Application number
CN202010219977.8A
Other languages
Chinese (zh)
Other versions
CN111443920B (en
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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010219977.8A priority Critical patent/CN111443920B/en
Publication of CN111443920A publication Critical patent/CN111443920A/en
Application granted granted Critical
Publication of CN111443920B publication Critical patent/CN111443920B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a frame migration method and device, and belongs to the technical field of computers. A target front-end framework to be migrated can be obtained, wherein the target front-end framework comprises a main application and a plurality of service modules; determining a target service module to be migrated in the plurality of service modules; generating a remote address of the target service module according to the module name of the target service module and a remote address generation rule, so that the main application calls the target service module according to the remote address; and searching routing information corresponding to the target service module in the main application, migrating the routing information from the main application to the target service module, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for individually deploying the target service module. By the method and the device, the efficiency of frame migration can be improved.

Description

Frame migration method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for frame migration.
Background
With the development of computer technology, the micro service framework is more and more widely applied. The micro-service framework can solve the problems that a modern framework (such as Vue, React and the like) is too bloated and too much in service coupling in a large project, and has the advantages of simplifying on-line steps of each module of a webpage, being strong in independence and the like. Thus, more and more web pages employ a micro-service framework to implement front-end services (which may be referred to as micro-front-ends).
In the related art, when implementing the micro front end, a technician needs to migrate the existing web front end framework and each service module into the micro front end framework. Since projects requiring the micro front-end technology are large websites, the number of service modules is large, and the migration process is complicated, the migration requires much labor and time, and the efficiency is low.
Disclosure of Invention
An object of the embodiments of the present application is to provide a frame migration method and apparatus, so as to solve the problems of high frame migration cost and low efficiency caused by manual frame migration. The specific technical scheme is as follows:
in a first aspect, a frame migration method is provided, where the method includes:
acquiring a target front-end framework to be migrated, wherein the target front-end framework comprises a main application and a plurality of service modules;
determining a target service module to be migrated in the plurality of service modules;
generating a remote address of the target service module according to the module name of the target service module and a remote address generation rule, so that the main application calls the target service module according to the remote address;
and searching routing information corresponding to the target service module in the main application, migrating the routing information from the main application to the target service module, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for individually deploying the target service module.
Optionally, the determining a target service module to be migrated in the plurality of service modules includes:
json file, searching a service module with a module name meeting a preset naming rule as a target service module.
Optionally, the migrating the routing information from the primary application to the target service module includes:
storing the routing information into a preset cache region, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the primary application;
and acquiring the routing information from the preset cache region, and storing the routing information into the target service module in the form of a routing file according to the corresponding relation between the routing information and the module name of the target service module.
Optionally, the method further includes:
and adding a code for acquiring the routing information in the main application so that the main application acquires the routing information from the target service module through the code.
Optionally, the method further includes:
identifying a common component contained in the target business module according to a preset identification rule;
adding the public component into the main application, and adding a program code for calling the public component into an entry file of the main application;
deleting the common component in the target business module.
Optionally, the method further includes:
and generating and outputting a frame migration report, wherein the frame migration report at least comprises error information and warning information generated in the frame migration process.
In a second aspect, there is provided a frame transfer device, the device comprising:
the system comprises an acquisition module, a migration module and a migration module, wherein the acquisition module is used for acquiring a target front-end framework to be migrated, and the target front-end framework comprises a main application and a plurality of service modules;
a determining module, configured to determine a target service module to be migrated among the plurality of service modules;
the generating module is used for generating a remote address of the target business module according to the module name and the remote address generating rule of the target business module so that the main application calls the target business module according to the remote address;
and the migration module is used for searching the routing information corresponding to the target service module in the main application, migrating the routing information from the main application to the target service module, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for individually deploying the target service module.
Optionally, the determining module is specifically configured to:
json file, searching a service module with a module name meeting a preset naming rule as a target service module.
Optionally, the migration module is specifically configured to:
storing the routing information into a preset cache region, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the primary application;
and acquiring the routing information from the preset cache region, and storing the routing information into the target service module in the form of a routing file according to the corresponding relation between the routing information and the module name of the target service module.
Optionally, the apparatus further comprises:
a first adding module, configured to add, in the primary application, a code for acquiring the routing information, so that the primary application acquires the routing information from the target service module through the code.
Optionally, the apparatus further comprises:
the identification module is used for identifying the common components contained in the target business module according to a preset identification rule;
the second adding module is used for adding the public component into the main application and adding a program code for calling the public component into an entry file of the main application;
and the deleting module is used for deleting the common component in the target service module.
Optionally, the apparatus further comprises:
and the output module is used for generating and outputting a frame migration report, wherein the frame migration report at least comprises error information and warning information generated in the frame migration process.
In a third aspect, an electronic device is provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of the first aspect when executing a program stored in the memory.
In a fourth aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when being executed by a processor, carries out the method steps of any of the first aspects.
In a fifth aspect, there is provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the methods described above.
The embodiment of the application has the following beneficial effects:
the embodiment of the application provides a frame migration method and device, electronic equipment can acquire a target front-end frame, the front-end frame comprises a main application and a plurality of service modules, and then a target service module to be migrated is determined in the plurality of service modules. And aiming at each target service module, generating a remote address of the target service module according to the name of the target service module and a remote address generation rule, so that the main application calls the target service module according to the remote address, further searching routing information corresponding to the target service module in the main application, transferring the routing information to the target service module from the main application, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for independently deploying the target service module. According to the scheme, the current target front-end framework can be automatically migrated into the micro front-end framework, manual migration is not needed, and migration efficiency is improved.
Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
Fig. 1 is a flowchart of a framework migration method according to an embodiment of the present application;
fig. 2 is a flowchart of a method for migrating routing information according to an embodiment of the present application;
FIG. 3 is a flow chart of a method for extracting common components according to an embodiment of the present application;
fig. 4 is a flowchart of an example of a framework migration method provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of a frame transfer device according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the application provides a frame migration method which can be applied to electronic equipment. The electronic device may be an electronic device with a data processing function, such as an intelligent terminal, a computer, or the like. The electronic equipment can be used for automatically migrating the existing webpage front-end framework and each service module into a micro front-end framework, so that low-cost migration is realized, and the migration efficiency is improved.
Before migration, the front end framework contains an npm package of a host application and a plurality of service modules. Npm of each service submodule contains all data of the service submodule, such as function codes, configuration information and the like. In the existing front-end framework, the main application includes some necessary data for running each service module, such as routing information, call rules, and the like. Each service module cannot be deployed and operated independently, and can be operated only by unified scheduling of the main application. In the micro front-end framework after migration, the main application is only responsible for the overall framework and does not contain the logic of other service modules, and the other service modules can be deployed and operated independently. The micro-Qin front-end framework solves the problems that modern frameworks such as Vue and React frameworks are too bloated and too much in service coupling in large projects, and has the advantages of simplifying on-line steps of each service module of a webpage, being strong in independence and the like.
A detailed description will be given below of a frame migration method provided in the embodiments of the present application with reference to specific embodiments, as shown in fig. 1, and specific steps are as follows.
Step 101, acquiring a target front-end framework to be migrated.
In the embodiment of the application, the electronic device can acquire the target front-end framework which needs to be migrated. The target front end frame is a common front end frame. Such as front end frameworks implemented based on Vue, React, etc. The target front-end framework is composed of a host application and a plurality of data packets (i.e., npm packets). Wherein, a data packet contains all data of a service module, such as the code, configuration information, etc. of the service module. In the target front-end framework, the main application contains some logic data for deploying and running the service module, such as the name and routing information of all the service modules.
Step 102, determining a target business module to be migrated in a plurality of business modules.
In this embodiment of the present application, the master application may include a webpack file, and module names (also referred to as packet names) of all service modules are stored in the webpack. The electronic equipment can obtain the module names of all the service modules by inquiring the webpack file, and further can determine the target service module to be migrated in all the service modules. The specific service module to be migrated can be set by a technician according to actual needs.
In one implementation, the electronic device may search, in a package, a service module whose module name meets a preset naming rule as a target service module.
In the embodiment of the present application, the existing front-end framework basically manages the dependent modules (i.e., the service modules) by using an npm method, and therefore, under the framework of the main application, a package json file corresponding to npm packages is stored. Json file contains the module name of each service module. Json file may determine whether the module name in the package satisfies a preset naming rule. If the name of a certain module meets the preset naming rule, the module corresponding to the name of the module is a service module to be migrated, and if the name of the certain module does not meet the preset naming rule, the module corresponding to the name of the module is not the service module to be migrated.
After the electronic device determines the target service module, the module name of the target service module may be stored in a to-be-migrated list, and then the module name of the target service module is deleted in a package json file.
In one example, the preset naming convention is @ company/mp-, where "") is an arbitrary character. If the module name of the service module 1 is @ company/mp-copying: {. the. } and the module name of the service module 2 is @ company/mp-interaction {. the. }, the service module 1 and the service module 2 are target service modules. The list to be migrated may be as shown in table one.
Watch 1
Serial number Module name
1 @company/mp-copyright:{...}
2 @company/mp-copyright:{...}
The module name may be comprised of a module identification and other data, which may include preset characters and configuration information for the module. As shown in table one, in @ company/mp-copy {.
And 103, generating a remote address of the target service module according to the module name of the target service module and the remote address generation rule, so that the main application calls the target service module according to the remote address.
In the embodiment of the application, codes of target service modules in a micro front-end framework are not introduced by package of a main application any more, but are dynamically and remotely pulled through a network when a page is loaded, so that a hosts configuration file needs to be automatically generated and contains remote addresses of all the target service modules.
In practice, the micro-front-end framework may operate in different environments and accordingly the remote address of the target service module is different for different operating environments in one implementation, both the operating environment and the UR L in the operating environment may be pre-configured by a technician, the module name in the UR L is a preset character, the electronic device may replace the preset character in the UR L with the module identification of the target service module, resulting in the UR L for the target service module.
As shown below, is an example of a hosts profile that contains the remote addresses of the service modules copy and interaction.
Figure BDA0002425729270000081
As can be seen, for each target service module, the electronic device may generate a remote address of the target service module in different operating environments, where the operating environments may include a local environment (built), a test environment (test), a pre-online environment (release), and an online environment (dist).
And 104, searching routing information corresponding to the target service module in the main application, migrating the routing information from the main application to the target service module, and adding deployment configuration information in the target service module to obtain the micro front-end framework.
Wherein the deployment configuration information is used for individually deploying the target service modules.
In the embodiment of the present application, the main application further stores routing information corresponding to each target service module. The routing information contains the sequence of calling or jumping of the service module in the running process. The main application in the micro front-end framework does not manage the routing information of each service any more, but is managed by the target service module. Therefore, after the electronic device generates the hosts configuration file, the routing information corresponding to the target service module may be searched in the main application, and then the routing information is migrated from the main application to the target service module, where a detailed description will be given later on in a specific migration process. In addition, the electronic device may further add deployment configuration information in the target service module, so that the target service module can be deployed alone. The deployment configuration information may be webpack deployment configuration information. Specifically, the electronic device may store preset webpack deployment configuration information. The webpack deployment configuration information contains preset characters, the electronic equipment can replace the preset characters with module identifiers of the target service modules to obtain deployment configuration information of the target service modules, and then the deployment configuration information is added to the target service modules. Optionally, in different operating environments, the deployment configuration information of the service module is different, and the preset webpack deployment configuration information may be configured for different operating environments. In one example, the deployment of the business module interaction in the test environment is configured to:
base.output.publicPath='//mp-test.iqiyi.com/static/mp-interaction/test/';
it should be noted that the number of the target service modules may be one or more, and in the case that there are a plurality of target service modules, the processing of step 103 and step 104 needs to be executed for each target service module to obtain the micro front-end framework.
In the embodiment of the application, the electronic device may obtain a target front-end framework, where the front-end framework includes a main application and a plurality of service modules, and then determine a target service module to be migrated among the plurality of service modules. And aiming at each target service module, generating a remote address of the target service module according to the name of the target service module and a remote address generation rule, so that the main application calls the target service module according to the remote address, further searching routing information corresponding to the target service module in the main application, transferring the routing information to the target service module from the main application, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for independently deploying the target service module. According to the scheme, the current target front-end framework can be automatically migrated into the micro front-end framework, manual migration is not needed, and migration efficiency is improved.
Compared with the prior art, when the micro front-end framework is migrated, the whole framework needs to be reconstructed, the framework and module migration needs to be performed in months, large-scale version iteration cannot be performed in the months, and otherwise, the workload is increased. The scheme realizes the full-automatic migration of the micro-front-end framework, greatly reduces the migration time and labor cost, can quickly reconstruct the framework and put the development labor into the iteration of new functions, but not reconstruct the original framework.
Optionally, as shown in fig. 2, a specific process of migrating the routing information from the primary application to the target service module includes the following steps.
Step 201, storing the routing information into a preset cache area, and establishing a corresponding relationship between the routing information and the module name of the target service module.
In this embodiment, the electronic device may scan all routing information in the main application. Each routing information includes a module identifier of a service module corresponding to the routing information. Based on this, the electronic device may search for the routing information including the module identifier of the target service module in the route of the main application, thereby obtaining the routing information of the target service module. Then, the electronic device stores the routing information into a preset cache region, and establishes a corresponding relationship between the routing information and the module name of the target service module. In an example, the to-be-migrated list may further include a routing information field, and the electronic device may store the routing information in the to-be-migrated list. If the routing information a of the service module copy is found, the routing information is stored in the to-be-migrated list, and the updated to-be-migrated list is shown in table two.
Watch two
Serial number Module name Routing information
1 @company/mp-copyright:{...} Routing information A
2 @company/mp-copyright:{...} Routing information A
Step 202, deleting the routing information from the routing configuration information of the master application.
In the embodiment of the present application, after the electronic device stores the routing information of a certain target service module in the to-be-migrated list, the electronic device may delete the routing information from the routing configuration information of the primary application.
Step 203, obtaining the routing information from the preset cache region, and storing the routing information in the form of a routing file into the target service module according to the corresponding relationship between the routing information and the module name of the target service module.
In the embodiment of the application, the list to be migrated includes a corresponding relationship between the routing information and the module name of the target service module. For each target service module, the electronic device may obtain the routing information of the target service module in the list to be migrated, and then store the routing information in the form of a routing file in the target service module. Js, i.e., the routing file is a js file.
Optionally, the electronic device may further add a code for acquiring the routing information in the main application, so that the main application acquires the routing information from the target service module through the code.
In the embodiment of the present application, in order to implement the skip between the service modules, a code for remotely reading the routing information of the target service module needs to be added to the host application. In one example, the added code may be as follows.
Figure BDA0002425729270000111
In the running process of the micro front end frame, the main application can acquire the routing information of the interaction of the target service module by executing the codes, so that the main application does not need to store the routing information of the interaction, and the routing information of the interaction is remotely acquired when the interaction needs to be executed.
It should be noted that, corresponding to the main application, a global method needs to be created in the routing file in the target service module, so that the main application can obtain the routing information of the target service module:
Figure BDA0002425729270000121
optionally, a common component in each target service module may also be extracted to further reduce the data volume of the target service module, as shown in fig. 3, the specific processing procedure is as follows:
step 301, identifying the common components contained in the target business module according to a preset identification rule.
In this embodiment, the electronic device may scan each file (e.g., js file) in the target service module, and identify whether a common component, i.e., a common component, exists according to a preset identification rule. In one implementation, the characteristics of a common class of components may be predefined, such as being distinguishable by paths, a component not being a common component if its path is a relative path, or a common component if its path is an absolute path. For example, if the path of a component is import chatmix from '/./>/kit/mix/chatmix', then the component is not a common component; the path of a component is import TimeformatUtils from $/TimeformatUtils', which is a common component that needs to be extracted.
Step 302, adding the common component into the main application, and adding a program code for calling the common component into an entry file of the main application.
In the embodiment of the application, after the electronic device determines the common component in the target service module, the common component may be added to the main application (which may be added to an app.js file of the main application), and in the entry file of the main application, a program code for calling the common component is added, so that the common component in the main application may be called in the subsequent operation process of the target service module.
For the case that there are multiple target service modules, the common components included in each target service module can be scanned, the scanned common components are deduplicated, and the deduplicated common components are added to the main application.
Step 303, delete common components in the target business module.
Based on the processing process, the common components in the target service modules can be extracted and placed in the main application, and the required common components can be directly called when each target service module runs, so that the common components are prevented from being contained in each target service module, and the file volume of the whole framework is reduced. Therefore, files required to be downloaded by a user when the user loads the page are reduced, and the page performance is improved.
In one example, the common component extracted from the target business module is TimeFormatUtils, and in the entry file app. js in the host application, the following logical code is added.
Figure BDA0002425729270000131
And the TimeFormatUtils in the target service module is replaced by Vue.
Optionally, the electronic device may further generate and output a frame migration report after completing the frame migration. The frame migration report at least comprises error information and warning information generated in the frame migration process. For example, a framework migration report may include a list of migrated traffic modules, routes, code, etc. that lists, for each item in the list, warning information, error information, etc. generated during the migration process for manual processing
An example of a frame migration method is also provided in the embodiments of the present application, as shown in fig. 4, specifically including the following steps.
Step 401, obtaining a target front-end framework to be migrated.
The target front-end framework comprises a main application and a plurality of business modules.
And step 402, searching a target service module of which the module name meets a preset naming rule in a package.
Step 403, according to the module name of the target service module and the remote address generation rule, generating the remote address of the target service module, so that the main application calls the target service module according to the remote address.
Step 404, in the primary application, the routing information corresponding to the target service module is searched.
Step 405, storing the routing information into a preset cache region, and establishing a corresponding relationship between the routing information and the module name of the target service module.
At step 406, the routing information is deleted from the master application.
Step 407, adding a code for acquiring the routing information in the main application, so that the main application can acquire the routing information from the target service module through the code.
Step 408, obtaining the routing information from the preset cache region, and storing the routing information in the form of a routing file into the target service module according to the corresponding relationship between the routing information and the module name of the target service module.
And step 409, adding webpack deployment configuration information in the target service module.
And step 410, identifying the common components contained in the target business module according to a preset identification rule.
Step 411, add the common component to the main application, and add the program code for calling the common component in the entry file of the main application.
At step 412, the common components are deleted in the target business module.
Step 413, generating and outputting a frame migration report.
Wherein, the frame migration report at least comprises error information and warning information generated in the frame migration process.
Based on the same technical concept, embodiments of the present application further provide a frame transfer device, as shown in fig. 5, the frame transfer device includes:
an obtaining module 510, configured to obtain a target front-end framework to be migrated, where the target front-end framework includes a main application and multiple service modules;
a determining module 520, configured to determine a target service module to be migrated among the plurality of service modules;
a generating module 530, configured to generate a remote address of the target service module according to a module name of the target service module and a remote address generation rule, so that the main application calls the target service module according to the remote address;
the migration module 540 is configured to search, in the master application, routing information corresponding to the target service module, migrate the routing information from the master application to the target service module, and add deployment configuration information in the target service module to obtain a micro front-end framework, where the deployment configuration information is used to deploy the target service module separately.
Optionally, the determining module 520 is specifically configured to:
json file, searching a service module with a module name meeting a preset naming rule as a target service module.
Optionally, the migration module 540 is specifically configured to:
storing the routing information into a preset cache region, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the primary application;
and acquiring the routing information from the preset cache region, and storing the routing information into the target service module in the form of a routing file according to the corresponding relation between the routing information and the module name of the target service module.
Optionally, the apparatus further comprises:
a first adding module, configured to add, in the primary application, a code for acquiring the routing information, so that the primary application acquires the routing information from the target service module through the code.
Optionally, the apparatus further comprises:
the identification module is used for identifying the common components contained in the target business module according to a preset identification rule;
the second adding module is used for adding the public component into the main application and adding a program code for calling the public component into an entry file of the main application;
and the deleting module is used for deleting the common component in the target service module.
Optionally, the apparatus further comprises:
and the output module is used for generating and outputting a frame migration report, wherein the frame migration report at least comprises error information and warning information generated in the frame migration process.
In the embodiment of the application, the electronic device may obtain a target front-end framework, where the front-end framework includes a main application and a plurality of service modules, and then determine a target service module to be migrated among the plurality of service modules. And aiming at each target service module, generating a remote address of the target service module according to the name of the target service module and a remote address generation rule, so that the main application calls the target service module according to the remote address, further searching routing information corresponding to the target service module in the main application, transferring the routing information to the target service module from the main application, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for independently deploying the target service module. According to the scheme, the current target front-end framework can be automatically migrated into the micro front-end framework, manual migration is not needed, and migration efficiency is improved.
Based on the same technical concept, an embodiment of the present invention further provides an electronic device, as shown in fig. 6, including a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the processor 601, the communication interface 602, and the memory 603 complete mutual communication through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to implement the following steps when executing the program stored in the memory 603:
acquiring a target front-end framework to be migrated, wherein the target front-end framework comprises a main application and a plurality of service modules;
determining a target service module to be migrated in the plurality of service modules;
generating a remote address of the target service module according to the module name of the target service module and a remote address generation rule, so that the main application calls the target service module according to the remote address;
and searching routing information corresponding to the target service module in the main application, migrating the routing information from the main application to the target service module, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for individually deploying the target service module.
Optionally, the determining a target service module to be migrated in the plurality of service modules includes:
json file, searching a service module with a module name meeting a preset naming rule as a target service module.
Optionally, the migrating the routing information from the primary application to the target service module includes:
storing the routing information into a preset cache region, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the primary application;
and acquiring the routing information from the preset cache region, and storing the routing information into the target service module in the form of a routing file according to the corresponding relation between the routing information and the module name of the target service module.
Optionally, the method further includes:
and adding a code for acquiring the routing information in the main application so that the main application acquires the routing information from the target service module through the code.
Optionally, the method further includes:
identifying a common component contained in the target business module according to a preset identification rule;
adding the public component into the main application, and adding a program code for calling the public component into an entry file of the main application;
deleting the common component in the target business module.
Optionally, the method further includes:
and generating and outputting a frame migration report, wherein the frame migration report at least comprises error information and warning information generated in the frame migration process.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
In yet another embodiment provided by the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above-mentioned frame migration methods.
In yet another embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above-described frame migration methods.
The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g., from one website site, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DS L)) or wireless (e.g., infrared, wireless, microwave, etc.) manner to another website site, computer, server, or data center.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (14)

1. A method for frame migration, the method comprising:
acquiring a target front-end framework to be migrated, wherein the target front-end framework comprises a main application and a plurality of service modules;
determining a target service module to be migrated in the plurality of service modules;
generating a remote address of the target service module according to the module name of the target service module and a remote address generation rule, so that the main application calls the target service module according to the remote address;
and searching routing information corresponding to the target service module in the main application, migrating the routing information from the main application to the target service module, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for individually deploying the target service module.
2. The method of claim 1, wherein the determining a target business module to be migrated among the plurality of business modules comprises:
json file, searching a service module with a module name meeting a preset naming rule as a target service module.
3. The method of claim 1, wherein the migrating the routing information from the primary application to the target traffic module comprises:
storing the routing information into a preset cache region, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the primary application;
and acquiring the routing information from the preset cache region, and storing the routing information into the target service module in the form of a routing file according to the corresponding relation between the routing information and the module name of the target service module.
4. The method of claim 1, further comprising:
and adding a code for acquiring the routing information in the main application so that the main application acquires the routing information from the target service module through the code.
5. The method of claim 1, further comprising:
identifying a common component contained in the target business module according to a preset identification rule;
adding the public component into the main application, and adding a program code for calling the public component into an entry file of the main application;
deleting the common component in the target business module.
6. The method of claim 1, further comprising:
and generating and outputting a frame migration report, wherein the frame migration report at least comprises error information and warning information generated in the frame migration process.
7. A frame transfer apparatus, the apparatus comprising:
the system comprises an acquisition module, a migration module and a migration module, wherein the acquisition module is used for acquiring a target front-end framework to be migrated, and the target front-end framework comprises a main application and a plurality of service modules;
a determining module, configured to determine a target service module to be migrated among the plurality of service modules;
the generating module is used for generating a remote address of the target business module according to the module name and the remote address generating rule of the target business module so that the main application calls the target business module according to the remote address;
and the migration module is used for searching the routing information corresponding to the target service module in the main application, migrating the routing information from the main application to the target service module, and adding deployment configuration information in the target service module to obtain a micro front-end framework, wherein the deployment configuration information is used for individually deploying the target service module.
8. The apparatus of claim 7, wherein the determining module is specifically configured to:
json file, searching a service module with a module name meeting a preset naming rule as a target service module.
9. The apparatus according to claim 7, wherein the migration module is specifically configured to:
storing the routing information into a preset cache region, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the primary application;
and acquiring the routing information from the preset cache region, and storing the routing information into the target service module in the form of a routing file according to the corresponding relation between the routing information and the module name of the target service module.
10. The apparatus of claim 7, further comprising:
a first adding module, configured to add, in the primary application, a code for acquiring the routing information, so that the primary application acquires the routing information from the target service module through the code.
11. The apparatus of claim 7, further comprising:
the identification module is used for identifying the common components contained in the target business module according to a preset identification rule;
the second adding module is used for adding the public component into the main application and adding a program code for calling the public component into an entry file of the main application;
and the deleting module is used for deleting the common component in the target service module.
12. The apparatus of claim 7, further comprising:
and the output module is used for generating and outputting a frame migration report, wherein the frame migration report at least comprises error information and warning information generated in the frame migration process.
13. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
14. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 6.
CN202010219977.8A 2020-03-25 2020-03-25 Frame migration method and device Active CN111443920B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010219977.8A CN111443920B (en) 2020-03-25 2020-03-25 Frame migration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010219977.8A CN111443920B (en) 2020-03-25 2020-03-25 Frame migration method and device

Publications (2)

Publication Number Publication Date
CN111443920A true CN111443920A (en) 2020-07-24
CN111443920B CN111443920B (en) 2023-10-13

Family

ID=71652536

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010219977.8A Active CN111443920B (en) 2020-03-25 2020-03-25 Frame migration method and device

Country Status (1)

Country Link
CN (1) CN111443920B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148263A (en) * 2020-09-28 2020-12-29 建信金融科技有限责任公司 Front-end standard frame and generation method, device, equipment and storage medium thereof

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108667925A (en) * 2018-05-04 2018-10-16 北京天元创新科技有限公司 A kind of method and system of WEB application seamless access distributed system
CN109683988A (en) * 2018-12-25 2019-04-26 鼎信信息科技有限责任公司 Micro services start method, apparatus, computer equipment and storage medium
CN109951564A (en) * 2019-03-29 2019-06-28 重庆忽米网络科技有限公司 A kind of generation method of smart machine micro services
US20190250912A1 (en) * 2018-02-15 2019-08-15 Wipro Limited Method and system for migrating monolithic enterprise applications to microservice architecture
CN110225131A (en) * 2019-06-19 2019-09-10 广州小鹏汽车科技有限公司 A kind of service calling method and device
CN110825356A (en) * 2019-11-12 2020-02-21 东方电子股份有限公司 Micro-service development framework and real-time monitoring implementation method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190250912A1 (en) * 2018-02-15 2019-08-15 Wipro Limited Method and system for migrating monolithic enterprise applications to microservice architecture
CN108667925A (en) * 2018-05-04 2018-10-16 北京天元创新科技有限公司 A kind of method and system of WEB application seamless access distributed system
CN109683988A (en) * 2018-12-25 2019-04-26 鼎信信息科技有限责任公司 Micro services start method, apparatus, computer equipment and storage medium
CN109951564A (en) * 2019-03-29 2019-06-28 重庆忽米网络科技有限公司 A kind of generation method of smart machine micro services
CN110225131A (en) * 2019-06-19 2019-09-10 广州小鹏汽车科技有限公司 A kind of service calling method and device
CN110825356A (en) * 2019-11-12 2020-02-21 东方电子股份有限公司 Micro-service development framework and real-time monitoring implementation method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148263A (en) * 2020-09-28 2020-12-29 建信金融科技有限责任公司 Front-end standard frame and generation method, device, equipment and storage medium thereof
CN112148263B (en) * 2020-09-28 2024-03-08 建信金融科技有限责任公司 Front-end standard framework, and generation method, device, equipment and storage medium thereof

Also Published As

Publication number Publication date
CN111443920B (en) 2023-10-13

Similar Documents

Publication Publication Date Title
CN111580884B (en) Configuration updating method, device, server and electronic equipment
CN110109659A (en) A kind of system that realizing front end applications scaffold and server
CN111182089B (en) Container cluster system, method and device for accessing big data assembly and server
CN109902247B (en) Page rendering method and device and electronic equipment
CN111124480B (en) Method and device for generating application program package, electronic equipment and storage medium
CN113141405B (en) Service access method, middleware system, electronic device, and storage medium
US11328021B2 (en) Automatic resource management for build systems
CN112416425B (en) APP construction method and device, computer equipment and storage medium
CN111045683A (en) Applet code compiling method, device, equipment and medium
CN108536489B (en) Method, apparatus, and computer-readable storage medium for matching resource environments
CN110209983B (en) Method and device for deploying web project of webpage
CN113885920A (en) Method and device for hot updating of machine learning model, electronic equipment and storage medium
CN111443920B (en) Frame migration method and device
CN111382953A (en) Dynamic process generation method and device
CN116414774A (en) File migration method, device, equipment and storage medium
CN112491943A (en) Data request method, device, storage medium and electronic equipment
CN112114871B (en) Code sharing method, device, server, terminal and medium
CN112579325A (en) Business object processing method and device, electronic equipment and storage medium
CN113179332A (en) Method, electronic device and storage medium for acquiring configuration information
CN112965697A (en) Code file generation method and device and electronic equipment
US10469319B2 (en) Certification tool gap analyzer
CN112558975B (en) Method and device for switching codes of components, electronic equipment and readable storage medium
CN112130860B (en) JSON object analysis method and device, electronic equipment and storage medium
CN113535570B (en) Processing method and device for test cases and electronic equipment
CN108052648B (en) Website picture deleting method and device and electronic 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