@tomjs/create-app 4.2.0 → 5.1.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/index.mjs +10 -9
- package/locales/en-US.json +1 -0
- package/locales/zh-CN.json +1 -0
- package/package.json +1 -1
- package/templates/config/base/.vscode/settings.json +1 -1
- package/templates/config/base/package.json +1 -0
- package/templates/config/electron/package.json +13 -0
- package/templates/config/hbuilderx/extension/index.ts +22 -0
- package/templates/config/hbuilderx/extension/webview.ts +71 -0
- package/templates/config/hbuilderx/package.json +96 -0
- package/templates/{vscode-vue → config/hbuilderx}/tsconfig.node.json +4 -2
- package/templates/config/npm/LICENSE +21 -0
- package/templates/config/npm/package.json +10 -0
- package/templates/config/package.json +10 -7
- package/templates/config/public/package.json +1 -8
- package/templates/{web-react → config/react}/_eslint.config.mjs +0 -1
- package/templates/config/react/package.json +15 -0
- package/templates/config/style/lint-staged.config.mjs +1 -1
- package/templates/{vscode-vue → config/vscode}/.vscode/settings.json +1 -1
- package/templates/config/vscode/package.json +49 -0
- package/templates/{vscode-react → config/vscode}/tsconfig.node.json +2 -7
- package/templates/config/vue/package.json +11 -0
- package/templates/electron-react/package.json +3 -25
- package/templates/electron-react/pnpm-workspace.yaml +1 -0
- package/templates/electron-vue/package.json +3 -19
- package/templates/electron-vue/pnpm-workspace.yaml +1 -0
- package/templates/electron-vue/tsconfig.node.json +1 -1
- package/templates/hbuilderx-base/README.md +20 -0
- package/templates/hbuilderx-base/package.json +52 -0
- package/templates/hbuilderx-base/src/env.d.ts +1 -0
- package/templates/hbuilderx-base/src/index.ts +17 -0
- package/templates/hbuilderx-base/tsconfig.json +7 -0
- package/templates/hbuilderx-base/tsdown.config.ts +13 -0
- package/templates/hbuilderx-react/README.md +25 -0
- package/templates/hbuilderx-react/index.html +13 -0
- package/templates/hbuilderx-react/package.json +12 -0
- package/templates/hbuilderx-react/pnpm-workspace.yaml +5 -0
- package/templates/hbuilderx-react/src/App.css +45 -0
- package/templates/hbuilderx-react/src/App.tsx +41 -0
- package/templates/hbuilderx-react/src/assets/react.svg +1 -0
- package/templates/hbuilderx-react/src/index.css +73 -0
- package/templates/hbuilderx-react/src/main.tsx +10 -0
- package/templates/hbuilderx-react/tsconfig.app.json +18 -0
- package/templates/hbuilderx-react/vite.config.ts +19 -0
- package/templates/hbuilderx-vue/README.md +26 -0
- package/templates/hbuilderx-vue/index.html +13 -0
- package/templates/hbuilderx-vue/package.json +12 -0
- package/templates/hbuilderx-vue/pnpm-workspace.yaml +4 -0
- package/templates/hbuilderx-vue/src/App.vue +32 -0
- package/templates/hbuilderx-vue/src/assets/vite.svg +1 -0
- package/templates/hbuilderx-vue/src/assets/vue.svg +1 -0
- package/templates/hbuilderx-vue/src/components/HelloWorld.vue +29 -0
- package/templates/hbuilderx-vue/src/main.ts +5 -0
- package/templates/hbuilderx-vue/src/style.css +68 -0
- package/templates/hbuilderx-vue/tsconfig.app.json +18 -0
- package/templates/hbuilderx-vue/vite.config.ts +17 -0
- package/templates/node-cli/.vscode/settings.json +15 -51
- package/templates/node-vite/examples/react/package.json +1 -1
- package/templates/node-vite/examples/react/vite.config.ts +2 -2
- package/templates/node-vite/examples/vue/package.json +1 -1
- package/templates/node-vite/examples/vue/vite.config.ts +2 -2
- package/templates/vscode-base/.vscode/launch.json +1 -0
- package/templates/vscode-base/.vscode/settings.json +1 -1
- package/templates/vscode-base/.vscode/tasks.json +1 -1
- package/templates/vscode-react/package.json +1 -54
- package/templates/vscode-react/tsconfig.app.json +2 -8
- package/templates/vscode-vue/package.json +1 -50
- package/templates/vscode-vue/tsconfig.app.json +2 -10
- package/templates/web-react/package.json +0 -16
- package/templates/web-react/tsconfig.app.json +2 -9
- package/templates/web-react/tsconfig.json +2 -6
- package/templates/web-react/tsconfig.node.json +1 -3
- package/templates/web-vue/package.json +0 -10
- package/templates/web-vue/tsconfig.app.json +2 -10
- package/templates/web-vue/tsconfig.json +2 -6
- package/templates/web-vue/tsconfig.node.json +1 -3
- package/templates/electron-react/_eslint.config.mjs +0 -3
- package/templates/electron-react/electron/env.d.ts +0 -1
- package/templates/electron-react/electron/main/index.ts +0 -130
- package/templates/electron-vue/.vscode/launch.json +0 -48
- package/templates/electron-vue/.vscode/tasks.json +0 -67
- package/templates/electron-vue/_eslint.config.mjs +0 -3
- package/templates/electron-vue/electron/preload/index.ts +0 -4
- package/templates/vscode-react/.vscode/settings.json +0 -59
- package/templates/vscode-vue/.vscode/extensions.json +0 -5
- package/templates/vscode-vue/.vscode/launch.json +0 -34
- package/templates/vscode-vue/.vscode/tasks.json +0 -45
- package/templates/vscode-vue/.vscodeignore +0 -73
- package/templates/vscode-vue/_.gitignore +0 -65
- package/templates/vscode-vue/extension/index.ts +0 -21
- package/templates/vscode-vue/extension/views/helper.ts +0 -29
- package/templates/vscode-vue/extension/views/panel.ts +0 -49
- package/templates/vscode-vue/locales/en.json +0 -6
- package/templates/vscode-vue/locales/zh-CN.json +0 -6
- package/templates/vscode-vue/resources/logo.png +0 -0
- package/templates/vscode-vue/resources/logo.svg +0 -1
- package/templates/web-vue/_eslint.config.mjs +0 -6
- /package/templates/{electron-react → config/electron}/.vscode/launch.json +0 -0
- /package/templates/{electron-react → config/electron}/.vscode/tasks.json +0 -0
- /package/templates/{electron-vue → config/electron}/electron/main/index.ts +0 -0
- /package/templates/{electron-react → config/electron}/electron/preload/index.ts +0 -0
- /package/templates/{electron-react → config/electron}/public/vite.svg +0 -0
- /package/templates/{vscode-react → config/hbuilderx}/tsconfig.json +0 -0
- /package/templates/config/{public → npm}/README.md +0 -0
- /package/templates/config/{public → npm}/README.zh_CN.md +0 -0
- /package/templates/{electron-vue → config/react}/public/vite.svg +0 -0
- /package/templates/{vscode-react → config/vscode}/.vscode/extensions.json +0 -0
- /package/templates/{vscode-react → config/vscode}/.vscode/launch.json +0 -0
- /package/templates/{vscode-react → config/vscode}/.vscode/tasks.json +0 -0
- /package/templates/{vscode-react → config/vscode}/.vscodeignore +0 -0
- /package/templates/{vscode-react → config/vscode}/_.gitignore +0 -0
- /package/templates/{vscode-react → config/vscode}/extension/index.ts +0 -0
- /package/templates/{vscode-react → config/vscode}/extension/views/helper.ts +0 -0
- /package/templates/{vscode-react → config/vscode}/extension/views/panel.ts +0 -0
- /package/templates/{vscode-react → config/vscode}/locales/en.json +0 -0
- /package/templates/{vscode-react → config/vscode}/locales/zh-CN.json +0 -0
- /package/templates/{vscode-react → config/vscode}/resources/logo.png +0 -0
- /package/templates/{vscode-react → config/vscode}/resources/logo.svg +0 -0
- /package/templates/{vscode-vue → config/vscode}/tsconfig.json +0 -0
- /package/templates/{web-react → config/vue}/public/vite.svg +0 -0
- /package/templates/{web-vue/public → hbuilderx-react/src/assets}/vite.svg +0 -0
|
@@ -4,67 +4,31 @@
|
|
|
4
4
|
"i18n-ally.localesPaths": "./locales",
|
|
5
5
|
"i18n-ally.displayLanguage": "zh-Hans",
|
|
6
6
|
"i18n-ally.sourceLanguage": "zh-Hans",
|
|
7
|
+
|
|
7
8
|
// Disable the default formatter, use eslint instead
|
|
8
9
|
"prettier.enable": false,
|
|
9
|
-
"editor.formatOnSave":
|
|
10
|
+
"editor.formatOnSave": false,
|
|
11
|
+
|
|
10
12
|
// Auto fix
|
|
11
13
|
"editor.codeActionsOnSave": {
|
|
12
14
|
"source.fixAll.eslint": "explicit",
|
|
13
15
|
"source.organizeImports": "never"
|
|
14
16
|
},
|
|
17
|
+
|
|
15
18
|
// Silent the stylistic rules in your IDE, but still auto fix them
|
|
16
19
|
"eslint.rules.customizations": [
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
{
|
|
28
|
-
"rule": "*-indent",
|
|
29
|
-
"severity": "off",
|
|
30
|
-
"fixable": true
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"rule": "*-spacing",
|
|
34
|
-
"severity": "off",
|
|
35
|
-
"fixable": true
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"rule": "*-spaces",
|
|
39
|
-
"severity": "off",
|
|
40
|
-
"fixable": true
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"rule": "*-order",
|
|
44
|
-
"severity": "off",
|
|
45
|
-
"fixable": true
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"rule": "*-dangle",
|
|
49
|
-
"severity": "off",
|
|
50
|
-
"fixable": true
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"rule": "*-newline",
|
|
54
|
-
"severity": "off",
|
|
55
|
-
"fixable": true
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"rule": "*quotes",
|
|
59
|
-
"severity": "off",
|
|
60
|
-
"fixable": true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"rule": "*semi",
|
|
64
|
-
"severity": "off",
|
|
65
|
-
"fixable": true
|
|
66
|
-
}
|
|
20
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
21
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
22
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
23
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
24
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
25
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
26
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
27
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
28
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
29
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
67
30
|
],
|
|
31
|
+
|
|
68
32
|
// Enable eslint for all supported languages
|
|
69
33
|
"eslint.validate": [
|
|
70
34
|
"javascript",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@eslint-react/eslint-plugin": "^2.3.9",
|
|
18
|
-
"@tomjs/vite-plugin-
|
|
18
|
+
"@tomjs/vite-plugin-xxx": "workspace:*",
|
|
19
19
|
"@types/node": "^24.10.1",
|
|
20
20
|
"@types/react": "^19.2.5",
|
|
21
21
|
"@types/react-dom": "^19.2.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import
|
|
2
|
+
import xxx from '@tomjs/vite-plugin-template';
|
|
3
3
|
import react from '@vitejs/plugin-react-swc';
|
|
4
4
|
import { defineConfig } from 'vite';
|
|
5
5
|
|
|
@@ -11,5 +11,5 @@ export default defineConfig({
|
|
|
11
11
|
react: path.resolve(process.cwd(), 'node_modules/react'),
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
|
-
plugins: [react(),
|
|
14
|
+
plugins: [react(), xxx()],
|
|
15
15
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import xxx from '@tomjs/vite-plugin-template';
|
|
2
2
|
import vue from '@vitejs/plugin-vue';
|
|
3
3
|
import { defineConfig } from 'vite';
|
|
4
4
|
|
|
5
5
|
// https://vite.dev/config/
|
|
6
6
|
export default defineConfig({
|
|
7
|
-
plugins: [vue(),
|
|
7
|
+
plugins: [vue(), xxx()],
|
|
8
8
|
});
|
|
@@ -5,61 +5,8 @@
|
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "%description%",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"vscode"
|
|
10
|
-
],
|
|
11
|
-
"categories": [
|
|
12
|
-
"Other"
|
|
13
|
-
],
|
|
14
8
|
"main": "dist/extension/index.js",
|
|
15
|
-
"icon": "resources/logo.png",
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">=14.16.0",
|
|
18
|
-
"vscode": "^1.56.0"
|
|
19
|
-
},
|
|
20
|
-
"activationEvents": [],
|
|
21
|
-
"contributes": {
|
|
22
|
-
"commands": [
|
|
23
|
-
{
|
|
24
|
-
"command": "tomjs.xxx.showHello",
|
|
25
|
-
"title": "%tomjs.commands.hello%",
|
|
26
|
-
"category": "%displayName%"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"command": "tomjs.xxx.showPanel",
|
|
30
|
-
"title": "%tomjs.commands.panel%",
|
|
31
|
-
"category": "%displayName%"
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
"vsce": {
|
|
36
|
-
"dependencies": false,
|
|
37
|
-
"yarn": false
|
|
38
|
-
},
|
|
39
9
|
"scripts": {
|
|
40
|
-
"
|
|
41
|
-
"dev:vsd": "vscode-dev --watch",
|
|
42
|
-
"dev:dist": "vite",
|
|
43
|
-
"build": "vscode-dev && tsc -b && vite build",
|
|
44
|
-
"preview": "vite preview"
|
|
45
|
-
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"@tomjs/node": "^2.2.3",
|
|
48
|
-
"@tomjs/vscode": "^2.5.0",
|
|
49
|
-
"@tomjs/vscode-webview": "^2.0.2",
|
|
50
|
-
"@vscode/webview-ui-toolkit": "^1.4.0",
|
|
51
|
-
"react": "^19.2.3",
|
|
52
|
-
"react-dom": "^19.2.3"
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@tomjs/vite-plugin-vscode": "^6.1.0",
|
|
56
|
-
"@tomjs/vscode-dev": "^3.1.2",
|
|
57
|
-
"@types/react": "^19.2.7",
|
|
58
|
-
"@types/react-dom": "^19.2.3",
|
|
59
|
-
"@types/vscode": "^1.56.0",
|
|
60
|
-
"@types/vscode-webview": "^1.57.5",
|
|
61
|
-
"@vitejs/plugin-react": "^5.1.2",
|
|
62
|
-
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
63
|
-
"vite": "^7.3.0"
|
|
10
|
+
"build": "tsc -b && vscode-dev && vite build"
|
|
64
11
|
}
|
|
65
12
|
}
|
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
"extends": "@tomjs/tsconfig/react-dom.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
-
"types": [
|
|
6
|
-
"vite/client"
|
|
7
|
-
]
|
|
5
|
+
"types": ["vite/client"]
|
|
8
6
|
},
|
|
9
|
-
"include": [
|
|
10
|
-
"src/**/*.ts",
|
|
11
|
-
"src/**/*.tsx",
|
|
12
|
-
"src/**/*.d.ts"
|
|
13
|
-
]
|
|
7
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"]
|
|
14
8
|
}
|
|
@@ -5,60 +5,11 @@
|
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "%description%",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"vscode"
|
|
10
|
-
],
|
|
11
|
-
"categories": [
|
|
12
|
-
"Other"
|
|
13
|
-
],
|
|
14
8
|
"main": "dist/extension/index.js",
|
|
15
|
-
"icon": "resources/logo.png",
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">=14.16.0",
|
|
18
|
-
"vscode": "^1.56.0"
|
|
19
|
-
},
|
|
20
|
-
"activationEvents": [],
|
|
21
|
-
"contributes": {
|
|
22
|
-
"commands": [
|
|
23
|
-
{
|
|
24
|
-
"command": "tomjs.xxx.showHello",
|
|
25
|
-
"title": "%tomjs.commands.hello%",
|
|
26
|
-
"category": "%displayName%"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"command": "tomjs.xxx.showPanel",
|
|
30
|
-
"title": "%tomjs.commands.panel%",
|
|
31
|
-
"category": "%displayName%"
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
"vsce": {
|
|
36
|
-
"dependencies": false,
|
|
37
|
-
"yarn": false
|
|
38
|
-
},
|
|
39
9
|
"scripts": {
|
|
40
|
-
"
|
|
41
|
-
"dev:vsd": "vscode-dev --watch",
|
|
42
|
-
"dev:dist": "vite",
|
|
43
|
-
"build": "vscode-dev && vue-tsc --noEmit && vite build",
|
|
44
|
-
"preview": "vite preview"
|
|
10
|
+
"build": "vue-tsc --noEmit && vscode-dev && vite build"
|
|
45
11
|
},
|
|
46
12
|
"dependencies": {
|
|
47
|
-
"@tomjs/node": "^2.2.3",
|
|
48
|
-
"@tomjs/vscode": "^2.5.0",
|
|
49
|
-
"@tomjs/vscode-webview": "^2.0.2",
|
|
50
|
-
"@vscode/webview-ui-toolkit": "^1.4.0",
|
|
51
|
-
"vue": "^3.5.26",
|
|
52
13
|
"vue-i18n": "^11.2.8"
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@tomjs/vite-plugin-vscode": "^6.1.0",
|
|
56
|
-
"@tomjs/vscode-dev": "^3.1.2",
|
|
57
|
-
"@types/vscode": "^1.56.0",
|
|
58
|
-
"@types/vscode-webview": "^1.57.5",
|
|
59
|
-
"@vitejs/plugin-vue": "^6.0.3",
|
|
60
|
-
"vite": "^7.3.0",
|
|
61
|
-
"vite-plugin-vue-devtools": "^8.0.5",
|
|
62
|
-
"vue-tsc": "^3.2.1"
|
|
63
14
|
}
|
|
64
15
|
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@tomjs/tsconfig/vue-dom.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"composite": true,
|
|
5
4
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
6
|
-
"types": [
|
|
7
|
-
"vite/client"
|
|
8
|
-
]
|
|
5
|
+
"types": ["vite/client"]
|
|
9
6
|
},
|
|
10
|
-
"include": [
|
|
11
|
-
"src/**/*.ts",
|
|
12
|
-
"src/**/*.tsx",
|
|
13
|
-
"src/**/*.vue",
|
|
14
|
-
"src/**/*.d.ts"
|
|
15
|
-
]
|
|
7
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "src/**/*.d.ts"]
|
|
16
8
|
}
|
|
@@ -6,22 +6,6 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "tsc -b && vite build",
|
|
9
|
-
"lint": "eslint .",
|
|
10
9
|
"preview": "vite preview"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"react": "^19.2.3",
|
|
14
|
-
"react-dom": "^19.2.3"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@eslint-react/eslint-plugin": "^2.4.0",
|
|
18
|
-
"@types/node": "^22.19.3",
|
|
19
|
-
"@types/react": "^19.2.7",
|
|
20
|
-
"@types/react-dom": "^19.2.3",
|
|
21
|
-
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
22
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
23
|
-
"eslint-plugin-react-refresh": "^0.4.26",
|
|
24
|
-
"typescript": "~5.9.3",
|
|
25
|
-
"vite": "^7.3.0"
|
|
26
10
|
}
|
|
27
11
|
}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@tomjs/tsconfig/react-dom.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"composite": true,
|
|
5
4
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
6
|
-
"types": [
|
|
7
|
-
"vite/client"
|
|
8
|
-
]
|
|
5
|
+
"types": ["vite/client"]
|
|
9
6
|
},
|
|
10
|
-
"include": [
|
|
11
|
-
"src/**/*.ts",
|
|
12
|
-
"src/**/*.tsx",
|
|
13
|
-
"src/**/*.d.ts"
|
|
14
|
-
]
|
|
7
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"]
|
|
15
8
|
}
|
|
@@ -7,15 +7,5 @@
|
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "vue-tsc -b && vite build",
|
|
9
9
|
"preview": "vite preview"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"vue": "^3.5.26"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@types/node": "^22.19.3",
|
|
16
|
-
"@vitejs/plugin-vue": "^6.0.3",
|
|
17
|
-
"typescript": "~5.9.3",
|
|
18
|
-
"vite": "^7.3.0",
|
|
19
|
-
"vue-tsc": "^3.2.1"
|
|
20
10
|
}
|
|
21
11
|
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@tomjs/tsconfig/vue-dom.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"composite": true,
|
|
5
4
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
6
|
-
"types": [
|
|
7
|
-
"vite/client"
|
|
8
|
-
]
|
|
5
|
+
"types": ["vite/client"]
|
|
9
6
|
},
|
|
10
|
-
"include": [
|
|
11
|
-
"src/**/*.ts",
|
|
12
|
-
"src/**/*.d.ts",
|
|
13
|
-
"src/**/*.tsx",
|
|
14
|
-
"src/**/*.vue"
|
|
15
|
-
]
|
|
7
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
|
|
16
8
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@tomjs/vite-plugin-electron/env" />
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { release } from 'node:os';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { ELECTRON_EXIT } from '@tomjs/vite-plugin-electron/electron';
|
|
4
|
-
import { app, BrowserWindow, ipcMain, shell } from 'electron';
|
|
5
|
-
|
|
6
|
-
console.log('Electron Main Process!');
|
|
7
|
-
|
|
8
|
-
const isDev = process.env.NODE_ENV === 'development';
|
|
9
|
-
process.env.DIST = join(__dirname, '../renderer');
|
|
10
|
-
|
|
11
|
-
console.log('process.env.DIST', process.env.DIST);
|
|
12
|
-
console.log('process.env.VITE_DEV_SERVER_URL', process.env.VITE_DEV_SERVER_URL);
|
|
13
|
-
|
|
14
|
-
// Disable GPU Acceleration for Windows 7
|
|
15
|
-
if (release().startsWith('6.1'))
|
|
16
|
-
app.disableHardwareAcceleration();
|
|
17
|
-
|
|
18
|
-
// Set application name for Windows 10+ notifications
|
|
19
|
-
if (process.platform === 'win32')
|
|
20
|
-
app.setAppUserModelId(app.getName());
|
|
21
|
-
|
|
22
|
-
if (!app.requestSingleInstanceLock()) {
|
|
23
|
-
app.quit();
|
|
24
|
-
process.exit(0);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Remove electron security warnings
|
|
28
|
-
// This warning only shows in development mode
|
|
29
|
-
// Read more on https://www.electronjs.org/docs/latest/tutorial/security
|
|
30
|
-
// process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
|
|
31
|
-
|
|
32
|
-
let win: BrowserWindow | null = null;
|
|
33
|
-
// Here, you can also use other preload
|
|
34
|
-
const preload = join(__dirname, '../preload/index.js');
|
|
35
|
-
const url = process.env.VITE_DEV_SERVER_URL as string;
|
|
36
|
-
const indexHtml = join(process.env.DIST, 'index.html');
|
|
37
|
-
|
|
38
|
-
function createWindow() {
|
|
39
|
-
win = new BrowserWindow({
|
|
40
|
-
title: 'Main window',
|
|
41
|
-
width: 800,
|
|
42
|
-
height: 700,
|
|
43
|
-
webPreferences: {
|
|
44
|
-
preload,
|
|
45
|
-
// Warning: Enable nodeIntegration and disable contextIsolation is not secure in production
|
|
46
|
-
// Consider using contextBridge.exposeInMainWorld
|
|
47
|
-
// Read more on https://www.electronjs.org/docs/latest/tutorial/context-isolation
|
|
48
|
-
nodeIntegration: true,
|
|
49
|
-
contextIsolation: false,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
if (isDev) {
|
|
54
|
-
// electron-vite-vue#298
|
|
55
|
-
win.loadURL(url);
|
|
56
|
-
// Open devTool if the app is not packaged
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
win.loadFile(indexHtml);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Test actively push message to the Electron-Renderer
|
|
63
|
-
win.webContents.on('did-finish-load', () => {
|
|
64
|
-
win?.webContents.send('main-process-message', new Date().toLocaleString());
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Make all links open with the browser, not with the application
|
|
68
|
-
win.webContents.setWindowOpenHandler(({ url }) => {
|
|
69
|
-
if (url.startsWith('https:'))
|
|
70
|
-
shell.openExternal(url);
|
|
71
|
-
return { action: 'deny' };
|
|
72
|
-
});
|
|
73
|
-
// win.webContents.on('will-navigate', (event, url) => { }) #344
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
app.whenReady().then(async () => {
|
|
77
|
-
createWindow();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
app.on('window-all-closed', () => {
|
|
81
|
-
win = null;
|
|
82
|
-
if (process.platform !== 'darwin')
|
|
83
|
-
app.quit();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
app.on('second-instance', () => {
|
|
87
|
-
if (win) {
|
|
88
|
-
// Focus on the main window if the user tried to open another
|
|
89
|
-
if (win.isMinimized())
|
|
90
|
-
win.restore();
|
|
91
|
-
win.focus();
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
app.on('activate', () => {
|
|
96
|
-
const allWindows = BrowserWindow.getAllWindows();
|
|
97
|
-
if (allWindows.length) {
|
|
98
|
-
allWindows[0].focus();
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
createWindow();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// New window example arg: new windows url
|
|
106
|
-
ipcMain.handle('open-win', (_, arg) => {
|
|
107
|
-
const childWindow = new BrowserWindow({
|
|
108
|
-
webPreferences: {
|
|
109
|
-
preload,
|
|
110
|
-
nodeIntegration: true,
|
|
111
|
-
contextIsolation: false,
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
if (process.env.VITE_DEV_SERVER_URL) {
|
|
116
|
-
childWindow.loadURL(`${url}#${arg}`);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
childWindow.loadFile(indexHtml, { hash: arg });
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
process.on('message', (data) => {
|
|
124
|
-
// electron exit message
|
|
125
|
-
if (data === ELECTRON_EXIT) {
|
|
126
|
-
if (isDev && win) {
|
|
127
|
-
win.webContents.closeDevTools();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"name": "Debug Electron",
|
|
9
|
-
"type": "node",
|
|
10
|
-
"request": "launch",
|
|
11
|
-
"cwd": "${workspaceFolder}",
|
|
12
|
-
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
|
13
|
-
"windows": {
|
|
14
|
-
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
|
15
|
-
},
|
|
16
|
-
"args": [
|
|
17
|
-
"."
|
|
18
|
-
],
|
|
19
|
-
"outFiles": [
|
|
20
|
-
"${workspaceFolder}/**/*.js",
|
|
21
|
-
"${workspaceFolder}/**/*.cjs",
|
|
22
|
-
"${workspaceFolder}/**/*.mjs",
|
|
23
|
-
"!**/node_modules/**"
|
|
24
|
-
],
|
|
25
|
-
"preLaunchTask": "npm:dev"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"name": "Debug Web",
|
|
29
|
-
"type": "node",
|
|
30
|
-
"request": "launch",
|
|
31
|
-
"cwd": "${workspaceFolder}",
|
|
32
|
-
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
|
33
|
-
"windows": {
|
|
34
|
-
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
|
35
|
-
},
|
|
36
|
-
"args": [
|
|
37
|
-
"."
|
|
38
|
-
],
|
|
39
|
-
"outFiles": [
|
|
40
|
-
"${workspaceFolder}/**/*.js",
|
|
41
|
-
"${workspaceFolder}/**/*.cjs",
|
|
42
|
-
"${workspaceFolder}/**/*.mjs",
|
|
43
|
-
"!**/node_modules/**"
|
|
44
|
-
],
|
|
45
|
-
"preLaunchTask": "npm:debug"
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|