@flytrigger/my-ui-test 0.1.0 → 0.1.2
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.
- package/bin/index.js +31 -0
- package/package.json +11 -2
package/bin/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { green, cyan } from 'kolorist'
|
|
4
|
+
import fs from 'fs-extra'
|
|
5
|
+
import path from 'path'
|
|
6
|
+
import { fileURLToPath } from 'url'
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
9
|
+
const __dirname = path.dirname(__filename)
|
|
10
|
+
|
|
11
|
+
const projectName = process.argv[2] || 'my-project'
|
|
12
|
+
|
|
13
|
+
if (!projectName) {
|
|
14
|
+
console.log('❌ 请输入项目名称')
|
|
15
|
+
console.log('👉 用法:npx @flytrigger/my-ui-test my-app')
|
|
16
|
+
process.exit(1)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const targetDir = path.resolve(process.cwd(), projectName)
|
|
20
|
+
const templateDir = path.resolve(__dirname, '../dist')
|
|
21
|
+
|
|
22
|
+
console.log(cyan('🛠 正在创建工程...'))
|
|
23
|
+
|
|
24
|
+
if (fs.existsSync(targetDir)) {
|
|
25
|
+
console.log('❌ 目录已存在')
|
|
26
|
+
process.exit(1)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await fs.copy(templateDir, targetDir)
|
|
30
|
+
|
|
31
|
+
console.log(green('🎉 工程已创建完成!'))
|
package/package.json
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flytrigger/my-ui-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "这是一个示例库",
|
|
5
5
|
"files": [
|
|
6
|
-
"dist"
|
|
6
|
+
"dist",
|
|
7
|
+
"bin"
|
|
7
8
|
],
|
|
9
|
+
"type": "module",
|
|
8
10
|
"scripts": {
|
|
9
11
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
12
|
},
|
|
11
13
|
"keywords": [],
|
|
12
14
|
"author": "",
|
|
13
15
|
"license": "MIT",
|
|
16
|
+
"bin": {
|
|
17
|
+
"my-ui-test": "./bin/index.js"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"fs-extra": "^11.2.0",
|
|
21
|
+
"kolorist": "^1.8.0"
|
|
22
|
+
},
|
|
14
23
|
"publishConfig": {
|
|
15
24
|
"access": "public"
|
|
16
25
|
}
|