@tomjs/create-app 0.3.2 → 0.4.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.
Files changed (41) hide show
  1. package/README.md +14 -28
  2. package/README.zh_CN.md +14 -29
  3. package/dist/index.mjs +1 -1
  4. package/package.json +3 -3
  5. package/template-electron-react/README.md +19 -11
  6. package/template-electron-react/electron/env.d.ts +1 -0
  7. package/template-electron-react/electron/main/index.ts +36 -27
  8. package/template-electron-react/electron/preload/index.ts +1 -0
  9. package/template-electron-react/package.json +7 -11
  10. package/template-electron-react/scripts/builder.ts +1 -1
  11. package/template-electron-react/scripts/release.ts +1 -1
  12. package/template-electron-react/src/App.tsx +4 -2
  13. package/template-electron-react/vite.config.ts +9 -81
  14. package/template-electron-vue/README.md +19 -11
  15. package/template-electron-vue/electron/env.d.ts +1 -0
  16. package/template-electron-vue/electron/main/index.ts +36 -27
  17. package/template-electron-vue/electron/preload/index.ts +1 -0
  18. package/template-electron-vue/package.json +9 -13
  19. package/template-electron-vue/scripts/builder.ts +1 -1
  20. package/template-electron-vue/scripts/release.ts +1 -1
  21. package/template-electron-vue/src/App.vue +16 -4
  22. package/template-electron-vue/src/components/HelloWorld.vue +6 -0
  23. package/template-electron-vue/src/style.css +3 -3
  24. package/template-electron-vue/vite.config.ts +9 -80
  25. package/template-node/package.json +3 -3
  26. package/template-react/package.json +3 -3
  27. package/template-vue/package.json +5 -5
  28. package/template-electron-react/.vscode/.debug.env +0 -1
  29. package/template-electron-react/.vscode/.debug.script.mjs +0 -23
  30. package/template-electron-react/.vscode/extensions.json +0 -6
  31. package/template-electron-react/.vscode/launch.json +0 -53
  32. package/template-electron-react/.vscode/settings.json +0 -13
  33. package/template-electron-react/.vscode/tasks.json +0 -31
  34. package/template-electron-react/electron/electron-env.d.ts +0 -11
  35. package/template-electron-vue/.vscode/.debug.env +0 -1
  36. package/template-electron-vue/.vscode/.debug.script.mjs +0 -23
  37. package/template-electron-vue/.vscode/extensions.json +0 -6
  38. package/template-electron-vue/.vscode/launch.json +0 -53
  39. package/template-electron-vue/.vscode/settings.json +0 -13
  40. package/template-electron-vue/.vscode/tasks.json +0 -31
  41. package/template-electron-vue/electron/electron-env.d.ts +0 -11
@@ -3,20 +3,8 @@ import { dirname, join } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { app, BrowserWindow, ipcMain, shell } from 'electron';
5
5
 
6
- // The built directory structure
7
- //
8
- // ├─┬ dist
9
- // │ ├── main.js > Electron-Main
10
- // │ ├── preload.js > Preload-Scripts
11
- // │ ├─┬ render > Electron-Renderer
12
- // │ │ └── index.html
13
- //
14
6
  const __dirname = dirname(fileURLToPath(import.meta.url));
15
- process.env.DIST_ELECTRON = __dirname;
16
- process.env.DIST = join(process.env.DIST_ELECTRON, 'render');
17
- process.env.VITE_PUBLIC = process.env.VITE_DEV_SERVER_URL
18
- ? join(process.env.DIST_ELECTRON, '../public')
19
- : process.env.DIST;
7
+ const isDev = process.env.NODE_ENV === 'development';
20
8
 
21
9
  // Disable GPU Acceleration for Windows 7
22
10
  if (release().startsWith('6.1')) app.disableHardwareAcceleration();
@@ -32,19 +20,22 @@ if (!app.requestSingleInstanceLock()) {
32
20
  // Remove electron security warnings
33
21
  // This warning only shows in development mode
34
22
  // Read more on https://www.electronjs.org/docs/latest/tutorial/security
35
- // process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
23
+ process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
36
24
 
37
25
  let win: BrowserWindow | null = null;
38
- // Here, you can also use other preload
39
- const preload = join(__dirname, './preload.js');
40
- const url = process.env.VITE_DEV_SERVER_URL as string;
41
- const indexHtml = join(process.env.DIST, 'index.html');
42
-
43
- async function createWindow() {
26
+ // package.json "type":"module", must use mjs extension
27
+ const preload = join(__dirname, '../preload/index.mjs');
28
+ const serverUrl = process.env.APP_DEV_SERVER_URL as string;
29
+ const rendererDist = join(__dirname, '../renderer');
30
+ const indexHtml = join(rendererDist, 'index.html');
31
+ const publicPath = serverUrl ? join(__dirname, '../../public') : rendererDist;
32
+
33
+ function createWindow() {
44
34
  win = new BrowserWindow({
45
35
  title: 'Main window',
46
36
  width: 800,
47
37
  height: 700,
38
+ icon: join(publicPath, 'img/icon.png'),
48
39
  webPreferences: {
49
40
  preload,
50
41
  // Warning: Enable nodeIntegration and disable contextIsolation is not secure in production
@@ -55,11 +46,10 @@ async function createWindow() {
55
46
  },
56
47
  });
57
48
 
58
- if (process.env.VITE_DEV_SERVER_URL) {
59
- // electron-vite-vue#298
60
- win.loadURL(url);
49
+ if (isDev) {
50
+ win.loadURL(serverUrl);
61
51
  // Open devTool if the app is not packaged
62
- // win.webContents.openDevTools();
52
+ win.webContents.openDevTools();
63
53
  } else {
64
54
  win.loadFile(indexHtml);
65
55
  }
@@ -77,7 +67,26 @@ async function createWindow() {
77
67
  // win.webContents.on('will-navigate', (event, url) => { }) #344
78
68
  }
79
69
 
80
- app.whenReady().then(createWindow);
70
+ app.whenReady().then(async () => {
71
+ createWindow();
72
+
73
+ if (isDev) {
74
+ const { installExtension, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } = await import(
75
+ '@tomjs/electron-devtools-installer'
76
+ );
77
+
78
+ installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS])
79
+ .then(exts => {
80
+ console.log(
81
+ 'Added Extension: ',
82
+ exts.map(s => s.name),
83
+ );
84
+ })
85
+ .catch(() => {
86
+ console.log('Failed to install extensions');
87
+ });
88
+ }
89
+ });
81
90
 
82
91
  app.on('window-all-closed', () => {
83
92
  win = null;
@@ -111,8 +120,8 @@ ipcMain.handle('open-win', (_, arg) => {
111
120
  },
112
121
  });
113
122
 
114
- if (process.env.VITE_DEV_SERVER_URL) {
115
- childWindow.loadURL(`${url}#${arg}`);
123
+ if (serverUrl) {
124
+ childWindow.loadURL(`${serverUrl}#${arg}`);
116
125
  } else {
117
126
  childWindow.loadFile(indexHtml, { hash: arg });
118
127
  }
@@ -0,0 +1 @@
1
+ console.log('Electron Preload Process!');
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "electron-app",
3
3
  "version": "0.0.0",
4
+ "type": "module",
4
5
  "description": "vite + electron + vue",
5
6
  "engines": {
6
7
  "node": ">=18"
7
8
  },
8
- "debug": {
9
- "env": {
10
- "VITE_DEV_SERVER_URL": "http://127.0.0.1:6888/"
11
- }
12
- },
13
- "main": "dist/main.js",
9
+ "main": "dist/main/index.mjs",
14
10
  "scripts": {
15
11
  "dev": "vite",
16
12
  "build": "npm run clean && vue-tsc --noEmit && vite build && npm run release",
@@ -22,18 +18,20 @@
22
18
  "prepare": "husky install"
23
19
  },
24
20
  "dependencies": {
25
- "vue": "^3.3.10"
21
+ "vue": "^3.3.11"
26
22
  },
27
23
  "devDependencies": {
28
24
  "@commitlint/cli": "^18.4.3",
29
25
  "@tomjs/commitlint": "^2.0.5",
26
+ "@tomjs/electron-devtools-installer": "^2.0.3",
30
27
  "@tomjs/eslint": "^1.1.1",
31
28
  "@tomjs/prettier": "^1.0.6",
32
- "@tomjs/stylelint": "^1.1.0",
33
- "@tomjs/tsconfig": "^1.0.8",
29
+ "@tomjs/stylelint": "^1.1.1",
30
+ "@tomjs/tsconfig": "^1.0.9",
31
+ "@tomjs/vite-plugin-electron": "^1.1.2",
34
32
  "@types/node": "^18.19.3",
35
33
  "@types/shelljs": "^0.8.15",
36
- "@vitejs/plugin-vue": "^4.5.1",
34
+ "@vitejs/plugin-vue": "^4.5.2",
37
35
  "electron": "^28.0.0",
38
36
  "electron-builder": "^24.9.1",
39
37
  "eslint": "^8.55.0",
@@ -44,11 +42,9 @@
44
42
  "rimraf": "^5.0.5",
45
43
  "shelljs": "^0.8.5",
46
44
  "stylelint": "^15.11.0",
47
- "tree-kill": "^1.2.2",
48
45
  "tsx": "^4.6.2",
49
46
  "typescript": "~5.2.2",
50
- "vite": "^5.0.6",
51
- "vite-plugin-electron": "^0.15.4",
47
+ "vite": "^5.0.7",
52
48
  "vite-plugin-electron-renderer": "^0.14.5",
53
49
  "vue-tsc": "^1.8.25"
54
50
  }
@@ -11,7 +11,7 @@ export default {
11
11
  output: `build/${pkg.version}`,
12
12
  app: 'dist',
13
13
  },
14
- files: ['main.js', 'preload.js', 'render'],
14
+ files: ['main/index.mjs', 'preload/index.mjs', 'renderer'],
15
15
  icon: 'public/img/icon.png',
16
16
  artifactName: '${productName}-${version}-${os}-${arch}.${ext}',
17
17
  electronLanguages: ['zh-CN', 'en-US'],
@@ -13,7 +13,7 @@ function genPkgJson() {
13
13
  version: pkg.version,
14
14
  author: os.userInfo().username,
15
15
  description: pkg.description,
16
- main: './main.js',
16
+ main: 'main/index.mjs',
17
17
  dependencies: Object.entries(Object.assign({}, pkg.dependencies, pkg.devDependencies))
18
18
  .filter(([name]) => ELECTRON_DEPENDENCIES.includes(name))
19
19
  .reduce((object, entry) => ({ ...object, [entry[0]]: entry[1] }), {}),
@@ -1,8 +1,5 @@
1
1
  <script setup lang="ts">
2
- import os from 'node:os';
3
2
  import HelloWorld from './components/HelloWorld.vue';
4
-
5
- const info = os.platform() + ' ' + os.arch();
6
3
  </script>
7
4
 
8
5
  <template>
@@ -17,7 +14,6 @@ const info = os.platform() + ' ' + os.arch();
17
14
  <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
18
15
  </a>
19
16
  </div>
20
- <div>{{ info }}</div>
21
17
  <HelloWorld msg="Vite + Electron + Vue" />
22
18
  </template>
23
19
 
@@ -40,4 +36,20 @@ const info = os.platform() + ' ' + os.arch();
40
36
  .logo.vue:hover {
41
37
  filter: drop-shadow(0 0 2em #42b883aa);
42
38
  }
39
+
40
+ @keyframes logo-spin {
41
+ from {
42
+ transform: rotate(0deg);
43
+ }
44
+
45
+ to {
46
+ transform: rotate(360deg);
47
+ }
48
+ }
49
+
50
+ @media (prefers-reduced-motion: no-preference) {
51
+ a:nth-of-type(2) .logo {
52
+ animation: logo-spin infinite 20s linear;
53
+ }
54
+ }
43
55
  </style>
@@ -1,15 +1,21 @@
1
1
  <script setup lang="ts">
2
+ import os from 'node:os';
2
3
  import { ref } from 'vue';
3
4
 
4
5
  defineProps<{ msg: string }>();
5
6
 
6
7
  const count = ref(0);
8
+
9
+ const versions = ['chrome', 'node', 'electron']
10
+ .map(s => `${s}: ${process.versions[s]}`)
11
+ .concat(['platform: ' + os.platform() + ' ' + os.arch()]);
7
12
  </script>
8
13
 
9
14
  <template>
10
15
  <h1>{{ msg }}</h1>
11
16
 
12
17
  <div class="card">
18
+ <div style="margin-bottom: 1em">{{ versions.join(', ') }}</div>
13
19
  <button type="button" @click="count++">count is {{ count }}</button>
14
20
  <p>
15
21
  Edit
@@ -55,9 +55,9 @@ button:focus-visible {
55
55
  outline: 4px auto -webkit-focus-ring-color;
56
56
  }
57
57
 
58
- .card {
59
- padding: 2em;
60
- }
58
+ /* .card {
59
+ padding: 1em;
60
+ } */
61
61
 
62
62
  #app {
63
63
  max-width: 1280px;
@@ -1,22 +1,12 @@
1
- import { rmSync } from 'node:fs';
2
1
  import path from 'node:path';
3
2
  import { defineConfig } from 'vite';
4
- import electron from 'vite-plugin-electron';
5
- import { notBundle } from 'vite-plugin-electron/plugin';
6
3
  import renderer from 'vite-plugin-electron-renderer';
4
+ import electron from '@tomjs/vite-plugin-electron';
7
5
  import vue from '@vitejs/plugin-vue';
8
6
  import pkg from './package.json';
9
7
 
10
8
  // https://vitejs.dev/config/
11
- export default defineConfig(({ command }) => {
12
- ['main.js', 'main.js.map', 'preload.js'].forEach(s => {
13
- rmSync(`dist/${s}`, { recursive: true, force: true });
14
- });
15
-
16
- const isServe = command === 'serve';
17
- const isBuild = command === 'build';
18
- const sourcemap = isServe || !!process.env.VSCODE_DEBUG;
19
-
9
+ export default defineConfig(() => {
20
10
  process.env.APP_BUILD_TIME = Date.now() + '';
21
11
  process.env.APP_VERSION = pkg.version;
22
12
 
@@ -33,79 +23,18 @@ export default defineConfig(({ command }) => {
33
23
  },
34
24
  plugins: [
35
25
  vue(),
36
- electron([
37
- {
38
- // Main process entry file of the Electron App.
39
- onstart({ startup }) {
40
- if (process.env.VSCODE_DEBUG) {
41
- console.log(/* For `.vscode/.debug.script.mjs` */ '[startup] Electron App');
42
- } else {
43
- startup();
44
- }
45
- },
46
- vite: {
47
- build: {
48
- sourcemap,
49
- minify: isBuild,
50
- outDir: 'dist',
51
- emptyOutDir: false,
52
- lib: {
53
- entry: 'electron/main/index.ts',
54
- formats: ['cjs'],
55
- fileName: () => 'main.js',
56
- },
57
- rollupOptions: {
58
- // Some third-party Node.js libraries may not be built correctly by Vite, especially `C/C++` addons,
59
- // we can use `external` to exclude them to ensure they work correctly.
60
- // Others need to put them in `dependencies` to ensure they are collected into `app.asar` after the app is built.
61
- // Of course, this is not absolute, just this way is relatively simple. :)
62
- external: Object.keys('dependencies' in pkg ? pkg.dependencies : {}),
63
- },
64
- },
65
- plugins: [
66
- // This is just an option to improve build performance, it's non-deterministic!
67
- // e.g. `import log from 'electron-log'` -> `const log = require('electron-log')`
68
- isServe && notBundle(),
69
- ],
70
- },
26
+ electron({
27
+ main: {
28
+ entry: 'electron/main/index.ts',
71
29
  },
72
- {
73
- onstart({ reload }) {
74
- // Notify the Renderer process to reload the page when the Preload scripts build is complete,
75
- // instead of restarting the entire Electron App.
76
- reload();
77
- },
78
- vite: {
79
- build: {
80
- sourcemap: sourcemap ? 'inline' : undefined, // #332
81
- minify: isBuild,
82
- outDir: 'dist',
83
- emptyOutDir: false,
84
- lib: {
85
- entry: 'electron/preload/index.ts',
86
- formats: ['cjs'],
87
- fileName: () => 'preload.js',
88
- },
89
- rollupOptions: {
90
- external: Object.keys('dependencies' in pkg ? pkg.dependencies : {}),
91
- },
92
- },
93
- plugins: [isServe && notBundle()],
94
- },
30
+ preload: {
31
+ entry: 'electron/preload/index.ts',
95
32
  },
96
- ]),
33
+ }),
97
34
  // Use Node.js API in the Renderer process
98
35
  renderer(),
99
36
  ],
100
- server: process.env.VSCODE_DEBUG
101
- ? (() => {
102
- const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL);
103
- return {
104
- host: url.hostname,
105
- port: +url.port,
106
- };
107
- })()
108
- : {},
37
+ server: {},
109
38
  clearScreen: false,
110
39
  };
111
40
  });
@@ -57,8 +57,8 @@
57
57
  "@tomjs/commitlint": "^2.0.5",
58
58
  "@tomjs/eslint": "^1.1.1",
59
59
  "@tomjs/prettier": "^1.0.6",
60
- "@tomjs/stylelint": "^1.1.0",
61
- "@tomjs/tsconfig": "^1.0.8",
60
+ "@tomjs/stylelint": "^1.1.1",
61
+ "@tomjs/tsconfig": "^1.0.9",
62
62
  "@types/jest": "^29.5.11",
63
63
  "@types/node": "^18.19.3",
64
64
  "electron": "^28.0.0",
@@ -75,6 +75,6 @@
75
75
  "tsup": "^8.0.1",
76
76
  "tsx": "^4.6.2",
77
77
  "typescript": "~5.2.2",
78
- "vite": "^5.0.6"
78
+ "vite": "^5.0.7"
79
79
  }
80
80
  }
@@ -25,8 +25,8 @@
25
25
  "@tomjs/commitlint": "^2.0.5",
26
26
  "@tomjs/eslint": "^1.1.1",
27
27
  "@tomjs/prettier": "^1.0.6",
28
- "@tomjs/stylelint": "^1.1.0",
29
- "@tomjs/tsconfig": "^1.0.8",
28
+ "@tomjs/stylelint": "^1.1.1",
29
+ "@tomjs/tsconfig": "^1.0.9",
30
30
  "@types/node": "^18.19.3",
31
31
  "@types/react": "^18.2.42",
32
32
  "@types/react-dom": "^18.2.17",
@@ -38,6 +38,6 @@
38
38
  "prettier": "^3.1.0",
39
39
  "stylelint": "^15.11.0",
40
40
  "typescript": "~5.2.2",
41
- "vite": "^5.0.6"
41
+ "vite": "^5.0.7"
42
42
  }
43
43
  }
@@ -17,17 +17,17 @@
17
17
  "prepare": "husky install"
18
18
  },
19
19
  "dependencies": {
20
- "vue": "^3.3.10"
20
+ "vue": "^3.3.11"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@commitlint/cli": "^18.4.3",
24
24
  "@tomjs/commitlint": "^2.0.5",
25
25
  "@tomjs/eslint": "^1.1.1",
26
26
  "@tomjs/prettier": "^1.0.6",
27
- "@tomjs/stylelint": "^1.1.0",
28
- "@tomjs/tsconfig": "^1.0.8",
27
+ "@tomjs/stylelint": "^1.1.1",
28
+ "@tomjs/tsconfig": "^1.0.9",
29
29
  "@types/node": "^18.19.3",
30
- "@vitejs/plugin-vue": "^4.5.1",
30
+ "@vitejs/plugin-vue": "^4.5.2",
31
31
  "eslint": "^8.55.0",
32
32
  "husky": "^8.0.3",
33
33
  "lint-staged": "^15.2.0",
@@ -35,7 +35,7 @@
35
35
  "prettier": "^3.1.0",
36
36
  "stylelint": "^15.11.0",
37
37
  "typescript": "~5.2.2",
38
- "vite": "^5.0.6",
38
+ "vite": "^5.0.7",
39
39
  "vue-tsc": "^1.8.25"
40
40
  }
41
41
  }
@@ -1 +0,0 @@
1
- VITE_DEV_SERVER_URL=http://127.0.0.1:6888/
@@ -1,23 +0,0 @@
1
- import fs from 'node:fs'
2
- import path from 'node:path'
3
- import { fileURLToPath } from 'node:url'
4
- import { createRequire } from 'node:module'
5
- import { spawn } from 'node:child_process'
6
-
7
- const pkg = createRequire(import.meta.url)('../package.json')
8
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
9
-
10
- // write .debug.env
11
- const envContent = Object.entries(pkg.debug.env).map(([key, val]) => `${key}=${val}`)
12
- fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
13
-
14
- // bootstrap
15
- spawn(
16
- // TODO: terminate `npm run dev` when Debug exits.
17
- process.platform === 'win32' ? 'npm.cmd' : 'npm',
18
- ['run', 'dev'],
19
- {
20
- stdio: 'inherit',
21
- env: Object.assign(process.env, { VSCODE_DEBUG: 'true' }),
22
- },
23
- )
@@ -1,6 +0,0 @@
1
- {
2
- "recommendations": [
3
- "Vue.volar",
4
- "Vue.vscode-typescript-vue-plugin"
5
- ]
6
- }
@@ -1,53 +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
- "compounds": [
7
- {
8
- "name": "Debug App",
9
- "preLaunchTask": "Before Debug",
10
- "configurations": [
11
- "Debug Main Process",
12
- "Debug Renderer Process"
13
- ],
14
- "presentation": {
15
- "hidden": false,
16
- "group": "",
17
- "order": 1
18
- },
19
- "stopAll": true
20
- }
21
- ],
22
- "configurations": [
23
- {
24
- "name": "Debug Main Process",
25
- "type": "node",
26
- "request": "launch",
27
- "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
28
- "windows": {
29
- "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
30
- },
31
- "runtimeArgs": [
32
- "--remote-debugging-port=9229",
33
- "."
34
- ],
35
- "envFile": "${workspaceFolder}/.vscode/.debug.env",
36
- "console": "integratedTerminal"
37
- },
38
- {
39
- "name": "Debug Renderer Process",
40
- "port": 9229,
41
- "request": "attach",
42
- "type": "chrome",
43
- "timeout": 60000,
44
- "skipFiles": [
45
- "<node_internals>/**",
46
- "${workspaceRoot}/node_modules/**",
47
- "${workspaceRoot}/dist-electron/**",
48
- // Skip files in host(VITE_DEV_SERVER_URL)
49
- "http://127.0.0.1:6888/**"
50
- ]
51
- },
52
- ]
53
- }
@@ -1,13 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules/typescript/lib",
3
- "typescript.tsc.autoDetect": "off",
4
- "json.schemas": [
5
- {
6
- "fileMatch": [
7
- "/*electron-builder.json5",
8
- "/*electron-builder.json"
9
- ],
10
- "url": "https://json.schemastore.org/electron-builder"
11
- }
12
- ]
13
- }
@@ -1,31 +0,0 @@
1
- {
2
- // See https://go.microsoft.com/fwlink/?LinkId=733558
3
- // for the documentation about the tasks.json format
4
- "version": "2.0.0",
5
- "tasks": [
6
- {
7
- "label": "Before Debug",
8
- "type": "shell",
9
- "command": "node .vscode/.debug.script.mjs",
10
- "isBackground": true,
11
- "problemMatcher": {
12
- "owner": "typescript",
13
- "fileLocation": "relative",
14
- "pattern": {
15
- // TODO: correct "regexp"
16
- "regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
17
- "file": 1,
18
- "line": 3,
19
- "column": 4,
20
- "code": 5,
21
- "message": 6
22
- },
23
- "background": {
24
- "activeOnStart": true,
25
- "beginsPattern": "^.*VITE v.* ready in \\d* ms.*$",
26
- "endsPattern": "^.*\\[startup\\] Electron App.*$"
27
- }
28
- }
29
- }
30
- ]
31
- }
@@ -1,11 +0,0 @@
1
- /// <reference types="vite-plugin-electron/electron-env" />
2
-
3
- declare namespace NodeJS {
4
- interface ProcessEnv {
5
- VSCODE_DEBUG?: 'true';
6
- DIST_ELECTRON: string;
7
- DIST: string;
8
- /** /dist/ or /public/ */
9
- VITE_PUBLIC: string;
10
- }
11
- }
@@ -1 +0,0 @@
1
- VITE_DEV_SERVER_URL=http://127.0.0.1:6888/
@@ -1,23 +0,0 @@
1
- import fs from 'node:fs'
2
- import path from 'node:path'
3
- import { fileURLToPath } from 'node:url'
4
- import { createRequire } from 'node:module'
5
- import { spawn } from 'node:child_process'
6
-
7
- const pkg = createRequire(import.meta.url)('../package.json')
8
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
9
-
10
- // write .debug.env
11
- const envContent = Object.entries(pkg.debug.env).map(([key, val]) => `${key}=${val}`)
12
- fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
13
-
14
- // bootstrap
15
- spawn(
16
- // TODO: terminate `npm run dev` when Debug exits.
17
- process.platform === 'win32' ? 'npm.cmd' : 'npm',
18
- ['run', 'dev'],
19
- {
20
- stdio: 'inherit',
21
- env: Object.assign(process.env, { VSCODE_DEBUG: 'true' }),
22
- },
23
- )
@@ -1,6 +0,0 @@
1
- {
2
- "recommendations": [
3
- "Vue.volar",
4
- "Vue.vscode-typescript-vue-plugin"
5
- ]
6
- }