代码拉取完成,页面将自动刷新
ngm
会按照一定的规则,使用预设的 git
模板创建到指定项目。
$ npm install -g @fattypanda/ngm-cli
OR
$ yarn global add @fattypanda/ngm-cli
$ ngm create new-project
$ ngm create
$ ngm create .
$ ngm create ./
$ ngm create new-project -c ./config.json
$ ngm create new-project -u default
Usage: ngm create [name] [options]
Options:
-v,--version 查看版本信息
-h,--help 查看帮助信息
Commands:
create [options] [name] 创建新项目([name]=[ |.|./] 在当前目录创建项目)
-i,--install 模板下载完成后自动安装依赖
-u,--use <config-name> 选择使用的配置名称
-c,--config <config-path> 选择使用的配置文件
add <name> <url> 添加配置
del <name> 删除配置
update <name> [url] 更新配置
use [name] 使用配置
help [command] 查看 [command] 的帮助信息
$ ngm create [name] -c <url>
$ ngm add <name> <url>
$ ngm update <name> [url]
以上 url
可以是远程地址 (http|https)
;
export interface When {
name: string;
includes?: string[];
}
export interface Prompt {
name: string;
type: 'list' | 'checkbox';
message: string;
choices: string[];
default: string[];
whens?: When[];
}
export interface Template {
whens: When[];
repo: string;
}
export interface Config {
name: string;
url?: string;
prompts: Prompt[];
templates: Template[];
}
{
"name": "默认",
"prompts": [
{
"name": "framework",
"type": "list",
"message": "请选择架构",
"choices": [
"umi"
],
"default": [
"umi"
]
},
{
"name": "template",
"type": "list",
"message": "请选择模板",
"choices": [
"公共模板"
],
"default": [
"公共模板"
],
"whens": [
{
"name": "framework",
"includes": [
"umi"
]
}
]
},
{
"name": "packages",
"type": "checkbox",
"message": "请选择需要使用第三方包",
"choices": [
"ahooks",
"react-use",
"classnames",
"unstated-next",
"antd",
"@ant-design/icon"
],
"default": [
"ahooks",
"react-use",
"classnames",
"unstated-next",
"antd",
"@ant-design/icon"
],
"whens": [
{
"name": "framework",
"includes": [
"umi"
]
}
]
}
],
"templates": [
{
"whens": [
{
"name": "framework",
"includes": [
"umi"
]
},
{
"name": "template",
"includes": [
"公共模板"
]
}
],
"repo": "https://gitee.com/ngm-cli/umi-default-template.git"
}
]
}
MIT
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。