Shared component updating method and device, computer equipment and storage medium

By monitoring the update of application components in the component sharing platform, extracting the updated version and automatically updating it to dependent applications, the problem of repeated development of the same logical components for multiple projects is solved, and resource sharing and development efficiency are improved.

CN120104152APending Publication Date: 2025-06-06SF TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311665384.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

In modern software development, multiple projects may have components that execute the same business logic, but due to independent development, resources are wasted and development is inefficient.

Method used

By monitoring the update of application components in the component sharing platform, extracting the updated version, using Webpack and module federated plug-ins to package it as an independent module, replacing the original component, and automatically updating it to applications that rely on the component.

Benefits of technology

Automatic update of components and resource sharing are realized, which avoids duplicate development, improves development efficiency, and ensures that components in the application always use the latest version.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104152A_ABST
    Figure CN120104152A_ABST
Patent Text Reader

Abstract

The invention relates to a shared component updating method and device, computer equipment and a storage medium. The method comprises the steps of extracting an updated version of a shared component associated with a first application under the condition that the shared component associated with the first application in the component sharing platform is monitored to be updated; replacing a corresponding original shared component in the component sharing platform based on the updated version to obtain an updated shared component associated with the first application; automatically updating the updated shared component to the second application; the second application is an application for calling an original shared component in the component sharing platform based on the module federated plug-in. When the shared component associated with the first application is updated, the related shared component stored in the component sharing platform can be automatically updated, and then the corresponding shared component in the component sharing platform called by the second application can be automatically updated, so that re-development of the component is avoided, waste of development resources is favorably avoided, and software development efficiency is also favorably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device, storage medium and computer program product for updating a shared component. Background Art

[0002] For software project development, currently, many project development teams only develop component resources in their own projects. Therefore, for different projects, there may be components that execute the same business logic but are developed multiple times, which results in a waste of development resources. It can be seen that in modern software development, how to avoid the waste of development resources and improve development efficiency is an urgent problem to be solved. Summary of the invention

[0003] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for updating shared components that can avoid waste of development resources and improve development efficiency in response to the above technical problems.

[0004] In a first aspect, the present application provides a method for updating a shared component, comprising:

[0005] When it is detected that a shared component associated with the first application in the component sharing platform is updated, an updated version of the shared component associated with the first application is extracted; in the component sharing platform, based on the output configuration of Webpack and the module federation plug-in, each of the shared components associated with the first application is packaged into an independent sharable module;

[0006] Replacing the corresponding original shared component in the component sharing platform based on the updated version to obtain an updated shared component associated with the first application;

[0007] The updated shared component is automatically updated to a second application; wherein the second application is also configured with the module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

[0008] In one of the embodiments, an automatic building tool is configured in the component sharing platform and the first application respectively;

[0009] The extracting the updated version of the shared component associated with the first application when monitoring that the shared component associated with the first application in the component sharing platform is updated includes:

[0010] When the automatic build tool in the first application monitors that the shared component associated with the first application in the component sharing platform is updated and receives a release request for an updated version of the shared component associated with the first application, the updated version of the shared component associated with the first application is automatically extracted by the automatic build tool in the component sharing platform.

[0011] In one embodiment, when it is detected that a shared component associated with a first application in a component sharing platform is updated, extracting an updated version of the shared component associated with the first application includes:

[0012] In a case where it is monitored that a shared component associated with a first application in the component sharing platform is updated, the component sharing platform receives information that the shared component of the first application is updated, which is transmitted by the automatic build tool in the first application;

[0013] In response to an automatic extraction request of the automatic build tool in the component sharing platform for an updated version of the shared component associated with the first application, the updated version of the shared component associated with the first application is extracted.

[0014] In one embodiment, the automatic build tool includes any one of Jenkins and GitLab CI / CD.

[0015] In one embodiment, when it is detected that a shared component associated with a first application in a component sharing platform is updated, before extracting an updated version of the shared component associated with the first application, the method further includes:

[0016] In response to a publishing request for a shared component associated with the first application, receiving an independent sharable module packaged as the shared component based on the output configuration of Webpack and the module federation plug-in, and storing the module in the component sharing platform; wherein each sharable module corresponding to each shared component is correspondingly configured with shared configuration information;

[0017] In response to a call request for the shared component initiated by the second application based on the module federation plug-in, a target module to be called is determined based on the shared configuration information in the call request; wherein the target module is a sharable module in the component sharing platform;

[0018] The shared component corresponding to the determined target module to be called is provided to the second application from the component sharing platform.

[0019] In one embodiment, before responding to the publishing request of the shared component of the first application, the method further includes:

[0020] Creating a plurality of shared components associated with the first application in a component sharing platform, and packaging and testing each of the shared components;

[0021] In the Webpack configuration of the component sharing platform, corresponding shared configuration information is configured for each of the shared components;

[0022] Based on the output configuration of Webpack and the module federation plug-in, the multiple shared components are packaged into an independent sharable module.

[0023] In one embodiment, after packaging the plurality of shared components into an independent shareable module, the method further includes:

[0024] Automatically generate OSS resources corresponding to each of the shared components; wherein the OSS resources are used by each of the second applications to access the corresponding shared components through the corresponding domain name bound to the NGINX server.

[0025] In one embodiment, automatically updating the updated shared component to the second application includes:

[0026] When the component sharing platform receives a call request from the second application for the updated shared component based on the module federation plug-in, the updated shared component is automatically updated to the second application.

[0027] In one embodiment, before automatically updating the updated shared component to the second application, the method further includes:

[0028] When it is detected in the component sharing platform that the original shared component called by the second application is updated to the updated shared component, the component sharing platform receives a request sent by the second application to call the updated shared component.

[0029] In one embodiment, the monitoring that the shared component associated with the first application in the component sharing platform is updated includes at least one of the following:

[0030] It is detected that a shared component associated with the first application in the component sharing platform is expired;

[0031] It is detected that a shared component associated with the first application in the component sharing platform is deleted;

[0032] It is detected that a shared component associated with the first application in the component sharing platform is modified;

[0033] It is monitored that at least one new shared component is added in the component sharing platform and is associated with the first application.

[0034] In a second aspect, the present application further provides a device for updating a shared component, the device comprising:

[0035] A component extraction module, configured to extract an updated version of the shared component associated with the first application when it is detected that the shared component associated with the first application in the component sharing platform is updated; in the component sharing platform, based on the output configuration of Webpack and the module federation plug-in, the shared components associated with the first application are packaged into an independent sharable module;

[0036] A component replacement module, configured to replace the corresponding original shared component in the component sharing platform based on the updated version, to obtain an updated shared component associated with the first application;

[0037] The component update module is used to automatically update the updated shared component to the second application; wherein the second application is also configured with the module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

[0038] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0039] When it is detected that a shared component associated with the first application in the component sharing platform is updated, an updated version of the shared component associated with the first application is extracted; in the component sharing platform, based on the output configuration of Webpack and the module federation plug-in, each of the shared components associated with the first application is packaged into an independent sharable module;

[0040] Replacing the corresponding original shared component in the component sharing platform based on the updated version to obtain an updated shared component associated with the first application;

[0041] The updated shared component is automatically updated to a second application; wherein the second application is also configured with the module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

[0042] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0043] When it is detected that a shared component associated with the first application in the component sharing platform is updated, an updated version of the shared component associated with the first application is extracted; in the component sharing platform, based on the output configuration of Webpack and the module federation plug-in, each of the shared components associated with the first application is packaged into an independent sharable module;

[0044] Replacing the corresponding original shared component in the component sharing platform based on the updated version to obtain an updated shared component associated with the first application;

[0045] The updated shared component is automatically updated to a second application; wherein the second application is also configured with the module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

[0046] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0047] When it is detected that a shared component associated with the first application in the component sharing platform is updated, an updated version of the shared component associated with the first application is extracted; in the component sharing platform, based on the output configuration of Webpack and the module federation plug-in, each of the shared components associated with the first application is packaged into an independent sharable module;

[0048] Replacing the corresponding original shared component in the component sharing platform based on the updated version to obtain an updated shared component associated with the first application;

[0049] The updated shared component is automatically updated to a second application; wherein the second application is also configured with the module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

[0050] The above-mentioned shared component updating method, apparatus, computer equipment, storage medium and computer program product, when monitoring that the shared component associated with the first application in the component sharing platform has been updated, extracts the updated version of the relevant shared component to the component sharing platform to replace the corresponding original shared component in the component sharing platform to obtain the updated shared component, and the component sharing platform automatically updates the updated shared component to the second application, so that the second application can automatically and timely obtain the updated shared component (updated shared component) when the shared component in the associated component sharing platform is updated, so that the second application that calls the shared component from the component sharing platform can use the latest version of the shared component as soon as possible, that is, when the shared component associated with the first application is updated, the relevant shared component stored in the component sharing platform can be automatically updated, and then the corresponding shared component in the component sharing platform called by the second application can be automatically updated, avoiding the re-development of the same business logic component for the second application, which is beneficial to avoiding the waste of development resources and improving the development efficiency of software development. In addition, the shared component update method provided in the present application can ensure that the corresponding relevant functional modules of the second application that calls the component from the component sharing platform can be updated in a timely manner, which is conducive to improving the user experience of the second application. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 An application environment diagram of a method for updating a shared component in one embodiment;

[0053] Figure 2 is a flow chart of a method for updating a shared component in one embodiment;

[0054] Figure 3 A flowchart of a method for updating a shared component in one embodiment;

[0055] Figure 4 is a flow chart of a method for updating a shared component in another embodiment;

[0056] Figure 5 is a structural block diagram of an updating device for a shared component in one embodiment;

[0057] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0058] The update method of the shared component provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Figure 1 The application environment diagram of the method for updating a shared component in one embodiment, wherein the terminal 12 communicates with the server 14 via a network. The data storage system can store data that the server 14 needs to process. The data storage system can be integrated on the server 14, or it can be placed on a cloud or other network server. The data storage system in the server 14 can be specifically used to store the shared components stored in the component sharing platform in this application, and the shared components stored here include updated shared components. Among them, the terminal 12 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, etc. The server 14 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0059] Figure 2 is a flow chart of a method for updating a shared component in one embodiment. Figure 3 FIG. 1 is a flowchart of a method for updating a shared component in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 2 As shown, a method for updating a shared component is provided, which is applied to Figure 1 The terminal 12 in the example is used for explanation, including the following steps 101 to 103. Please refer to Figure 3 ,in:

[0060] Step 101, when it is monitored that the shared component associated with the first application in the component sharing platform is updated, the updated version of the shared component associated with the first application is extracted; in the component sharing platform, based on the output configuration of Webpack and the module federation plug-in, the shared components associated with the first application are packaged into an independent sharable module.

[0061] The component sharing platform in step 101 is used to store shared components, such as a component library within the company, a private NPM (Node Package Manager) warehouse, etc. If conditions permit, it can also be a component library that allows external applications to access; that is, a platform or library or system that can be used to store a large number of shared components, etc., can all be the component sharing platform provided by this application. The first application in step 101 can be an application established by a department within the company, or it can be any application system that can call the shared components published in the component sharing platform.

[0062] Specifically, the component sharing platform provided by the present application can be used to store shared components associated with the first application, that is, the shared components stored in the component sharing platform are created based on the development of the first application and are used to implement some module functions of the first application; when at least one shared component associated with the first application is updated, the corresponding shared components stored in the component sharing platform that can be called by other applications should also be updated in a timely manner to ensure that the version of the shared components stored in the component sharing platform that can be called by other applications is the latest, so that the application that calls the shared components stored in the component sharing platform can call the latest version of the component in a timely manner and update the application version in a timely manner. Therefore, in the shared component updating method provided by the present application, the content of step 101 is that, when it is monitored that the shared component associated with the first application in the component sharing platform is updated, it means that the related shared components associated with the first application and stored in the component sharing platform also need to be updated. At this time, the updated version of the updated shared component associated with the first application can be extracted, so that when necessary, the updated version can be published to the component sharing platform associated with the first application for updating and storage, so that the application that calls the component from the component sharing platform can use the latest version of the component as soon as possible, so as to ensure that the relevant functional modules of the application that calls the component from the component sharing platform can be updated in time, which is also beneficial to improving the user experience of the related applications.

[0063] It should be added that the present application provides an optional implementation method, in which the shared component associated with the first application stored in the component sharing platform can be stored in the component sharing platform as an independent sharable module; for this independent sharable module, the shared component associated with the first application can be packaged into an independent sharable module in the component sharing platform using the Webpack output configuration and the ModuleFederation plug-in.

[0064] It should be noted that packaging the shared components associated with the first application as an independent sharable module and storing it in the component sharing platform is only an optional implementation method provided by the present application, but the present application is not limited to this; if technology permits, the shared components associated with the first application may not be packaged, and each shared component may be directly stored in the component sharing platform; or the shared components associated with the first application may be classified, packaged and stored according to functions, types and other conditions, as long as it is convenient for other applications to call the required shared components from the component sharing platform.

[0065] Step 102: Replace the corresponding original shared component in the component sharing platform based on the updated version to obtain an updated shared component associated with the first application.

[0066] Specifically, in the case that the updated version of the shared component associated with the first application is extracted through step 101, step 102 can be further performed to replace the corresponding original shared component in the corresponding component sharing platform with the updated version of the shared component extracted, so as to update the original shared component corresponding to the updated version of the shared component in the component sharing platform, thereby storing the updated shared component associated with the first application in the component sharing platform. That is, the purpose of performing step 102 is to replace the relevant original shared component in the corresponding component sharing platform based on the updated version of the shared component extracted and associated with the first application, so that the original shared component in the component sharing platform is updated to the updated shared component, and the corresponding original shared component is overwritten or deleted, so as to achieve timely update of the shared component stored in the component sharing platform, improve the update efficiency of the shared component stored in the component sharing platform, facilitate other applications that call the shared component from the component sharing platform to use the latest version of the component as soon as possible, so as to ensure that the relevant functional modules of other applications that call the component from the component sharing platform can be updated in time, which is also conducive to improving the user experience of other related applications.

[0067] Step 103, automatically updating the updated shared component to the second application; wherein the second application is also configured with a module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

[0068] Among them, the second application in step 103 refers to an application, a system, a platform, etc. that is associated with the component sharing platform and will call shared components from the component sharing platform for use. Any consumer that can call the shared components stored on the component sharing platform can be the second application of this application; correspondingly, the above-mentioned first application can be regarded as the provider of shared components.

[0069] Specifically, when the shared component stored in the component sharing platform is updated through step 102 so that the version of the shared component stored in the component sharing platform is the same as the shared component associated with the first application, step 103 can be further executed to automatically update the updated shared component stored in the component sharing platform to the second application that previously called the original shared component corresponding to the updated shared component, so that the second application that calls the shared component from the component sharing platform can use the latest version of the shared component in time, so as to ensure that the corresponding relevant functional modules of the second application that calls the shared component from the component sharing platform can be updated in time, which is beneficial to improving the user experience of other related applications (such as the second application).

[0070] It should be added that Figure 3 As shown, the first application, the second application, and the component sharing platform can all be built in the React framework.

[0071] In the above-mentioned method for updating shared components, when it is detected that the shared component associated with the first application in the component sharing platform is updated, the updated version of the related shared component is extracted to the component sharing platform to replace the corresponding original shared component in the component sharing platform to obtain the updated shared component, and the component sharing platform automatically updates the updated shared component to the second application, so that the second application can automatically and timely obtain the updated shared component (updated shared component) when the shared component in the associated component sharing platform is updated, so that the second application that calls the shared component from the component sharing platform can use the latest version of the shared component as soon as possible, that is, when the shared component associated with the first application is updated, the related shared component stored in the component sharing platform can be automatically updated, and then the corresponding shared component in the component sharing platform called by the second application can be automatically updated, avoiding the re-development of the same business logic component for the second application, which is conducive to avoiding the waste of development resources and improving the development efficiency of software development. In addition, the method for updating shared components provided by the present application can ensure that the corresponding related functional modules of the second application that calls the component from the component sharing platform can be updated in a timely manner, which is conducive to improving the user experience of the second application.

[0072] It can be seen that by executing the contents of steps 101-103 provided in this application, when the shared component associated with the first application is updated, it can be automatically updated to the associated component sharing platform to update the related shared components stored in the component sharing platform, and then the updated shared components stored in the component sharing platform can be timely and automatically updated to the second application that calls the related shared components; it can be seen that the shared components associated with the first application can be used by multiple modules or projects in the process of software development, and these shared components can be shared and reused by multiple modules or projects, avoiding the process of writing the same functional code separately in multiple modules or projects, thereby avoiding a large amount of redundant code. In addition, componentization and code sharing and reuse allow developers to focus on the implementation of core business logic and reduce unnecessary repetitive development work; at the same time, while continuously optimizing and improving existing shared components or shared modules (independent sharable modules), it can also quickly respond to the needs of related businesses (such as second applications). In addition, for a system, as the scale of the system becomes larger and larger, and involves various platforms, devices, languages ​​and other issues, the time cost of debugging and correcting defects is also increasing; and through fine management and unified maintenance of several reusable and shareable important components or frameworks, the system can be managed more conveniently and ensure better stability. In addition, when a team is collaborating on development, each person is responsible for different parts of the code. If the same team does not standardize and encapsulate the functions they are responsible for and bring them out for others to use, then a lot of communication and connection operations will inevitably occur during the collaboration process; on the contrary, the advantages of each other can be used to maximize the work efficiency; that is, the existence of shared components can achieve a significant improvement in the efficiency of software development; specifically, in the process of software development, when the requirements change to a certain extent, if we use traditional programming methods, then every time the code is modified, it needs to be recompiled and tested, which is very time-consuming and laborious; and if we use componentization and code reuse, we can separate the code modules with different functions, and when we need to modify them, we only need to modify the corresponding modules in a targeted manner, and the development efficiency is significantly improved.

[0073] In an exemplary embodiment, it should be noted that an automatic construction tool is configured in the component sharing platform and the first application. Figure 2 As shown, step 101 is performed to extract the updated version of the shared component associated with the first application when it is monitored that the shared component associated with the first application in the component sharing platform is updated. Specifically, the following can be performed:

[0074] When the automatic build tool in the first application monitors that the shared component associated with the first application in the component sharing platform is updated and receives a release request for the updated version of the shared component associated with the first application, the updated version of the shared component associated with the first application is automatically extracted by the automatic build tool in the component sharing platform.

[0075] Specifically, the shared component updating method provided by the present application is to enable the shared component associated with the first application to be automatically updated to the corresponding component sharing platform for storage when being updated. The present application provides an optional implementation method, in which the component sharing platform and the corresponding first application are pre-configured with an automatic build tool, so that the first application, as the shared component provider, can automatically update the updated shared component to the corresponding component sharing platform based on the automatic build tool after updating at least one shared component, so as to realize automatic update of the shared component, without the need to manually publish the updated shared component to the component sharing platform, which is conducive to improving the efficiency of software development.

[0076] In the shared component update method provided by the present application, one specific executable manner of step 101 is that, for a component sharing platform, when the automatic build tool in the first application detects that the shared component associated with the first application in the component sharing platform is updated, the updated shared component may not be automatically extracted first, but upon receiving a release request for the updated version of the shared component associated with the first application, the updated version may be automatically extracted through the automatic build tool in the component sharing platform; in this way, before the updated version sends a release request to the component sharing platform, the first application may first test the updated version, thereby improving the reliability of the updated version of the (shared component) subsequently extracted to the component sharing platform, avoiding defects in the application that calls the updated version of the (shared component) through the component sharing platform and the inability to execute related content normally, which is beneficial to improving the stability and reliability of component reuse and reducing the time cost spent on program debugging and defect correction.

[0077] That is, the content of step 101 provided in the present application may include two types. One is that, when it is monitored that the shared component associated with the first application in the component sharing platform is updated, the updated version of the shared component associated with the first application is automatically extracted to the component sharing platform by the automatic construction tool in the component sharing platform; the other is that, when it is monitored that the shared component associated with the first application in the component sharing platform is updated and a release request for the updated version of the shared component associated with the first application is received, the updated version of the shared component associated with the first application is automatically extracted by the automatic construction tool in the component sharing platform.

[0078] Figure 4FIG. 1 is a flow chart of a method for updating a shared component in another embodiment. In an exemplary embodiment, Figure 4 As shown, step 101 is performed to extract an updated version of the shared component associated with the first application in the component sharing platform when it is monitored that the shared component associated with the first application is updated, which may specifically include steps 111 and 112, wherein:

[0079] Step 111, when it is detected that a shared component associated with the first application in the component sharing platform is updated, the component sharing platform receives information that the shared component of the first application is updated, which is transmitted by an automatic build tool in the first application;

[0080] Step 112 : extracting the updated version of the shared component associated with the first application in response to an automatic extraction request of the automatic construction tool in the component sharing platform for the updated version of the shared component associated with the first application.

[0081] Specifically, in the shared component update method provided by the present application, one specific executable manner of step 101 is to implement it through steps 111 and 112, wherein the content of step 111 execution is specifically as follows: when it is monitored that the shared component associated with the first application in the component sharing platform is updated, that is, when it is monitored that the first application, as a component provider, has updated at least one shared component, the component sharing platform receives the information that there is an updated shared component in the shared component associated with the first application transmitted to it by the automatic build tool configured in the code repository of the first application; and then executes step 112, in response to the automatic extraction request of the automatic build tool configured in the code repository in the component sharing platform for the updated version of the shared component associated with the first application, that is, after the component sharing platform sends an automatic extraction request to the updated version of the shared component, the updated version of the shared component associated with the first application is extracted to the shared component platform, so that the shared component originally stored in the component sharing platform can be replaced by the updated version by executing step 102 later.

[0082] It can be seen that when the shared component associated with the first application is updated, the relevant original shared components stored in the component sharing platform can be automatically updated, which is equivalent to the shared component update method provided in the present application. The automatic construction and version management of the shared components are integrated with the release process of the shared components, and the automatic construction, automatic release and version management of the shared components are realized, which is beneficial to improving the update efficiency of the shared components stored in the component sharing platform; and then the corresponding shared components in the component sharing platform called by the second application can be automatically updated, avoiding the re-development of the same business logic components for the second application, which is beneficial to avoiding the waste of development resources and improving the development efficiency of software development.

[0083] In an exemplary embodiment, the automatic construction tool includes any one of Jenkins and GitLab CI / CD.

[0084] Specifically, for the automatic build tools configured in the component sharing platform and the code repository of the first application, the present application provides two optional types, one is Jenkins and the other is GitLab CI / CD; however, the present application is not limited to this. On the basis of being able to achieve the technical effect of automatically updating the related original shared components stored in the component sharing platform when the shared components associated with the first application are updated, technical personnel in this field may also choose other types of automatic build tools.

[0085] It should also be added that the first application and the second application involved in this application can both be front-end projects, and the first application and the second application can both serve as providers and consumers of shared components, that is, based on the shared components published by the first application to the component sharing platform, in addition to the second application being able to call the shared components from the component sharing platform, the first application can also call the shared components from the component sharing platform when developing needs; that is, the provider of the component can serve as the consumer of the component, and correspondingly, the consumer of the component can also serve as the provider of the component, so that the flexibility of component sharing can be improved. Specifically, as the second application provided in the embodiment of this application, not only can the shared components associated with the first application be called from the component sharing platform and published and stored, but the second application can also publish the shared components to the component sharing platform.

[0086] In an exemplary embodiment, Figure 4 As shown, in step 101, when it is detected that the shared component associated with the first application in the component sharing platform is updated, before extracting the updated version of the shared component associated with the first application, steps 104 to 106 may also be included, wherein:

[0087] Step 104, in response to a publishing request of a shared component associated with the first application, receiving an independent sharable module packaged as the shared component based on the output configuration of Webpack and the module federation plug-in, and storing the module in a component sharing platform; wherein the sharable module corresponding to each shared component is correspondingly configured with shared configuration information;

[0088] Step 105, in response to the calling request for the shared component initiated by the second application based on the module federation plug-in, determining the target module to be called based on the shared configuration information in the calling request; wherein the target module is a sharable module in the component sharing platform;

[0089] Step 106: Provide the shared component corresponding to the determined target module to be called from the component sharing platform to the second application.

[0090] Specifically, the present application also provides an optional implementation method, that is, before executing the content of step 101, steps 104 to 106 may be executed first, wherein the content of step 104 is that in response to a release request for a shared component associated with the first application, that is, in response to a release request for a program code that can be used as a shared component based on the development process of the first application, the component sharing platform receives an independent sharable module associated with the first application, where an independent sharable module associated with the first application is packaged with all shared components associated with the first application, and the packaging process can be implemented based on the output configuration of Webpack and the module federation (MF, Module Federation) plug-in; at the same time, the component sharing platform stores the above-mentioned independent sharable module including the shared component associated with the first application, so as to realize the storage of the shared component associated with the first application in a modular form on the component sharing platform. It should also be added that in the update method of the shared component provided by the present application, in the Webpack configuration of the component sharing platform, these shared components can be defined as external modules, and these external modules are configured with corresponding shared configuration information.

[0091] After the shared components associated with the first application are stored in the component sharing platform in the form of sharable modules through step 104, step 105 can be further executed, in response to the second application's call request for the shared component based on the module federation plug-in, the corresponding call request contains the shared configuration information for the shared component it wants to call, so that the shared component it specifically wants to call can be found in the component sharing platform through these shared configuration information, so as to determine the target module to be called by the second application, that is, to determine the sharable module in the component sharing platform to be called by the second application. It should be supplemented that the second application and the first application provided in this application can be different front-end projects. Therefore, the Webpack configuration of the second application is also configured with the Module Federation plug-in, which can specify the entry and shared configuration of the shared components that it can call. Then, step 106 is executed to provide the shared component corresponding to the determined target module to be called from the component sharing platform to the second application, so that the code of the second application can reference the shared component from the component sharing platform as needed, thereby enabling the second application to use the functions related to the shared component stored in the component sharing platform, which is conducive to reducing the development complexity of the second application and improving the development efficiency of the second application.

[0092] In an exemplary embodiment, Figure 4As shown, before executing step 104 in response to the publishing request of the shared component of the first application, steps 107 to 109 may also be included, wherein:

[0093] Step 107, creating multiple shared components associated with the first application in the component sharing platform, and packaging and testing each shared component;

[0094] Step 108, in the Webpack configuration of the component sharing platform, configure corresponding shared configuration information for each shared component;

[0095] Step 109, based on the output configuration of Webpack and the module federation plug-in, multiple shared components are packaged into an independent sharable module.

[0096] Specifically, the present application also provides an optional implementation method, which is to execute steps 107-109 before executing step 104. The specific implementation content of step 107 is to create multiple shared components associated with the first application in the component sharing platform, and perform necessary packaging and testing on each shared component, that is, to publish the code that can be used as a shared component in the development of the first application to the component sharing platform. The component sharing platform encapsulates and tests these shared components to ensure that these shared components can independently implement corresponding functions, so that after subsequent calls to them by other references, the corresponding functions of the shared components can be implemented in other applications, avoiding the situation where other applications cannot implement related functions after calling the shared components, and also avoiding the situation where other applications call the shared components and affect other existing functions of other applications. Then, step 108 can be further performed. In the Webpack configuration of the component sharing platform, these components are defined as external modules, and corresponding shared configuration information is configured for each shared component, so that each shared component has its corresponding shared configuration information, so that when other applications need to call a shared component in the future, they can call the corresponding shared component through the shared configuration information to avoid calling errors, which is conducive to improving the accuracy and efficiency of component sharing. Then, step 109 can be further performed. In the component sharing platform, the output configuration and module federation plug-in of Webpack are used to package multiple shared components into an independent shareable module, that is, the shared components corresponding to the first application can be packaged into an independent shareable module. In the development of other applications, when it is necessary to implement related functions in the shareable module, the entire independent shareable module associated with the first application can be called, without calling the shared components associated with the first application one by one, which is conducive to improving the calling efficiency of the shared components and reducing the development time of the second application.

[0097] It should also be added that before step 107, Webpack5 and Module Federation plug-ins can be installed on a terminal that can create a component sharing platform, and then a component sharing platform can be created on the terminal where Webpack5 and Module Federation plug-ins are installed, and the basic configuration of Webpack5 can be configured for it, so that the component sharing platform provided by this application can run in an environment where the Webpack5 version is integrated with the Module Federation plug-in. By setting up the component sharing platform, integrating the Module Federation plug-in in the front-end application (first application, second application), and configuring the automated build tool, the entire process of automated build, version management and component sharing is realized, thereby improving the front-end development efficiency and code reusability, reducing duplication of work, and simplifying the maintenance and version management process of the component sharing platform.

[0098] In an exemplary embodiment, Figure 4 As shown, after executing step 109 and packaging multiple shared components into an independent shareable module, the following content can be further executed: automatically generating OSS (Object Storage Service) resources corresponding to each shared component; wherein, the OSS resources are used for each second application to access the corresponding shared component through the corresponding domain name bound to the NGINX server.

[0099] Specifically, the present application also provides an optional implementation method that can automatically publish and generate OSS resources and NGINX cross-domain and cache processing in the process of packaging multiple shared components into an independent shareable module in step 109 through a configurable file. Through these operations, it is ensured that the user is the latest when loading resources, that is, it is ensured that the shared component called by the second application from the component sharing platform is the latest version; in addition, some resource (shared component) cache expiration mechanisms can be set to improve the user-friendliness.

[0100] In an exemplary embodiment, Figure 2 , Figure 4 As shown, step 103 is executed to automatically update the updated shared component to the second application, which can be specifically executed as follows: when the component sharing platform receives a call request for the updated shared component from the second application based on the module federation plug-in, the updated shared component is automatically updated to the second application.

[0101] Specifically, the present application also provides an optional implementation method, in which the content of automatically updating the updated shared component to the second application in step 103 can be specifically implemented as follows: when the component sharing platform receives a call request sent by the second application to call the updated shared component based on the module federation plug-in, the component sharing platform automatically updates the updated shared component in the component sharing platform to the second application based on the configured automatic construction tool. It can be seen that the present application configures the automatic construction tool in the component sharing platform, the second application and the associated first application, so that when the second application requests the component sharing platform to call the updated shared component, the component sharing platform automatically updates the relevant updated shared component to the second reference, realizing the full process of automated construction, version management and component sharing, improving the front-end development efficiency and code reusability, and facilitating the simplification of the maintenance and version management process of the relevant shared components between the component sharing platform, the first application and the second application.

[0102] In an exemplary embodiment, Figure 4 As shown, before executing step 103 and automatically updating the updated shared component to the second application, step 110 may be further included. When it is monitored in the component sharing platform that the original shared component called by the second application is updated to the updated shared component, the component sharing platform receives the request sent by the second application to call the updated shared component.

[0103] Specifically, the present application also provides an optional implementation method, that is, before executing the content of automatically updating the updated shared component to the second application in step 103, step 110 can be executed first, and when it is detected that in the component sharing platform, the original shared component that the second application has originally called from the component sharing platform is updated, that is, updated to the updated shared component, the component sharing platform does not automatically update the updated shared component to the second application first, but after receiving the request sent by the second application to call the updated shared component, it automatically updates the updated shared component in the component sharing platform to the second application based on the configured automatic construction tool. Compared with the case where it is detected that in the component sharing platform, the original shared component that the second application has called is updated to the updated shared component, the component sharing platform directly and automatically updates the updated shared component to the second application, the second application can choose whether to update the call of the relevant shared component as needed, which improves the flexibility of the second application to call the shared component, and is also conducive to avoiding the adverse effects of suddenly updating some components in the second application, which is conducive to ensuring the development stability of the second application and the stability of use.

[0104] In an exemplary embodiment, Figure 2 , Figure 4As shown, in step 101, monitoring that the shared component associated with the first application in the component sharing platform is updated may specifically include at least one of the following:

[0105] It is detected that a shared component associated with the first application in the component sharing platform is expired;

[0106] It is detected that a shared component associated with the first application in the component sharing platform is deleted;

[0107] It is detected that a shared component associated with the first application in the component sharing platform is modified;

[0108] It is monitored that at least one new shared component is added in the component sharing platform and is associated with the first application.

[0109] Specifically, the present application also provides an optional implementation method, regarding the content of the shared component involved in step 101 being updated, for example, it can be any of the four types of shared component expiration, shared component deletion, shared component modification, and new shared component addition. It can be seen that as long as the shared component associated with the first application is different from the shared component originally stored in the component sharing platform, it can be considered that the shared component associated with the first application in the component sharing platform is updated.

[0110] It should be added that the above-mentioned specific embodiments of updating shared components are only several optional embodiments provided by this application, but this application is not limited to this. Other situations that cause the shared components associated with the first application and the shared components originally stored in the component sharing platform to be different can also be summarized.

[0111] The present application provides a method for updating a shared component, and optional implementation examples are as follows:

[0112] Preparation: Install Webpack5 and Module Federation plugin. Create a component library project (such as a component sharing platform) and configure the basic configuration of Webpack5.

[0113] Define shared components: Create components that need to be shared (such as shared components) in the component library project, and perform necessary packaging and testing. In the Webpack configuration of the component library project, define these components as external modules and configure the corresponding shared configuration.

[0114] Publish shared components: In the component library project, use Webpack's output configuration and Module Federation plug-in to package the component library into an independent, shareable module. Publish the packaged shared components to a sharing platform, such as a private NPM repository or a company's internal component library.

[0115] Use shared components: In the front-end project (such as the second application), install shared components through npm or other methods. In the Webpack configuration of the front-end project, configure the Module Federation plug-in to specify the entry and shared configuration of the shared components. In the code of the front-end project, reference the shared components as needed to use the shared component functions. Based on the shared component solution of ModuleFederation, the component consumer (such as the second application) can also export components as the provider (such as the first application), which greatly improves the flexibility of implementing component sharing.

[0116] Automatic build and version management: Configure automatic build tools, such as Jenkins or GitLab CI / CD, in the code repositories of component library projects and front-end projects. Integrate automatic build and version management with the release process of shared components to achieve automated build, release, and version management of shared components.

[0117] Configuration management of version dependencies and component cache mechanisms: Through configuration files, OSS resources are automatically published and generated during the packaging and integration process, as well as NGINX cross-domain and cache processing. These operations ensure that the resources loaded by the user are the latest, and set cache expiration mechanisms for some resources to improve user friendliness.

[0118] Through the shared component update method provided in this application, the entire process of automatically publishing shared components is realized, including the definition, publication and use of components. Compared with the traditional method of manually maintaining component libraries and version management, this solution has the advantages of improving development efficiency and code reusability, reducing duplication of work; simplifying the maintenance and version management process of component libraries; providing support for automatic construction and version management, and ensuring the stability and reliability of component libraries.

[0119] This application provides a method for updating shared components by using Module Federation to automatically publish shared components. By integrating the Module Federation plug-in, the entire process of automated construction, version management, and component sharing is realized; it can improve front-end development efficiency and code reusability, reduce duplication of work, and simplify the maintenance and version management process of the component library.

[0120] The update method of shared components provided by this application has the advantages of module sharing and version control. ModuleFederation enables different projects to share the same modules and components, avoiding the problem of repeatedly writing similar codes; in addition, it also supports version control to ensure that the module versions used in each project are consistent. It also has the advantages of decoupling and independent deployment. Each project can be developed, tested and deployed independently without relying on the build process of other projects; this decoupling enables the team to develop and maintain more flexibly. In addition, Module Federation provides good support for micro-frontend architecture; different teams can independently develop their own small applications and integrate them into a main application through shared components to achieve the overall application. It can also meet the on-demand loading and incremental update of shared components. Applications built based on Module Federation can achieve on-demand loading, load the required modules only when needed, and reduce the initial loading time; at the same time, only the changed modules need to be reloaded when updating, without reloading the entire application. The update method of shared components provided by this application also has the advantage of efficient resource utilization. By splitting the code into multiple independent constructions and sharing modules, redundant code can be minimized and resource utilization can be improved; this helps to reduce the size of the final generated package and improve user experience.

[0121] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0122] Based on the same inventive concept, the embodiment of the present application also provides a shared component update device for implementing the shared component update method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the update device for one or more shared components provided below can refer to the limitations of the shared component update method above, and will not be repeated here.

[0123] Figure 5 FIG. 1 is a structural block diagram of an updating device for a shared component in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 5 As shown, a shared component update device is provided, comprising: a component extraction module 81, a component replacement module 82 and a component update and use module 83, wherein:

[0124] The component extraction module 81 is used to extract the updated version of the shared component associated with the first application when it is detected that the shared component associated with the first application in the component sharing platform is updated; in the component sharing platform, based on the output configuration of Webpack and the module federation plug-in, the shared components associated with the first application are packaged into an independent sharable module;

[0125] A component replacement module 82, configured to replace the corresponding original shared component in the component sharing platform based on the updated version, to obtain an updated shared component associated with the first application;

[0126] The component update module 83 is used to automatically update the updated shared component to the second application; wherein the second application is also configured with a module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

[0127] Specifically, the shared component update device provided in the present application includes at least a component extraction module 81, a component replacement module 82 and a component update and use module 83; wherein the component extraction module 81 is used to monitor that when a shared component associated with the first application in the component sharing platform is updated, it indicates that the related shared components associated with the first application and stored in the component sharing platform also need to be updated. At this time, the updated version of the updated shared component associated with the first application can be extracted, so that when necessary, the updated version can be published to the component sharing platform associated with the first application for updating and storage, so that the application that calls the component from the component sharing platform can use the latest version of the component as soon as possible, so as to ensure that the relevant functional modules of the application that calls the component from the component sharing platform can be updated in time, which is also conducive to improving the user experience of the related applications.

[0128] It should be added that the present application provides an optional implementation method, in which the shared component associated with the first application stored in the component sharing platform can be stored in the component sharing platform as an independent sharable module; for this independent sharable module, the shared component associated with the first application can be packaged into an independent sharable module in the component sharing platform using the Webpack output configuration and the ModuleFederation plug-in.

[0129] It should be noted that packaging the shared components associated with the first application as an independent sharable module and storing it in the component sharing platform is only an optional implementation method provided by the present application, but the present application is not limited to this; if technology permits, the shared components associated with the first application may not be packaged, and each shared component may be directly stored in the component sharing platform; or the shared components associated with the first application may be classified, packaged and stored according to functions, types and other conditions, as long as it is convenient for other applications to call the required shared components from the component sharing platform.

[0130] The component replacement module 82 is used to replace the corresponding original shared component in the corresponding component sharing platform with the updated version of the shared component extracted by the component extraction module 81, so as to update the original shared component corresponding to the updated version of the shared component in the component sharing platform, thereby storing the updated shared component associated with the first application in the component sharing platform. That is, the component replacement module 82 is used to replace the relevant original shared component in the corresponding component sharing platform based on the updated version of the shared component extracted and associated with the first application, so that the original shared component in the component sharing platform is updated to the updated shared component, and the corresponding original shared component is overwritten or deleted, so as to realize the timely update of the shared component stored in the component sharing platform, improve the update efficiency of the shared component stored in the component sharing platform, facilitate other applications that call the shared component from the component sharing platform to use the latest version of the component as soon as possible, so as to ensure that the relevant functional modules of other applications that call the component from the component sharing platform can be updated in time, which is also conducive to improving the user experience of other related applications.

[0131] When the shared component stored in the component sharing platform is updated by the component replacement module 82 so that the shared component stored in it has the same version as the shared component associated with the first application, the component update usage module 83 is used to automatically update the updated shared component stored in the component sharing platform to the second application that previously called the original shared component corresponding to the updated shared component, so that the second application that calls the shared component from the component sharing platform can use the latest version of the shared component in time, thereby ensuring that the corresponding related functional modules of the second application that calls the component from the component sharing platform can be updated in time, which is beneficial to improving the user experience of other related applications.

[0132] It can be seen that, in the updating device of the shared component provided by the present application, the component extraction module 81, the component replacement module 82 and the component update use module 83 are included. When the shared component associated with the first application is updated, the updated shared component can be automatically updated to the associated component sharing platform through the component extraction module 81 and the component replacement module 82 to update the related shared components stored in the component sharing platform, and then the updated shared components stored in the component sharing platform can be timely and automatically updated to the second application that calls the related shared components through the component update use module 83; it can be seen that the shared components associated with the first application can be used by multiple modules or projects in the process of software development. These shared components can be shared and reused by multiple modules or projects, avoiding the process of writing the same functional code separately in multiple modules or projects, thereby avoiding a large amount of redundant code. In addition, componentization and code sharing and reuse allow developers to focus on the implementation of core business logic and reduce unnecessary repeated development work; at the same time, while continuously optimizing and improving existing shared components or shared modules (independent shareable modules), it can also quickly respond to the needs of related businesses (such as second applications). In addition, for a system, as the scale of the system becomes larger and larger, and involves various platforms, devices, languages ​​and other issues, the time cost of debugging and correcting defects is also increasing; and through fine management and unified maintenance of several reusable and shareable important components or frameworks, the system can be managed more conveniently and ensure better stability. In addition, when a team is collaborating on development, each person is responsible for different parts of the code. If the same team does not standardize and encapsulate the functions they are responsible for and bring them out for others to use, then a lot of communication and connection operations will inevitably occur during the collaboration process; on the contrary, the advantages of each other can be used to maximize the work efficiency; that is, the existence of shared components can achieve a significant improvement in the efficiency of software development; specifically, in the process of software development, when the requirements change to a certain extent, if we use traditional programming methods, then every time the code is modified, it needs to be recompiled and tested, which is very time-consuming and laborious; and if we use componentization and code reuse, we can separate the code modules with different functions, and when we need to modify them, we only need to modify the corresponding modules in a targeted manner, and the development efficiency is significantly improved.

[0133] In an exemplary embodiment, automatic build tools are respectively configured in the component sharing platform and the first application; the component extraction module 81 is used to extract the updated version of the shared component associated with the first application when the shared component associated with the first application in the component sharing platform is detected to be updated. Specifically, it may include: the component extraction module 81 is used to automatically extract the updated version of the shared component associated with the first application through the automatic build tool in the component sharing platform when the automatic build tool in the first application detects that the shared component associated with the first application in the component sharing platform is updated and receives a release request for the updated version of the shared component associated with the first application. For details, please refer to Figure 2 , and the above Figure 2 Description.

[0134] In an exemplary embodiment, the component extraction module 81 is used to extract the updated version of the shared component associated with the first application when the shared component associated with the first application in the component sharing platform is detected to be updated. Specifically, the component extraction module 81 is used to extract the updated version of the shared component associated with the first application when the shared component associated with the first application in the component sharing platform is detected to be updated. The component sharing platform receives the updated information in the shared component of the first application transmitted by the automatic build tool in the first application; in response to the automatic extraction request of the automatic build tool in the component sharing platform for the updated version of the shared component associated with the first application, the updated version of the shared component associated with the first application is extracted. For details, please refer to Figure 4 , and the above Figure 4 Description.

[0135] In an exemplary embodiment, the automatic construction tools respectively configured in the component sharing platform and the first application include any one of Jenkins and GitLab CI / CD.

[0136] In an exemplary embodiment, the component extraction module 81 is used to respond to the publishing request of the shared component associated with the first application before extracting the updated version of the shared component associated with the first application when it is detected that the shared component associated with the first application in the component sharing platform is updated, and is used to receive an independent sharable module packaged as the shared component based on the output configuration of Webpack and the module federation plug-in, and store it in the component sharing platform; wherein the sharable modules corresponding to each shared component are configured with shared configuration information; the component use module is used to respond to the call request for the shared component initiated by the second application based on the module federation plug-in, and determine the target module to be called based on the shared configuration information in the call request; wherein the target module is a sharable module in the component sharing platform; and provide the shared component corresponding to the determined target module to be called from the component sharing platform to the second application. For details, please refer to Figure 4 , and the above Figure 4 Description.

[0137] In an exemplary embodiment, the component extraction module 81 is used to respond to the release request of the shared component associated with the first application before the component creation module in the shared component update device is used to create multiple shared components associated with the first application in the component sharing platform, and to package and test each shared component; the information configuration module in the shared component update device is used to configure corresponding shared configuration information for each shared component in the Webpack configuration of the component sharing platform; the component packaging module in the shared component update device is used to package multiple shared components into an independent shareable module based on the output configuration of Webpack and the module federation plug-in. For details, please refer to Figure 4 , and the above Figure 4 Description.

[0138] In an exemplary embodiment, after the multiple shared components are packaged into an independent sharable module through the component packaging module, it also includes a method for automatically generating OSS resources corresponding to each shared component at the same time; wherein the OSS resources are used for each second application to access the corresponding shared component through the corresponding domain name bound to the NGINX server. For details, please refer to Figure 4 , and the above Figure 4 Description.

[0139] In an exemplary embodiment, the component update module 83 is used to automatically update the updated shared component to the second application, including automatically updating the updated shared component to the second application when the component sharing platform receives a call request for the updated shared component from the second application based on the module federation plug-in. Figure 2 and Figure 4, and the above Figure 2 and Figure 4 Description.

[0140] In an exemplary embodiment, the component update module 83 is used to automatically update the updated shared component to the second application, and is also used to monitor that in the component sharing platform, the original shared component called by the second application is updated to the updated shared component, and the component sharing platform receives the request sent by the second application to call the updated shared component. Figure 4 , and the above Figure 4 Description.

[0141] In an exemplary embodiment, the component extraction module 81 detects that the shared component associated with the first application in the component sharing platform is updated, including at least one of the following: detecting that the shared component associated with the first application in the component sharing platform is expired; detecting that the shared component associated with the first application in the component sharing platform is deleted; detecting that the shared component associated with the first application in the component sharing platform is modified; detecting that at least one shared component is added in the component sharing platform associated with the first application. For details, please refer to Figure 2 and Figure 4 , and the above Figure 2 and Figure 4 Description.

[0142] Each module in the above-mentioned updating device of the shared component can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0143] Figure 6 FIG. 1 is an internal structure diagram of a computer device in an embodiment. In an exemplary embodiment, a computer device is provided. The computer device may be a terminal. The internal structure diagram thereof may be as shown in FIG. Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for updating a shared component is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0144] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0145] Based on the same inventive concept, the present application also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the aforementioned shared component update method when executing the computer program. The shared component update method is any one of the shared component update methods mentioned in the embodiments of the present application. Relevant embodiments can be found above.

[0146] Based on the same inventive concept, the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the aforementioned shared component update method is implemented. The shared component update method is any one of the shared component update methods mentioned in the embodiments of the present application. Relevant embodiments can be found above.

[0147] Based on the same inventive concept, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the aforementioned shared component update method. The shared component update method is any one of the shared component update methods mentioned in the embodiments of the present application. Relevant embodiments can be found above.

[0148] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0149] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0150] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0151] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for updating a shared component, It is characterized in that include: In the case where it is monitored that a shared component associated with a first application in a component sharing platform is updated, extracting an updated version of the shared component associated with the first application; In the component sharing platform, based on the output configuration and module federation plug-in of Webpack, each of the shared components associated with the first application is packaged into an independent sharable module; Replacing the corresponding original shared component in the component sharing platform based on the updated version to obtain an updated shared component associated with the first application; The updated shared component is automatically updated to a second application; wherein the second application is also configured with the module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

2. The method for updating a shared component according to claim 1, It is characterized in that An automatic building tool is respectively configured in the component sharing platform and the first application; The extracting the updated version of the shared component associated with the first application when monitoring that the shared component associated with the first application in the component sharing platform is updated includes: When the automatic build tool in the first application monitors that the shared component associated with the first application in the component sharing platform is updated and receives a release request for an updated version of the shared component associated with the first application, the updated version of the shared component associated with the first application is automatically extracted by the automatic build tool in the component sharing platform.

3. The method for updating a shared component according to claim 2, It is characterized in that The extracting the updated version of the shared component associated with the first application when monitoring that the shared component associated with the first application in the component sharing platform is updated includes: In a case where it is monitored that a shared component associated with a first application in the component sharing platform is updated, the component sharing platform receives information that the shared component of the first application is updated, which is transmitted by the automatic build tool in the first application; In response to an automatic extraction request of the automatic build tool in the component sharing platform for an updated version of the shared component associated with the first application, the updated version of the shared component associated with the first application is extracted.

4. The method for updating a shared component according to claim 2, It is characterized in that The automatic construction tool includes any one of Jenkins and GitLab CI / CD.

5. The method for updating a shared component according to claim 1, It is characterized in that In the case where it is monitored that the shared component associated with the first application in the component sharing platform is updated, before extracting the updated version of the shared component associated with the first application, the method further includes: In response to a publishing request for a shared component associated with the first application, receiving an independent sharable module packaged as the shared component based on the output configuration of Webpack and the module federation plug-in, and storing the module in the component sharing platform; wherein each sharable module corresponding to each shared component is correspondingly configured with shared configuration information; In response to a call request for the shared component initiated by the second application based on the module federation plug-in, a target module to be called is determined based on the shared configuration information in the call request; wherein the target module is a sharable module in the component sharing platform; The shared component corresponding to the determined target module to be called is provided to the second application from the component sharing platform.

6. The method for updating a shared component according to claim 5, It is characterized in that Before responding to the publishing request of the shared component of the first application, the method further includes: Creating a plurality of shared components associated with the first application in a component sharing platform, and packaging and testing each of the shared components; In the Webpack configuration of the component sharing platform, corresponding shared configuration information is configured for each of the shared components; Based on the output configuration of Webpack and the module federation plug-in, the multiple shared components are packaged into an independent sharable module.

7. The method for updating a shared component according to claim 6, It is characterized in that After packaging the plurality of shared components into an independent sharable module, the method further includes: Automatically generate OSS resources corresponding to each of the shared components; wherein the OSS resources are used by each of the second applications to access the corresponding shared components through the corresponding domain name bound to the NGINX server.

8. The method for updating a shared component according to claim 1, It is characterized in that The automatically updating the updated shared component to the second application includes: When the component sharing platform receives a call request from the second application for the updated shared component based on the module federation plug-in, the updated shared component is automatically updated to the second application.

9. The method for updating a shared component according to claim 1, It is characterized in that Before automatically updating the updated shared component to the second application, the method further includes: When it is detected in the component sharing platform that the original shared component called by the second application is updated to the updated shared component, the component sharing platform receives a request sent by the second application to call the updated shared component.

10. The method for updating a shared component according to claim 1, It is characterized in that The monitoring that the shared component associated with the first application in the component sharing platform is updated includes at least one of the following: It is detected that a shared component associated with the first application in the component sharing platform is expired; It is detected that a shared component associated with the first application in the component sharing platform is deleted; It is detected that a shared component associated with the first application in the component sharing platform is modified; It is monitored that at least one new shared component is added in the component sharing platform and is associated with the first application.

11. A device for updating a shared component, It is characterized in that The device comprises: A component extraction module, configured to extract an updated version of the shared component associated with the first application when it is detected that the shared component associated with the first application in the component sharing platform is updated; in the component sharing platform, based on the output configuration of Webpack and the module federation plug-in, the shared components associated with the first application are packaged into an independent sharable module; A component replacement module, configured to replace the corresponding original shared component in the component sharing platform based on the updated version, to obtain an updated shared component associated with the first application; The component update module is used to automatically update the updated shared component to the second application; wherein the second application is also configured with the module federation plug-in, and the second application is an application that calls the original shared component in the component sharing platform based on the module federation plug-in.

12. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.

13. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

14. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Cited By

  • Front-end multi-module development method and system based on module federation

    CN121070313A