Uniapp applet one-key packaging uploading method and system and electronic equipment
By configuring an automation service platform and writing core automation scripts, the full process of uniapp mini-programs is automated packaging and uploaded, which solves the problems of inefficiency and human resource waste caused by relying on manual operations in the existing technology, and improves the stability and efficiency of mini-program publishing.
Patent Information
- Application Number
- CN202510411156.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-07-11
AI Technical Summary
The packaging and release process of existing uniapp mini programs is complex, relies on manual operations, and has technical barriers, resulting in waste of human resources and inefficiency.
Configure the automation service platform, integrate the script execution environment, and write core automation scripts to realize the automated process of code pulling, version number generation, resource packaging and uploading, support one-click packaging and uploading, use Expect scripts to simulate the SFTP protocol or call open API for resource upload, integrate exception handling and alarm notification mechanisms, and provide a stable environment through Docker containerized deployment.
Eliminate technical operation thresholds, reduce human errors, realize the closed loop of the entire process automation, save human resources, improve operational efficiency, reduce error risks, and ensure the stability and controllability of the release process.
Smart Images

Figure CN120295664A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software development. More specifically, it particularly relates to a one-key packaging and uploading method for uniapp small programs. In addition, the present invention also relates to a one-key packaging and uploading system for uniapp small programs and an electronic device. Background Art
[0002] With the development of the Internet, small programs, with their characteristics of being lightweight, cross-platform, and ready-to-use immediately, have become the core carriers for enterprises to expand their mobile business. As a mainstream small program development framework, uniapp supports "one development, multi-terminal release", significantly reducing the multi-platform adaptation cost. However, in the prior art, the contradiction between the frequent iteration requirements of small programs and the complexity of the existing packaging and release process has become increasingly prominent. Currently, the packaging and release of uniapp small programs rely on manual operations by developers. Although the technical content of the work is not high, there is a certain technical threshold, and it is difficult for non-developers to get started. In the actual production process, it takes a lot of time of developers, resulting in a waste of human resources.
[0003] Therefore, how to provide a one-key packaging and uploading method for uniapp small programs, which can eliminate the technical operation threshold, reduce the mistakes caused by manual operations, achieve a full-process automated closed-loop, and simplify the uniapp small program packaging and uploading process has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the Invention
[0004] To solve the above technical problems, the present invention provides a one-key packaging and uploading method for uniapp small programs, which can eliminate the technical operation threshold, reduce the mistakes caused by manual operations, achieve a full-process automated closed-loop, simplify the uniapp small program packaging and uploading process, greatly save human resources, and accelerate the operation efficiency.
[0005] The technical solution provided by the present invention is as follows:
[0006] The present invention provides a method for one - click packaging and uploading of uniapp mini - programs. The method includes: S1: Configure an automated service platform, which integrates a script execution environment and associates a uniapp code repository with a mini - program publishing platform; S2: Write a core automated script, which includes: S201: Code pulling step: Obtain the latest uniapp source code from the code repository through a command - line tool; S202: Version number generation step: Based on the version control information of the code repository, call the node command to extract a unique version identifier to generate a version number; S203: Resource packaging step: Execute the npm command to compile the uniapp source code and generate a wgt - formatted resource package named with the version number; S204: Resource uploading step: Upload the wgt resource package to the target mini - program publishing platform; S3: Deploy the core automated script to the automated service platform and provide a trigger interface; S4: Respond to an operation instruction, and the automated service platform executes the script to complete the automated release of the uniapp mini - program.
[0007] Further, in a preferred embodiment of the present invention, the resource uploading step is specifically: Simulate SFTP protocol operations based on the Expect script, automatically fill in the account password, and upload the wgt resource package to the target mini - program publishing platform; or call the open API provided by the mini - program publishing platform and upload the wgt resource package to the target mini - program publishing platform through token authentication.
[0008] Further, in a preferred embodiment of the present invention, the automated service platform is Jenkins, GitLabCI / CD, or a self - built containerized task scheduling platform.
[0009] Further, in a preferred embodiment of the present invention, the core automated script further includes an exception - handling mechanism: If the upload process is interrupted, automatically record the byte position that has been transmitted, and continue uploading from the breakpoint when reconnecting after the interruption.
[0010] Further, in a preferred embodiment of the present invention, the automated service platform integrates an alarm notification module. When detecting an abnormal script execution, it automatically triggers notifications via email and instant messaging tools, and associates with the version control system to perform a code rollback operation.
[0011] Further, in a preferred embodiment of the present invention, the execution environment of the automated service platform is deployed through Docker containerization, including a standardized image pre - installed with Node.js, npm, Git, and Expect tools, and supports one - click deployment across server and virtual machine environments.
[0012] Further, in a preferred embodiment of the present invention, it further includes: recording the full-process operation log and storing it in the Elasticsearch database.
[0013] In addition, the present invention also provides a one-key packaging and uploading system for uniapp mini programs, which includes: an automated service platform module for integrating a script execution environment; a first storage module for storing core automated scripts; a code pulling module for pulling the latest uniapp source code from a code repository; a version generation module for extracting a unique version identifier based on the version control information of the code repository and generating a version number; a resource packaging module for executing npm commands to compile the uniapp source code and generate a resource package in the wgt format named after the version number; a resource uploading module for uploading the wgt format resource package to a target mini program publishing platform; a scheduling control module for receiving external trigger instructions and driving the above-mentioned modules to work together, and it also has the above-mentioned technical effects.
[0014] Further, in a preferred embodiment of the present invention, the system includes: a log management module for recording the full-process operation log and storing it in the Elasticsearch database for real-time query; an exception handling module for automatically recording the byte position of the data that has been transmitted when the upload process is interrupted and resuming the upload from the breakpoint when reconnecting after the interruption.
[0015] In addition, the present invention also provides an electronic device, which includes: a memory for storing a computer program for executing the one-key packaging and uploading method of the uniapp mini program; a processor for processing the computer program. It also has the above-mentioned technical effects.
[0016] A one - click packaging and uploading method for uniapp small programs provided by the present invention, compared with the prior art, includes: S1: Configure an automated service platform, which integrates a script execution environment and associates a uniapp code repository with a small program publishing platform; S2: Write a core automated script, and the core automated script includes: S201: Code pulling step: Obtain the latest uniapp source code from the code repository through a command - line tool; S202: Version number generation step: Based on the version control information of the code repository, call the node command to extract a unique version identifier to generate a version number; S203: Resource packaging step: Execute the npm command to compile the uniapp source code and generate a resource package in the wgt format named after the version number; S204: Resource uploading step: Upload the wgt resource package to the target small program publishing platform; S3: Deploy the core automated script to the automated service platform and provide a trigger interface; S4: In response to an operation instruction, the automated service platform executes the script to complete the automated release of the uniapp small program. During the execution of the technical solution involved in the present invention, with the help of the automated platform, technicians write a core automated script for others to use. The script content includes code pulling, version number generation, resource packaging, and resource uploading steps. The operations required in the process of packaging and uploading the small program are completed through commands such as node and npm in the script. Non - technical personnel do not need to understand underlying technologies such as compilation, version management, or uploading protocols when publishing. The technical solution involved in the present invention, compared with the prior art, can eliminate the technical operation threshold, reduce errors caused by human operations, achieve a full - process automated closed - loop, simplify the packaging and uploading process of uniapp small programs, greatly save human resources, and speed up the operation efficiency. In addition, the present invention also provides a one - click packaging and uploading system for uniapp small programs and a one - click packaging and uploading electronic device for uniapp small programs, which also have the above - mentioned technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0018] Figure 1 It is a schematic diagram of the one - click packaging and uploading method for uniapp small programs provided by the embodiments of the present invention;
[0019] Figure 2 It is a step - flow chart of the one - click packaging and uploading method for uniapp small programs provided by the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0021] It should be noted that when an element is referred to as being "fixed to" or "disposed on" another element, it can be directly on the other element or indirectly disposed on the other element; when an element is referred to as being "connected to" another element, it can be directly connected to the other element or indirectly connected to the other element.
[0022] It should be understood that the orientation or positional relationship indicated by terms such as "length", "width", "upper", "lower", "front", "rear", "first", "second", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. is based on the orientation or positional relationship shown in the accompanying drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be construed as a limitation on the present invention.
[0023] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present invention, the meaning of "a plurality of" or "several" is two or more, unless otherwise specifically defined.
[0024] It should be noted that the structures, ratios, sizes, etc. shown in the drawings of this specification are only used to cooperate with the content disclosed in the specification for those skilled in this technology to understand and read, and are not used to limit the limiting conditions under which the present invention can be implemented. Therefore, they do not have a substantial technical meaning. Any modification of the structure, change in the proportional relationship, or adjustment of the size, without affecting the effects that the present invention can produce and the purposes that can be achieved, should still fall within the scope that can be covered by the technical content disclosed in the present invention.
[0025] Please refer to Figure 1 and Figure 2As shown in the figure, the one-click packaging and uploading method for uniapp applets provided by the embodiments of the present invention includes: S1: Configure an automated service platform, which integrates a script execution environment and associates the uniapp code repository with the applet publishing platform; S2: Write a core automated script, and the core automated script includes: S201: Code pulling step: Obtain the latest uniapp source code from the code repository through a command-line tool; S202: Version number generation step: Based on the version control information of the code repository, call the node command to extract a unique version identifier to generate a version number; S203: Resource packaging step: Execute the npm command to compile the uniapp source code to generate a wgt format resource package named after the version number; S204: Resource uploading step: Upload the wgt resource package to the target applet publishing platform; S3: Deploy the core automated script to the automated service platform and provide a trigger interface; S4: In response to an operation instruction, the automated service platform executes the script to complete the automated publishing of the uniapp applet.
[0026] In the technical solution of the one-click packaging and uploading method for uniapp applets provided by the embodiments of the present invention, specifically, in step S1, by configuring an automated service platform, it is equipped with a script execution environment and the code repository is associated with the applet publishing platform, thereby providing basic environmental support for subsequent automated processes. This platform can automatically pull code, execute scripts, and monitor the publishing status, improving the controllability and stability of the entire process. In step S2, each sub-step of the core automated script jointly constitutes a complete packaging and uploading process. First, the code pulling step checks out the latest uniapp source code from the code repository through a command-line tool to ensure that each build is based on the latest version. Then, the version number generation step calls the node command to generate a unique version identifier based on the version control information of the code repository, so that each wgt resource package has a traceable version number, which helps with version management and rollback operations. Next, the resource packaging step uses the npm command to compile the uniapp source code to generate a wgt format resource package, ensuring that the build product meets the requirements of the applet running environment. Finally, the resource uploading step transfers the resources to the target platform. In step S3, the core automated script is deployed to the automated service platform and a trigger interface is provided, enabling developers or operation and maintenance personnel to remotely trigger the build and release processes through command lines, web interfaces, webhooks, etc. Step S4 further ensures the automated execution of the entire process, that is, after receiving an operation instruction, the automated service platform calls the core automated script to sequentially complete code acquisition, version generation, resource packaging, and uploading, ultimately realizing the automated publishing of uniapp applets. The technical solution provided by the present invention can eliminate technical operation thresholds, reduce errors caused by manual operations, achieve a fully automated closed loop, and simplify the packaging and uploading process of uniapp applets.
[0027] It should be noted that in the prior art, if one wants to package and release a uniapp applet, non-technical personnel cannot operate independently due to lack of environment configuration knowledge. Developers need to use a dedicated code development tool, HBuilder, to operate, generate a code resource wgt package, and finally upload it to the release platform to complete the release, which greatly causes waste of manpower and time.
[0028] Specifically, in the embodiments of the present invention, the resource upload step is specifically as follows: Simulating SFTP protocol operations based on Expect scripts, automatically filling in the account password to upload the wgt resource package to the target applet release platform; or calling the open API provided by the applet release platform to upload the wgt resource package to the target applet release platform through token authentication.
[0029] It should be noted that in this embodiment, the method of simulating SFTP protocol operations based on Expect scripts utilizes the automatic interaction ability of Expect scripts, which can automatically fill in the account and password during the upload process to achieve a fully automatic upload operation without manual intervention. This method is applicable to the situation where the target applet release platform supports the SFTP protocol. Its main advantages are simple process, low implementation cost, and can quickly complete resource transmission during the construction process, effectively reducing the error risk and operation delay caused by manual operations.
[0030] Among them, in the embodiments of the present invention, by configuring an automated service platform such as Jenkins, GitLab CI / CD or a self-built containerized platform, integrating a script execution environment, associating the uniapp code repository with the applet release platform, the technical threshold of manual environment configuration can be eliminated, a unified automated task scheduling foundation can be provided, centralized control of the code management, compilation, and upload processes can be achieved, the environmental dependence risk can be reduced, and multi-platform adaptation can be supported.
[0031] Specifically, in the embodiments of the present invention, the automated service platform is Jenkins, GitLab CI / CD or a self-built containerized task scheduling platform.
[0032] It should be noted that when using the Jenkins or GitLab CI / CD platform, its built-in pipeline function can be utilized to concatenate steps such as code pulling, version number generation, resource packaging, and resource uploading into an automated task flow in a predefined order, achieving full-process automation from code submission to mini-program release. While for a self-built containerized task scheduling platform, container technology is used to build a flexible and efficient task scheduling environment. Through containerized deployment, isolation of each automated step and dynamic resource allocation can be achieved, further enhancing the system's concurrent processing ability and scalability. Among them, in the embodiments of the present invention, through code pulling: obtaining the latest source code from the code repository through a command-line tool (such as Git); version number generation: calling the Node command based on version control information (such as Git commit hash) to generate a unique version number; resource packaging: executing the npm command to compile the uniapp source code to generate a wgt format resource package; resource uploading: using technical means such as simulating the SFTP protocol through an Expect script or calling an open API to upload to the target platform, etc., to solve the technical problems of the traditional process relying on manual operations for compilation, version naming, and uploading, with low efficiency and easy errors, realizing end-to-end automation from code update to release, reducing human intervention, and improving process standardization and execution efficiency.
[0033] Specifically, in the embodiments of the present invention, the core automation script further includes an exception handling mechanism: if the upload process is interrupted, the byte position that has been transmitted is automatically recorded, and when reconnecting after the interruption, the upload continues from the breakpoint.
[0034] Specifically, in the embodiments of the present invention, the automated service platform integrates an alarm notification module. When detecting an abnormal script execution, it automatically triggers notifications via email and instant messaging tools, and associates with the version control system to perform a code rollback operation.
[0035] It should be noted that the core automation script realizes automatic resume of interrupted uploads by integrating an exception handling mechanism. Specifically, during the upload process, if an interruption occurs, the script will record the position of the data bytes that have been transmitted in real time. When the upload interruption is resumed, the system can automatically continue the transmission from the breakpoint position recorded last time, avoiding resource waste and repetitive labor caused by starting the upload from scratch, thereby improving the upload efficiency and the fault tolerance of the system. At the same time, the automation service platform integrates an alarm notification module, which can notify relevant personnel in real time for problem handling when an abnormal script execution is detected. In addition, the platform is associated with the version control system. Once a serious abnormality is detected, it will automatically execute a code rollback operation to ensure that the version environment of the applet is restored to a known stable state, reducing the system risk caused by abnormalities. In the embodiment of the present invention, when the upload is interrupted, the position of the transmitted bytes is recorded, and the transmission continues from the breakpoint after recovery, and there is an alarm notification, integrating email and instant messaging tools to notify abnormal events, and at the same time automatically rolling back: associating with the version control system, triggering a code rollback when an abnormality occurs, which can solve the technical problem that the upload fails due to network fluctuations or operation errors and requires manual intervention to recover, improve the fault tolerance of the system, reduce repetitive operations, and ensure the continuity and security of the release process.
[0036] Specifically, in the embodiment of the present invention, the execution environment of the automation service platform is deployed through Docker containerization, including a standardized image pre-installed with Node.js, npm, Git, and Expect tools, supporting one-click deployment across server and virtual machine environments.
[0037] It should be noted that all necessary tools are pre-installed and configured in the Docker image to ensure that each container has the same execution environment when starting. Through Docker containerization deployment, the effects of environment standardization, one-click cross-platform deployment, task isolation, and elastic expansion can be achieved, significantly improving the deployment efficiency, system stability, and maintenance convenience of the automation service platform, thus providing a reliable and efficient operation guarantee for the applet automation release process.
[0038] Specifically, in the embodiment of the present invention, it also includes: recording the full-process operation logs and storing them in the Elasticsearch database.
[0039] Among them, Elasticsearch, as a distributed search and analysis engine, can quickly index and store a large amount of log data, and support real-time query, aggregation, and statistical analysis. Through this database, not only can the quick retrieval of the full-process logs be realized, but also trend analysis, anomaly detection, and security auditing can be carried out based on the log data.
[0040] The present invention also provides a one - key packaging and uploading system for uniapp mini - programs. The system includes: an automated service platform module for integrating a script execution environment; a first storage module for storing core automated scripts; a code pulling module for pulling the latest uniapp source code from a code repository; a version generation module for extracting a unique version identifier based on the version control information of the code repository and generating a version number; a resource packaging module for executing npm commands to compile the uniapp source code and generate a resource package in the wgt format named with the version number; a resource uploading module for uploading the wgt - format resource package to a target mini - program publishing platform; and a scheduling control module for receiving an external trigger instruction and driving the above - mentioned modules to work together.
[0041] Specifically, in the embodiment of the present invention, the system further includes: a log management module for recording the full - process operation logs and storing them in an Elasticsearch database for real - time query; an exception handling module for automatically recording the byte position of the transmitted data when the upload is interrupted and resuming the upload from the breakpoint when reconnecting after the interruption, and also having the above - mentioned technical effects.
[0042] The present invention also provides an electronic device, including: a memory for storing a computer program for executing the one - key packaging and uploading method of the uniapp mini - program; a processor for processing the computer program.
[0043] The present invention provides an electronic device for one - key packaging and uploading of uniapp mini - programs, which also has the above - mentioned technical effects.
[0044] More specifically, the present invention provides a simple, fully - automated code packaging and uploading solution applicable to all personnel that can be achieved with just one key. It only requires the installation of the node command tool and the npm command tool in the packaging computer environment, and providing an automated service platform built by the company or belonging to a third party can easily achieve fully - automated code packaging and uploading, reducing errors caused by human operations. In summary, through the integration of automated scripts and the service platform, the present invention realizes the full - process closed - loop management of uniapp mini - program packaging and uploading. Its core value lies in transforming traditional multi - step operations relying on manual labor into standardized and highly reliable automated processes, significantly reducing the technical threshold and operation risks. Technical means such as version control automation, breakpoint resumption, and containerized deployment further enhance the fault - tolerance ability and environment consistency of the system. At the same time, the log management and warning mechanism enhance the controllability of operation and maintenance and support rapid response to exceptions. This solution not only optimizes the allocation of human resources but also provides efficient and stable mini - program iteration support for enterprises by reducing human errors and accelerating the release cycle, and has significant practical value and industry promotion potential.
[0045] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A one - key packaging and uploading method for uniapp applets, characterized in that, The method includes: S1: Configure an automated service platform; The automated service platform integrates a script execution environment and associates a uniapp code repository with a mini-program publishing platform; S2: Write a core automated script, including: S201: Code pulling step: Obtain the latest uniapp source code from the code repository through a command-line tool; S202: Version number generation step: Based on the version control information of the code repository, call the node command to extract a unique version identifier to generate a version number; S203: Resource packaging step: Execute the npm command to compile the uniapp source code and generate a resource package in the wgt format named after the version number; S204: Resource uploading step: Upload the wgt resource package to the target mini-program publishing platform; S3: Deploy the core automated script to the automated service platform and provide a trigger interface; S4: In response to an operation instruction, the automated service platform executes the script to complete the automated publishing of the uniapp mini-program.
2. The one-key packaging and uploading method for uniapp applets according to claim 1, wherein The specific resource uploading step is: Based on the Expect script to simulate SFTP protocol operations, automatically fill in the account password and upload the wgt resource package to the target mini-program publishing platform; or Call the open API provided by the mini-program publishing platform and upload the wgt resource package to the target mini-program publishing platform through token authentication.
3. The one-key packaging and uploading method for uniapp applets according to claim 2, wherein The automated service platform is Jenkins, GitLab CI / CD or a self-built containerized task scheduling platform.
4. The one-key packaging and uploading method for uniapp applets according to claim 3, characterized in that, The core automated script also includes an exception handling mechanism: If the upload process is interrupted, automatically record the byte position that has been transmitted, and continue uploading from the breakpoint when reconnecting after the interruption.
5. The one-key packaging and uploading method of the uniapp applet according to claim 1, characterized in that The automated service platform integrates an alarm notification module. When detecting an abnormal script execution, it automatically triggers notifications via email and instant messaging tools, and associates with the version control system to perform a code rollback operation.
6. The one-key packaging and uploading method for uniapp applets according to claim 1, wherein, The execution environment of the automated service platform is deployed through Docker containerization, including a standardized image pre-installed with Node.js, npm, Git, and Expect tools, supporting one-click deployment across server and virtual machine environments.
7. The one-key packaging and uploading method for uniapp applets according to any one of claims 1 to 6, characterized in that It also includes: Record the full-process operation log and store it in the Elasticsearch database.
8. A one-key packaging and uploading system for uniapp mini programs, characterized in that, This system is used to implement the one-click packaging and uploading method for the uniapp mini-program described in any one of claims 1 to 7, including: An automated service platform module for integrating a script execution environment; A first storage module for saving the core automated script; A code pulling module for pulling the latest uniapp source code from the code repository; A version generation module for extracting a unique version identifier based on the code repository version control information and generating a version number; A resource packaging module for executing the npm command to compile the uniapp source code and generate a resource package in the wgt format named after the version number; A resource uploading module for uploading the wgt format resource package to the target mini-program publishing platform; A scheduling control module for receiving external trigger instructions and driving the above modules to work together.
9. The one-key packaging and uploading system for uniapp mini programs according to claim 8, characterized in that It also includes: A log management module, which is used to record the operation logs of the entire process and store them in the Elasticsearch database for real-time query; An exception handling module, which is used to automatically record the byte position of the transmitted data when the upload process is interrupted, and continue the upload from the breakpoint when reconnecting after the interruption.
10. An electronic device, characterized in that, Comprising: A computer program, which is used to execute the one-key packaging and uploading method of the uniapp applet described in any one of claims 1 to 8; A memory, which is used to store the computer program; A processor, which is used to execute the computer program.