Guide to JD Mini Program CI Tool: Usage, Scripts, and Pipeline Integration
This article introduces the JD Mini Program CI tool, explains its architecture, provides step‑by‑step instructions for installing dependencies, configuring secrets, using script and command‑line interfaces for upload and preview, and demonstrates how to integrate the tool into CI/CD pipelines for automated deployment.
The JD Mini Program CI tool is a utility that enables developers to preview, upload, and manage JD mini‑programs without opening the standard developer tools, supporting remote deployment through CI/CD pipelines.
1. Overview of JD Mini Programs – The platform consists of a view layer running in a WebView container and a logic layer executing in a JSCore sandbox, communicating via a JSBridge.
2. CI Tool Features – Provides commands for generating preview QR codes, uploading code packages, and retrieving build information.
2.1 Preparation
Obtain the upload secret key from the JD Mini Program console (Settings → Development Settings → Mini Program Code Upload Secret).
Install the tool via npm:
npm install jd-miniprogram-ci --save2.2 Upload Function
Script usage:
const { upload } = require('jd-miniprogram-ci')
upload({
privateKey: 'your private key',
projectPath: 'your project path',
uv: '1.0.0',
desc: 'custom description',
base64: false,
})CLI usage:
jd-miniprogram-ci upload --privateKey your_private_key --projectPath your/project/path --uv '1.0.0' --desc 'custom remark' --base64 falseNote: If the tool is installed locally, run it via npx jd-miniprogram-ci or ./node_modules/.bin/jd-miniprogram-ci .
2.3 Preview Function
Script usage:
const { preview } = require('jd-miniprogram-ci')
preview({
privateKey: 'your private key',
projectPath: 'your project path',
base64: false,
})CLI usage:
jd-miniprogram-ci preview --privateKey your_private_key --projectPath your/project/path --base64 falseThe preview QR code is valid for five minutes.
3. Pipeline Integration
Add an upload.js script in the project root with the upload code shown above, then add a script entry in package.json :
{
"scripts": {
"upload": "node upload.js"
}
}Configure pipeline parameters to include the upload secret key, ensuring it is kept confidential.
Pipeline steps typically include:
Detect code push via webhook.
Checkout repository and install dependencies ( npm i ).
Execute the upload script ( npm run upload ).
4. CI Client and Server Architecture
The CI client parses command‑line arguments, resolves project paths, compresses files, and uploads them, displaying the QR code in the terminal.
The CI server, built with Nest.js, provides APIs for packaging, querying build IDs, and generating QR codes.
5. Conclusion
The JD Mini Program CI tool removes the dependency on the developer GUI for upload and preview, and when combined with CI pipelines it enables fully automated remote deployment, allowing developers to focus on code while the pipeline handles packaging and publishing.
JD Tech
Official JD technology sharing platform. All the cutting‑edge JD tech, innovative insights, and open‑source solutions you’re looking for, all in one place.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.