@foxpage/foxpage-cli

3.0.2 • Public • Published

@foxpage/foxpage-cli

a CLI tool for foxpage

🖥 Environment Support

Minimum node.js version typescript version yarn

⌨️ Usage

The root level command is foxpage:

# see version
foxpage -v

# get help
foxpage -h

# init foxpage config
foxpage --init

The CLI provides two main commands:

  • create: Create new projects or packages
  • build: Build resources for projects or packages

foxpage create

Create new projects or packages. Supports two targets:

  1. Create a project:
foxpage create project [options]

Options:
  --name <targetName>    target name
  --component           create component project
  --plugin             create plugin project
  --server             create server project
  --repo <repository>  project git repository
  --uri <uri>         custom template repository URI (e.g., https://github.com/user/custom-template)
  # or
  --zip-uri <zipUri>  custom template zip download URI (e.g., https://github.com/user/custom-template/archive/refs/heads/main.zip)

The default template repositories:

  1. Create a package:
foxpage create package [options]

Options:
  --name <targetName>         target name
  --templates <templateDir>   templates dir location
  --template <templateDir>    template dir location
  --format                   format code after create
  --out-dir <directory>      out dir for new created package (default: "packages")

Examples:

# Create a component project
foxpage create project --component --name my-component-project

# Create a component project with custom template (using repository URI)
foxpage create project --component --name my-component-project \
  --uri https://github.com/user/custom-template

# Create a component project with custom template (using zip download)
foxpage create project --component --name my-component-project \
  --zip-uri https://github.com/user/custom-template/archive/refs/heads/main.zip

# Create a plugin project
foxpage create project --plugin --name my-plugin-project

# Create a plugin project with custom template (using repository URI)
foxpage create project --plugin --name my-plugin-project \
  --uri https://github.com/user/custom-plugin-template

# Create a plugin project with custom template (using zip download)
foxpage create project --plugin --name my-plugin-project \
  --zip-uri https://github.com/user/custom-plugin-template/archive/refs/heads/main.zip

# Create a package
foxpage create package --name my-package --format

foxpage build

Build resources for projects or packages:

foxpage build [options]

Options:
  --foxpage                   Build for foxpage
  --foxpage-root             Build foxpage in root
  --umd                      Build umd
  --umd-root                 Build umd in root
  --cjs                      Build cjs
  --cjs-root                 Build cjs in root
  --lib                      Build lib(cjs) for npm
  --es-module                Build es(es-module) for npm
  --schema-md                Build schema.md to describe the api of component
  --clean                    Clean dist directory (default: true)
  --no-clean                Set --clean to false
  --output <o>              Output path
  --assets-hash             Build files in assets using the WebPack Contenthash parameter
  --debug                   Debug: some temp file or data will be retained
  --packages <pattern...>   Packages need to build (default: ["packages/*"])
  --root-cache             Cache <root>/dist directory for all package (default: true)
  --no-root-cache          Set --root-cache to false
  --npm-client <npmClient> Executable used to run scripts (npm, yarn, ...) (default: "npm")
  --max-concurrency <n>    Limit the max number of concurrently running processes
  --concurrency <n>        Number of concurrently pending subprocess
  --modes <modes>         Build modes (comma separated):
                          - foxpage: "production,debug,node,editor"
                          - umd: "umd_prod,umd_dev"
                          - cjs: "cjs_prod,cjs_dev"
  --ignore-modes <modes>  Ignore specific build modes (comma separated)
  --manifest              Generate manifest.json (used with --file-hash)
  --file-hash            Build all files using the WebPack Contenthash parameter
  --progress-plugin      Use webpack.ProgressPlugin when webpack build
  --analyze              Use webpack-bundle-analyzer (only for --umd, --cjs, --foxpage)
  --css-in-js           Use style loader to include style in js file (only for --foxpage --umd)
  --generate-foxpage-json Generate foxpage.json file (default: true)
  --no-generate-foxpage-json Disable generate foxpage.json file
  --zip-fox             Automatically compress build resources (only for --foxpage)
  --no-zip-fox          Disable zip-fox
  --zip-fox-output <o>  Output path for zip-fox
  --babel-options <o>   Custom babel cli options (only for --es/lib)
  --ts-declaration      Generate typescript declaration (*.d.ts) (only for --es/lib)
  --no-ts-declaration   Disable ts-declaration
  --css-style          Build style from index.(less/scss) to index.css (only for --es/lib)
  --remove-style-import Remove style import for all ".js" file (only for --es/lib)
  --import-index-css   Add "import './index.css'" in root index.js (only for --es/lib)
  --remove-console     Remove console in final result (default: true)
  --no-remove-console  Keep console

Build output directories:

  • /dist: Resources for Foxpage platform registration
  • /es: ES Module format resources for NPM
  • /lib: CommonJS format resources for NPM

Examples:

# Build a component with foxpage format
foxpage build --foxpage

# Build a component in root directory
foxpage build --foxpage-root

# Build a component with all formats and styles
foxpage build --foxpage --lib --es-module --css-style --ts-declaration

# Build with specific modes
foxpage build --foxpage --modes production,debug

# Build with custom concurrency
foxpage build --foxpage-root --concurrency 4 --max-concurrency 8

Package Sidebar

Install

npm i @foxpage/foxpage-cli

Weekly Downloads

81

Version

3.0.2

License

MIT

Unpacked Size

219 kB

Total Files

135

Last publish

Collaborators

  • xdrxdr
  • wangyilong
  • yhdeng
  • milkrong
  • shumingzhang
  • mianlitp