@blocklet/component-studio-cli 0.5.56 → 0.6.1

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.
@@ -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, _options) {
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
- // 删除 workspace parent 目录(清空历史的 component studio 项目,节省用户磁盘空间)
19
- await fs.remove(workspaceParentDir);
20
- // 创建 workspace parent 目录
21
- await fs.ensureDir(workspaceParentDir);
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').description('Start development server').action(async (options) => {
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
  // 处理终止信号
@@ -1,5 +1,5 @@
1
1
  export declare function getWorkspaceTemplatePath(): string;
2
- export declare function getWorkspacePath(): string;
2
+ export declare function getWorkspacePath(version?: string): string;
3
3
  export declare function getProjectPath(): string;
4
4
  /**
5
5
  * 复制模板文件,但排除某些特定文件
@@ -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 workspaceVersion = '0.1.8';
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 = workspaceVersion;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/component-studio-cli",
3
- "version": "0.5.56",
3
+ "version": "0.6.1",
4
4
  "description": "CLI for Component Studio",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,11 +16,11 @@
16
16
  },
17
17
  "dependencies": {},
18
18
  "devDependencies": {
19
- "@types/react": "^18.2.0",
20
- "@types/react-dom": "^18.2.0",
19
+ "@types/react": "^19.1.8",
20
+ "@types/react-dom": "^19.1.6",
21
21
  "lint-staged": "^15.5.2",
22
- "react": "^18.2.0",
23
- "react-dom": "^18.2.0",
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": "^18.3.18",
45
- "@types/react-dom": "^18.3.5",
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": "^18.3.1",
49
- "react-dom": "^18.3.1",
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"
@@ -1,4 +1,4 @@
1
- import React, { CSSProperties } from 'react';
1
+ import React, { CSSProperties, type JSX } from 'react';
2
2
 
3
3
  export interface GradientTitleProps {
4
4
  title: string;
@@ -16,11 +16,11 @@
16
16
  },
17
17
  "dependencies": {},
18
18
  "devDependencies": {
19
- "@types/react": "^18.2.0",
20
- "@types/react-dom": "^18.2.0",
19
+ "@types/react": "^19.1.8",
20
+ "@types/react-dom": "^19.1.6",
21
21
  "lint-staged": "^15.5.2",
22
- "react": "^18.2.0",
23
- "react-dom": "^18.2.0",
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]( 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.14",
54
+ "@arcblock/did-auth": "^1.20.15",
55
55
  "@arcblock/did-auth-storage-nedb": "^1.7.1",
56
- "@arcblock/did-connect": "^2.13.67",
57
- "@arcblock/ux": "^2.13.67",
58
- "@blocklet/pages-kit": "^0.5.41",
59
- "@blocklet/pages-kit-block-studio": "^0.5.41",
60
- "@blocklet/pages-kit-inner-components": "^0.5.41",
61
- "@blocklet/pages-kit-runtime": "^0.5.41",
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.274",
64
- "@blocklet/ui-react": "^2.13.67",
65
- "@ocap/client": "^1.20.14",
66
- "@ocap/mcrypto": "^1.20.14",
67
- "@ocap/wallet": "^1.20.14",
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.10",
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": "^18.3.18",
87
- "@types/react-dom": "^18.3.5",
88
- "@vitejs/plugin-react": "^4.3.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": "^18.3.1",
97
- "react-dom": "^18.3.1",
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": "^5.4.11",
104
- "vite-node": "^2.1.8",
105
- "vite-plugin-blocklet": "^0.9.33",
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": "^4.3.2",
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.3.4",
125
+ "@vitejs/plugin-react": "4.4.1",
126
126
  "react-dnd": "^16.0.1",
127
127
  "react-dnd-html5-backend": "^16.0.1",
128
- "vite": "5.4.11",
129
- "vite-node": "2.1.8",
130
- "vite-plugin-blocklet": "0.9.31",
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": "4.3.2"
133
+ "vite-tsconfig-paths": "5.1.4"
134
134
  }
135
135
  }
@@ -5,8 +5,5 @@
5
5
  "noEmit": false,
6
6
  "noEmitOnError": true
7
7
  },
8
- "include": [
9
- "api/*.d.ts",
10
- "api/src"
11
- ]
8
+ "include": ["api/*.d.ts", "api/src"]
12
9
  }