@tomjs/create-app 0.4.6 → 0.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomjs/create-app",
3
- "version": "0.4.6",
3
+ "version": "0.5.1",
4
4
  "description": "create tomjs web app",
5
5
  "keywords": [
6
6
  "tomjs",
@@ -56,3 +56,4 @@ tsconfig.tsbuildinfo
56
56
  # build output
57
57
  build
58
58
  dist
59
+ release
@@ -5,7 +5,8 @@
5
5
  "version": "0.2.0",
6
6
  "configurations": [
7
7
  {
8
- "name": "Main Debug",
8
+ "name": "Debug Main Process",
9
+ "preLaunchTask": "npm:debug",
9
10
  "type": "node",
10
11
  "request": "launch",
11
12
  "cwd": "${workspaceFolder}",
@@ -14,11 +15,15 @@
14
15
  "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
15
16
  },
16
17
  "args": [
17
- "."
18
+ ".",
18
19
  ],
19
- "envFile": "${workspaceFolder}/node_modules/@tomjs/vite-plugin-electron/debug/.env",
20
- "outputCapture": "std",
21
- "console": "integratedTerminal"
20
+ "outFiles": [
21
+ "${workspaceFolder}/**/*.js",
22
+ "${workspaceFolder}/**/*.cjs",
23
+ "${workspaceFolder}/**/*.mjs",
24
+ "!**/node_modules/**"
25
+ ],
26
+ "envFile": "${workspaceFolder}/node_modules/@tomjs/vite-plugin-electron/debug/.env"
22
27
  },
23
28
  ]
24
29
  }
@@ -0,0 +1,31 @@
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": "npm:debug",
8
+ "type": "npm",
9
+ "script": "debug",
10
+ "detail": "cross-env VITE_ELECTRON_DEBUG=1 vite",
11
+ "isBackground": true,
12
+ "problemMatcher": {
13
+ "owner": "typescript",
14
+ "fileLocation": "relative",
15
+ "pattern": {
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": "^.*\\[@tomjs:electron\\] startup electron*$"
27
+ }
28
+ }
29
+ }
30
+ ]
31
+ }
@@ -8,11 +8,13 @@ vite + electron + react
8
8
 
9
9
  ```
10
10
  |--electron
11
- | |--main
11
+ | |--main // main process code
12
12
  | | |--index.ts
13
- | |--preload
13
+ | |--preload // preload process code
14
14
  | | |--index.ts
15
- |--src
15
+ | |--build // electron-builder resources for electron package
16
+ | | |--icons
17
+ |--src // front-end code
16
18
  | |--App.tsx
17
19
  | |--main.ts
18
20
  ```
@@ -3,8 +3,6 @@ import { join } from 'node:path';
3
3
  import { app, BrowserWindow, ipcMain, shell } from 'electron';
4
4
  import '../polyfills';
5
5
 
6
- const isDev = process.env.NODE_ENV === 'development';
7
-
8
6
  // Disable GPU Acceleration for Windows 7
9
7
  if (release().startsWith('6.1')) app.disableHardwareAcceleration();
10
8
 
@@ -21,6 +19,8 @@ if (!app.requestSingleInstanceLock()) {
21
19
  // Read more on https://www.electronjs.org/docs/latest/tutorial/security
22
20
  process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
23
21
 
22
+ const isDev = process.env.NODE_ENV === 'development';
23
+
24
24
  let win: BrowserWindow | null = null;
25
25
  // package.json "type":"module", must use mjs extension
26
26
  const preload = join(__dirname, '../preload/index.mjs');
@@ -9,8 +9,9 @@
9
9
  "main": "dist/main/index.mjs",
10
10
  "scripts": {
11
11
  "dev": "vite",
12
- "build": "npm run clean && vite build && npm run release",
13
- "release": "tsx ./scripts/release.ts",
12
+ "debug": "cross-env VITE_ELECTRON_DEBUG=1 npm run dev",
13
+ "build": "npm run clean && vite build",
14
+ "build:pack": "cross-env VITE_ELECTRON_BUILDER=1 npm run build",
14
15
  "clean": "rimraf ./dist",
15
16
  "lint": "run-s lint:eslint lint:stylelint lint:prettier",
16
17
  "lint:eslint": "eslint \"{src,electron,scripts}/**/*.{ts,tsx}\" *.{js,cjs,ts} --fix --cache",
@@ -30,11 +31,10 @@
30
31
  "@tomjs/prettier": "^1.0.6",
31
32
  "@tomjs/stylelint": "^1.1.1",
32
33
  "@tomjs/tsconfig": "^1.1.2",
33
- "@tomjs/vite-plugin-electron": "^1.3.8",
34
+ "@tomjs/vite-plugin-electron": "^1.6.0",
34
35
  "@types/node": "^18.19.3",
35
- "@types/react": "^18.2.43",
36
+ "@types/react": "^18.2.45",
36
37
  "@types/react-dom": "^18.2.17",
37
- "@types/shelljs": "^0.8.15",
38
38
  "@vitejs/plugin-react-swc": "^3.5.0",
39
39
  "electron": "^28.0.0",
40
40
  "electron-builder": "^24.9.1",
@@ -44,11 +44,10 @@
44
44
  "npm-run-all": "^4.1.5",
45
45
  "prettier": "^3.1.1",
46
46
  "rimraf": "^5.0.5",
47
- "shelljs": "^0.8.5",
48
47
  "stylelint": "^15.11.0",
49
48
  "tsx": "^4.6.2",
50
49
  "typescript": "~5.2.2",
51
- "vite": "^5.0.7",
50
+ "vite": "^5.0.8",
52
51
  "vite-plugin-electron-renderer": "^0.14.5"
53
52
  }
54
53
  }
@@ -5,7 +5,8 @@
5
5
  "version": "0.2.0",
6
6
  "configurations": [
7
7
  {
8
- "name": "Main Debug",
8
+ "name": "Debug Main Process",
9
+ "preLaunchTask": "npm:debug",
9
10
  "type": "node",
10
11
  "request": "launch",
11
12
  "cwd": "${workspaceFolder}",
@@ -14,11 +15,15 @@
14
15
  "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
15
16
  },
16
17
  "args": [
17
- "."
18
+ ".",
18
19
  ],
19
- "envFile": "${workspaceFolder}/node_modules/@tomjs/vite-plugin-electron/debug/.env",
20
- "outputCapture": "std",
21
- "console": "integratedTerminal"
20
+ "outFiles": [
21
+ "${workspaceFolder}/**/*.js",
22
+ "${workspaceFolder}/**/*.cjs",
23
+ "${workspaceFolder}/**/*.mjs",
24
+ "!**/node_modules/**"
25
+ ],
26
+ "envFile": "${workspaceFolder}/node_modules/@tomjs/vite-plugin-electron/debug/.env"
22
27
  },
23
28
  ]
24
29
  }
@@ -0,0 +1,31 @@
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": "npm:debug",
8
+ "type": "npm",
9
+ "script": "debug",
10
+ "detail": "cross-env VITE_ELECTRON_DEBUG=1 vite",
11
+ "isBackground": true,
12
+ "problemMatcher": {
13
+ "owner": "typescript",
14
+ "fileLocation": "relative",
15
+ "pattern": {
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": "^.*\\[@tomjs:electron\\] startup electron*$"
27
+ }
28
+ }
29
+ }
30
+ ]
31
+ }
@@ -8,11 +8,13 @@ vite + electron + vue
8
8
 
9
9
  ```
10
10
  |--electron
11
- | |--main
11
+ | |--main // main process code
12
12
  | | |--index.ts
13
- | |--preload
13
+ | |--preload // preload process code
14
14
  | | |--index.ts
15
- |--src
15
+ | |--build // electron-builder resources for electron package
16
+ | | |--icons
17
+ |--src // front-end code
16
18
  | |--App.vue
17
19
  | |--main.ts
18
20
  ```
@@ -3,8 +3,6 @@ import { join } from 'node:path';
3
3
  import { app, BrowserWindow, ipcMain, shell } from 'electron';
4
4
  import '../polyfills';
5
5
 
6
- const isDev = process.env.NODE_ENV === 'development';
7
-
8
6
  // Disable GPU Acceleration for Windows 7
9
7
  if (release().startsWith('6.1')) app.disableHardwareAcceleration();
10
8
 
@@ -21,6 +19,8 @@ if (!app.requestSingleInstanceLock()) {
21
19
  // Read more on https://www.electronjs.org/docs/latest/tutorial/security
22
20
  process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
23
21
 
22
+ const isDev = process.env.NODE_ENV === 'development';
23
+
24
24
  let win: BrowserWindow | null = null;
25
25
  // package.json "type":"module", must use mjs extension
26
26
  const preload = join(__dirname, '../preload/index.mjs');
@@ -70,16 +70,11 @@ app.whenReady().then(async () => {
70
70
  createWindow();
71
71
 
72
72
  if (isDev) {
73
- const { installExtension, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } = await import(
74
- '@tomjs/electron-devtools-installer'
75
- );
76
-
77
- installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS])
78
- .then(exts => {
79
- console.log(
80
- 'Added Extension: ',
81
- exts.map(s => s.name),
82
- );
73
+ const { installExtension, VUEJS_DEVTOOLS } = await import('@tomjs/electron-devtools-installer');
74
+
75
+ installExtension(VUEJS_DEVTOOLS)
76
+ .then(ext => {
77
+ console.log('Added Extension: ', ext.name);
83
78
  })
84
79
  .catch(() => {
85
80
  console.log('Failed to install extensions');
@@ -9,8 +9,9 @@
9
9
  "main": "dist/main/index.mjs",
10
10
  "scripts": {
11
11
  "dev": "vite",
12
- "build": "npm run clean && vue-tsc --noEmit && vite build && npm run release",
13
- "release": "tsx ./scripts/release.ts",
12
+ "debug": "cross-env VITE_ELECTRON_DEBUG=1 npm run dev",
13
+ "build": "npm run clean && vue-tsc --noEmit && vite build",
14
+ "build:pack": "cross-env VITE_ELECTRON_BUILDER=1 npm run build",
14
15
  "clean": "rimraf ./dist",
15
16
  "lint": "run-s lint:eslint lint:stylelint lint:prettier",
16
17
  "lint:eslint": "eslint \"{src,electron,scripts}/**/*.{js,cjs,ts,vue}\" *.{js,cjs,ts} --fix --cache",
@@ -29,9 +30,8 @@
29
30
  "@tomjs/prettier": "^1.0.6",
30
31
  "@tomjs/stylelint": "^1.1.1",
31
32
  "@tomjs/tsconfig": "^1.1.2",
32
- "@tomjs/vite-plugin-electron": "^1.3.8",
33
+ "@tomjs/vite-plugin-electron": "^1.6.0",
33
34
  "@types/node": "^18.19.3",
34
- "@types/shelljs": "^0.8.15",
35
35
  "@vitejs/plugin-vue": "^4.5.2",
36
36
  "electron": "^28.0.0",
37
37
  "electron-builder": "^24.9.1",
@@ -41,11 +41,10 @@
41
41
  "npm-run-all": "^4.1.5",
42
42
  "prettier": "^3.1.1",
43
43
  "rimraf": "^5.0.5",
44
- "shelljs": "^0.8.5",
45
44
  "stylelint": "^15.11.0",
46
45
  "tsx": "^4.6.2",
47
46
  "typescript": "~5.2.2",
48
- "vite": "^5.0.7",
47
+ "vite": "^5.0.8",
49
48
  "vite-plugin-electron-renderer": "^0.14.5",
50
49
  "vue-tsc": "^1.8.25"
51
50
  }
@@ -74,6 +74,6 @@
74
74
  "tsup": "^8.0.1",
75
75
  "tsx": "^4.6.2",
76
76
  "typescript": "~5.2.2",
77
- "vite": "^5.0.7"
77
+ "vite": "^5.0.8"
78
78
  }
79
79
  }
@@ -28,7 +28,7 @@
28
28
  "@tomjs/stylelint": "^1.1.1",
29
29
  "@tomjs/tsconfig": "^1.1.2",
30
30
  "@types/node": "^18.19.3",
31
- "@types/react": "^18.2.43",
31
+ "@types/react": "^18.2.45",
32
32
  "@types/react-dom": "^18.2.17",
33
33
  "@vitejs/plugin-react-swc": "^3.5.0",
34
34
  "eslint": "^8.55.0",
@@ -38,6 +38,6 @@
38
38
  "prettier": "^3.1.1",
39
39
  "stylelint": "^15.11.0",
40
40
  "typescript": "~5.2.2",
41
- "vite": "^5.0.7"
41
+ "vite": "^5.0.8"
42
42
  }
43
43
  }
@@ -35,7 +35,7 @@
35
35
  "prettier": "^3.1.1",
36
36
  "stylelint": "^15.11.0",
37
37
  "typescript": "~5.2.2",
38
- "vite": "^5.0.7",
38
+ "vite": "^5.0.8",
39
39
  "vue-tsc": "^1.8.25"
40
40
  }
41
41
  }