dimcode 0.0.5 → 0.0.6-beta.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/README.md +72 -35
- package/dist/cli.mjs +1647 -481
- package/package.json +12 -6
- package/scripts/postinstall.mjs +64 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dimcode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6-beta.2",
|
|
5
5
|
"description": "Dim Code CLI built on dreams",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"cli.mjs",
|
|
23
|
-
"dist"
|
|
23
|
+
"dist",
|
|
24
|
+
"scripts/postinstall.mjs"
|
|
24
25
|
],
|
|
25
26
|
"scripts": {
|
|
26
27
|
"build": "bun run build.mjs",
|
|
@@ -31,7 +32,11 @@
|
|
|
31
32
|
"build:binary:linux": "bun run build.mjs --binary --target=bun-linux-x64",
|
|
32
33
|
"build:binary:linux-arm64": "bun run build.mjs --binary --target=bun-linux-arm64",
|
|
33
34
|
"build:binary:windows": "bun run build.mjs --binary --target=bun-windows-x64",
|
|
34
|
-
"cli": "bun
|
|
35
|
+
"cli": "bun scripts/cli-watch.mjs",
|
|
36
|
+
"cli:run": "esno src/cli.ts",
|
|
37
|
+
"cli:run:node": "node --enable-source-maps --import tsx src/cli.ts",
|
|
38
|
+
"cli:debug": "DIMCODE_DEBUG=1 bun scripts/cli-watch.mjs --watch -- --debug",
|
|
39
|
+
"cli:debug:run": "DIMCODE_DEBUG=1 bun src/cli.ts --debug",
|
|
35
40
|
"test": "bun test --preload ./test/setup.ts",
|
|
36
41
|
"smoke": "bun run build && bun dist/cli.mjs --help",
|
|
37
42
|
"lint": "eslint src/**/*.ts",
|
|
@@ -40,19 +45,20 @@
|
|
|
40
45
|
"fix-package": "bun run fix-package.mjs",
|
|
41
46
|
"restore-package": "bun run restore-package.mjs",
|
|
42
47
|
"release": "bumpp --commit --no-tag --no-push && bun run build && bun publish",
|
|
43
|
-
"release:npm": "bumpp --commit --no-tag --no-push && bun run build:npm && npm publish"
|
|
48
|
+
"release:npm": "bumpp --commit --no-tag --no-push && bun run build:npm && npm publish",
|
|
49
|
+
"postinstall": "node scripts/postinstall.mjs"
|
|
44
50
|
},
|
|
45
51
|
"dependencies": {
|
|
46
|
-
"goatchain": "latest",
|
|
47
52
|
"semver": "^7.7.3",
|
|
48
53
|
"shiki": "^3.20.0",
|
|
49
54
|
"vue": "^3.4.0"
|
|
50
55
|
},
|
|
51
56
|
"devDependencies": {
|
|
52
57
|
"@types/node": "^18.19.111",
|
|
58
|
+
"chokidar": "^4.0.1",
|
|
53
59
|
"happy-dom": "^17.5.0",
|
|
54
60
|
"tsdown": "^0.20.0-beta.3",
|
|
55
61
|
"typescript": "5.8.3",
|
|
56
62
|
"vitest": "^4.0.17"
|
|
57
63
|
}
|
|
58
|
-
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const stdout = process.stdout
|
|
3
|
+
const isTTY = Boolean(stdout && stdout.isTTY)
|
|
4
|
+
const isCI = Boolean(
|
|
5
|
+
process.env.CI
|
|
6
|
+
|| process.env.GITHUB_ACTIONS
|
|
7
|
+
|| process.env.BUILD_NUMBER
|
|
8
|
+
|| process.env.JENKINS_URL
|
|
9
|
+
|| process.env.GITLAB_CI
|
|
10
|
+
|| process.env.BUILDKITE
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
const logo = [
|
|
14
|
+
' ██████████ █████ ██████ ██████',
|
|
15
|
+
'░░███░░░░███ ░░███ ░░██████ ██████ ',
|
|
16
|
+
' ░███ ░░███ ░███ ░███░█████░███ ',
|
|
17
|
+
' ░███ ░███ ░███ ░███░░███ ░███ ',
|
|
18
|
+
' ░███ ░███ ░███ ░███ ░░░ ░███ ',
|
|
19
|
+
' ░███ ███ ░███ ░███ ░███ ',
|
|
20
|
+
' ██████████ █████ █████ █████',
|
|
21
|
+
'░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ',
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const lines = [
|
|
25
|
+
...logo,
|
|
26
|
+
'',
|
|
27
|
+
'👋 DimCode installed.',
|
|
28
|
+
'✨ Run: dim to start your coding journey.',
|
|
29
|
+
'🎉 安装完成!输入 dim 即可开启你的 coding 之旅。',
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
function printStatic() {
|
|
33
|
+
stdout.write(`${lines.join('\n')}\n`)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!isTTY || isCI) {
|
|
37
|
+
printStatic()
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const frames = [
|
|
41
|
+
'[= ]',
|
|
42
|
+
'[== ]',
|
|
43
|
+
'[=== ]',
|
|
44
|
+
'[==== ]',
|
|
45
|
+
'[===== ]',
|
|
46
|
+
'[======]',
|
|
47
|
+
'[===== ]',
|
|
48
|
+
'[==== ]',
|
|
49
|
+
'[=== ]',
|
|
50
|
+
'[== ]',
|
|
51
|
+
]
|
|
52
|
+
let idx = 0
|
|
53
|
+
const label = 'Welcome to DimCode '
|
|
54
|
+
const interval = setInterval(() => {
|
|
55
|
+
stdout.write(`\r${label}${frames[idx % frames.length]}`)
|
|
56
|
+
idx += 1
|
|
57
|
+
}, 90)
|
|
58
|
+
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
clearInterval(interval)
|
|
61
|
+
stdout.write('\r' + ' '.repeat(label.length + frames[0].length) + '\r')
|
|
62
|
+
printStatic()
|
|
63
|
+
}, 1100)
|
|
64
|
+
}
|