@tomjs/create-app 1.3.2 → 1.5.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/package.json +12 -12
- package/templates/base/core/package.json +4 -4
- package/templates/base/electron/package.json +1 -1
- package/templates/base/node/README.md +1 -1
- package/templates/base/node/README.zh_CN.md +1 -1
- package/templates/base/node/package.json +5 -4
- package/templates/base/react/package.json +1 -1
- package/templates/base/style/package.json +1 -1
- package/templates/base/vscode/.vscode/launch.json +1 -1
- package/templates/base/vscode/.vscode/settings.json +8 -1
- package/templates/base/vscode/package.json +5 -5
- package/templates/base/vscode/tsconfig.node.json +1 -1
- package/templates/base/vue/package.json +3 -3
- package/templates/node-cli/package.json +1 -1
- package/templates/node-cli-legacy/package.json +2 -2
- package/templates/node-vite-plugin/package.json +1 -1
- package/templates/vscode/.vscode/settings.json +8 -1
- package/templates/vscode/package.json +3 -3
- package/templates/vscode/tsconfig.json +1 -1
- package/templates/vscode-react/index.html +0 -1
- package/templates/vscode-vue/index.html +0 -1
- package/templates/vscode-vue/package.json +3 -0
- package/templates/vue/electron/main/index.ts +0 -123
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomjs/create-app",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"description": "create tomjs web app",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tomjs",
|
|
@@ -43,25 +43,25 @@
|
|
|
43
43
|
"registry": "https://registry.npmjs.org"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@tomjs/logger": "^1.1.
|
|
47
|
-
"@tomjs/node": "^2.2.
|
|
46
|
+
"@tomjs/logger": "^1.1.2",
|
|
47
|
+
"@tomjs/node": "^2.2.1",
|
|
48
48
|
"chalk": "^5.3.0",
|
|
49
49
|
"dayjs": "^1.11.11",
|
|
50
|
-
"execa": "^9.
|
|
51
|
-
"inquirer": "^9.2
|
|
50
|
+
"execa": "^9.3.0",
|
|
51
|
+
"inquirer": "^9.3.2",
|
|
52
52
|
"lodash-es": "^4.17.21",
|
|
53
53
|
"meow": "^13.2.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@commitlint/cli": "^19.3.0",
|
|
57
57
|
"@tomjs/commitlint": "^3.3.0",
|
|
58
|
-
"@tomjs/eslint": "^3.
|
|
58
|
+
"@tomjs/eslint": "^3.3.0",
|
|
59
59
|
"@tomjs/prettier": "^1.4.1",
|
|
60
|
-
"@tomjs/stylelint": "^2.
|
|
61
|
-
"@tomjs/tsconfig": "^1.
|
|
60
|
+
"@tomjs/stylelint": "^2.6.1",
|
|
61
|
+
"@tomjs/tsconfig": "^1.7.0",
|
|
62
62
|
"@types/inquirer": "^9.0.7",
|
|
63
63
|
"@types/lodash-es": "^4.17.12",
|
|
64
|
-
"@types/node": "^18.19.
|
|
64
|
+
"@types/node": "^18.19.39",
|
|
65
65
|
"@types/prompts": "^2.4.9",
|
|
66
66
|
"cross-env": "^7.0.3",
|
|
67
67
|
"dotenv": "^16.4.5",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"prettier": "^3.3.2",
|
|
73
73
|
"stylelint": "^16.6.1",
|
|
74
74
|
"tsup": "^8.1.0",
|
|
75
|
-
"tsx": "^4.
|
|
76
|
-
"type-fest": "^4.20.
|
|
77
|
-
"typescript": "~5.
|
|
75
|
+
"tsx": "^4.16.0",
|
|
76
|
+
"type-fest": "^4.20.1",
|
|
77
|
+
"typescript": "~5.5.2"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"dev": "tsup --watch",
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@commitlint/cli": "^19.3.0",
|
|
17
17
|
"@tomjs/commitlint": "^3.3.0",
|
|
18
|
-
"@tomjs/eslint": "^3.
|
|
18
|
+
"@tomjs/eslint": "^3.3.0",
|
|
19
19
|
"@tomjs/prettier": "^1.4.1",
|
|
20
|
-
"@tomjs/tsconfig": "^1.
|
|
21
|
-
"@types/node": "^18.19.
|
|
20
|
+
"@tomjs/tsconfig": "^1.7.0",
|
|
21
|
+
"@types/node": "^18.19.39",
|
|
22
22
|
"eslint": "^8.57.0",
|
|
23
23
|
"husky": "^9.0.11",
|
|
24
24
|
"lint-staged": "^15.2.7",
|
|
25
25
|
"npm-run-all": "^4.1.5",
|
|
26
26
|
"prettier": "^3.3.2",
|
|
27
27
|
"rimraf": "^5.0.7",
|
|
28
|
-
"typescript": "~5.
|
|
28
|
+
"typescript": "~5.5.2"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{pkgName}}
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/{{pkgName}})  
|
|
3
|
+
[](https://www.npmjs.com/package/{{pkgName}})  
|
|
4
4
|
|
|
5
5
|
**English** | [中文](./README.zh_CN.md)
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{pkgName}}
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/{{pkgName}})  
|
|
3
|
+
[](https://www.npmjs.com/package/{{pkgName}})  
|
|
4
4
|
|
|
5
5
|
[English](./README.md) | **中文**
|
|
6
6
|
|
|
@@ -33,14 +33,15 @@
|
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"lint:eslint": "eslint \"{src,test}/**/*.ts\" *.{js,cjs,mjs,ts} --fix --cache",
|
|
36
|
-
"test": "vitest"
|
|
36
|
+
"test": "vitest",
|
|
37
|
+
"prepublishOnly": "pnpm build"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@tomjs/node": "^2.2.
|
|
40
|
+
"@tomjs/node": "^2.2.1"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"tsx": "^4.
|
|
43
|
-
"type-fest": "^4.20.
|
|
43
|
+
"tsx": "^4.16.0",
|
|
44
|
+
"type-fest": "^4.20.1",
|
|
44
45
|
"vitest": "^1.6.0"
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"i18n-ally.localesPaths": ["locales"]
|
|
2
|
+
"i18n-ally.localesPaths": ["locales"],
|
|
3
|
+
"i18n-ally.sourceLanguage": "zh-CN",
|
|
4
|
+
"i18n-ally.displayLanguage": "zh-CN",
|
|
5
|
+
"i18n-ally.keepFulfilled": true,
|
|
6
|
+
"i18n-ally.keystyle": "flat",
|
|
7
|
+
"i18n-ally.sortKeys": true,
|
|
8
|
+
"i18n-ally.translate.promptSource": true,
|
|
9
|
+
"i18n-ally.translate.saveAsCandidates": true
|
|
3
10
|
}
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"lint:eslint": "eslint \"{src,extension}/**/*.{js,cjs,ts,tsx}\" *.{js,cjs,ts} --fix --cache"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@tomjs/node": "^2.2.
|
|
57
|
-
"@tomjs/vscode": "^2.4.
|
|
56
|
+
"@tomjs/node": "^2.2.1",
|
|
57
|
+
"@tomjs/vscode": "^2.4.2",
|
|
58
58
|
"@vscode/webview-ui-toolkit": "^1.4.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@tomjs/vite-plugin-vscode": "^2.3
|
|
62
|
-
"@tomjs/vscode-dev": "^
|
|
61
|
+
"@tomjs/vite-plugin-vscode": "^2.5.3",
|
|
62
|
+
"@tomjs/vscode-dev": "^3.0.2",
|
|
63
63
|
"@types/vscode": "^1.56.0",
|
|
64
64
|
"@types/vscode-webview": "^1.57.5",
|
|
65
|
-
"vite": "^5.3.
|
|
65
|
+
"vite": "^5.3.2"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
"lint:stylelint": "stylelint \"src/**/*.{css,less,scss,html,vue}\" *.html --fix --cache"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"vue": "^3.4.
|
|
10
|
+
"vue": "^3.4.31"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@vitejs/plugin-vue": "^5.0.5",
|
|
14
|
-
"vite": "^5.3.
|
|
15
|
-
"vue-tsc": "^2.0.
|
|
14
|
+
"vite": "^5.3.2",
|
|
15
|
+
"vue-tsc": "^2.0.24"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"i18n-ally.localesPaths": ["locales"]
|
|
2
|
+
"i18n-ally.localesPaths": ["locales"],
|
|
3
|
+
"i18n-ally.sourceLanguage": "zh-CN",
|
|
4
|
+
"i18n-ally.displayLanguage": "zh-CN",
|
|
5
|
+
"i18n-ally.keepFulfilled": true,
|
|
6
|
+
"i18n-ally.keystyle": "flat",
|
|
7
|
+
"i18n-ally.sortKeys": true,
|
|
8
|
+
"i18n-ally.translate.promptSource": true,
|
|
9
|
+
"i18n-ally.translate.saveAsCandidates": true
|
|
3
10
|
}
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"build": "vscode-dev && tsup --minify"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@tomjs/node": "^2.2.
|
|
49
|
-
"@tomjs/vscode": "^2.4.
|
|
48
|
+
"@tomjs/node": "^2.2.1",
|
|
49
|
+
"@tomjs/vscode": "^2.4.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@tomjs/vscode-dev": "^
|
|
52
|
+
"@tomjs/vscode-dev": "^3.0.2",
|
|
53
53
|
"@types/vscode": "^1.56.0",
|
|
54
54
|
"tsup": "^8.1.0"
|
|
55
55
|
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import '../polyfills';
|
|
2
|
-
|
|
3
|
-
import { release } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { app, BrowserWindow, ipcMain, shell } from 'electron';
|
|
6
|
-
|
|
7
|
-
// Disable GPU Acceleration for Windows 7
|
|
8
|
-
if (release().startsWith('6.1')) app.disableHardwareAcceleration();
|
|
9
|
-
|
|
10
|
-
// Set application name for Windows 10+ notifications
|
|
11
|
-
if (process.platform === 'win32') app.setAppUserModelId(app.getName());
|
|
12
|
-
|
|
13
|
-
if (!app.requestSingleInstanceLock()) {
|
|
14
|
-
app.quit();
|
|
15
|
-
process.exit(0);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Remove electron security warnings
|
|
19
|
-
// This warning only shows in development mode
|
|
20
|
-
// Read more on https://www.electronjs.org/docs/latest/tutorial/security
|
|
21
|
-
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
|
22
|
-
|
|
23
|
-
const isDev = process.env.NODE_ENV === 'development';
|
|
24
|
-
|
|
25
|
-
let win: BrowserWindow | null = null;
|
|
26
|
-
// package.json "type":"module", must use mjs extension
|
|
27
|
-
const preload = join(__dirname, '../preload/index.mjs');
|
|
28
|
-
const serverUrl = process.env.VITE_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() {
|
|
34
|
-
win = new BrowserWindow({
|
|
35
|
-
title: 'Main window',
|
|
36
|
-
width: 800,
|
|
37
|
-
height: 700,
|
|
38
|
-
icon: join(publicPath, 'img/icon.png'),
|
|
39
|
-
webPreferences: {
|
|
40
|
-
preload,
|
|
41
|
-
// Warning: Enable nodeIntegration and disable contextIsolation is not secure in production
|
|
42
|
-
// Consider using contextBridge.exposeInMainWorld
|
|
43
|
-
// Read more on https://www.electronjs.org/docs/latest/tutorial/context-isolation
|
|
44
|
-
nodeIntegration: true,
|
|
45
|
-
contextIsolation: false,
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (isDev) {
|
|
50
|
-
win.loadURL(serverUrl);
|
|
51
|
-
// Open devTool if the app is not packaged
|
|
52
|
-
win.webContents.openDevTools();
|
|
53
|
-
} else {
|
|
54
|
-
win.loadFile(indexHtml);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Test actively push message to the Electron-Renderer
|
|
58
|
-
win.webContents.on('did-finish-load', () => {
|
|
59
|
-
win?.webContents.send('main-process-message', new Date().toLocaleString());
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Make all links open with the browser, not with the application
|
|
63
|
-
win.webContents.setWindowOpenHandler(({ url }) => {
|
|
64
|
-
if (url.startsWith('https:')) shell.openExternal(url);
|
|
65
|
-
return { action: 'deny' };
|
|
66
|
-
});
|
|
67
|
-
// win.webContents.on('will-navigate', (event, url) => { }) #344
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
app.whenReady().then(async () => {
|
|
71
|
-
createWindow();
|
|
72
|
-
|
|
73
|
-
if (isDev) {
|
|
74
|
-
const { installExtension, VUEJS_DEVTOOLS } = await import('@tomjs/electron-devtools-installer');
|
|
75
|
-
|
|
76
|
-
installExtension(VUEJS_DEVTOOLS)
|
|
77
|
-
.then(ext => {
|
|
78
|
-
console.log('Added Extension: ', ext.name);
|
|
79
|
-
})
|
|
80
|
-
.catch(() => {
|
|
81
|
-
console.log('Failed to install extensions');
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
app.on('window-all-closed', () => {
|
|
87
|
-
win = null;
|
|
88
|
-
if (process.platform !== 'darwin') app.quit();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
app.on('second-instance', () => {
|
|
92
|
-
if (win) {
|
|
93
|
-
// Focus on the main window if the user tried to open another
|
|
94
|
-
if (win.isMinimized()) win.restore();
|
|
95
|
-
win.focus();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
app.on('activate', () => {
|
|
100
|
-
const allWindows = BrowserWindow.getAllWindows();
|
|
101
|
-
if (allWindows.length) {
|
|
102
|
-
allWindows[0].focus();
|
|
103
|
-
} else {
|
|
104
|
-
createWindow();
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// New window example arg: new windows url
|
|
109
|
-
ipcMain.handle('open-win', (_, arg) => {
|
|
110
|
-
const childWindow = new BrowserWindow({
|
|
111
|
-
webPreferences: {
|
|
112
|
-
preload,
|
|
113
|
-
nodeIntegration: true,
|
|
114
|
-
contextIsolation: false,
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
if (serverUrl) {
|
|
119
|
-
childWindow.loadURL(`${serverUrl}#${arg}`);
|
|
120
|
-
} else {
|
|
121
|
-
childWindow.loadFile(indexHtml, { hash: arg });
|
|
122
|
-
}
|
|
123
|
-
});
|