Registry / devops / zmp-cli

zmp-cli

JSON →
library4.0.3jsnpmunverified

The `zmp-cli` is a command-line interface utility designed to streamline the development, testing, and deployment of Zalo Mini Apps. It provides essential commands for developer login, project creation, building, previewing, and deployment, offering an alternative to the Zalo Mini App Extension. Currently at version 4.0.3, the package was last published a month ago as of March 2026, indicating active maintenance. It focuses on integrating into various IDEs and CI/CD pipelines for automation. Key differentiators include its ability to convert existing web applications into Zalo Mini Apps and its support for both QR code and access token-based authentication. Its primary mode of interaction is through shell commands, though it also exposes a programmatic interface for advanced automation in JavaScript/TypeScript environments.

npm install zmp-cli
INSTALL
IMPORT
SIG · ZMP-CLI
Z
zmp-cli
devopsjavascriptv4.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

login
import { login } from 'zmp-cli';
import login from 'zmp-cli'; // 'login' is a named export, not default.
The `login` function initiates the Zalo Mini App developer authentication process, either via QR code or access token. It returns a Promise<void>.
init
import { init } from 'zmp-cli';
const { init } = require('zmp-cli'); // Primarily ESM; CJS might have issues or require transpilation.
The `init` function allows programmatic creation or conversion of a Zalo Mini App project. It accepts an optional `InitOptions` object and returns a Promise<void>.
deploy
import { deploy } from 'zmp-cli';
import * as zmp from 'zmp-cli'; zmp.deploy(); // While technically correct, direct named import is preferred.
The `deploy` function handles the deployment of a Zalo Mini App. It accepts an optional `DeployOptions` object and returns a Promise<void>.

Demonstrates global CLI installation and common shell commands for login and project initialization, alongside a conceptual programmatic invocation example using the exposed `login` function.

import { login, init } from 'zmp-cli'; import { exec } from 'child_process'; // --- CLI Usage --- console.log('--- CLI Usage ---'); exec('npm install -g zmp-cli', (err, stdout, stderr) => { if (err) { console.error(`CLI install error: ${stderr}`); return; } console.log('Zalo Mini App CLI installed globally.'); exec('zmp --help', (err, stdout, stderr) => { if (err) { console.error(`zmp --help error: ${stderr}`); return; } console.log('zmp --help output:\n', stdout.substring(0, 200) + '...'); console.log('\nRun `zmp login` to authenticate or `zmp init` to create a project.'); console.log('For example: `zmp login` will prompt for QR code or access token.'); console.log('Or: `zmp init` will guide through project creation.'); // --- Programmatic Usage (Conceptual) --- console.log('\n--- Programmatic Usage (Conceptual) ---'); async function automateZmp() { try { console.log('Attempting programmatic login (this will likely open a browser/terminal prompt).'); // In a real scenario, you might pass an access token directly if the API supports it. // For now, this acts as an example of calling the exported function. await login(); console.log('Login initiated programmatically. Please complete in browser/terminal.'); console.log('Initiating a new Zalo Mini App project programmatically (e.g., in a temp directory).'); // For actual programmatic init, you'd provide options like project name, template, etc. // await init({ name: 'my-automated-app', template: 'blank', appId: process.env.ZMP_APP_ID ?? '' }); console.log('`init()` function would be called here with specific options.'); } catch (error) { console.error('Programmatic ZMP operation failed:', error); } } // automateZmp(); // Uncomment to run the programmatic example }); });
zmp --version
Debug
Known issues
breakingMajor version updates (e.g., from v3 to v4) for `zmp-cli` may introduce breaking changes in command-line arguments, options, or output formats. Always consult the official release notes before upgrading in CI/CD environments or scripts.
fix
Review the official Zalo Mini App documentation for version-specific changes. Update CI/CD scripts and local development workflows to reflect new command syntaxes or expected outputs.
affects: >=4.0.0
gotchaAuthentication methods for `zmp login` include QR code scanning via the Zalo mobile app or providing an access token. QR codes have a limited lifespan, and access tokens can expire. Ensure tokens are fresh or be prepared to re-authenticate frequently.
fix
For automation, prefer using an `access token` provided as an environment variable or command argument, and implement a token refresh mechanism if supported. For manual login, ensure quick access to your Zalo mobile app for QR scanning.
affects: >=1.0.0
gotchaWhile `npm install -g zmp-cli` provides a global `zmp` command, you might encounter issues with different Node.js versions or permissions. Alternatively, using `npx zmp` will execute the latest version without global installation, or execute a locally installed version.
fix
If experiencing global command issues, try `npx zmp <command>` to ensure you're running a consistent version. For project-specific needs, install `zmp-cli` as a dev dependency (`npm install --save-dev zmp-cli`) and add scripts to your `package.json` like `"deploy": "npx zmp deploy"`.
affects: >=1.0.0
gotchaWhen initializing a new project with `zmp init`, the CLI offers two modes: 'Create a new ZMP project' which generates a new directory, or 'Use ZMP to deploy only' which modifies the current working directory. Misunderstanding this choice can lead to unexpected file creation or overwrites.
fix
Always execute `zmp init` in a clean or intended directory. Carefully read the prompts and select the correct option to avoid unintended modifications to your existing codebase or directory structure. Back up important files before running `init` in 'deploy only' mode on an existing project.
affects: >=1.0.0
Errors
Common errors & fixes
zmp: command not found
The Zalo Mini App CLI (zmp-cli) is not installed globally or is not in your system's PATH.
fix
Run `npm install -g zmp-cli` to install it globally. If it's already installed, ensure your `npm` global binaries directory is in your system's PATH environment variable, or try `npx zmp <command>`.
Login failed: Invalid Access Token
The provided access token is expired, revoked, or incorrect, preventing authentication with the Zalo developer platform.
fix
Obtain a fresh access token from the Zalo for Developers portal (Công cụ > API Explorer > Lấy Access Token) and ensure it's for the correct Zalo App. Re-run `zmp login` or pass the new token explicitly if using programmatic authentication.
Error: Zalo Mini App ID is required
During project initialization or deployment, a valid Zalo Mini App ID was not provided or configured.
fix
Ensure you have registered your Mini App on mini.zalo.me/developers and have obtained an App ID. When prompted by `zmp init` or `zmp deploy`, provide the correct Zalo Mini App ID.
Project requires Vite 2.x for Device mode. Webpack projects are not compatible.
When attempting to run `zmp start -D` (Device mode), the CLI detected that the project is using Webpack instead of Vite 2.x or newer.
fix
To use Device mode, your Zalo Mini App project must be configured with Vite 2.x. Consider migrating your project build system to Vite or use the standard `zmp start` command for browser preview mode instead.
Upgrade
Version history
4.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
35 hits · last 30 days
node
30
Resources