[go: up one dir, main page]

CN111443920B - Frame migration method and device - Google Patents

Frame migration method and device Download PDF

Info

Publication number
CN111443920B
CN111443920B CN202010219977.8A CN202010219977A CN111443920B CN 111443920 B CN111443920 B CN 111443920B CN 202010219977 A CN202010219977 A CN 202010219977A CN 111443920 B CN111443920 B CN 111443920B
Authority
CN
China
Prior art keywords
target service
module
service module
main application
routing information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010219977.8A
Other languages
Chinese (zh)
Other versions
CN111443920A (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

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)

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 from the plurality of service modules; generating a remote address of the target service module according to the module name and the remote address generation rule of the target service module, so that the main application calls the target service module according to the remote address; and 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 frame, wherein the deployment configuration information is used for independently deploying the target service module. By adopting the application, the frame migration efficiency 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 apparatus for frame migration.
Background
With the development of computer technology, the application of micro-service frameworks is becoming more and more widespread. The micro-service framework can solve the problems of excessive and heavy operation and excessive service coupling of modern frameworks (such as Vue, act and the like) in large projects, and has the advantages of simplifying the online steps of each module of the webpage, being strong in independence and the like. Thus, more and more web pages implement front-end services (which may be referred to as micro-front-ends) using a micro-service framework.
When the related technology realizes the micro front end, technicians need to migrate the existing web page front end frame and each service module into the micro front end frame. Because the projects requiring micro front-end technology are all large websites, the service modules are more, and the migration process is complicated, the migration requires much manpower and time, and the efficiency is low.
Disclosure of Invention
The embodiment of the application aims to provide a frame migration method and device, which are used for solving 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 method for frame migration is provided, 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 from the plurality of service modules;
generating a remote address of the target service module according to the module name and the remote address generation rule of the target service module, so that the main application calls the target service module according to the remote address;
and 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 frame, wherein the deployment configuration information is used for independently deploying the target service module.
Optionally, the determining a target service module to be migrated among the plurality of service modules includes:
and searching a service module with the module name meeting a preset naming rule in the package json file as a target service module.
Optionally, the migrating the routing information from the host application to the target service module includes:
storing the routing information into a preset cache area, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the master 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 comprises:
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 comprises:
identifying public components contained in the target service module according to a preset identification rule;
adding the public component to the main application, and adding program code for calling the public component in an entry file of the main application;
and deleting the public components in the target service module.
Optionally, the method further comprises:
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 migration 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;
the determining module is used for determining a target service module to be migrated from the plurality of service modules;
the generation module is used for generating a remote address of the target service module according to the module name and the remote address generation rule of the target service module so that the main application calls the target service module according to the remote address;
the migration module is used for searching the route information corresponding to the target service module in the main application, migrating the route 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 frame, wherein the deployment configuration information is used for independently deploying the target service module.
Optionally, the determining module is specifically configured to:
and searching a service module with the module name meeting a preset naming rule in the package json file as a target service module.
Optionally, the migration module is specifically configured to:
storing the routing information into a preset cache area, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the master 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 includes:
and the first adding module is used for 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 apparatus further includes:
the identification module is used for identifying public components contained in the target service module according to a preset identification rule;
a second adding module, configured to add the common component to the main application, and add program code for calling the common component in an entry file of the main application;
and the deleting module is used for deleting the public components in the target service module.
Optionally, the apparatus further includes:
the output module is used for generating and outputting a frame migration report, and 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, including a processor, a communication interface, a memory, and a communication bus, where 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 aspects when executing a program stored on a memory.
In a fourth aspect, a computer-readable storage medium is provided, in which a computer program is stored 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 comprising 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 beneficial effects that:
the embodiment of the application provides a frame migration method and a frame migration device, wherein an electronic device 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 generating a remote address of the target service module according to the name and the remote address generation rule of the target service module aiming at each target service module, so that the main application calls the target service module according to the remote address, further searching the route information corresponding to the target service module in the main application, migrating the route 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 frame, wherein the deployment configuration information is used for independently deploying the target service module. Through the scheme, the current target front end frame can be automatically migrated into the micro front end frame without manual migration, and migration efficiency is improved.
Of course, it is not necessary for any one product or method of practicing the application to achieve all of the advantages set forth above at the same time.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flowchart of a frame 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 frame migration method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a frame migration apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
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, etc. The electronic equipment can be used for automatically migrating the existing webpage front-end frame and each business module into a micro front-end frame so as to realize low-cost migration and improve migration efficiency.
Before migration, the front end framework contains npm packages of the host application and the plurality of business modules. The npm packet of each service sub-module contains all data of the service sub-module, such as function codes, configuration information, and the like. In the existing front-end framework, the main application contains some necessary data for running each service module, such as routing information, calling rules, and the like. Each service module cannot be deployed and operated independently, and the service modules must be uniformly scheduled by the main application to operate. In the micro front end framework after migration, the main application is only responsible for the overall framework, does not contain logic of other service modules, and other service modules can be independently deployed and operated. The micro-Qin front end frame solves the problems of excessive and heavy business coupling of modern frames such as Vue and reaction frames in large projects, and has the advantages of simplified online steps of each business module of the webpage, strong independence and the like.
The following will describe a frame migration method according to an embodiment of the present application in detail with reference to the specific embodiment, as shown in fig. 1, and the specific steps are as follows.
Step 101, obtaining a target front end framework to be migrated.
In the embodiment of the application, the electronic equipment can acquire the target front-end frame needing to be migrated. The target front end frame is a common front end frame. Such as a front-end framework implemented based on Vue, exact, etc. The target front-end framework is made up of a host application and a number of data packets (i.e., npm packets). Wherein a data packet contains all data of a service module, such as 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 modules, such as names, routing information and the like of all the service modules.
And 102, determining a target service module to be migrated from the plurality of service modules.
In the embodiment of the present application, the host application may include a weback file, where the module name (may also be referred to as a packet name) of all service modules is stored in the weback file. The electronic device can obtain the module names of all the service modules by inquiring the weback 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 requirements.
In one implementation manner, the electronic device may search, in the package. Json file, a service module whose module name meets a preset naming rule, as the target service module.
In the embodiment of the present application, the existing front-end framework basically uses the npm method to manage the dependency module (i.e. the service module), so that under the framework of the main application, the package. Json file corresponding to the npm package is stored. The package json file contains the module names of the service modules. The electronic device may determine whether the module name in the package json file 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 the 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 the to-be-migrated list, and then the module name of the target service module is deleted in the package.
In one example, the preset naming convention is @ company/mp-, where "@" is any character. If the module name of the service module 1 is @ company/mp-copy: {..and the module name of the service module 2 is: {..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.
List one
Sequence number Module name
1 @company/mp-copyright:{...}
2 @company/mp-copyright:{...}
The module name may be composed of a module identification and other data, which may include preset characters and configuration information of the module. As shown in table one, in @ company/mp-copy: {..the module is identified as-copy, the preset character is @ company/mp-, and the configuration information of the module is omitted in {..the module is identified as-copy.
And step 103, generating a remote address of the target service module according to the module name and the remote address generation rule of the target service module, so that the main application calls the target service module according to the remote address.
In the embodiment of the application, the codes of the target service modules in the micro front-end framework are not introduced by means of package json of the main application, but are dynamically and remotely pulled through a network when the page is loaded, so that a hosts configuration file containing all the remote addresses of the target service modules is required to be automatically generated. Specifically, for each target service module, after the electronic device obtains the module name of the target service module, the electronic device may generate a remote address of the target service module according to the module name and the remote address generating rule, so that the main application invokes the target service module according to the remote address. Wherein the remote address may be a URL of a server for deploying the target business module.
In practice, the micro front end framework may operate in different environments, and accordingly, the remote address of the target business module is different for different operating environments. In one implementation, the running environment and the URL in the running environment, where the module name is a preset character, may be configured in advance by a technician. The electronic device may replace the preset character in the URL with the module identifier of the target service module to obtain the URL for the target service module.
As shown below, an example of a host profile contains the remote addresses of the business module copy and business module interactions.
It can be seen that for each target business module, the electronic device generates a remote address of the target business module under different operating environments, which may include a local environment (build), a test environment (test), a pre-live environment (release), and an online environment (dist).
Step 104, in the main application, searching the route information corresponding to the target service module, migrating the route 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 frame.
The deployment configuration information is used for independently deploying the target service modules.
In the embodiment of the application, the main application also stores the route information corresponding to each target service module. The routing information contains the order in which the service modules call or jump during operation. Since the main application in the micro front-end framework no longer manages the routing information of each service, but is managed by the target service module itself. 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, and a specific migration process will be described in detail later. In addition, the electronic device can also add deployment configuration information in the target service module so that the target service module can be deployed independently. The deployment configuration information may be weback deployment configuration information. Specifically, the electronic device may store preset weback deployment configuration information. The configuration information of weback deployment contains preset characters, the electronic equipment can replace the preset characters with module identifiers of the target service modules to obtain the configuration information of the target service modules, and then the configuration information of the target service modules is added into the target service modules. Optionally, in different operation environments, the deployment configuration information of the service module is different, and then preset weback deployment configuration information can be configured for the operation environments without being used respectively. In one example, the deployment of business module interactions in a 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 performed for each target service module to obtain the micro front end frame.
In the embodiment of the application, the electronic device can acquire the target front-end frame, wherein the front-end frame comprises the main application and a plurality of service modules, and then the target service module to be migrated is determined in the plurality of service modules. And generating a remote address of the target service module according to the name and the remote address generation rule of the target service module aiming at each target service module, so that the main application calls the target service module according to the remote address, further searching the route information corresponding to the target service module in the main application, migrating the route 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 frame, wherein the deployment configuration information is used for independently deploying the target service module. Through the scheme, the current target front end frame can be automatically migrated into the micro front end frame without manual migration, and migration efficiency is improved.
Compared with the prior art, in the prior art, when the micro front end frame migration is carried out, the whole framework needs to be reconstructed, the frame and module migration needs to be carried out in a period of several months, and large version iteration cannot be carried out in the period of several months, otherwise, the workload is increased. The proposal realizes the full-automatic migration of the micro front end framework, greatly reduces the migration time and the labor cost, can quickly reconstruct the framework and put the development labor into the iteration of new functions, and is not the reconstruction of the original framework.
Optionally, as shown in fig. 2, the specific process of migrating the routing information from the host application to the target service module includes the following steps.
Step 201, storing the routing information in a preset buffer area, and establishing a corresponding relationship between the routing information and the module name of the target service module.
In the embodiment of the application, the electronic equipment can scan all the routing information in the main application. Each piece of routing information contains a module identifier of the service module corresponding to the routing information. Based on the above, the electronic device may find, in the route of the main application, the route information including the module identifier of the target service module, thereby obtaining the route information of the target service module. And then, the electronic equipment stores the routing information into a preset buffer area, and establishes a corresponding relation between the routing information and the module name of the target service module. In one 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. And if the routing information A of the service module copy is found, storing the routing information into a to-be-migrated list, wherein the updated to-be-migrated list is shown in a table II.
Watch II
Sequence number Module name Routing information
1 @company/mp-copyright:{...} Routing information A
2 @company/mp-copyright:{...} Routing information A
Step 202, deleting the route information from the route configuration information of the master application.
In the embodiment of the application, after the electronic equipment stores the route information of a certain target service module in the to-be-migrated list, the route information can be deleted from the route configuration information of the main application.
Step 203, obtaining the routing information from the preset cache area, and storing the routing information in the form of a routing file to the target service module according to the corresponding relation between the routing information and the module name of the target service module.
In the embodiment of the application, the to-be-migrated list contains the corresponding relation between the route information and the module name of the target service module. For each target service module, the electronic device may acquire the routing information of the target service module in the to-be-migrated list, and then store the routing information in the form of a routing file in the target service module. For example, the route file may be/route/index. Js, i.e., the route 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 application, in order to realize the jump among the service modules, a code for remotely reading the route information of the target service module is required to be added in the main application. In one example, the added code may be as follows.
In the running process of the micro front end framework, the main application can acquire the route information of the target service module interaction by executing the codes, so that the main application does not need to store the route information of the interaction, and the route information of the interaction is remotely acquired when the interaction needs to be executed.
It should be noted that, corresponding to the above-mentioned 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:
optionally, the common components in each target service module may be extracted to further reduce the data volume of the target service module, as shown in fig. 3, and the specific processing procedure is as follows:
step 301, identifying the public components contained in the target service module according to a preset identification rule.
In the embodiment of the application, the electronic device can scan each file (such as js file) in the target service module respectively, and identify whether a common component exists or not according to the preset identification rule, namely, a common component. In one implementation, features of components of a common class may be predefined, such as being distinguishable by path, if the path of a component is a relative path, the component is not a common component, and if the path of the component is an absolute path, the component is a common component. For example, a component has a path of import ChatMixin from '/kit/mix/chatmaxin', then the component is not a public component; the path of a component is import TimeFormatUtils from '$kit/timeFormatUtils', which is a common component that needs to be extracted.
Step 302, add the common component to the host application, and add program code for invoking the common component in the portal file of the host application.
In the embodiment of the application, after the electronic device determines the public component in the target service module, the public component can be added into the main application (can be added into an app. Js file of the main application), and program codes for calling the public component are added into an entry file of the main application, so that the public component in the main application can be called in the running process of the subsequent target service module.
In the case that there are multiple target service modules, the common components contained in each target service module can be scanned respectively, then the scanned common components are de-duplicated, and the de-duplicated common components are added into the main application.
And step 303, deleting the public components in the target business module.
Based on the processing procedure, the public components in the target service modules can be extracted and put into the main application, and the required public components can be directly called when each target service module runs, so that the public components are prevented from being contained in each target service module, and the file volume of the whole frame is reduced. Thus, the files required to be downloaded by the user when loading 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 the following logical code is added in the portal file app.js in the host application.
In addition, the TimeFormatUtils in the target service module is replaced by Vue. Prototype, so that the target service module is changed into the calling of the Vue. Prototype at the place where the component TimeFormatUtils is called in the running process, and the target service module can directly call the Vue. Prototype from the main application so as to realize the function of the TimeFormatUtils component.
Optionally, the electronic device may also 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, the frame migration report may include a list of migrated business modules, routes, codes, etc., and for each item in the list, list warning information, error information, etc. generated during migration for manual processing
The embodiment of the application also provides a frame migration method example, as shown in fig. 4, which specifically comprises 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.
In step 402, in the package. Json file, a target service module whose module name satisfies a preset naming rule is searched.
And step 403, generating a remote address of the target service module according to the module name and the remote address generation rule of the target service module, so that the main application calls the target service module according to the remote address.
Step 404, in the main application, searching the route information corresponding to the target service module.
And step 405, storing the routing information in a preset cache area, and establishing a corresponding relation between the routing information and the module name of the target service module.
Step 406, deleting the routing information from the host application.
In step 407, a code for acquiring routing information is added in the master application, so that the master application can acquire the routing information from the target service module through the code.
Step 408, obtaining the routing information from the preset cache area, and storing the routing information in the form of a routing file to the target service module according to the corresponding relation between the routing information and the module name of the target service module.
Step 409, adding weback deployment configuration information in the target service module.
Step 410, identifying the public components contained in the target business module according to the preset identification rule.
In step 411, the common component is added to the host application, and program code for calling the common component is added in the portal file of the host application.
At step 412, the common components are deleted in the target business module.
In step 413, a frame migration report is generated and output.
The frame migration report at least comprises error information and warning information generated in the frame migration process.
Based on the same technical concept, the embodiment of the application further provides a frame migration device, as shown in fig. 5, which includes:
the obtaining module 510 is configured to obtain a target front end framework to be migrated, where the target front end framework includes a main application and a plurality of service modules;
a determining module 520, configured to determine a target service module to be migrated from 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 and a remote address generating rule of the target service module, so that the host application invokes the target service module according to the remote address;
and the migration module 540 is configured to search for routing information corresponding to the target service module in the main application, migrate the routing information from the main 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 for deploying the target service module separately.
Optionally, the determining module 520 is specifically configured to:
and searching a service module with the module name meeting a preset naming rule in the package json file as a target service module.
Optionally, the migration module 540 is specifically configured to:
storing the routing information into a preset cache area, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the master 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 includes:
and the first adding module is used for 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 apparatus further includes:
the identification module is used for identifying public components contained in the target service module according to a preset identification rule;
a second adding module, configured to add the common component to the main application, and add program code for calling the common component in an entry file of the main application;
and the deleting module is used for deleting the public components in the target service module.
Optionally, the apparatus further includes:
the output module is used for generating and outputting a frame migration report, and 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 can acquire the target front-end frame, wherein the front-end frame comprises the main application and a plurality of service modules, and then the target service module to be migrated is determined in the plurality of service modules. And generating a remote address of the target service module according to the name and the remote address generation rule of the target service module aiming at each target service module, so that the main application calls the target service module according to the remote address, further searching the route information corresponding to the target service module in the main application, migrating the route 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 frame, wherein the deployment configuration information is used for independently deploying the target service module. Through the scheme, the current target front end frame can be automatically migrated into the micro front end frame without manual migration, and migration efficiency is improved.
Based on the same technical concept, the embodiment of the present application 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 perform communication with each other through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to execute the program stored in the memory 603, and implement the following steps:
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 from the plurality of service modules;
generating a remote address of the target service module according to the module name and the remote address generation rule of the target service module, so that the main application calls the target service module according to the remote address;
and 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 frame, wherein the deployment configuration information is used for independently deploying the target service module.
Optionally, the determining a target service module to be migrated among the plurality of service modules includes:
and searching a service module with the module name meeting a preset naming rule in the package json file as a target service module.
Optionally, the migrating the routing information from the host application to the target service module includes:
storing the routing information into a preset cache area, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the master 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 comprises:
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 comprises:
identifying public components contained in the target service module according to a preset identification rule;
adding the public component to the main application, and adding program code for calling the public component in an entry file of the main application;
and deleting the public components in the target service module.
Optionally, the method further comprises:
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 above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include 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 aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the frame migration methods described above.
In yet another embodiment of the present application, a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the frame migration methods of the embodiments described above is also provided.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It should be noted that in this document, relational terms such as "first" and "second" and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a specific embodiment of the application to enable those skilled in the art to understand or practice the 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 (12)

1. A method of 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 from the plurality of service modules;
generating a remote address of the target service module according to the module name and the remote address generation rule of the target service module, so that the main application calls the target service module according to the remote address;
searching route information corresponding to the target service module in the main application, migrating the route 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 frame, wherein the deployment configuration information is used for independently deploying the target service module;
the migration of the routing information from the host application to the target service module includes:
storing the routing information into a preset cache area, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the master 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.
2. The method of claim 1, wherein the determining a target traffic module to migrate among the plurality of traffic modules comprises:
and searching a service module with the module name meeting a preset naming rule in the package json file as a target service module.
3. The method according to claim 1, wherein the method further comprises:
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.
4. The method according to claim 1, wherein the method further comprises:
identifying public components contained in the target service module according to a preset identification rule;
adding the public component to the main application, and adding program code for calling the public component in an entry file of the main application;
and deleting the public components in the target service module.
5. The method according to claim 1, wherein the method further comprises:
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.
6. A frame migration 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;
the determining module is used for determining a target service module to be migrated from the plurality of service modules;
the generation module is used for generating a remote address of the target service module according to the module name and the remote address generation rule of the target service module so that the main application calls the target service module according to the remote address;
the migration module is used for searching the route information corresponding to the target service module in the main application, migrating the route 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 frame, wherein the deployment configuration information is used for independently deploying the target service module;
the migration module is specifically configured to:
storing the routing information into a preset cache area, and establishing a corresponding relation between the routing information and the module name of the target service module;
deleting the routing information from the master 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.
7. The apparatus according to claim 6, wherein the determining module is specifically configured to:
and searching a service module with the module name meeting a preset naming rule in the package json file as a target service module.
8. The apparatus of claim 6, wherein the apparatus further comprises:
and the first adding module is used for 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.
9. The apparatus of claim 6, wherein the apparatus further comprises:
the identification module is used for identifying public components contained in the target service module according to a preset identification rule;
a second adding module, configured to add the common component to the main application, and add program code for calling the common component in an entry file of the main application;
and the deleting module is used for deleting the public components in the target service module.
10. The apparatus of claim 6, wherein the apparatus further comprises:
the output module is used for generating and outputting a frame migration report, and the frame migration report at least comprises error information and warning information generated in the frame migration process.
11. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-5 when executing a program stored on a memory.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-5.
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 CN111443920A (en) 2020-07-24
CN111443920B true 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)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148263B (en) * 2020-09-28 2024-03-08 建信金融科技有限责任公司 Front-end standard framework, and generation method, device, equipment and storage medium thereof
CN114035786B (en) * 2021-11-10 2025-05-13 中国建设银行股份有限公司 A dependency-based micro-frontend compatible migration method and system
CN114090075B (en) * 2021-11-30 2024-12-13 土巴兔集团股份有限公司 Compatible with new and old framework service calling methods and related devices
CN114546436B (en) * 2021-12-20 2024-11-26 北京达佳互联信息技术有限公司 A micro front-end service update method, device, electronic device and storage medium
CN114675876B (en) * 2022-03-30 2024-06-21 苏州浪潮智能科技有限公司 A business processing method, device, electronic device and storage medium

Citations (5)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10620947B2 (en) * 2018-02-15 2020-04-14 Wipro Limited Method and system for migrating monolithic enterprise applications to microservice architecture

Patent Citations (5)

* 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
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

Also Published As

Publication number Publication date
CN111443920A (en) 2020-07-24

Similar Documents

Publication Publication Date Title
CN111443920B (en) Frame migration method and device
CN111443921A (en) Subcontracting deployment method, system and computer equipment for web front-end project
CN111597110B (en) Page test method and device, electronic equipment and storage medium
CN110209983B (en) Method and device for deploying web project of webpage
CN112579118B (en) Method, device, system, medium and equipment for updating configuration information of micro-service
CN109902247B (en) Page rendering method and device and electronic equipment
CN110365724B (en) Task processing method and device and electronic equipment
US11328021B2 (en) Automatic resource management for build systems
CN111045683A (en) Small program code compilation method, device, device and medium
CN113885920A (en) Method and device for hot updating of machine learning model, electronic equipment and storage medium
CN111124480B (en) Method and device for generating application program package, electronic equipment and storage medium
CN113778897A (en) Automatic test method, device, equipment and storage medium of interface
CN110688096B (en) Method and device for constructing application program containing plug-in, medium and electronic equipment
CN112130860B (en) JSON object analysis method and device, electronic equipment and storage medium
CN114153473A (en) Module integration method, device, storage medium and electronic equipment
CN112965697A (en) Code file generation method and device and electronic equipment
CN117289906A (en) Low-code application development method, equipment and medium
CN113805878B (en) Plug-in engineering method, device, computer system and medium
CN110442353B (en) Installation package management method and device and electronic equipment
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN115623060B (en) Method and device for generating service catalog of micro service
CN112579325A (en) Business object processing method and device, electronic equipment and storage medium
CN111124545A (en) Application program starting method and device, electronic equipment and storage medium
CN112905164A (en) Project code processing method and device
CN113535570B (en) Processing method and device for test cases 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