@blocklet/component-studio-cli 0.5.56 → 0.6.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.
- package/dist/commands/dev.js +20 -7
- package/dist/utils/helper.d.ts +1 -1
- package/dist/utils/helper.js +3 -3
- package/package.json +1 -1
- package/templates/init/0-basic/package.json +4 -4
- package/templates/init/1-professional/package.json +4 -4
- package/templates/init/1-professional/src/atoms/GradientTitle.tsx +1 -1
- package/templates/init/2-blank/package.json +4 -4
- package/templates/workspace/README.md +3 -3
- package/templates/workspace/api/src/libs/auth.ts +1 -2
- package/templates/workspace/package.json +27 -27
- package/templates/workspace/tsconfig.api.json +1 -4
package/dist/commands/dev.js
CHANGED
|
@@ -6,19 +6,29 @@ import { existsSync } from 'node:fs';
|
|
|
6
6
|
import { join, dirname } from 'node:path';
|
|
7
7
|
import ora from 'ora';
|
|
8
8
|
import { getWorkspaceTemplatePath, installDependencies, getWorkspacePath, getProjectPath, replaceInDirectoryFileNameWithExample, checkShouldInstallDependencies, } from '../utils/helper.js';
|
|
9
|
-
async function createDevServer(projectPath,
|
|
9
|
+
async function createDevServer(projectPath, options) {
|
|
10
10
|
// 1. 创建工作区
|
|
11
|
-
const workspacePath = getWorkspacePath();
|
|
11
|
+
const workspacePath = getWorkspacePath(options.version);
|
|
12
12
|
const workspaceSpinner = ora({ text: 'Creating workspace...', color: 'blue' }).start();
|
|
13
13
|
const workspacePathText = chalk.blue(`The workspace directory: ${workspacePath}`);
|
|
14
|
+
if (options.version) {
|
|
15
|
+
console.log(chalk.cyan(`Using version: ${options.version}`));
|
|
16
|
+
}
|
|
14
17
|
// 2. 准备基础环境
|
|
15
18
|
if (!existsSync(workspacePath)) {
|
|
16
19
|
const workspaceTemplatePath = getWorkspaceTemplatePath();
|
|
17
20
|
const workspaceParentDir = dirname(workspacePath);
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
// Selectively clean workspace parent directory, preserving @ prefixed directories
|
|
22
|
+
if (existsSync(workspaceParentDir)) {
|
|
23
|
+
const items = await fs.readdir(workspaceParentDir);
|
|
24
|
+
await Promise.all(items
|
|
25
|
+
.filter((item) => !item.startsWith('@'))
|
|
26
|
+
.map((item) => fs.remove(join(workspaceParentDir, item))));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
// 创建 workspace parent 目录
|
|
30
|
+
await fs.ensureDir(workspaceParentDir);
|
|
31
|
+
}
|
|
22
32
|
// 复制 workspace 模板
|
|
23
33
|
await fs.copy(workspaceTemplatePath, workspacePath);
|
|
24
34
|
// 修改 workspace 目录中,_example 后缀的文件名,删除 _example 后缀
|
|
@@ -108,7 +118,10 @@ async function createDevServer(projectPath, _options) {
|
|
|
108
118
|
};
|
|
109
119
|
}
|
|
110
120
|
export function createDevCommand() {
|
|
111
|
-
return new Command('dev')
|
|
121
|
+
return new Command('dev')
|
|
122
|
+
.description('Start development server')
|
|
123
|
+
.option('-v, --version <version>', 'Specify version to use')
|
|
124
|
+
.action(async (options) => {
|
|
112
125
|
const projectPath = getProjectPath();
|
|
113
126
|
const server = await createDevServer(projectPath, options);
|
|
114
127
|
// 处理终止信号
|
package/dist/utils/helper.d.ts
CHANGED
package/dist/utils/helper.js
CHANGED
|
@@ -10,16 +10,16 @@ import { join, resolve, dirname, basename, relative } from 'node:path';
|
|
|
10
10
|
import ora from 'ora';
|
|
11
11
|
import os from 'os';
|
|
12
12
|
import path from 'path';
|
|
13
|
-
const
|
|
13
|
+
const DEFAULT_WORKSPACE_VERSION = '0.1.8';
|
|
14
14
|
const METADATA_FILE_NAME = '@metadata.json';
|
|
15
15
|
// 获取CLI内置的workspace模板路径
|
|
16
16
|
export function getWorkspaceTemplatePath() {
|
|
17
17
|
return join(import.meta.dirname, '../../templates/workspace');
|
|
18
18
|
}
|
|
19
19
|
// 获取用户电脑的workspace路径
|
|
20
|
-
export function getWorkspacePath() {
|
|
20
|
+
export function getWorkspacePath(version) {
|
|
21
21
|
const homeDir = os.homedir();
|
|
22
|
-
const workspaceHash =
|
|
22
|
+
const workspaceHash = version || DEFAULT_WORKSPACE_VERSION;
|
|
23
23
|
const workspaceDir = join(homeDir, `.component-studio`, workspaceHash);
|
|
24
24
|
return workspaceDir;
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/react": "^
|
|
20
|
-
"@types/react-dom": "^
|
|
19
|
+
"@types/react": "^19.1.8",
|
|
20
|
+
"@types/react-dom": "^19.1.6",
|
|
21
21
|
"lint-staged": "^15.5.2",
|
|
22
|
-
"react": "^
|
|
23
|
-
"react-dom": "^
|
|
22
|
+
"react": "^19.1.0",
|
|
23
|
+
"react-dom": "^19.1.0",
|
|
24
24
|
"typescript": "^5.0.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"dependencies": {},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@biomejs/biome": "^1.9.4",
|
|
44
|
-
"@types/react": "^
|
|
45
|
-
"@types/react-dom": "^
|
|
44
|
+
"@types/react": "^19.1.8",
|
|
45
|
+
"@types/react-dom": "^19.1.6",
|
|
46
46
|
"bumpp": "^9.9.3",
|
|
47
47
|
"lint-staged": "^15.3.0",
|
|
48
|
-
"react": "^
|
|
49
|
-
"react-dom": "^
|
|
48
|
+
"react": "^19.1.0",
|
|
49
|
+
"react-dom": "^19.1.0",
|
|
50
50
|
"simple-git-hooks": "^2.11.1",
|
|
51
51
|
"typescript": "^5.7.2",
|
|
52
52
|
"zx": "^8.3.0"
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/react": "^
|
|
20
|
-
"@types/react-dom": "^
|
|
19
|
+
"@types/react": "^19.1.8",
|
|
20
|
+
"@types/react-dom": "^19.1.6",
|
|
21
21
|
"lint-staged": "^15.5.2",
|
|
22
|
-
"react": "^
|
|
23
|
-
"react-dom": "^
|
|
22
|
+
"react": "^19.1.0",
|
|
23
|
+
"react-dom": "^19.1.0",
|
|
24
24
|
"typescript": "^5.0.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -43,7 +43,7 @@ your-component-studio/
|
|
|
43
43
|
|
|
44
44
|
Blocklet needs blocklet server as a dependency. So you need to install it first.
|
|
45
45
|
`npm install -g @blocklet/cli`
|
|
46
|
-
See details in [ https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli#start-blocklet-server](
|
|
46
|
+
See details in [ https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli#start-blocklet-server](https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli#start-blocklet-server)
|
|
47
47
|
|
|
48
48
|
2. Init blocklet server & start blocklet server
|
|
49
49
|
|
|
@@ -51,7 +51,7 @@ your-component-studio/
|
|
|
51
51
|
`blocklet server init`
|
|
52
52
|
`blocklet server start`
|
|
53
53
|
See details in [https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli#start-blocklet-server](https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli#start-blocklet-server)
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
3. Go to the project directory `cd [name]`
|
|
56
56
|
4. Install dependencies: `npm install` or `yarn`
|
|
57
57
|
5. Start development server: `blocklet dev`
|
|
@@ -124,4 +124,4 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
124
124
|
## License
|
|
125
125
|
|
|
126
126
|
The code is licensed under the Apache 2.0 license found in the
|
|
127
|
-
[LICENSE](LICENSE) file.
|
|
127
|
+
[LICENSE](LICENSE) file.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
|
|
3
1
|
import AuthStorage from '@arcblock/did-auth-storage-nedb';
|
|
4
2
|
import getWallet from '@blocklet/sdk/lib/wallet';
|
|
5
3
|
import WalletAuthenticator from '@blocklet/sdk/lib/wallet-authenticator';
|
|
6
4
|
import WalletHandler from '@blocklet/sdk/lib/wallet-handler';
|
|
5
|
+
import path from 'path';
|
|
7
6
|
|
|
8
7
|
import env from './env';
|
|
9
8
|
|
|
@@ -51,20 +51,20 @@
|
|
|
51
51
|
]
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@arcblock/did-auth": "^1.20.
|
|
54
|
+
"@arcblock/did-auth": "^1.20.15",
|
|
55
55
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
56
|
-
"@arcblock/did-connect": "^
|
|
57
|
-
"@arcblock/ux": "^
|
|
58
|
-
"@blocklet/pages-kit": "^0.
|
|
59
|
-
"@blocklet/pages-kit-block-studio": "^0.
|
|
60
|
-
"@blocklet/pages-kit-inner-components": "^0.
|
|
61
|
-
"@blocklet/pages-kit-runtime": "^0.
|
|
56
|
+
"@arcblock/did-connect": "^3.0.8",
|
|
57
|
+
"@arcblock/ux": "^3.0.8",
|
|
58
|
+
"@blocklet/pages-kit": "^0.6.0",
|
|
59
|
+
"@blocklet/pages-kit-block-studio": "^0.6.0",
|
|
60
|
+
"@blocklet/pages-kit-inner-components": "^0.6.0",
|
|
61
|
+
"@blocklet/pages-kit-runtime": "^0.6.0",
|
|
62
62
|
"@blocklet/sdk": "^1.16.44",
|
|
63
|
-
"@blocklet/studio-ui": "^0.4.
|
|
64
|
-
"@blocklet/ui-react": "^
|
|
65
|
-
"@ocap/client": "^1.20.
|
|
66
|
-
"@ocap/mcrypto": "^1.20.
|
|
67
|
-
"@ocap/wallet": "^1.20.
|
|
63
|
+
"@blocklet/studio-ui": "^0.4.275",
|
|
64
|
+
"@blocklet/ui-react": "^3.0.8",
|
|
65
|
+
"@ocap/client": "^1.20.15",
|
|
66
|
+
"@ocap/mcrypto": "^1.20.15",
|
|
67
|
+
"@ocap/wallet": "^1.20.15",
|
|
68
68
|
"axios": "^1.7.9",
|
|
69
69
|
"cookie-parser": "^1.4.7",
|
|
70
70
|
"cors": "^2.8.5",
|
|
@@ -76,16 +76,16 @@
|
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@biomejs/biome": "^1.9.4",
|
|
78
78
|
"@blocklet/js-sdk": "^1.16.44",
|
|
79
|
-
"@tailwindcss/vite": "^4.1.
|
|
79
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
80
80
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
81
81
|
"@types/cookie-parser": "^1.4.8",
|
|
82
82
|
"@types/cors": "^2.8.17",
|
|
83
83
|
"@types/dotenv-flow": "^3.3.3",
|
|
84
84
|
"@types/express": "^4.17.21",
|
|
85
85
|
"@types/node": "^20.17.12",
|
|
86
|
-
"@types/react": "^
|
|
87
|
-
"@types/react-dom": "^
|
|
88
|
-
"@vitejs/plugin-react": "^4.
|
|
86
|
+
"@types/react": "^19.1.8",
|
|
87
|
+
"@types/react-dom": "^19.1.6",
|
|
88
|
+
"@vitejs/plugin-react": "^4.6.0",
|
|
89
89
|
"autoprefixer": "^10.4.21",
|
|
90
90
|
"bumpp": "^9.9.3",
|
|
91
91
|
"cross-env": "^7.0.3",
|
|
@@ -93,19 +93,19 @@
|
|
|
93
93
|
"lint-staged": "^15.3.0",
|
|
94
94
|
"nodemon": "^3.1.9",
|
|
95
95
|
"npm-run-all": "^4.1.5",
|
|
96
|
-
"react": "^
|
|
97
|
-
"react-dom": "^
|
|
96
|
+
"react": "^19.1.0",
|
|
97
|
+
"react-dom": "^19.1.0",
|
|
98
98
|
"react-router-dom": "^6.26.1",
|
|
99
99
|
"rimraf": "^5.0.10",
|
|
100
100
|
"simple-git-hooks": "^2.11.1",
|
|
101
101
|
"tailwindcss": "^4.1.10",
|
|
102
102
|
"typescript": "^5.7.2",
|
|
103
|
-
"vite": "^
|
|
104
|
-
"vite-node": "^2.
|
|
105
|
-
"vite-plugin-blocklet": "^0.
|
|
103
|
+
"vite": "^7.0.0",
|
|
104
|
+
"vite-node": "^3.2.4",
|
|
105
|
+
"vite-plugin-blocklet": "^0.10.0",
|
|
106
106
|
"vite-plugin-require": "^1.2.14",
|
|
107
107
|
"vite-plugin-svgr": "^4.3.0",
|
|
108
|
-
"vite-tsconfig-paths": "^
|
|
108
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
109
109
|
"zx": "^8.3.0"
|
|
110
110
|
},
|
|
111
111
|
"importSort": {
|
|
@@ -122,14 +122,14 @@
|
|
|
122
122
|
"pre-commit": "npx lint-staged"
|
|
123
123
|
},
|
|
124
124
|
"resolutions": {
|
|
125
|
-
"@vitejs/plugin-react": "4.
|
|
125
|
+
"@vitejs/plugin-react": "4.6.0",
|
|
126
126
|
"react-dnd": "^16.0.1",
|
|
127
127
|
"react-dnd-html5-backend": "^16.0.1",
|
|
128
|
-
"vite": "
|
|
129
|
-
"vite-node": "2.
|
|
130
|
-
"vite-plugin-blocklet": "0.
|
|
128
|
+
"vite": "7.0.0",
|
|
129
|
+
"vite-node": "3.2.4",
|
|
130
|
+
"vite-plugin-blocklet": "0.10.0",
|
|
131
131
|
"vite-plugin-require": "1.2.14",
|
|
132
132
|
"vite-plugin-svgr": "4.3.0",
|
|
133
|
-
"vite-tsconfig-paths": "
|
|
133
|
+
"vite-tsconfig-paths": "5.1.4"
|
|
134
134
|
}
|
|
135
135
|
}
|