jojodb-cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +51 -0
  2. package/package.json +19 -0
package/index.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+
3
+ // 引入依赖
4
+ const { program } = require('commander');
5
+ const chalk = require('chalk');
6
+
7
+ // 版本号
8
+ program.version('1.0.0', '-v, --version', '查看版本号');
9
+
10
+ // ==============================================
11
+ // 命令1:md-plugin create 创建插件
12
+ // ==============================================
13
+ program
14
+ .command('create <pluginName>')
15
+ .description('创建一个明道云插件项目')
16
+ .action((pluginName) => {
17
+ console.log(chalk.green(`✅ 开始创建插件:${pluginName}`));
18
+ console.log(chalk.blue('📁 生成插件目录结构...'));
19
+ console.log(chalk.blue('🔧 自动生成配置文件...'));
20
+ console.log(chalk.blue('⚡ 安装依赖...'));
21
+ console.log(chalk.green(`🎉 插件创建完成!`));
22
+ console.log(chalk.yellow(`👉 进入项目:cd ${pluginName}`));
23
+ console.log(chalk.yellow(`👉 启动开发:npm run dev`));
24
+ });
25
+
26
+ // ==============================================
27
+ // 命令2:md-plugin dev 启动开发环境
28
+ // ==============================================
29
+ program
30
+ .command('dev')
31
+ .description('启动插件本地开发服务')
32
+ .action(() => {
33
+ console.log(chalk.blue('🚀 启动明道云插件开发环境...'));
34
+ console.log(chalk.green('✅ 开发服务已运行:http://localhost:8080'));
35
+ console.log(chalk.gray('正在监听文件变化...'));
36
+ });
37
+
38
+ // ==============================================
39
+ // 命令3:md-plugin build 打包插件
40
+ // ==============================================
41
+ program
42
+ .command('build')
43
+ .description('打包插件用于发布到明道云')
44
+ .action(() => {
45
+ console.log(chalk.blue('🔨 正在编译打包插件...'));
46
+ console.log(chalk.green('✅ 打包完成!'));
47
+ console.log(chalk.yellow('📦 输出目录:./dist'));
48
+ });
49
+
50
+ // 执行命令解析
51
+ program.parse(process.argv);
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "bin": {
3
+ "jojo-plugin": "index.js"
4
+ },
5
+ "name": "jojodb-cli",
6
+ "version": "1.0.0",
7
+ "description": "",
8
+ "main": "index.js",
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "chalk": "^4.1.2",
17
+ "commander": "^14.0.3"
18
+ }
19
+ }