create-blocklet 0.9.26 → 0.9.28

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/index.js CHANGED
@@ -609,7 +609,7 @@ async function init() {
609
609
 
610
610
  await initGitRepo(root);
611
611
 
612
- let defaultAgent = 'npm';
612
+ let defaultAgent = 'pnpm';
613
613
  const agentList = ['npm', 'yarn', 'pnpm'];
614
614
 
615
615
  // switch (templateNames) {
@@ -686,7 +686,7 @@ async function init() {
686
686
 
687
687
  if (!hasStart) {
688
688
  // console.log(dim('\n start it later by:\n'));
689
- if (root !== cwd) console.log(blue(` cd ${bold(related)}`));
689
+ if (root !== cwd) console.log(blue(`cd ${bold(related)}`));
690
690
  if (mainBlocklet) {
691
691
  console.log(blue('npm run init'));
692
692
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-blocklet",
3
- "version": "0.9.26",
3
+ "version": "0.9.28",
4
4
  "exports": "./index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:blocklet/create-blocklet.git",
@@ -17,7 +17,7 @@ alwaysApply: true
17
17
 
18
18
  ## 维护要点
19
19
  - 保持 `id` 唯一性
20
- - 所有 `id` 都是 16 位的 uuid,不需要语意化(非常重要!)
20
+ - 所有 `id` 都是 16 位的 uuid,不需要语意化,需要乱序字母和数字组合(非常重要!)
21
21
  - 确保 `properties` 中每个属性有唯一的标识符
22
22
  - 维护多语言支持(至少包含 en/zh)
23
23
  - 管理属性的显示顺序(通过 index 字段)
@@ -65,7 +65,7 @@ alwaysApply: true
65
65
 
66
66
  说明:
67
67
  - `index`: 排序号,从0开始
68
- - `id`: 属性唯一标识符,16 uuid,不需要语意化(非常重要!)
68
+ - `id`: 属性唯一标识符,16 位的 uuid,不需要语意化,需要乱序字母和数字组合(非常重要!)
69
69
  - `key`: 属性键名,在代码中引用时使用
70
70
  - `type`: 属性类型,默认为 string
71
71
  - `visible`: 是否在编辑器中可见,默认为 true
@@ -73,7 +73,7 @@ alwaysApply: true
73
73
  #### 属性字段说明
74
74
  - `index`: 显示顺序编号
75
75
  - `data`:
76
- - `id`: 属性唯一标识符,16 uuid,不需要语意化(非常重要!)
76
+ - `id`: 属性唯一标识符,16 位的 uuid,不需要语意化,需要乱序字母和数字组合(非常重要!)
77
77
  - `key`: 属性键名,用于代码中引用
78
78
  - `type`: 属性数据类型,支持以下类型:
79
79
  - `string`: 文本
@@ -111,7 +111,7 @@ A: 不同类型需要匹配相应格式的默认值,修改类型时需同步
111
111
 
112
112
  ## `@metadata.json` 示例
113
113
  请仔细查看它的结构,其它 `@metadata.json` 的结构与其基本一致,只是其中 `properties` 中的差别
114
- 请注意:所有 `id` 都是 16 位的 uuid,不需要语意化(非常重要!)
114
+ 请注意:所有 `id` 都是 16 位的 uuid,不需要语意化,需要乱序字母和数字组合(非常重要!)
115
115
  ```json
116
116
  {
117
117
  "id": "KEHGy3vdflE8JGrV",
@@ -22,7 +22,7 @@
22
22
  "useKeyWithClickEvents": "off",
23
23
  "useValidAnchor": "off",
24
24
  "noSvgWithoutTitle": "off",
25
- "useMouseEvents": "off"
25
+ "useKeyWithMouseEvents": "off"
26
26
  }
27
27
  },
28
28
  "ignore": ["**/node_modules/**", "*.md"]
@@ -31,23 +31,6 @@
31
31
  "enabled": true,
32
32
  "indentStyle": "space",
33
33
  "indentWidth": 2,
34
- "lineWidth": 100,
35
- "include": ["**/*.{js,jsx,ts,tsx,json,css,less,scss,graphql}"]
36
- },
37
- "javascript": {
38
- "formatter": {
39
- "quoteStyle": "single",
40
- "trailingComma": "es5",
41
- "semicolons": "always"
42
- }
43
- },
44
- "json": {
45
- "parser": {
46
- "allowComments": true,
47
- "allowTrailingCommas": true
48
- },
49
- "formatter": {
50
- "enabled": true
51
- }
34
+ "lineWidth": 100
52
35
  }
53
36
  }
@@ -25,7 +25,7 @@
25
25
  "bump-version": "zx --quiet scripts/bump-version.mjs",
26
26
  "dev-front": "vite serve .",
27
27
  "build-lib": "node -r dotenv-flow/config -e \"require('@blocklet/pages-kit-block-studio/build-lib')\"",
28
- "update:deps": "taze -r -n '/arcblock|ocap|abtnode|blocklet|did-connect|did-comment|nedb/' -w -f && pnpm install && pnpm run deduplicate",
28
+ "update:deps": "npx -y taze -r -n '/arcblock|ocap|abtnode|blocklet|did-connect|did-comment|nedb/' -w -f && pnpm install && pnpm run deduplicate",
29
29
  "deduplicate": "pnpm dedupe",
30
30
  "preinstall": "npx only-allow pnpm",
31
31
  "postinstall": "node scripts/init-component-studio.mjs"
@@ -71,7 +71,7 @@
71
71
  "express-async-errors": "^3.1.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@biomejs/biome": "1.5.3",
74
+ "@biomejs/biome": "^1.9.4",
75
75
  "@blocklet/js-sdk": "^1.16.40",
76
76
  "@types/cookie-parser": "^1.4.8",
77
77
  "@types/cors": "^2.8.17",
@@ -81,8 +81,10 @@
81
81
  "@types/react": "^18.3.18",
82
82
  "@types/react-dom": "^18.3.5",
83
83
  "@vitejs/plugin-react": "^4.3.4",
84
+ "@trivago/prettier-plugin-sort-imports": "^4.3.0",
84
85
  "bumpp": "^9.9.3",
85
86
  "cross-env": "^7.0.3",
87
+ "get-port": "^5.1.1",
86
88
  "import-sort-style-module": "^6.0.0",
87
89
  "lint-staged": "^15.3.0",
88
90
  "nodemon": "^3.1.9",
@@ -95,7 +97,7 @@
95
97
  "typescript": "^5.7.2",
96
98
  "vite": "^5.4.11",
97
99
  "vite-node": "^2.1.8",
98
- "vite-plugin-blocklet": "^0.9.25",
100
+ "vite-plugin-blocklet": "^0.9.28",
99
101
  "vite-plugin-require": "^1.2.14",
100
102
  "vite-plugin-svgr": "^4.3.0",
101
103
  "vite-tsconfig-paths": "^4.3.2",
@@ -2,17 +2,32 @@
2
2
  import { execSync } from 'child_process';
3
3
  import fs from 'fs';
4
4
  import path from 'path';
5
+ import getPort from 'get-port';
5
6
 
6
7
  const flagFile = path.join(process.cwd(), '.init-component-studio');
7
8
 
9
+ // write the BLOCKLET_PORT to .env.development.local
10
+ async function ensureBlockletPortToDevEnv() {
11
+ if (fs.existsSync(path.join(process.cwd(), '.env.development.local'))) {
12
+ return;
13
+ }
14
+
15
+ const port = await getPort({ port: 8118 });
16
+ fs.writeFileSync(path.join(process.cwd(), '.env.development.local'), `BLOCKLET_PORT=${port}`);
17
+ }
18
+
8
19
  // check the flag file is exists
9
20
  if (fs.existsSync(flagFile)) {
10
21
  try {
11
22
  // remove flag file to avoid infinite loop
12
23
  fs.unlinkSync(flagFile);
24
+
13
25
  // execute update:deps script
14
26
  console.log('auto updating dependencies...');
15
27
  execSync('pnpm run update:deps', { stdio: 'inherit' });
28
+
29
+ // write the BLOCKLET_PORT to .env.development.local
30
+ ensureBlockletPortToDevEnv();
16
31
  } catch (error) {
17
32
  process.exit(1);
18
33
  }
@@ -77,7 +77,7 @@
77
77
  "rimraf": "^5.0.10",
78
78
  "simple-git-hooks": "^2.11.1",
79
79
  "vite": "^5.4.14",
80
- "vite-plugin-blocklet": "^0.9.26",
80
+ "vite-plugin-blocklet": "^0.9.28",
81
81
  "vite-plugin-svgr": "^4.3.0",
82
82
  "zx": "^8.3.2"
83
83
  },
@@ -53,7 +53,7 @@
53
53
  "simple-git-hooks": "^2.11.1",
54
54
  "vite": "^5.4.14",
55
55
  "vite-node": "^2.1.9",
56
- "vite-plugin-blocklet": "^0.9.26",
56
+ "vite-plugin-blocklet": "^0.9.28",
57
57
  "vite-plugin-require": "^1.2.14",
58
58
  "vite-plugin-svgr": "^4.3.0",
59
59
  "zx": "^8.3.2"
@@ -98,7 +98,7 @@
98
98
  "ts-node": "^10.9.2",
99
99
  "typescript": "^5.7.3",
100
100
  "vite": "^5.4.14",
101
- "vite-plugin-blocklet": "^0.9.26",
101
+ "vite-plugin-blocklet": "^0.9.28",
102
102
  "vite-plugin-svgr": "^4.3.0",
103
103
  "zx": "^8.3.2"
104
104
  },
@@ -71,7 +71,7 @@
71
71
  "rimraf": "^5.0.10",
72
72
  "simple-git-hooks": "^2.11.1",
73
73
  "vite": "^5.4.14",
74
- "vite-plugin-blocklet": "^0.9.26",
74
+ "vite-plugin-blocklet": "^0.9.28",
75
75
  "vite-plugin-svgr": "^4.3.0",
76
76
  "zx": "^8.3.2"
77
77
  },
@@ -81,7 +81,7 @@
81
81
  "ts-node": "^10.9.2",
82
82
  "typescript": "^5.7.3",
83
83
  "vite": "^5.4.14",
84
- "vite-plugin-blocklet": "^0.9.26",
84
+ "vite-plugin-blocklet": "^0.9.28",
85
85
  "vite-plugin-svgr": "^4.3.0",
86
86
  "zx": "^8.3.2"
87
87
  },
@@ -71,7 +71,7 @@
71
71
  "rimraf": "^5.0.10",
72
72
  "simple-git-hooks": "^2.11.1",
73
73
  "vite": "^5.4.14",
74
- "vite-plugin-blocklet": "^0.9.26",
74
+ "vite-plugin-blocklet": "^0.9.28",
75
75
  "vite-plugin-svgr": "^4.3.0",
76
76
  "zx": "^8.3.2"
77
77
  },
@@ -52,7 +52,7 @@
52
52
  "rimraf": "^5.0.10",
53
53
  "simple-git-hooks": "^2.11.1",
54
54
  "vite": "^5.4.14",
55
- "vite-plugin-blocklet": "^0.9.26",
55
+ "vite-plugin-blocklet": "^0.9.28",
56
56
  "vite-plugin-svgr": "^4.3.0",
57
57
  "zx": "^8.3.2"
58
58
  },
@@ -36,7 +36,7 @@
36
36
  "rimraf": "^5.0.10",
37
37
  "simple-git-hooks": "^2.11.1",
38
38
  "vite": "^5.4.14",
39
- "vite-plugin-blocklet": "^0.9.26",
39
+ "vite-plugin-blocklet": "^0.9.28",
40
40
  "vite-plugin-solid": "^2.11.2",
41
41
  "zx": "^8.3.2"
42
42
  },
@@ -32,7 +32,7 @@
32
32
  "simple-git-hooks": "^2.11.1",
33
33
  "solid-js": "^1.9.4",
34
34
  "vite": "^5.4.14",
35
- "vite-plugin-blocklet": "^0.9.26",
35
+ "vite-plugin-blocklet": "^0.9.28",
36
36
  "vite-plugin-solid": "^2.11.2",
37
37
  "zx": "^8.3.2"
38
38
  },
@@ -44,7 +44,7 @@
44
44
  "simple-git-hooks": "^2.11.1",
45
45
  "svelte": "^4.2.19",
46
46
  "vite": "^5.4.14",
47
- "vite-plugin-blocklet": "^0.9.26",
47
+ "vite-plugin-blocklet": "^0.9.28",
48
48
  "zx": "^8.3.2"
49
49
  },
50
50
  "lint-staged": {
@@ -25,7 +25,7 @@
25
25
  "simple-git-hooks": "^2.11.1",
26
26
  "svelte": "^4.2.19",
27
27
  "vite": "^5.4.14",
28
- "vite-plugin-blocklet": "^0.9.26",
28
+ "vite-plugin-blocklet": "^0.9.28",
29
29
  "zx": "^8.3.2"
30
30
  },
31
31
  "lint-staged": {
@@ -96,7 +96,7 @@
96
96
  "ts-node": "^10.9.2",
97
97
  "typescript": "^5.7.3",
98
98
  "vite": "^5.4.14",
99
- "vite-plugin-blocklet": "^0.9.26",
99
+ "vite-plugin-blocklet": "^0.9.28",
100
100
  "vite-plugin-svgr": "^4.3.0",
101
101
  "zx": "^8.3.2"
102
102
  },
@@ -49,7 +49,7 @@
49
49
  "rimraf": "^5.0.10",
50
50
  "simple-git-hooks": "^2.11.1",
51
51
  "vite": "^5.4.14",
52
- "vite-plugin-blocklet": "^0.9.26",
52
+ "vite-plugin-blocklet": "^0.9.28",
53
53
  "vue": "^3.5.13",
54
54
  "zx": "^8.3.2"
55
55
  },
@@ -30,7 +30,7 @@
30
30
  "rimraf": "^5.0.10",
31
31
  "simple-git-hooks": "^2.11.1",
32
32
  "vite": "^5.4.14",
33
- "vite-plugin-blocklet": "^0.9.26",
33
+ "vite-plugin-blocklet": "^0.9.28",
34
34
  "vue": "^3.5.13",
35
35
  "zx": "^8.3.2"
36
36
  },
@@ -39,7 +39,7 @@
39
39
  "taze": "^0.16.9",
40
40
  "typescript": "^5.7.3",
41
41
  "vite": "^5.4.14",
42
- "vite-plugin-blocklet": "^0.9.26",
42
+ "vite-plugin-blocklet": "^0.9.28",
43
43
  "vue-tsc": "^2.2.2",
44
44
  "zx": "^8.3.2"
45
45
  },
@@ -48,7 +48,7 @@
48
48
  "rimraf": "^5.0.10",
49
49
  "simple-git-hooks": "^2.11.1",
50
50
  "vite": "^5.4.14",
51
- "vite-plugin-blocklet": "^0.9.26",
51
+ "vite-plugin-blocklet": "^0.9.28",
52
52
  "vue": "^2.7.16",
53
53
  "zx": "^8.3.2"
54
54
  },
@@ -30,7 +30,7 @@
30
30
  "rimraf": "^5.0.10",
31
31
  "simple-git-hooks": "^2.11.1",
32
32
  "vite": "^5.4.14",
33
- "vite-plugin-blocklet": "^0.9.26",
33
+ "vite-plugin-blocklet": "^0.9.28",
34
34
  "vue": "^2.7.16",
35
35
  "zx": "^8.3.2"
36
36
  },