A CLI tool to initialize a new project from jtemplate boilerplate.
# Using npm init (recommended)
npm init jtemplate <project-name>
# Or with options (note the -- separator)
npm init jtemplate -- --h5 my-h5-project
npm init jtemplate -- --web --dev my-project
# Or using npx
npx create-jtemplate <project-name>
# Or install globally
npm install -g create-jtemplate
create-jtemplate <project-name>
# Show help
npm init jtemplate -- --help
| Option | Description |
|---|---|
--web | Initialize only web directory (no backend) |
--h5 | Initialize H5 mobile template |
--dev | Auto install dependencies and start dev server |
--test | Test mode, output parsed arguments only |
--help | Show help message |
# Initialize a full-stack project
npm init jtemplate my-project
# Initialize only web directory (no backend)
npm init jtemplate -- --web my-web-project
# Initialize H5 mobile template
npm init jtemplate -- --h5 my-h5-project
# Initialize and auto-start dev server
npm init jtemplate -- --dev my-project
npm init jtemplate -- --web --dev my-web-project
First attempt: Tries to clone from the primary repository via SSH:
git@git.ciccjinteng.cn:jvfe/base/template/boilerplate.git
Fallback: If the primary repository is unavailable or you don't have SSH access, it automatically falls back to:
https://cnb.cool/yc_null/base/template
Clean up: After cloning, the .git directory is removed to give you a fresh start.
Options handling:
web directory content to the target directory, suitable for front-end only projectsInitializes only the web directory from the template, excluding the backend part. This is ideal for front-end only projects where you don't need the backend code.
Example:
create-jtemplate --web my-web-project
Initializes a project from the H5 template repository. This is designed for H5 mobile web projects.
Repository: git@git.ciccjinteng.cn:js-group/base/h5-template.git
Requirements:
Example:
create-jtemplate --h5 my-h5-project
Automatically installs dependencies and starts the development server after initialization. It checks if pnpm is installed and uses it if available, otherwise falls back to npm.
Behavior:
npm run install:all or pnpm run install:all:pnpmnpm install or pnpm install directly in the web directorynpm run devExample:
create-jtemplate --dev my-dev-project
You can combine both options to create a web-only project and start the development server immediately:
Example:
create-jtemplate --web --dev my-web-dev-project
The tool attempts repositories in this order:
Primary (SSH): git@git.ciccjinteng.cn:jvfe/base/template/boilerplate.git
Fallback (HTTPS): https://cnb.cool/yc_null/base/template
When using --h5 option, the tool clones from:
git@git.ciccjinteng.cn:js-group/base/h5-template.git
MIT