@tomjs/create-app 1.0.0-alpha.1 → 1.0.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/dist/index.js +8 -7
- package/package.json +11 -11
- package/templates/base/core/.commitlintrc.cjs +3 -0
- package/templates/base/core/.editorconfig +15 -0
- package/templates/base/core/.eslintignore +14 -0
- package/templates/base/core/.gitattributes +203 -0
- package/templates/base/core/.husky/commit-msg +1 -0
- package/templates/base/core/.husky/pre-commit +1 -0
- package/templates/base/core/.prettierignore +17 -0
- package/templates/base/core/.prettierrc.cjs +1 -0
- package/templates/base/core/_eslintrc.cjs +7 -0
- package/templates/base/core/_gitignore +60 -0
- package/templates/base/core/_lintstagedrc.cjs +4 -0
- package/templates/base/core/package.json +30 -0
- package/templates/base/electron/.vscode/launch.json +28 -0
- package/templates/base/electron/.vscode/tasks.json +37 -0
- package/templates/base/electron/electron/env.d.ts +1 -0
- package/templates/base/electron/electron/main/index.ts +111 -0
- package/templates/base/electron/electron/polyfills.ts +4 -0
- package/templates/base/electron/electron/preload/index.ts +1 -0
- package/templates/base/electron/package.json +25 -0
- package/templates/base/electron/tsconfig.node.json +7 -0
- package/templates/base/node/LICENSE +21 -0
- package/templates/base/node/README.md +13 -0
- package/templates/base/node/README.zh_CN.md +13 -0
- package/templates/base/node/package.json +46 -0
- package/templates/base/node/test/index.test.ts +7 -0
- package/templates/base/react/_eslintrc.cjs +7 -0
- package/templates/base/react/_lintstagedrc.cjs +6 -0
- package/templates/base/react/package.json +19 -0
- package/templates/base/react/tsconfig.json +5 -0
- package/templates/base/react/tsconfig.node.json +7 -0
- package/templates/base/style/.stylelintignore +16 -0
- package/templates/base/style/.stylelintrc.cjs +3 -0
- package/templates/base/style/_lintstagedrc.cjs +5 -0
- package/templates/base/style/package.json +10 -0
- package/templates/base/vscode/.vscode/extensions.json +5 -0
- package/templates/base/vscode/.vscode/launch.json +21 -0
- package/templates/base/vscode/.vscode/settings.json +3 -0
- package/templates/base/vscode/.vscode/tasks.json +36 -0
- package/templates/base/vscode/.vscodeignore +73 -0
- package/templates/base/vscode/LICENSE +21 -0
- package/templates/base/vscode/_gitignore +63 -0
- package/templates/base/vscode/extension/env.d.ts +1 -0
- package/templates/base/vscode/extension/index.ts +21 -0
- package/templates/base/vscode/extension/views/helper.ts +27 -0
- package/templates/base/vscode/extension/views/panel.ts +48 -0
- package/templates/base/vscode/locales/en.json +6 -0
- package/templates/base/vscode/locales/zh-CN.json +5 -0
- package/templates/base/vscode/locales/zh-TW.json +5 -0
- package/templates/base/vscode/package.json +70 -0
- package/templates/base/vscode/resources/logo.png +0 -0
- package/templates/base/vscode/tsconfig.node.json +7 -0
- package/templates/base/vue/_eslintrc.cjs +7 -0
- package/templates/base/vue/_lintstagedrc.cjs +6 -0
- package/templates/base/vue/package.json +17 -0
- package/templates/base/vue/tsconfig.json +5 -0
- package/templates/base/vue/tsconfig.node.json +7 -0
- package/templates/config.json +105 -0
- package/templates/electron-react/README.md +3 -0
- package/templates/electron-react/electron/main/index.ts +128 -0
- package/templates/electron-react/index.html +15 -0
- package/templates/electron-react/package.json +26 -0
- package/templates/electron-react/public/img/icon.png +0 -0
- package/templates/electron-react/public/vite.svg +1 -0
- package/templates/electron-react/src/App.css +45 -0
- package/templates/electron-react/src/App.tsx +42 -0
- package/templates/electron-react/src/assets/electron.svg +10 -0
- package/templates/electron-react/src/assets/react.svg +1 -0
- package/templates/electron-react/src/index.css +69 -0
- package/templates/electron-react/src/main.tsx +11 -0
- package/templates/electron-react/src/vite-env.d.ts +1 -0
- package/templates/electron-react/vite.config.ts +27 -0
- package/templates/electron-vue/README.md +3 -0
- package/templates/electron-vue/electron/main/index.ts +123 -0
- package/templates/electron-vue/package.json +6 -0
- package/templates/electron-vue/public/img/icon.png +0 -0
- package/templates/electron-vue/public/vite.svg +1 -0
- package/templates/electron-vue/src/App.vue +55 -0
- package/templates/electron-vue/src/assets/electron.svg +10 -0
- package/templates/electron-vue/src/assets/vue.svg +1 -0
- package/templates/electron-vue/src/components/HelloWorld.vue +43 -0
- package/templates/electron-vue/src/main.ts +6 -0
- package/templates/electron-vue/src/style.css +80 -0
- package/templates/electron-vue/src/vite-env.d.ts +1 -0
- package/templates/electron-vue/vite.config.ts +26 -0
- package/templates/node/package.json +12 -0
- package/templates/node/src/index.ts +3 -0
- package/templates/node/tsconfig.json +4 -0
- package/templates/node/tsup.config.ts +19 -0
- package/templates/node-cli/.vscode/launch.json +23 -0
- package/templates/node-cli/index.d.ts +5 -0
- package/templates/node-cli/package.json +33 -0
- package/templates/node-cli/src/cli.ts +68 -0
- package/templates/node-cli/src/config.ts +28 -0
- package/templates/node-cli/src/constants.ts +1 -0
- package/templates/node-cli/src/index.ts +3 -0
- package/templates/node-cli/src/types.ts +1 -0
- package/templates/node-cli/tsconfig.json +4 -0
- package/templates/node-cli/tsup.config.ts +18 -0
- package/templates/node-cli/xxx.config.cjs +0 -0
- package/templates/node-cli-legacy/.vscode/launch.json +23 -0
- package/templates/node-cli-legacy/index.d.ts +5 -0
- package/templates/node-cli-legacy/package.json +31 -0
- package/templates/node-cli-legacy/src/cli.ts +45 -0
- package/templates/node-cli-legacy/src/config.ts +28 -0
- package/templates/node-cli-legacy/src/index.ts +3 -0
- package/templates/node-cli-legacy/src/types.ts +1 -0
- package/templates/node-cli-legacy/src/utils.ts +5 -0
- package/templates/node-cli-legacy/tsconfig.json +4 -0
- package/templates/node-cli-legacy/tsup.config.ts +18 -0
- package/templates/node-cli-legacy/xxx.config.cjs +0 -0
- package/templates/node-vite-plugin/package.json +19 -0
- package/templates/node-vite-plugin/src/index.ts +10 -0
- package/templates/node-vite-plugin/src/types.ts +1 -0
- package/templates/node-vite-plugin/test/index.test.ts +7 -0
- package/templates/node-vite-plugin/tsconfig.json +4 -0
- package/templates/node-vite-plugin/tsup.config.ts +18 -0
- package/templates/node-workspaces/package.json +10 -0
- package/templates/react/index.html +14 -0
- package/templates/react/package.json +12 -0
- package/templates/react/public/vite.svg +1 -0
- package/templates/react/src/App.css +42 -0
- package/templates/react/src/App.tsx +32 -0
- package/templates/react/src/assets/react.svg +1 -0
- package/templates/react/src/index.css +69 -0
- package/templates/react/src/main.tsx +11 -0
- package/templates/react/src/vite-env.d.ts +1 -0
- package/templates/react/vite.config.ts +7 -0
- package/templates/schema.json +110 -0
- package/templates/vscode/.vscode/extensions.json +5 -0
- package/templates/vscode/.vscode/launch.json +21 -0
- package/templates/vscode/.vscode/settings.json +3 -0
- package/templates/vscode/.vscode/tasks.json +36 -0
- package/templates/vscode/.vscodeignore +72 -0
- package/templates/vscode/LICENSE +21 -0
- package/templates/vscode/README.md +3 -0
- package/templates/vscode/_gitignore +63 -0
- package/templates/vscode/locales/en.json +5 -0
- package/templates/vscode/locales/zh-CN.json +5 -0
- package/templates/vscode/locales/zh-TW.json +5 -0
- package/templates/vscode/package.json +57 -0
- package/templates/vscode/resources/logo.png +0 -0
- package/templates/vscode/src/index.ts +15 -0
- package/templates/vscode/tsconfig.json +5 -0
- package/templates/vscode/tsup.config.ts +13 -0
- package/templates/vscode-react/README.md +3 -0
- package/templates/vscode-react/index.html +14 -0
- package/templates/vscode-react/package.json +1 -0
- package/templates/vscode-react/src/App.css +7 -0
- package/templates/vscode-react/src/App.tsx +51 -0
- package/templates/vscode-react/src/main.tsx +9 -0
- package/templates/vscode-react/src/utils/index.ts +1 -0
- package/templates/vscode-react/src/utils/vscode.ts +83 -0
- package/templates/vscode-react/src/vite-env.d.ts +1 -0
- package/templates/vscode-react/vite.config.ts +20 -0
- package/templates/vscode-vue/README.md +3 -0
- package/templates/vscode-vue/index.html +14 -0
- package/templates/vscode-vue/package.json +6 -0
- package/templates/vscode-vue/src/App.vue +58 -0
- package/templates/vscode-vue/src/main.ts +4 -0
- package/templates/vscode-vue/src/utils/index.ts +1 -0
- package/templates/vscode-vue/src/utils/vscode.ts +83 -0
- package/templates/vscode-vue/src/vite-env.d.ts +1 -0
- package/templates/vscode-vue/vite.config.ts +29 -0
- package/templates/vue/electron/main/index.ts +123 -0
- package/templates/vue/index.html +14 -0
- package/templates/vue/package.json +12 -0
- package/templates/vue/public/vite.svg +1 -0
- package/templates/vue/src/App.vue +32 -0
- package/templates/vue/src/assets/vue.svg +1 -0
- package/templates/vue/src/components/HelloWorld.vue +37 -0
- package/templates/vue/src/main.ts +6 -0
- package/templates/vue/src/style.css +80 -0
- package/templates/vue/src/vite-env.d.ts +1 -0
- package/templates/vue/vite.config.ts +7 -0
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
|
|
74
|
+
app.on('window-all-closed', () => {
|
|
75
|
+
win = null;
|
|
76
|
+
if (process.platform !== 'darwin') app.quit();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
app.on('second-instance', () => {
|
|
80
|
+
if (win) {
|
|
81
|
+
// Focus on the main window if the user tried to open another
|
|
82
|
+
if (win.isMinimized()) win.restore();
|
|
83
|
+
win.focus();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
app.on('activate', () => {
|
|
88
|
+
const allWindows = BrowserWindow.getAllWindows();
|
|
89
|
+
if (allWindows.length) {
|
|
90
|
+
allWindows[0].focus();
|
|
91
|
+
} else {
|
|
92
|
+
createWindow();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// New window example arg: new windows url
|
|
97
|
+
ipcMain.handle('open-win', (_, arg) => {
|
|
98
|
+
const childWindow = new BrowserWindow({
|
|
99
|
+
webPreferences: {
|
|
100
|
+
preload,
|
|
101
|
+
nodeIntegration: true,
|
|
102
|
+
contextIsolation: false,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
if (serverUrl) {
|
|
107
|
+
childWindow.loadURL(`${serverUrl}#${arg}`);
|
|
108
|
+
} else {
|
|
109
|
+
childWindow.loadFile(indexHtml, { hash: arg });
|
|
110
|
+
}
|
|
111
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('Electron Preload Process!');
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"engines": {
|
|
4
|
+
"node": ">=18"
|
|
5
|
+
},
|
|
6
|
+
"main": "dist/main/index.mjs",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"debug": "cross-env VITE_ELECTRON_DEBUG=1 npm run dev",
|
|
10
|
+
"build": "npm run clean && vite build",
|
|
11
|
+
"release": "cross-env VITE_ELECTRON_BUILDER=1 npm run build",
|
|
12
|
+
"clean": "rimraf ./dist",
|
|
13
|
+
"lint:eslint": "eslint \"{src,electron}/**/*.{ts,tsx}\" *.{js,cjs,mjs,ts} --fix --cache"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@tomjs/electron-devtools-installer": "^2.2.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@tomjs/vite-plugin-electron": "^1.9.0",
|
|
20
|
+
"electron": "^30.0.9",
|
|
21
|
+
"electron-builder": "^24.13.3",
|
|
22
|
+
"vite": "^5.2.12",
|
|
23
|
+
"vite-plugin-electron-renderer": "^0.14.5"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}<{{gitUserEmail}}>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{pkgName}}
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/{{pkgName}})   [](https://www.paka.dev/npm/{{pkgName}})
|
|
4
|
+
|
|
5
|
+
**English** | [中文](./README.zh_CN.md)
|
|
6
|
+
|
|
7
|
+
> Basic template
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
{{pkgInstall}}
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{pkgName}}
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/{{pkgName}})   [](https://www.paka.dev/npm/{{pkgName}})
|
|
4
|
+
|
|
5
|
+
[English](./README.md) | **中文**
|
|
6
|
+
|
|
7
|
+
> 基础模板
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
{{pkgInstall}}
|
|
13
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"keywords": [],
|
|
3
|
+
"author": {
|
|
4
|
+
"name": "{{gitUserName}}",
|
|
5
|
+
"email": "{{gitUserEmail}}"
|
|
6
|
+
},
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"module": "./dist/index.mjs",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"require": {
|
|
17
|
+
"default": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"import": {
|
|
21
|
+
"default": "./dist/index.mjs",
|
|
22
|
+
"types": "./dist/index.d.mts"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org/"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+{{gitUrl}}.git"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"lint:eslint": "eslint \"{src,test}/**/*.ts\" *.{js,cjs,mjs,ts} --fix --cache",
|
|
36
|
+
"test": "vitest"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@tomjs/node": "^2.1.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"tsx": "^4.11.2",
|
|
43
|
+
"type-fest": "^4.19.0",
|
|
44
|
+
"vitest": "^1.6.0"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"dev": "vite",
|
|
4
|
+
"build": "tsc && vite build",
|
|
5
|
+
"preview": "vite preview",
|
|
6
|
+
"lint": "run-s lint:eslint lint:stylelint lint:prettier",
|
|
7
|
+
"lint:eslint": "eslint \"src/**/*.{ts,tsx}\" *.{js,cjs,mjs,ts} --fix --cache"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"react": "^18.3.1",
|
|
11
|
+
"react-dom": "^18.3.1"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/react": "^18.3.3",
|
|
15
|
+
"@types/react-dom": "^18.3.0",
|
|
16
|
+
"@vitejs/plugin-react-swc": "^3.7.0",
|
|
17
|
+
"vite": "^5.2.12"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// A launch configuration that compiles the extension and then opens it inside a new window
|
|
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
|
+
{
|
|
6
|
+
"version": "0.2.0",
|
|
7
|
+
"configurations": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Debug Extension",
|
|
10
|
+
"type": "extensionHost",
|
|
11
|
+
"request": "launch",
|
|
12
|
+
"args": [
|
|
13
|
+
"--extensionDevelopmentPath=${workspaceFolder}"
|
|
14
|
+
],
|
|
15
|
+
"outFiles": [
|
|
16
|
+
"${workspaceFolder}/dist/*.js"
|
|
17
|
+
],
|
|
18
|
+
"preLaunchTask": "${defaultBuildTask}"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
2
|
+
// for the documentation about the tasks.json format
|
|
3
|
+
{
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "npm",
|
|
8
|
+
"script": "dev",
|
|
9
|
+
"problemMatcher": {
|
|
10
|
+
"owner": "typescript",
|
|
11
|
+
"fileLocation": "relative",
|
|
12
|
+
"pattern": {
|
|
13
|
+
"regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
|
|
14
|
+
"file": 1,
|
|
15
|
+
"line": 3,
|
|
16
|
+
"column": 4,
|
|
17
|
+
"code": 5,
|
|
18
|
+
"message": 6
|
|
19
|
+
},
|
|
20
|
+
"background": {
|
|
21
|
+
"activeOnStart": true,
|
|
22
|
+
"beginsPattern": "^.*extension build start*$",
|
|
23
|
+
"endsPattern": "^.*extension (build|rebuild) success.*$"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"isBackground": true,
|
|
27
|
+
"presentation": {
|
|
28
|
+
"reveal": "never"
|
|
29
|
+
},
|
|
30
|
+
"group": {
|
|
31
|
+
"kind": "build",
|
|
32
|
+
"isDefault": true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# logs
|
|
2
|
+
*.log
|
|
3
|
+
lerna-debug.log*
|
|
4
|
+
logs
|
|
5
|
+
npm-debug.log*
|
|
6
|
+
pnpm-debug.log*
|
|
7
|
+
yarn-debug.log*
|
|
8
|
+
yarn-error.log*
|
|
9
|
+
|
|
10
|
+
# diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# runtime data
|
|
14
|
+
*.pid
|
|
15
|
+
*.pid.lock
|
|
16
|
+
*.seed
|
|
17
|
+
pids
|
|
18
|
+
|
|
19
|
+
# dependency directory
|
|
20
|
+
node_modules
|
|
21
|
+
|
|
22
|
+
# cache
|
|
23
|
+
.cache
|
|
24
|
+
.npm
|
|
25
|
+
.tmp
|
|
26
|
+
.temp
|
|
27
|
+
.eslintcache
|
|
28
|
+
.stylelintcache
|
|
29
|
+
tsconfig.tsbuildinfo
|
|
30
|
+
|
|
31
|
+
# environment
|
|
32
|
+
*.local
|
|
33
|
+
|
|
34
|
+
# macOS
|
|
35
|
+
.DS_Store
|
|
36
|
+
|
|
37
|
+
# package files
|
|
38
|
+
*.7z
|
|
39
|
+
*.gz
|
|
40
|
+
*.gzip
|
|
41
|
+
*.rar
|
|
42
|
+
*.tar
|
|
43
|
+
*.tar.*
|
|
44
|
+
*.tgz
|
|
45
|
+
*.zip
|
|
46
|
+
*.vsix
|
|
47
|
+
|
|
48
|
+
# IDEA
|
|
49
|
+
.idea
|
|
50
|
+
|
|
51
|
+
# vscode
|
|
52
|
+
.vscode
|
|
53
|
+
.history
|
|
54
|
+
|
|
55
|
+
# project
|
|
56
|
+
src
|
|
57
|
+
extensions
|
|
58
|
+
locales
|
|
59
|
+
|
|
60
|
+
.husky
|
|
61
|
+
.commitlintrc*
|
|
62
|
+
.editorconfig
|
|
63
|
+
.eslintrc*
|
|
64
|
+
.eslintignore
|
|
65
|
+
.gitattributes
|
|
66
|
+
.gitignore
|
|
67
|
+
.lintstagedrc*
|
|
68
|
+
.prettierrc*
|
|
69
|
+
.prettierignore
|
|
70
|
+
pnpm-lock.yaml
|
|
71
|
+
tsconfig.json
|
|
72
|
+
tsconfig.*.json
|
|
73
|
+
*.config.ts
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}<{{gitUserEmail}}>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# logs
|
|
2
|
+
*.log
|
|
3
|
+
lerna-debug.log*
|
|
4
|
+
logs
|
|
5
|
+
npm-debug.log*
|
|
6
|
+
pnpm-debug.log*
|
|
7
|
+
yarn-debug.log*
|
|
8
|
+
yarn-error.log*
|
|
9
|
+
|
|
10
|
+
# diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# runtime data
|
|
14
|
+
*.pid
|
|
15
|
+
*.pid.lock
|
|
16
|
+
*.seed
|
|
17
|
+
pids
|
|
18
|
+
|
|
19
|
+
# dependency directory
|
|
20
|
+
bower_components
|
|
21
|
+
jspm_packages
|
|
22
|
+
node_modules
|
|
23
|
+
web_modules
|
|
24
|
+
|
|
25
|
+
# cache
|
|
26
|
+
.cache
|
|
27
|
+
.npm
|
|
28
|
+
.tmp
|
|
29
|
+
.temp
|
|
30
|
+
.eslintcache
|
|
31
|
+
.stylelintcache
|
|
32
|
+
tsconfig.tsbuildinfo
|
|
33
|
+
|
|
34
|
+
# environment
|
|
35
|
+
*.local
|
|
36
|
+
|
|
37
|
+
# macOS
|
|
38
|
+
.DS_Store
|
|
39
|
+
|
|
40
|
+
# package files
|
|
41
|
+
*.7z
|
|
42
|
+
*.gz
|
|
43
|
+
*.gzip
|
|
44
|
+
*.rar
|
|
45
|
+
*.tar
|
|
46
|
+
*.tar.*
|
|
47
|
+
*.tgz
|
|
48
|
+
*.zip
|
|
49
|
+
*.vsix
|
|
50
|
+
|
|
51
|
+
# IDEA
|
|
52
|
+
.idea
|
|
53
|
+
|
|
54
|
+
# vscode
|
|
55
|
+
.history
|
|
56
|
+
|
|
57
|
+
# build output
|
|
58
|
+
build
|
|
59
|
+
dist
|
|
60
|
+
release
|
|
61
|
+
|
|
62
|
+
package.nls.json
|
|
63
|
+
package.nls.*.json
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@tomjs/vite-plugin-vscode/env" />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { i18n, initExtension } from '@tomjs/vscode';
|
|
2
|
+
import type { ExtensionContext } from 'vscode';
|
|
3
|
+
import { commands, window } from 'vscode';
|
|
4
|
+
import { MainPanel } from './views/panel';
|
|
5
|
+
|
|
6
|
+
export function activate(context: ExtensionContext) {
|
|
7
|
+
initExtension(context);
|
|
8
|
+
|
|
9
|
+
context.subscriptions.push(
|
|
10
|
+
commands.registerCommand('tomjs.xxx.showHello', async () => {
|
|
11
|
+
window.showInformationMessage(i18n.t('tomjs.commands.hello'));
|
|
12
|
+
}),
|
|
13
|
+
);
|
|
14
|
+
context.subscriptions.push(
|
|
15
|
+
commands.registerCommand('tomjs.xxx.showPanel', async () => {
|
|
16
|
+
MainPanel.render(context);
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function deactivate() {}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Disposable, ExtensionContext, Webview } from 'vscode';
|
|
2
|
+
import { window } from 'vscode';
|
|
3
|
+
|
|
4
|
+
export class WebviewHelper {
|
|
5
|
+
public static setupHtml(webview: Webview, context: ExtensionContext) {
|
|
6
|
+
return process.env.VITE_DEV_SERVER_URL
|
|
7
|
+
? __getWebviewHtml__(process.env.VITE_DEV_SERVER_URL)
|
|
8
|
+
: __getWebviewHtml__(webview, context);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public static setupWebviewHooks(webview: Webview, disposables: Disposable[]) {
|
|
12
|
+
webview.onDidReceiveMessage(
|
|
13
|
+
(message: any) => {
|
|
14
|
+
const command = message.command;
|
|
15
|
+
const text = message.text;
|
|
16
|
+
console.log(`command: ${command}`);
|
|
17
|
+
switch (command) {
|
|
18
|
+
case 'hello':
|
|
19
|
+
window.showInformationMessage(text);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
undefined,
|
|
24
|
+
disposables,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|