Comparing version
@@ -11,2 +11,4 @@ #! /usr/bin/env node | ||
import create from "../src/scripts/create/index.js"; | ||
import server from "../src/scripts/server/index.js"; | ||
const __filename = fileURLToPath(import.meta.url); | ||
@@ -26,2 +28,15 @@ const __dirname = dirname(__filename); | ||
// 定义 server 命令 | ||
program | ||
.command("server [directory]") | ||
.description(chalk.greenBright(chalk.bold("启动本地静态文件服务器"))) | ||
.option("-p, --port <port>", `指定${chalk.yellowBright("端口号")}`, "8080") | ||
.option("-o, --open", "自动打开浏览器", false) | ||
.action((directory, options) => { | ||
server(directory, { | ||
port: parseInt(options.port), | ||
open: options.open, | ||
}).catch(() => process.exit(1)); | ||
}); | ||
program.parse(); |
{ | ||
"name": "ying-cli", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "影的脚手架工具集", | ||
"main": "bin/index.js", | ||
"type": "module", | ||
"bin": { | ||
"ying-cli": "bin/index.js" | ||
}, | ||
"files": [ | ||
"bin", | ||
"src", | ||
"README.md" | ||
], | ||
"keywords": [ | ||
"cli", | ||
"vue", | ||
"template", | ||
"scaffold", | ||
"http", | ||
"server" | ||
], | ||
"repository": { | ||
@@ -10,6 +27,2 @@ "type": "git", | ||
}, | ||
"type": "module", | ||
"bin": { | ||
"yin-cli": "bin/index.js" | ||
}, | ||
"scripts": { | ||
@@ -24,2 +37,3 @@ "test": "echo \"Error: no test specified\" && exit 1" | ||
"execa": "^9.5.2", | ||
"express": "^4.21.2", | ||
"fs-extra": "^11.3.0", | ||
@@ -29,3 +43,6 @@ "inquirer": "^12.3.2", | ||
"simple-git": "^3.27.0" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# Yin CLI | ||
# Ying CLI | ||
一个简单而强大的项目脚手架工具,帮助你快速创建项目模板。 | ||
一个简单而强大的项目脚手架工具,帮助你快速创建项目模板和启动本地开发服务器。 | ||
@@ -11,2 +11,3 @@ ## 特性 | ||
- 💪 支持强制覆盖已存在的项目 | ||
- 🌐 内置静态文件服务器 | ||
- 🎨 友好的命令行界面 | ||
@@ -18,6 +19,6 @@ | ||
# 全局安装 | ||
npm install -g yin-cli | ||
npm install -g ying-cli | ||
# 或者使用 yarn | ||
yarn global add yin-cli | ||
yarn global add ying-cli | ||
``` | ||
@@ -30,6 +31,6 @@ | ||
```bash | ||
yin-cli create <project-name> | ||
ying-cli create <project-name> | ||
``` | ||
### 参数说明 | ||
#### 参数说明 | ||
@@ -39,12 +40,37 @@ - `project-name`: 项目名称(必填) | ||
### 示例 | ||
#### 示例 | ||
```bash | ||
# 创建新项目 | ||
yin-cli create my-project | ||
ying-cli create my-project | ||
# 强制覆盖已存在的项目 | ||
yin-cli create my-project -f | ||
ying-cli create my-project -f | ||
``` | ||
### 启动开发服务器 | ||
```bash | ||
ying-cli server [directory] | ||
``` | ||
#### 参数说明 | ||
- `directory`: 要服务的目录(可选,默认为当前目录) | ||
- `-p, --port`: 指定端口号(默认:8080) | ||
- `-o, --open`: 自动打开浏览器 | ||
#### 示例 | ||
```bash | ||
# 在当前目录启动服务器 | ||
ying-cli server | ||
# 指定端口和目录 | ||
ying-cli server ./dist -p 3000 | ||
# 启动服务器并自动打开浏览器 | ||
ying-cli server -o | ||
``` | ||
## 可用模板 | ||
@@ -60,3 +86,3 @@ | ||
``` | ||
yin-cli/ | ||
ying-cli/ | ||
├── bin/ # CLI 入口文件 | ||
@@ -84,8 +110,8 @@ ├── src/ # 源代码 | ||
- chalk: 命令行美化工具 | ||
- commander: 命令行工具 | ||
- inquirer: 交互式命令行工具 | ||
- ora: 命令行 loading 效果 | ||
- fs-extra: 文件系统操作工具 | ||
- simple-git: Git 操作工具 | ||
- chalk: 命令行美化 | ||
- inquirer: 交互式命令行 | ||
- ora: 加载动画 | ||
- fs-extra: 文件操作 | ||
- express: 静态服务器 | ||
@@ -92,0 +118,0 @@ ## 许可证 |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
9979
50.35%7
16.67%194
64.41%119
27.96%8
14.29%4
33.33%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added