A method and system for fast automatic deployment of Electron development environment
By automating the Node.js management module and log collection, the installation and configuration issues of Electron development environments on different CPU platforms are solved, enabling rapid deployment and efficient development, simplifying developer operations, and improving development efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KYLIN CORP
- Filing Date
- 2023-11-02
- Publication Date
- 2026-07-14
AI Technical Summary
When developing Electron applications on different CPU platforms, existing technologies require manually downloading and compiling Node.js, making it impossible to mix versions, resulting in low development efficiency. Furthermore, network or system problems must be resolved manually, further impacting development efficiency.
This paper provides a method for rapid and automated deployment of an Electron development environment. It obtains CPU platform information through the Node.js management module, automatically installs or compiles Node.js, automatically switches between npm and Electron sources, sets environment variables, and collects logs to quickly locate problems.
It enables rapid and automated deployment of Electron development environments on different CPU platforms, saving developers manual operations, improving development efficiency, automatically resolving common build problems, and simplifying the environment setup process.
Smart Images

Figure CN117453311B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of development environment deployment technology, and in particular to a rapid and automatic deployment method and system for an Electron development environment. Background Technology
[0002] Currently, there are many domestically produced CPU platforms, including amd64, arm64, mips64el, and loongarch64. Developing Electron applications on these platforms requires setting up different development environments, and different problems may be encountered during the setup and construction process, such as:
[0003] 1. The operating system only provides a relatively low version of the Node.js development environment. Developers need to download and install different versions themselves.
[0004] 2. Node.js versions for different platforms are not interchangeable and cannot be installed using the same method. Some platforms do not have pre-compiled Node.js binaries, requiring developers to compile them manually. This can be time-consuming for developers unfamiliar with compilation. Even if developers understand compilation, they typically need to compile manually with specific parameters. These special parameters are used to automate Node.js compilation on some platforms. While some tools can automate compilation, they only provide standard compilation parameters, which often lead to various problems and compilation failures on certain platforms.
[0005] 3. When developing an application, different versions of Node.js may be used, which requires downloading them one by one and manually setting environment variables, which is quite troublesome;
[0006] 4. During the application building and packaging process, various errors may be encountered due to network or system problems, requiring developers to search for or obtain assistance from system vendors, which affects development efficiency.
[0007] Due to the aforementioned issues, developers need to understand the deployment methods of different CPU platform development environments before developing applications on different CPU platforms, and then solve the problems they encounter one by one, which consumes a lot of manpower and time in development environment deployment. Summary of the Invention
[0008] The technical problem to be solved by this invention is: in view of the technical problems existing in the prior art, this invention provides a method and system for rapid automatic deployment of Electron development environment, which can quickly complete the automatic deployment of Electron development environment on different CPU platforms.
[0009] To solve the above-mentioned technical problems, the technical solution proposed by this invention is as follows:
[0010] A rapid, automated deployment method for an Electron development environment includes the following steps:
[0011] S101) Deploy the Node.js management module, obtain the current CPU platform information, display the corresponding input items according to the current CPU platform information, and then complete the automatic installation of Node.js according to the Node.js version entered by the developer.
[0012] S102) Configure the corresponding npm and Electron sources according to the information of the current CPU platform, and then install the corresponding fpm and set the environment variables according to the information of the current CPU platform.
[0013] Furthermore, when the Node.js management module displays the corresponding input items based on the current CPU platform information, it includes:
[0014] If the current CPU platform information indicates that the official Node.js binary package has been provided, an input box will be displayed, allowing developers to directly enter the Node.js version they need to install.
[0015] If the current CPU platform information is for a CPU platform where no Node.js binary package is officially provided, the adapted Node.js versions will be displayed in a list for developers to select the Node.js version they need to install.
[0016] Furthermore, the official documentation provides the CPU platform for the Node.js binary package, specifically amd64 or arm64 architecture CPU platforms.
[0017] Furthermore, when automatically installing Node.js based on the Node.js version entered by the developer, it includes:
[0018] Determine if the Node.js version entered by the developer is compatible with the current CPU platform; if so, install the corresponding version of Node.js.
[0019] If the Node.js version entered by the developer is not compatible with the current CPU platform, obtain the Node.js source code tar package of the corresponding version, and then use an automated script to automatically compile and install it using the preset compilation parameters corresponding to the current CPU platform.
[0020] Furthermore, after step S102, the method further includes: collecting all logs and saving them in a specified folder, the logs including logs of deploying the Node.js management module, Node.js installation logs, logs of configuring the npm and Electron sources, and logs of installing fpm.
[0021] Furthermore, after deploying the Node.js management module, the process includes: if the Node.js management module fails to deploy successfully, recording error logs and jumping to collect all logs and save them in a specified folder; if the Node.js management module is deployed successfully, recording success logs and executing steps to obtain information about the current CPU platform.
[0022] Furthermore, after automatically installing Node.js based on the Node.js version entered by the developer, the process also includes: if Node.js fails to install, logging the error and jumping to the next step of collecting all logs and saving them in a specified folder; if Node.js installs successfully, logging the success log and executing the steps of configuring the corresponding npm and Electron sources based on the current CPU platform information.
[0023] Furthermore, after configuring the corresponding npm and Electron sources based on the current CPU platform information, the process also includes: determining whether the connectivity of the corresponding npm and Electron sources meets the requirements; if the connectivity does not meet the requirements, recording an error log and jumping to the step of collecting all logs and saving them in a specified folder; if the connectivity meets the requirements, recording a success log and executing the steps of installing the corresponding fpm and setting environment variables according to the current CPU platform information; determining whether the connectivity of the corresponding npm and Electron sources meets the requirements specifically refers to testing the packet loss rate or average speed when downloading the npm and Electron sources. If the packet loss rate or average speed is less than a preset threshold, the connectivity meets the requirements; if the packet loss rate or average speed is greater than the preset threshold, the connectivity does not meet the requirements.
[0024] Furthermore, after installing the corresponding fpm based on the current CPU platform information and setting the environment variables, the process also includes: logging an error if fpm fails to install, and logging a success if fpm is installed successfully.
[0025] The present invention also proposes a rapid automated deployment system for an Electron development environment, comprising interconnected microprocessors and computer-readable storage media, wherein the microprocessors are programmed or configured to execute the rapid automated deployment method for the Electron development environment described in any one of the present invention.
[0026] Compared with the prior art, the advantages of the present invention are as follows:
[0027] 1. This invention outputs different Node.js installation methods based on platform information to achieve automatic installation of Node.js across multiple platforms. Developers can directly select the version to install without having to download or compile it themselves. This saves a lot of manual work for developers who are unfamiliar with platforms and compilation.
[0028] 2. This invention can automatically switch between npm and Electron mirror sources based on platform information, without requiring manual configuration by developers;
[0029] 3. This invention automatically installs fpm and sets environment variables, solving common fpm error problems during software build and proactively addressing potential issues developers may encounter during the build process;
[0030] 4. This invention automatically collects log information, which can automatically collect problems that occur during the development environment setup process. After a problem occurs, you only need to check this log information to quickly locate the problem. Attached Figure Description
[0031] Figure 1 This is a flowchart of an embodiment of the present invention. Detailed Implementation
[0032] The present invention will be further described below with reference to the accompanying drawings and specific preferred embodiments, but this does not limit the scope of protection of the present invention.
[0033] Example 1
[0034] To improve the development efficiency and save development time for desktop application developers, this embodiment proposes a rapid and automated deployment method for the Electron development environment, such as... Figure 1 As shown, the method in this embodiment includes the following steps:
[0035] S101) Deploy the Node.js management module, obtain the current CPU platform information, display the corresponding input items according to the current CPU platform information, and then complete the automatic installation of Node.js according to the Node.js version entered by the developer.
[0036] S102) Configure the corresponding npm and Electron sources according to the information of the current CPU platform, and then install the corresponding fpm and set the environment variables according to the information of the current CPU platform.
[0037] S103) Collect all logs and save them in the specified folder for later analysis and processing. The logs include the logs of deploying the Node.js management module and the Node.js installation logs in step S101, as well as the logs of configuring the npm source and Electron source and installing fpm in step S102.
[0038] By following the steps above, developers only need to focus on the business logic of the application itself, without having to worry about the details of deploying the Electron development environment on various CPU platforms. This improves the development efficiency of desktop application developers and accelerates the localization of applications.
[0039] The following is a detailed explanation of each step.
[0040] Step S101 of this embodiment aims to automatically install Node.js for different CPU platforms, eliminating the need for developers to download or compile it themselves. This saves developers unfamiliar with platforms and compilation processes a significant amount of manual work. The Node.js management module in this embodiment outputs different installation methods for Node.js based on platform information. For platforms where official binary packages are provided, developers can directly input the desired Node.js version. For platforms where official binary packages are not provided, the module lists currently compatible versions for developers to choose from. For versions entered by the developer but not compatible, the module directly obtains the Node.js source code tar package and then compiles and installs it using pre-defined compilation parameters based on the platform information.
[0041] Therefore, in step S101, when the Node.js management module displays the corresponding input items based on the current CPU platform information, it includes:
[0042] If the current CPU platform information indicates that the official Node.js binary package has been provided, an input box will be displayed, allowing developers to directly enter the Node.js version they need to install. Specifically, the CPU platform for which the official Node.js binary package has been provided is an amd64 or arm64 architecture CPU platform.
[0043] If the current CPU platform information is for a CPU platform where no Node.js binary package is officially provided, the adapted Node.js versions will be displayed in a list for developers to select the Node.js version they need to install.
[0044] Furthermore, in step S101, when automatically installing Node.js based on the Node.js version entered by the developer, the following steps are included:
[0045] Determine if the Node.js version entered by the developer is compatible with the current CPU platform; if so, install the corresponding version of Node.js.
[0046] If the Node.js version entered by the developer is incompatible with the current CPU platform, and since some special platforms require specific compilation parameters and manual compilation of certain dependencies to succeed, this embodiment uses an automated script instead of manual compilation. The automated script includes the relevant parameters required for the specific platform. Therefore, when the Node.js version entered by the developer is incompatible with the current CPU platform, the corresponding Node.js source code tar package is directly pulled, and then the automated script selects the preset compilation parameters corresponding to the current CPU platform for automatic compilation and installation.
[0047] Step S102 in this embodiment aims to automatically switch between the npm source and the Electron mirror source based on platform information, without requiring manual configuration by the developer; and to solve common fpm error problems during software building, thus proactively addressing potential issues that developers may encounter during the build process.
[0048] Correspondingly, in step S102, when configuring the corresponding npm and Electron sources based on the information of the current CPU platform, for x64 and arm64 architectures, regular npm and Electron mirror sources are used, such as the Taobao source https: / / registry.npm.taobao.org / ; for Loongson architecture, Loongson-specific npm and Electron mirror sources are used.
[0049] Furthermore, in step S102, when installing the corresponding fpm and setting environment variables according to the current CPU platform information, for the x64 architecture, the default fpm can be used; however, for the arm64 and Loongson architectures, since the npm source only has the fpm package for the x86_64 architecture, it cannot be used normally after being pulled. In this case, we need to first use the apt tool to install ruby from the apt source, then use the gem tool to install fpm from the gems source, and finally set the global variables of fpm to achieve normal use of fpm packaging.
[0050] Step S103 in this embodiment aims to automatically collect problems that occur during the development environment setup process.
[0051] To provide logs for deploying Node.js management modules, such as Figure 1 As shown, in step S101 of this embodiment, after deploying the Node.js management module, the method further includes: if the Node.js management module is not deployed successfully, recording the error log and jumping to the step of collecting all logs and saving them in the specified folder; if the Node.js management module is deployed successfully, recording the success log and executing the step of obtaining the information of the current CPU platform.
[0052] To provide installation logs for Node.js, such as Figure 1 As shown, in step S101 of this embodiment, after the automatic installation of Node.js is completed according to the Node.js version input by the developer, the steps further include: if Node.js is not installed successfully, recording the error log and jumping to the step of collecting all logs and saving them in the specified folder; if Node.js is installed successfully, recording the success log and executing the step of configuring the corresponding npm source and Electron source according to the information of the current CPU platform.
[0053] To provide logs for configuring npm and Electron repositories, such as Figure 1 As shown, in step S102 of this embodiment, after configuring the corresponding npm source and Electron source according to the information of the current CPU platform, it further includes: determining whether the connectivity of the corresponding npm source and Electron source meets the requirements; if the connectivity does not meet the requirements, recording an error log and jumping to the step of collecting all logs and saving them in a specified folder; if the connectivity meets the requirements, recording a success log and executing the step of installing the corresponding fpm and setting environment variables according to the information of the current CPU platform.
[0054] In this embodiment, determining whether the connectivity between the corresponding npm source and Electron source meets the requirements specifically refers to testing the packet loss rate or average speed when downloading the npm source and Electron source. If the packet loss rate or average speed is less than a preset threshold, the connectivity meets the requirements; if the packet loss rate or average speed is greater than the preset threshold, the connectivity does not meet the requirements.
[0055] To provide logs of the FPM installation, such as Figure 1 As shown, in step S102 of this embodiment, after installing the corresponding fpm and setting the environment variables according to the information of the current CPU platform, the method further includes: if fpm is not installed successfully, an error log is recorded; if fpm is installed successfully, a success log is recorded.
[0056] By collecting the above logs, once a problem occurs, simply reviewing this log information will allow you to quickly pinpoint the issue.
[0057] Example 2
[0058] This embodiment proposes a rapid automated deployment system for an Electron development environment, including interconnected microprocessors and computer-readable storage media, wherein the microprocessors are programmed or configured to execute the rapid automated deployment method for the Electron development environment described in Embodiment 1.
[0059] The microprocessor in this embodiment includes modules for automatically detecting the CPU platform, automatically or compiling and installing Node.js modules, automatically detecting and switching between npm and electron sources, automatically detecting and switching between fpm modules, and automatically collecting logs.
[0060] The automatic CPU platform detection module is used to detect the system's CPU platform and obtain information about the current CPU platform.
[0061] The automatic installation or compilation of Node.js modules is used to execute step S101 of Example 1. Thus, developers only need to input or select the Node.js version they want to install to complete the automatic installation and deployment of Node.js. If the Node.js version that the developer wants to install is not compatible with the current CPU platform, it can be automatically compiled and installed according to the set compilation parameters.
[0062] The automatic detection and switching module for npm and electron sources is used to automatically configure appropriate npm and electron mirror sources (providing an internally maintained public-network usable Electron source) based on platform and network environment detection.
[0063] The automatic detection and switching of the FPM module is used to automatically switch FPM-related configurations based on platform information.
[0064] The automatic log collection module is used to collect logs during the environment deployment process, which facilitates problem location and repair.
[0065] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the invention. Therefore, any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention should fall within the protection scope of the present invention.
Claims
1. A rapid automatic deployment method for an Electron development environment, characterized in that, Includes the following steps: S101) Deploy the Node.js management module, obtain the current CPU platform information, and display the corresponding input items based on the current CPU platform information. Then, based on the Node.js version entered by the developer, complete the automatic installation of Node.js. When the Node.js management module displays the corresponding input items based on the current CPU platform information, it includes: If the current CPU platform information indicates that the official Node.js binary package has been provided, an input box will be displayed, allowing developers to directly enter the Node.js version they need to install. If the current CPU platform information is for a CPU platform where no Node.js binary package is officially provided, the adapted Node.js versions will be displayed in a list for developers to select the Node.js version they need to install. When automatically installing Node.js based on the Node.js version entered by the developer, it includes: Determine if the Node.js version entered by the developer is compatible with the current CPU platform; if so, install the corresponding version of Node.js. If the Node.js version entered by the developer is not compatible with the current CPU platform, obtain the Node.js source code tar package of the corresponding version, and then use an automated script to select the preset compilation parameters corresponding to the current CPU platform for automatic compilation and installation; S102) Configure the corresponding npm and Electron sources according to the information of the current CPU platform, and then install the corresponding fpm and set the environment variables according to the information of the current CPU platform.
2. The rapid automatic deployment method for the Electron development environment according to claim 1, characterized in that, The official documentation provides CPU platform options for the Node.js binary package, specifically amd64 or arm64 architecture CPU platforms.
3. The rapid automatic deployment method for the Electron development environment according to claim 1, characterized in that, Step S102 is followed by: collecting all logs and saving them in a specified folder. The logs include logs of deploying the Node.js management module, Node.js installation logs, logs of configuring the npm and Electron sources, and logs of installing fpm.
4. The rapid automatic deployment method for the Electron development environment according to claim 3, characterized in that, After deploying the Node.js management module, the process also includes: if the Node.js management module fails to deploy successfully, logging the error log and jumping to collect all logs and save them in the specified folder; if the Node.js management module is deployed successfully, logging the success log and executing the step of obtaining the current CPU platform information.
5. The rapid automatic deployment method for the Electron development environment according to claim 3, characterized in that, After automatically installing Node.js based on the version entered by the developer, the process includes: if Node.js installation fails, logging the error and jumping to the next step of collecting all logs and saving them in a specified folder; if Node.js installation succeeds, logging the success log and configuring the corresponding npm and Electron repositories based on the current CPU platform information.
6. The rapid automatic deployment method for the Electron development environment according to claim 3, characterized in that, After configuring the corresponding npm and Electron repositories based on the current CPU platform information, the process includes: determining whether the connectivity of the corresponding npm and Electron repositories meets the requirements; if the connectivity does not meet the requirements, recording an error log and jumping to the step of collecting all logs and saving them in a specified folder; if the connectivity meets the requirements, recording a success log and executing the steps of installing the corresponding fpm and setting environment variables according to the current CPU platform information; determining whether the connectivity of the corresponding npm and Electron repositories meets the requirements specifically refers to testing the packet loss rate or average speed when downloading the npm and Electron repositories. If the packet loss rate is less than a preset threshold or the average speed is greater than a preset threshold, the connectivity meets the requirements; if the packet loss rate is greater than a preset threshold or the average speed is less than a preset threshold, the connectivity does not meet the requirements.
7. The rapid automatic deployment method for the Electron development environment according to claim 3, characterized in that, After installing the corresponding fpm based on the current CPU platform information and setting the environment variables, the following steps are also included: if fpm fails to install successfully, log an error; if fpm installs successfully, log a success.
8. A rapid automatic deployment system for an Electron development environment, characterized in that, It includes interconnected microprocessors and computer-readable storage media, the microprocessors being configured to execute a rapid automated deployment method for the Electron development environment as described in any one of claims 1 to 7.