@vnxjs/plugin-mini-ci
v3.5.66
Published
A plugin that supports CI (continuous integration) after the Vnmf applet is built
Downloads
2
Readme
@vnxjs/plugin-mini-ci
After the Vnmf applet is built, it supports CI (continuous integration) plug-ins. It supports to automatically open the applet to develop this tool after the build is completed, upload it as a trial version, and generate a preview QR code. Currently, only WeChat, Byte, Alipay, Baidu applet
use
Install
npm i @vnxjs/plugin-mini-ci -D
Using plugins
/config/index.js
// For example, if you use `vs code` as a development tool, you can also use the comment syntax to import the declaration file included in the plugin to get friendly prompts similar to typescript
/**
* @typedef { import("@vnxjs/plugin-mini-ci").CIOptions } CIOptions
* @type {CIOptions}
*/
const CIPluginOpt = {
weapp: {
appid: "WeChat applet appid",
privateKeyPath: "The relative path of the key file relative to the project root directory, such as key/private.appid.key"
},
tt: {
email: "Byte applet mailbox",
password: "Byte applet password"
},
alipay: {
appId: "Alipay applet appId",
toolId: "tool id",
privateKeyPath: "The relative path of the key file relative to the project root directory, such as key/pkcs8-private-pem"
},
swan: {
token: "The token token required for authentication"
},
// version number
version: "1.0.0",
// release description
desc: "version description"
}
const config = {
plugins: [
[ "@vnxjs/plugin-mini-ci", CIPluginOpt ]
]
}
Configuration Commands
The scripts
field of package.json
uses command parameters
{
"scripts": {
// Automatically "open developer tools" after build
"build:weapp": "vnmf build --type weapp --open",
// Automatically "upload code as trial version" after building
"build:weapp:upload": "vnmf build --type weapp --upload",
// Automatically "upload code as development version and generate preview QR code" after building
"build:weapp:preview": "vnmf build --type weapp --preview"
},
"vnmfConfig": {
"version": "1.0.0",
"desc": "Upload description"
}
}
As can be seen from the above example, the plugin extends the vnmf cli command with 3 options:
- --open Open developer tools, similar to automatically opening Google Chrome in web development
- --upload Upload the code as a trial version
- --preview Upload the code as a development version and generate a preview QR code
These three options cannot be used at the same time in one command
##API
Plugin configuration
| Parameters | Type | Description | | :--- | :--- | :--- | | weapp | Object | WeChat Mini Program CI Configuration | | tt | Object | Toutiao applet configuration | | alipay | Object | Alipay applet configuration | | swan | Object | Baidu applet configuration | | version | string | Upload version number, if not, read the version field under vnmfConfig under package.json by default | | desc | string | The description information when uploading, when not uploading, the desc field under vnmfConfig under package.json is read by default |
WeChat Mini Program CI Configuration
| Parameters | Type | Description | | :--- | :--- | :--- | | appid | string | appid of the applet/minigame item | | privateKeyPath | string | The relative path of the private key file in the project, which is used for authentication when obtaining project properties and uploading| | devToolsInstallPath | string | WeChat developer tools installation path, if you choose the default path when installing WeChat developer tools, you do not need to pass this parameter | | projectPath | string | The path of the uploaded applet (default outputPath ) | | ignores | string[] | Upload directories to be excluded (optional) |
Official CI documentation click here
Toutiao applet CI configuration
| Parameters | Type | Description | | :--- | :--- | :--- | | email | string | Byte applet mailbox | | password | string | Byte applet password |
Official CI documentation click here
Alipay applet CI configuration
| Parameters | Type | Description | | :--- | :--- | :--- | | appId | string | Mini Program appId | | toolId | string | tool id, generation method [check here](https://opendocs.alipay.com/mini/miniu/api#%E5%88%9D%E5%A7%8B%E5%8C%96% E9%85%8D%E7%BD%AE%EF%BC%88%E4%B9%8B%E5%89%8D%E7%9A%84%E6%96%B9%E5%BC%8F%EF% BC%8C%E6%8E%A8%E8%8D%90%E4%BD%BF%E7%94%A8%20miniu%20login%EF%BC%89) | | privateKeyPath | string | The relative path of the key file relative to the project root directory, the private key file name produced by Alipay is generally pkcs8-private-pem | | clientType | string | Upload terminal, the terminal type is shown in the following table (default value alipay) |
Terminal type values and their meanings:
alipay: Alipay
ampe: AMPE
amap: Gaode
genie: Tmall Genie
alios: ALIOS
uc: UC
quark: quark
taobao: Taobao
koubei: word of mouth
alipayiot: IoT
cainiao: rookie
alihealth: Ali Health
Official CI documentation click here
Baidu Mini Program CI Configuration
| Parameters | Type | Description | | :--- | :--- | :--- | | token | string | The login key that has the permission to publish the applet | | minSwanVersion | string | Minimum base library version, default is 3.350.6 |
Official CI documentation click here
ts interface description
export interface IOptions {
version?: string;
desc?: string;
weapp?: WeappConfig;
tt?: TTConfig;
alipay?: AlipayConfig;
swan?: SwanConfig;
}
/** WeChat applet configuration */
export interface WeappConfig {
/** The appid of the applet/minigame item */
appid: string;
/** Private key, used for authentication when obtaining project properties and uploading (required) */
privateKeyPath: string;
/** WeChat developer tools installation path */
devToolsInstallPath?: string;
/** The path of the uploaded applet (default outputPath ) */
projectPath?: string;
/** Type, default miniProgram applet */
type?: ProjectType;
/** Upload directories to be excluded */
ignores?: Array<string>;
}
/** Toutiao applet configuration */
export interface TTConfig {
email: string;
password: string;
}
/** terminal type */
export type ClientType =
/** Alipay */'alipay' |
/** AMPE */'ampe' |
/** Gaode */'amap' |
/** Tmall Genie */'genie'|
/** ALIOS */ 'alios'|
/** UC */'uc'|
/** quark */ 'quark'|
/** Taobao */ 'taobao'|
/** Word of mouth */'koubei' |
/** loT */'alipayiot'|
/** Rookie */'cainiao' |
/** Ali Health */ 'alihealth'
/** Alipay series applet configuration */
export interface AlipayConfig {
/** applet appId */
appId: string;
/** tool id */
toolId: string;
/** Tool private key */
privateKey: string;
/** Service proxy address (optional) */
proxy?: string;
/** Upload terminal, default alipay */
clientType?: ClientType;
}
/** Baidu applet configuration */
export interface SwanConfig {
/** The login key that has the permission to publish the applet */
token: string;
/** Minimum base library version, default is 3.350.6 if not passed */
minSwanVersion?: string;
}