vant/packages/vant-cli/docs/commands.md
2022-07-23 22:10:20 +08:00

1.2 KiB

Commands

You can add built-in commands to npm scripts to use it.

// package.json
{
  "scripts": {
    "dev": "vant-cli dev",
    "test": "vant-cli test",
    "lint": "vant-cli lint",
    "release": "vant-cli release",
    "build-site": "vant-cli build-site"
  }
}

Additionally, npx can used to be run those commands.

npx vant-cli dev

dev

Start local dev server for browsering components and demo.

build

Build Vue component library.

Files will be output to es and lib directory. More details directory structure

Please add the followed config to package.json when publish to npm.

// package.json
{
  "main": "lib/index.js",
  "module": "es/index.js",
  "files": ["es", "lib"]
}

build-site

Build documentation website. Files will be output to site directory.

release

Publish to npm. build and changelog will be automatically execute when run release.

changelog

Generate changelog based on commit records.

commit-lint

Validate the format of commit message. Need husky to do this.

npx husky add .husky/commit-msg 'npx --no-install vant-cli commit-lint $1'