create-electron-base 0.1.0 → 0.1.3

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 CHANGED
@@ -36,13 +36,14 @@ my-app/
36
36
  │ ├─ bridge/ 封装 window.api
37
37
  │ ├─ views/
38
38
  │ ├─ components/
39
- │ ├─ assets/
40
39
  │ └─ styles/
41
40
  ├─ shared/ 两侧共享的类型
42
41
  ├─ scripts/ 打包加固
43
42
  ├─ app.config.json 项目配置
43
+ ├─ electron.vite.config.ts 构建配置
44
44
  ├─ electron-builder.yml 打包配置
45
- ├─ vite.config.ts
45
+ ├─ tsconfig.json
46
+ ├─ .template.json 生成记录:模板版本和选项
46
47
  └─ package.json
47
48
  ```
48
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-electron-base",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "生成 Electron 桌面项目",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -19,6 +19,9 @@
19
19
  "engines": {
20
20
  "node": ">=18"
21
21
  },
22
+ "scripts": {
23
+ "release": "node scripts/release.mjs"
24
+ },
22
25
  "dependencies": {
23
26
  "prompts": "^2.4.2"
24
27
  }
package/src/generate.mjs CHANGED
@@ -111,4 +111,22 @@ export async function generate({ target, answers }) {
111
111
  }
112
112
 
113
113
  await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
114
+
115
+ // .template.json:记录生成来源,以后和模板比对时用
116
+ const selfPkg = JSON.parse(
117
+ await readFile(join(here, '..', 'package.json'), 'utf8'),
118
+ )
119
+
120
+ const meta = {
121
+ template: selfPkg.name,
122
+ version: selfPkg.version,
123
+ generatedAt: new Date().toISOString().slice(0, 10),
124
+ capabilities: answers.capabilities,
125
+ frontend: answers.frontend,
126
+ }
127
+
128
+ await writeFile(
129
+ join(target, '.template.json'),
130
+ JSON.stringify(meta, null, 2) + '\n',
131
+ )
114
132
  }
@@ -9,7 +9,8 @@
9
9
  "build": "npm run typecheck && electron-vite build",
10
10
  "build:win": "npm run build && electron-builder --win",
11
11
  "build:mac": "npm run build && electron-builder --mac",
12
- "typecheck": "vue-tsc --noEmit -p tsconfig.json"
12
+ "typecheck": "vue-tsc --noEmit -p tsconfig.json",
13
+ "postinstall": "node node_modules/electron/install.js"
13
14
  },
14
15
  "dependencies": {
15
16
  "@thirty-coder/electron-base-kit": "{{kitVersion}}",