Skip to content

脚手架

swico-cli 是Swico的官方脚手架工具,通过它可以轻松创建swico项目。

安装使用

全局安装此脚手架:

shell
npm i swico-cli -g

swico-cli版本说明

v3:模板基于rsbuild 2,最佳实践,性能最好!

v2:基于rspack 1,底层基于rust,性能较v1显著提升。

v1:基于webpack 5,受限于js单线程,性能一般。

指定在当前路径下创建的项目名称:

shell
swico-cli create [project-name]

注意

v2.4.0之前的版本请使用swico create [project-name]来创建项目

创建命令执行后,会提供以下选项:

  • 选择模板类型:
shell
? Please select the template type:
> React18.2 + Typescript5
Vue3.4 + Typescript5
  • 选择是否需要配置Git Hooks:
shell
? Do you need Git Hooks:
> Yes
No
  • 选择依赖包管理工具,目前支持npmpnpm
shell
? Please select the npm type: 
> npm
pnpm

如果当前路径下已存在同名项目,则会提示选择是否覆盖:

shell
? The destination folder already exists, please select: 
> Overwritten
Cancel

然后等待脚手架远程拉取模板并自动安装依赖后,项目即创建完成:

shell
- pulling the built-in template...

 Successfully pulled!

Installing dependencies...

added 967 packages, and audited 968 packages in 8s

290 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities
 Install finished!

Successfully Created!


.-')     (`\ .-') /`
( OO ).    `.( OO ),'
(_)---\_),--./  .--.  ,-.-')   .-----.  .-'),-----.
/    _ | |      |  |  |  |OO) '  .--./ ( OO'  .-.  '
\  :` `. |  |   |  |, |  |  \ |  |('-. /   |  | |  |
'..`''.)|  |.'.|  |_)|  |(_//_) |OO  )\_) |  |\|  |
.-._)   \|         | ,|  |_.'||  |`-'|   \ |  | |  |
\       /|   ,'.   |(_|  |  (_'  '--'\    `'  '-'  '
`-----' '--'   '--'  `--'     `-----'      `-----'

Now you can cd test and npm run start to start your Swico App!

MIT Licensed