Command-line interface

The Command-line Interface (CLI) of the Alipay Plus Mini Program (APMP) is a tool that helps you to initialize, develop, and maintain your mini programs. It helps you to achieve cross-platform operation, preview on physical devices, initialize projects, and upload projects. Compared with IDE, CLI is more efficiency as developers can use other code editing tools to improve mini program's development.

Overview

You can take an overview of CLI in the following table:

Category

Description

Command

Description

Check versions

apmp -v

Check command-line descriptions

apmp -h

Workspace

Log in

apmp login

log out

apmp logout

APP

Select the current app

apmp app select

Initialize projects

apmp app create

Preview apps

apmp app preview

Upload apps

apmp app upload

Features

You can benefit from the following features:

  • apmp login
  • Check project information
  • Set workspaces
  • Select the current project
  • Persistent login

Global installation

Sample code

copy
npm install apmp -g

Log in

Sample code

copy
# Input the username and password via command parameters
apmp login -u [username] -p [password] -w [workspaceId] -a [appId]

# Input the username and password via inquirer Q&A
apmp login
> username: [username]
> password: [password]
> 

Parameters

Name

Value

Required

-u,--username

username

Yes

-p,--password

password

Yes

-w,--workspaceId

workspaceId

No

-a,--appId

appId

No

Log out

Log out, clear cache, and clear cookies.

Sample code

copy
apmp logout

Select the current app

Sample code

copy
apmp app select // use arrow key to move cursor
> app1:[app1]
> app2:[app2]
> app3:[app3]

Initialize projects

Sample code

copy
# Input app type and name via command parameters
apmp app create -t [mini-app] -n [appName]

# Input the app type and name via inquirer Q&A
apmp app create
- project type
> mini-app
- app name : [app name]

Parameters

Name

Value

Required

Default Value

Remark

-t, --type

type

No

None

Enum: mini-app

-n, --name

name

No

new-project

A new file will be generated according to the new project name.

Preview apps

Sample code

copy
# Use the currently selected project
apmp app preview

Parameters

Name

Value

Required

Default Value

Remark

-a, --appId

appId

No

selectedCurrentAppId

You can obtain an appId in two ways:

  • Select an appId in the app list.
  • Obtain the currently selected appId If you have not selected an appId in the app list.

-w, --workspaceId

workspaceId

No

selectedCurrentWorkspaceId

You can obtain a workspaceId in two ways:

  • Select a workspaceId in the workspace list.
  • Obtain the currently selected workspaceId if you have not selected a workspaceId in the workspace list.

-p, -projectPath

projectPath

No

.

Use the current project path by default.

Upload apps

Sample code

copy
# Use the currently selected project
apmp app upload

Parameters

Name

Value

Required

Default Value

Remark

-a, --appId

appId

No

selectedCurrentAppId

You can obtain an appId in two ways:

  • Select an appId in the app list.
  • Obtain the currently selected appId If you have not selected an appId in the app list.

-w, --workspaceId

workspaceId

No

selectedCurrentWorkspaceId

You can obtain a workspaceId in two ways:

  • Select a workspaceId in the workspace list.
  • Obtain the currently selected workspaceId If you have not selected a workspaceId in the workspace list.

-p, --projectPath

projectPath

No

.

Use the current project path by default.

--nextVersion

nextVersion

No

specify upload version number.