Micro front-end service update method, device, electronic device and storage medium
By automatically obtaining and updating the target files and configuration information of micro front-end applications, the cumbersome problems of manual updates during the development of micro front-end applications are solved, and the development efficiency and experience are improved.
Patent Information
- Application Number
- CN202111563732.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-20
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-12-20
AI Technical Summary
During the development process of micro front-end applications, developers need to manually update the main service and sub-services. The process is cumbersome and the cost of access development is high, resulting in low development experience and efficiency.
Provide a micro front-end service update method, which automatically updates the configuration information of the main service and sub-service by obtaining the latest version of the target file, realizes automatic start-up and registration, and reduces manual operations by developers.
It improves the efficiency of local integrated development of micro front-end, reduces the operating process of developers in micro front-end service updates, and realizes automated updates.
Smart Images

Figure CN114546436B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of application testing, and in particular to a micro-frontend service update method, device, electronic device and storage medium. Background Art
[0002] A micro front-end application is composed of multiple front-end applications aggregated together, where each front-end application is independent of each other and does not interfere with each other. For users, a micro front-end application is a complete application, but the multiple front-end applications included in the micro front-end application are independent of each other during the development and testing process, and then combined in some way to obtain a micro front-end application.
[0003] That is to say, during the development and testing process, the micro-frontend application serves as a main service, which includes sub-services corresponding to multiple front-end applications. The current mainstream micro-frontend framework in the front-end development industry can achieve technology stack independence between sub-services, support independent development and deployment of sub-services, and runtime isolation of sub-services.
[0004] However, during the development process, developers need to download and start the main service server and sub-service server locally. If the remote main service code repository is updated, developers cannot perceive it in real time and need to update it manually. In addition, developers need to manually modify the development configuration items of the main service and sub-service to start the micro-frontend development mode. Therefore, the overall process is cumbersome, the cost of micro-frontend access development is high, the update of micro-frontend services is not convenient, and the development experience and efficiency are very low. Summary of the invention
[0005] The present disclosure provides a micro-frontend service update method, device, electronic device and storage medium to at least solve the problems in the related art that the overall process is cumbersome, the micro-frontend access development cost is high, the update of micro-frontend services is not convenient, and the development experience and efficiency are very low. The technical solution of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a micro-frontend service update method is provided, which is applied to an electronic device, and the method includes:
[0007] In response to a development instruction for a sub-service, a target file is obtained, where the target file is a file for running the latest version of a main service to which the sub-service belongs, and both the sub-service and the main service are services based on a micro-frontend framework;
[0008] Acquire configuration information of the sub-service, start the webpage server of the sub-service according to the configuration information, and write the configuration information into the target file to obtain an updated target file;
[0009] The updated target file is read, and a web page server of an updated main service is started, wherein the updated main service includes the sub-service.
[0010] Optionally, the acquiring of the target file in response to the development instruction for the sub-service includes:
[0011] In response to a development instruction for a sub-service, obtaining the latest version information of the target file of the main service from a preset database;
[0012] Determine whether the latest version information is consistent with the version information of the target file of the main service stored locally;
[0013] If they are inconsistent, the target file of the main service is obtained from the preset database, and the target file of the main service stored locally is updated.
[0014] Optionally, if the latest version information is consistent with the version information of the target file of the primary service stored locally, the method further includes:
[0015] Get the target file of the main service stored locally.
[0016] Optionally, after obtaining the target file, the method further includes:
[0017] Obtaining an installation file of a dependent software package from the target file, downloading and installing the dependent software package according to the installation file, wherein the dependent software package is an external target file required by the main service;
[0018] The step of reading the updated target file and starting the updated web page server of the main service includes:
[0019] The updated target file is read, the dependent software package is called, and the updated web page server of the main service is started.
[0020] Optionally, writing the configuration information into the target file to obtain an updated target file includes:
[0021] Generate a simulation file of the sub-service according to the configuration information;
[0022] Query whether the target file includes a simulation file corresponding to the sub-service;
[0023] If included, the simulation file in the target file is replaced with the generated simulation file to obtain the updated target file;
[0024] If not included, the simulation file is added to the target file to obtain the updated target file.
[0025] Optionally, the reading the updated target file and starting the updated web page server of the main service includes:
[0026] Reading a simulation file of at least one sub-service included in the updated target file to obtain configuration information of the at least one sub-service;
[0027] The web page server of the updated main service is started, and the at least one sub-service is registered in the updated main service according to the configuration information of the at least one sub-service.
[0028] Optionally, the obtaining the configuration information of the sub-service includes:
[0029] In response to the development instruction, using a scaffolding tool to create a template file of the sub-service;
[0030] In response to an instruction to edit the template file, configuration information of the sub-service is acquired.
[0031] According to a second aspect of an embodiment of the present disclosure, a micro-frontend service update device is provided, which is applied to an electronic device, and the device includes:
[0032] an acquisition unit, configured to execute in response to a development instruction for a sub-service and acquire a target file, wherein the target file is a file for running a latest version of a main service to which the sub-service belongs, and both the sub-service and the main service are services based on a micro-frontend framework;
[0033] An updating unit is configured to obtain configuration information of the sub-service, start a web server of the sub-service according to the configuration information, and write the configuration information into the target file to obtain an updated target file;
[0034] The startup unit is configured to read the updated target file and start the web page server of the updated main service, wherein the updated main service includes the sub-service.
[0035] Optionally, the acquisition unit is configured to execute:
[0036] In response to a development instruction for a sub-service, obtaining the latest version information of the target file of the main service from a preset database;
[0037] Determine whether the latest version information is consistent with the version information of the target file of the main service stored locally;
[0038] If they are inconsistent, the target file of the main service is obtained from the preset database, and the target file of the main service stored locally is updated.
[0039] Optionally, the acquisition unit is configured to execute:
[0040] If the latest version information is consistent with the version information of the target file of the main service stored locally, the target file of the main service stored locally is obtained.
[0041] Optionally, the acquisition unit is configured to execute:
[0042] Obtaining an installation file of a dependent software package from the target file, downloading and installing the dependent software package according to the installation file, wherein the dependent software package is an external file required by the main service;
[0043] The startup unit is configured to execute:
[0044] The updated target file is read, the dependent software package is called, and the updated web page server of the main service is started.
[0045] Optionally, the updating unit is configured to execute:
[0046] Generate a simulation file of the sub-service according to the configuration information;
[0047] Query whether the target file includes a simulation file corresponding to the sub-service;
[0048] If included, the simulation file in the target file is replaced with the generated simulation file to obtain the updated target file;
[0049] If not included, the simulation file is added to the target file to obtain the updated target file.
[0050] Optionally, the updating unit is configured to execute:
[0051] Reading a simulation file of at least one sub-service included in the updated target file to obtain configuration information of the at least one sub-service;
[0052] The web page server of the updated main service is started, and the at least one sub-service is registered in the updated main service according to the configuration information of the at least one sub-service.
[0053] Optionally, the updating unit is configured to execute:
[0054] In response to the development instruction, using a scaffolding tool to create a template file of the sub-service;
[0055] In response to an instruction to edit the template file, configuration information of the sub-service is acquired.
[0056] According to a third aspect of an embodiment of the present disclosure, a micro-frontend service is provided to update an electronic device, including:
[0057] processor;
[0058] a memory for storing instructions executable by the processor;
[0059] Wherein, the processor is configured to execute the instructions to implement the micro-frontend service update method described in the first item above.
[0060] According to the fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When the instructions in the computer-readable storage medium are executed by a processor of a micro-front-end service update electronic device, the micro-front-end service update electronic device is enabled to execute any of the micro-front-end service update methods described above.
[0061] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program / instruction, and when the computer program / instruction is executed by a processor, the micro-frontend service update method described in the first item above is implemented.
[0062] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0063] The electronic device responds to the development instruction for the sub-service and obtains the target file, which is the file used to run the latest version of the main service to which the sub-service belongs; obtains the configuration information of the sub-service, starts the web server of the sub-service according to the configuration information, and writes the configuration information into the target file to obtain an updated target file; reads the updated target file, starts the web server of the updated main service, and the updated main service includes the sub-item.
[0064] That is to say, after receiving the development instructions, the target file of the main service can be automatically configured. In this way, developers only need to focus on the development configuration and business development of the sub-services in the micro-frontend application, without having to worry about how to pull, update, and configure the code of the main service corresponding to the sub-service. The micro-frontend service can be automatically updated, thereby improving the efficiency of local integrated development of the micro-frontend.
[0065] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0067] Figure 1 The present invention is a flowchart of a micro-frontend service update method according to an exemplary embodiment.
[0068] Figure 2 According to an exemplary embodiment, Figure 1 Flowchart of S101 in FIG.
[0069] Figure 3 According to an exemplary embodiment, Figure 1 Flowchart of S102 in FIG.
[0070] Figure 4 It is a block diagram of a micro-frontend service updating device according to an exemplary embodiment.
[0071] Figure 5 It is a block diagram of an electronic device for updating a micro-frontend service according to an exemplary embodiment.
[0072] Figure 6 The invention is a block diagram of a device for updating a micro-frontend service according to an exemplary embodiment. DETAILED DESCRIPTION
[0073] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0074] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0075] Figure 1 is a flowchart of a micro-frontend service update method according to an exemplary embodiment. Figure 1 As shown, the micro-front-end service update method is applied to an electronic device, and specifically includes the following steps.
[0076] In step S101, in response to the development instruction for the sub-service, a target file is obtained, where the target file is a file for running the latest version of the main service to which the sub-service belongs. Both the sub-service and the main service are services based on the micro-frontend framework.
[0077] In the present disclosure, an electronic device can run a micro-front-end application, which is composed of multiple front-end applications aggregated together, wherein each front-end application is independent of each other and does not interfere with each other. During the development and testing process, the micro-front-end application serves as a main service, which includes sub-services corresponding to multiple front-end applications. Developers can develop and test the sub-services corresponding to separate front-end applications respectively.
[0078] In this step, the target file is a file for running the latest version of the main service to which the sub-service belongs, which can be a code file or a compiled instruction file, without specific limitation. In one implementation, the target file can be directly obtained from a preset database, and in another implementation, a backup of the target file of the main service is stored locally. In this case, the version of the target file of the local main service can be compared with the version of the target file in the preset database.
[0079] Specifically, if Figure 2 FIG. 1 is a flow chart of S101 in one implementation, which includes the following steps:
[0080] S1011: In response to a development instruction for a sub-service, the latest version information of a target file of a main service is obtained from a preset database.
[0081] The preset database may be a git database, in which the target file of the main service is stored. The target file of the main service is usually a package.json file, and the version information of the target file is usually the version field in package.json, which may be a version number composed of digits or a version update date, etc., without specific limitation.
[0082] S1012: Determine whether the latest version information is consistent with the version information of the target file of the main service stored locally. If not, execute S1013; if consistent, execute S1014.
[0083] S1013: Obtain the target file of the main service from the preset database, and update the target file of the main service stored locally. In this way, by judging the consistency of the latest version information of the target file, it can be ensured that the obtained target file is the latest version, and the locally stored target file can also be updated in a timely and proactive manner.
[0084] In one implementation, the locally stored target file of the main service is updated by modifying the locally stored version based on the difference between the locally stored version and the version in the preset database. Alternatively, when the latest version information is inconsistent with the version information of the locally stored target file of the main service, the locally stored target file of the main service is deleted and then downloaded again from the preset database and backed up.
[0085] S1014: Obtain the target file of the main service stored locally as the target file. In this way, the number of times and the amount of data pulled from the preset database can be reduced, and the occupation of system resources can be reduced.
[0086] In this way, by storing a backup of the target file of the main service locally, the number of times the target file is obtained from the preset database can be reduced, thereby reducing the data transmission load and improving efficiency. Moreover, the latest code of the micro-frontend main service can be automatically pulled, reducing the operation process required by developers and improving development efficiency.
[0087] In the present disclosure, a micro-frontend development framework is used between the sub-service and the main service, such as the qiankun framework or the single-spa (single page web application) framework, etc. Therefore, the micro-frontend development scaffolding tool needs to be installed locally in advance before the development instructions can be received. The development instructions can carry specific command functions and passing parameters in the micro-frontend development scaffolding tool. For example, the developer can send the development instruction by entering the following content in sequence: "ksc serve—port 3000—force".
[0088] In one implementation, after obtaining the target file, the installation file of the dependent software package can be obtained from the target file, and the dependent software package can be downloaded and installed according to the installation file. The installation file can be a script file or a common source code file, and there is no specific limitation. For example, the installation file can be npm install, and the dependent software package is an external file required by the main service, which is usually in the dependencies and devDependencies fields of the package.json file. The external file can be a code file or a compiled instruction file, etc.
[0089] In this way, since the target file is the latest version of the file used to run the main service, the dependent software package is also the latest external file required by the main service. After installing the dependent software package, the updated target file can be read, and the updated web server of the micro-frontend main service can be started by calling the dependent software package. The web server of the main service is also the web server used to provide the main service. In other words, the main service can be automatically updated, which improves the efficiency of local integrated development of the micro-frontend.
[0090] In step S102, the configuration information of the sub-service is obtained, the web page server of the sub-service is started according to the configuration information, and the configuration information is written into the target file to obtain an updated target file.
[0091] In this step, the configuration information of the sub-service is determined according to the developer's configuration, wherein the configuration information of the sub-service can be read from the configuration file .sub-app.js, which includes one or more information such as the domain name (host) of the sub-service, the port number (port), the service name (project name), and the service homepage url (uniform resource locator) address.
[0092] The configuration information is written into the target file, which can be specifically written into the simulation file included in the target file. The simulation file is a mock file. The configuration file of the sub-service can be located in the root directory of the sub-service in the target file. During the test process, for some objects that are not easy to construct or obtain, a corresponding virtual mock file is created and the mock file is tested, thereby implementing the test of these objects that are not easy to construct or obtain.
[0093] Specifically, obtaining the configuration information of the sub-service may include: first, in response to a development instruction, creating a template file of the sub-service using a scaffolding tool; and then, in response to an editing instruction for the template file, obtaining the configuration information of the sub-service.
[0094] A scaffolding tool is a tool that can automatically create service template files. The template files can define the service infrastructure, service specifications and conventions, and other information. In other words, configuring sub-services based on template files created by scaffolding tools can reduce repetitive development work in the same main service and further realize the automation of local integrated development and debugging of micro-frontends.
[0095] like Figure 3 FIG. 1 is a flow chart of S102 in one implementation, which includes the following steps:
[0096] S1021: Generate a simulation file for the sub-service according to the configuration information.
[0097] The simulation file may include the corresponding sub-service service identifier (project key), service name, service homepage URL address and other information. The service identifier is used to query whether the target file includes the simulation file corresponding to the sub-service. The query can be performed based on the sub-service key value projectKey.
[0098] S1022: Check whether the target file includes the simulation file corresponding to the sub-service; if included, execute S1023; if not, execute S1024.
[0099] S1023: Replace the simulation file in the target file with the generated simulation file to obtain an updated target file.
[0100] S1024: Add the simulation file to the target file to obtain an updated target file.
[0101] That is to say, if a sub-service simulation file with the same name already exists in the target file, it will be directly overwritten; if a sub-service simulation file with the same name does not exist in the target file, the simulation file will be added to the target file. In this way, the web server of the sub-service can be started and run according to the latest simulation file of the sub-service. The web server of the sub-service is also the web server used to provide the sub-service, which avoids the situation where the old version of the sub-service is provided after the web server of the sub-service is started.
[0102] In step S103, the updated target file is read and the web page server of the updated main service is started, wherein the updated main service includes the sub-service.
[0103] In one implementation, reading the updated target file and starting the updated web server of the main service may specifically include:
[0104] First, read the simulation file of at least one sub-service included in the updated target file to obtain the configuration information of the at least one sub-service; then, start the web server of the updated main service, and register the at least one sub-service in the updated main service according to the configuration information of the at least one sub-service.
[0105] The configuration information of the sub-service may include any one or more items such as the service identifier, service name, and service homepage URL address of the sub-service. In this way, by reading the simulation file in the target file, the electronic device can start the updated web server of the main service without completely constructing or obtaining the data of the main service. At the same time, the new sub-service can be automatically registered in the main service, which also realizes the automatic update of the sub-service in the main service, reducing the manual operation of the developer.
[0106] After the target file is updated, the updated target file can be read to start the updated main service's web server. Since the updated target file includes the sub-service configuration information, after reading the updated target file, the sub-service configuration information in the simulation file can be parsed, and then the registered sub-service list can be added to the micro-frontend framework, thereby automatically starting the micro-frontend sub-service's web server, and then further developing and testing the sub-service.
[0107] It can be seen from the above that the technical solution provided by the embodiment of the present disclosure can automatically configure the target file of the main service after receiving the development instruction. In this way, the developer only needs to focus on the development configuration and business development of the sub-services in the micro-frontend application, without having to worry about how to pull, update and configure the code of the main service corresponding to the sub-service. The micro-frontend service can be automatically updated, thereby improving the efficiency of local integrated development of the micro-frontend.
[0108] Figure 4 The present invention is a block diagram of a micro-frontend service update device according to an exemplary embodiment. The device is applied to an electronic device, and the device includes:
[0109] An acquisition unit 201 is configured to execute a development instruction for a sub-service and acquire a target file, wherein the target file is a file for running the latest version of a main service to which the sub-service belongs, and both the sub-service and the main service are services based on a micro-frontend framework;
[0110] An updating unit 202 is configured to obtain configuration information of the sub-service, start the web server of the sub-service according to the configuration information, and write the configuration information into the target file to obtain an updated target file;
[0111] The starting unit 203 is configured to read the updated target file and start the web page server of the updated main service, wherein the updated main service includes the sub-service.
[0112] In one implementation, the obtaining unit 201 is configured to execute:
[0113] In response to a development instruction for a sub-service, obtaining the latest version information of the target file of the main service from a preset database;
[0114] Determine whether the latest version information is consistent with the version information of the target file of the main service stored locally;
[0115] If they are inconsistent, the target file of the main service is obtained from the preset database as the target file, and the target file of the main service stored locally is updated.
[0116] In one implementation, the obtaining unit 201 is configured to execute:
[0117] If the latest version information is consistent with the version information of the target file of the main service stored locally, the target file of the main service stored locally is obtained.
[0118] In one implementation, the obtaining unit 201 is configured to execute:
[0119] Obtaining an installation file of a dependent software package from the target file, downloading and installing the dependent software package according to the installation file, wherein the dependent software package is an external file required by the main service;
[0120] The startup unit 203 is configured to execute:
[0121] The updated target file is read, the dependent software package is called, and the updated web page server of the main service is started.
[0122] In one implementation, the updating unit 202 is configured to execute:
[0123] Generate a simulation file of the sub-service according to the configuration information;
[0124] Query whether the target file includes a simulation file corresponding to the sub-service;
[0125] If included, the simulation file in the target file is replaced with the generated simulation file to obtain an updated target file;
[0126] If not included, the simulation file is added to the target file to obtain an updated target file.
[0127] In one implementation, the updating unit 202 is configured to execute:
[0128] Reading a simulation file of at least one sub-service included in the updated target file to obtain configuration information of the at least one sub-service;
[0129] The web page server of the updated main service is started, and the at least one sub-service is registered in the updated main service according to the configuration information of the at least one sub-service.
[0130] In one implementation, the updating unit 202 is configured to execute:
[0131] In response to the development instruction, using a scaffolding tool to create a template file of the sub-service;
[0132] In response to an instruction to edit the template file, configuration information of the sub-service is acquired.
[0133] It can be seen from the above that the technical solution provided by the embodiment of the present disclosure can automatically configure the target file of the main service after receiving the development instruction. In this way, the developer only needs to focus on the development configuration and business development of the sub-services in the micro-frontend application, without having to worry about how to pull, update and configure the code of the main service corresponding to the sub-service. The micro-frontend service can be automatically updated, thereby improving the efficiency of local integrated development of the micro-frontend.
[0134] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0135] Figure 5 It is a block diagram of an electronic device for updating a micro-frontend service according to an exemplary embodiment.
[0136] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to perform the above method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0137] In an exemplary embodiment, a computer program product is also provided, which, when executed on a computer, enables the computer to implement the above-mentioned method for updating the micro-frontend service.
[0138] It can be seen from the above that the technical solution provided by the embodiment of the present disclosure can automatically configure the target file of the main service after receiving the development instruction. In this way, the developer only needs to focus on the development configuration and business development of the sub-services in the micro-frontend application, without having to worry about how to pull, update and configure the code of the main service corresponding to the sub-service, thereby improving the efficiency of local integrated development of the micro-frontend.
[0139] Figure 6It is a block diagram of a device 800 for updating a micro-frontend service according to an exemplary embodiment.
[0140] For example, apparatus 800 may be a mobile phone, a computer, a digital broadcast electronic device, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0141] Reference Figure 6 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0142] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0143] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0144] The power supply component 807 provides power to the various components of the device 800. The power supply component 807 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.
[0145] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0146] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0147] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0148] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0149] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0150] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the methods described in the first and second aspects.
[0151] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to complete the above method. Optionally, for example, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0152] In an exemplary embodiment, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the micro-frontend service update method described in the first embodiment above.
[0153] It can be seen from the above that the technical solution provided by the embodiment of the present disclosure can automatically configure the target file of the main service after receiving the development instruction. In this way, the developer only needs to focus on the development configuration and business development of the sub-services in the micro-frontend application, without having to worry about how to pull, update and configure the code of the main service corresponding to the sub-service. The micro-frontend service can be automatically updated, thereby improving the efficiency of local integrated development of the micro-frontend.
[0154] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0155] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A micro-frontend service update method, characterized in that: Applied to electronic equipment, the method comprises: In response to a development instruction for a sub-service, a target file is obtained, the target file being a file for running the latest version of a main service to which the sub-service belongs, and both the sub-service and the main service are services based on a micro-frontend framework; the obtaining of the target file in response to the development instruction for the sub-service includes: in response to the development instruction for the sub-service, obtaining the latest version information of the target file of the main service from a preset database; determining whether the latest version information is consistent with the version information of the target file of the main service stored locally; if not, obtaining the target file of the main service from the preset database, and updating the target file of the main service stored locally; if the latest version information is consistent with the version information of the target file of the main service stored locally, the method further includes: obtaining the target file of the main service stored locally; Acquire configuration information of the sub-service, start the webpage server of the sub-service according to the configuration information, and write the configuration information into the target file to obtain an updated target file; the writing of the configuration information into the target file to obtain an updated target file includes: generating a simulation file of the sub-service according to the configuration information; querying whether the target file includes the simulation file corresponding to the sub-service; if included, replacing the simulation file in the target file with the generated simulation file to obtain the updated target file; if not included, adding the simulation file to the target file to obtain the updated target file; The updated target file is read, and a web page server of an updated main service is started, wherein the updated main service includes the sub-service; the reading of the updated target file and starting the web page server of the updated main service comprises: reading a simulation file of at least one sub-service included in the updated target file to obtain configuration information of the at least one sub-service; starting the web page server of the updated main service, and registering the at least one sub-service in the updated main service according to the configuration information of the at least one sub-service.
2. The micro-frontend service update method according to claim 1, characterized in that: After obtaining the target file, the method further includes: Obtaining an installation file of a dependent software package from the target file, downloading and installing the dependent software package according to the installation file, wherein the dependent software package is an external file required by the main service; The step of reading the updated target file and starting the updated web page server of the main service includes: The updated target file is read, the dependent software package is called, and the updated web page server of the main service is started.
3. The micro-frontend service update method according to claim 1, characterized in that: The obtaining the configuration information of the sub-service includes: In response to the development instruction, using a scaffolding tool to create a template file of the sub-service; In response to an instruction to edit the template file, configuration information of the sub-service is acquired.
4. A micro-frontend service update device, characterized in that: Applied to electronic equipment, the device comprises: An acquisition unit is configured to execute a development instruction for a sub-service and acquire a target file, wherein the target file is a file for running the latest version of the main service to which the sub-service belongs, and both the sub-service and the main service are services based on a micro-frontend framework; the acquisition of the target file in response to the development instruction for the sub-service includes: acquiring the latest version information of the target file of the main service from a preset database in response to the development instruction for the sub-service; determining whether the latest version information is consistent with the version information of the target file of the main service stored locally; if not, acquiring the target file of the main service from the preset database, and updating the target file of the main service stored locally; if the latest version information is consistent with the version information of the target file of the main service stored locally, the device is further used to: acquire the target file of the main service stored locally; The updating unit is configured to execute the acquisition of the configuration information of the sub-service, start the webpage server of the sub-service according to the configuration information, and write the configuration information into the target file to obtain the updated target file; the writing of the configuration information into the target file to obtain the updated target file includes: generating a simulation file of the sub-service according to the configuration information; querying whether the target file includes the simulation file corresponding to the sub-service; if included, replacing the simulation file in the target file with the generated simulation file to obtain the updated target file; if not included, adding the simulation file to the target file to obtain the updated target file; The starting unit is configured to execute reading of the updated target file and starting of the web page server of the updated main service, wherein the updated main service includes the sub-service; the reading of the updated target file and starting of the web page server of the updated main service comprises: reading a simulation file of at least one sub-service included in the updated target file to obtain configuration information of the at least one sub-service; starting of the web page server of the updated main service, and registering the at least one sub-service in the updated main service according to the configuration information of the at least one sub-service.
5. The micro-frontend service updating device according to claim 4, characterized in that: The acquisition unit is configured to execute: Obtaining an installation file of a dependent software package from the target file, downloading and installing the dependent software package according to the installation file, wherein the dependent software package is an external file required by the main service; The startup unit is configured to execute: The updated target file is read, the dependent software package is called, and the updated web page server of the main service is started.
6. The micro-frontend service updating device according to claim 4, characterized in that: The updating unit is configured to execute: In response to the development instruction, using a scaffolding tool to create a template file of the sub-service; In response to an instruction to edit the template file, configuration information of the sub-service is acquired.
7. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the micro-frontend service update method as described in any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of a micro-frontend service updating electronic device, the micro-frontend service updating electronic device is enabled to execute the micro-frontend service updating method as described in any one of claims 1 to 3.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the micro-frontend service updating method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Micro-front-end system and method based on routing distribution
CN110708368A
Framework migration method and device
CN111443920A
Software development method and device based on micro front end, electronic equipment and storage medium
CN113157274A
Micro-front-end system
CN113254050A
Application registration method, device and apparatus, computer readable storage medium and product
CN113590174A
