@tomjs/create-app 0.15.0 → 1.0.0-alpha.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.js +25 -0
- package/package.json +25 -20
- package/dist/index.mjs +0 -11
- package/template-config/.commitlintrc.cjs +0 -3
- package/template-config/.editorconfig +0 -15
- package/template-config/.eslintignore +0 -14
- package/template-config/.gitattributes +0 -203
- package/template-config/.husky/commit-msg +0 -1
- package/template-config/.husky/pre-commit +0 -1
- package/template-config/.prettierignore +0 -17
- package/template-config/.prettierrc.cjs +0 -1
- package/template-config/.stylelintignore +0 -16
- package/template-config/.stylelintrc.cjs +0 -3
- package/template-config/_gitignore +0 -60
- package/template-electron-react/.vscode/launch.json +0 -28
- package/template-electron-react/.vscode/tasks.json +0 -37
- package/template-electron-react/README.md +0 -97
- package/template-electron-react/_eslintrc.cjs +0 -7
- package/template-electron-react/_lintstagedrc.cjs +0 -5
- package/template-electron-react/electron/env.d.ts +0 -1
- package/template-electron-react/electron/main/index.ts +0 -128
- package/template-electron-react/electron/polyfills.ts +0 -4
- package/template-electron-react/electron/preload/index.ts +0 -1
- package/template-electron-react/index.html +0 -15
- package/template-electron-react/package.json +0 -54
- package/template-electron-react/public/img/icon.png +0 -0
- package/template-electron-react/public/vite.svg +0 -1
- package/template-electron-react/src/App.css +0 -45
- package/template-electron-react/src/App.tsx +0 -42
- package/template-electron-react/src/assets/electron.svg +0 -10
- package/template-electron-react/src/assets/react.svg +0 -1
- package/template-electron-react/src/index.css +0 -69
- package/template-electron-react/src/main.tsx +0 -11
- package/template-electron-react/src/vite-env.d.ts +0 -1
- package/template-electron-react/tsconfig.json +0 -10
- package/template-electron-react/tsconfig.node.json +0 -7
- package/template-electron-react/vite.config.ts +0 -27
- package/template-electron-vue/.vscode/launch.json +0 -28
- package/template-electron-vue/.vscode/tasks.json +0 -37
- package/template-electron-vue/README.md +0 -92
- package/template-electron-vue/_eslintrc.cjs +0 -7
- package/template-electron-vue/_lintstagedrc.cjs +0 -6
- package/template-electron-vue/electron/env.d.ts +0 -1
- package/template-electron-vue/electron/main/index.ts +0 -123
- package/template-electron-vue/electron/polyfills.ts +0 -4
- package/template-electron-vue/electron/preload/index.ts +0 -1
- package/template-electron-vue/index.html +0 -15
- package/template-electron-vue/package.json +0 -52
- package/template-electron-vue/public/img/icon.png +0 -0
- package/template-electron-vue/public/vite.svg +0 -1
- package/template-electron-vue/src/App.vue +0 -55
- package/template-electron-vue/src/assets/electron.svg +0 -10
- package/template-electron-vue/src/assets/vue.svg +0 -1
- package/template-electron-vue/src/components/HelloWorld.vue +0 -43
- package/template-electron-vue/src/main.ts +0 -6
- package/template-electron-vue/src/style.css +0 -80
- package/template-electron-vue/src/vite-env.d.ts +0 -1
- package/template-electron-vue/tsconfig.json +0 -10
- package/template-electron-vue/tsconfig.node.json +0 -7
- package/template-electron-vue/vite.config.ts +0 -26
- package/template-node/.vscode/launch.json +0 -19
- package/template-node/.vscode/tasks.json +0 -36
- package/template-node/LICENSE +0 -21
- package/template-node/README.md +0 -13
- package/template-node/README.zh_CN.md +0 -13
- package/template-node/_eslintrc.cjs +0 -7
- package/template-node/_lintstagedrc.cjs +0 -4
- package/template-node/_lintstagedrc.examples.cjs +0 -6
- package/template-node/package.json +0 -79
- package/template-node/scripts/info.ts +0 -12
- package/template-node/src/index.ts +0 -3
- package/template-node/test/index.test.ts +0 -7
- package/template-node/tsconfig.json +0 -4
- package/template-node/tsconfig.test.json +0 -4
- package/template-node/tsup.config.ts +0 -16
- package/template-node/vite.config.ts +0 -42
- package/template-node/vitest.workspace.ts +0 -3
- package/template-react/README.md +0 -3
- package/template-react/_eslintrc.cjs +0 -7
- package/template-react/_lintstagedrc.cjs +0 -5
- package/template-react/index.html +0 -14
- package/template-react/package.json +0 -44
- package/template-react/public/vite.svg +0 -1
- package/template-react/src/App.css +0 -42
- package/template-react/src/App.tsx +0 -32
- package/template-react/src/assets/react.svg +0 -1
- package/template-react/src/index.css +0 -69
- package/template-react/src/main.tsx +0 -11
- package/template-react/src/vite-env.d.ts +0 -1
- package/template-react/tsconfig.json +0 -5
- package/template-react/tsconfig.node.json +0 -7
- package/template-react/vite.config.ts +0 -7
- package/template-vscode/.vscode/launch.json +0 -21
- package/template-vscode/.vscode/tasks.json +0 -36
- package/template-vscode/.vscodeignore +0 -71
- package/template-vscode/LICENSE +0 -21
- package/template-vscode/README.md +0 -3
- package/template-vscode/_eslintrc.cjs +0 -7
- package/template-vscode/_lintstagedrc.cjs +0 -5
- package/template-vscode/package.json +0 -66
- package/template-vscode/package.nls.json +0 -4
- package/template-vscode/package.nls.zh-cn.json +0 -4
- package/template-vscode/resources/logo.png +0 -0
- package/template-vscode/src/index.ts +0 -12
- package/template-vscode/tsconfig.json +0 -5
- package/template-vscode/tsup.config.ts +0 -13
- package/template-vscode-react/.vscode/launch.json +0 -21
- package/template-vscode-react/.vscode/tasks.json +0 -36
- package/template-vscode-react/.vscodeignore +0 -72
- package/template-vscode-react/LICENSE +0 -21
- package/template-vscode-react/README.md +0 -3
- package/template-vscode-react/_eslintrc.cjs +0 -7
- package/template-vscode-react/_lintstagedrc.cjs +0 -5
- package/template-vscode-react/extension/env.d.ts +0 -1
- package/template-vscode-react/extension/index.ts +0 -13
- package/template-vscode-react/extension/views/helper.ts +0 -27
- package/template-vscode-react/extension/views/panel.ts +0 -48
- package/template-vscode-react/index.html +0 -14
- package/template-vscode-react/package.json +0 -82
- package/template-vscode-react/package.nls.json +0 -4
- package/template-vscode-react/package.nls.zh-cn.json +0 -4
- package/template-vscode-react/resources/logo.png +0 -0
- package/template-vscode-react/src/App.css +0 -7
- package/template-vscode-react/src/App.tsx +0 -51
- package/template-vscode-react/src/main.tsx +0 -9
- package/template-vscode-react/src/utils/index.ts +0 -1
- package/template-vscode-react/src/utils/vscode.ts +0 -83
- package/template-vscode-react/src/vite-env.d.ts +0 -1
- package/template-vscode-react/tsconfig.json +0 -10
- package/template-vscode-react/tsconfig.node.json +0 -7
- package/template-vscode-react/vite.config.ts +0 -20
- package/template-vscode-vue/.vscode/launch.json +0 -21
- package/template-vscode-vue/.vscode/tasks.json +0 -36
- package/template-vscode-vue/.vscodeignore +0 -72
- package/template-vscode-vue/LICENSE +0 -21
- package/template-vscode-vue/README.md +0 -3
- package/template-vscode-vue/_eslintrc.cjs +0 -7
- package/template-vscode-vue/_lintstagedrc.cjs +0 -6
- package/template-vscode-vue/extension/env.d.ts +0 -1
- package/template-vscode-vue/extension/index.ts +0 -13
- package/template-vscode-vue/extension/views/helper.ts +0 -27
- package/template-vscode-vue/extension/views/panel.ts +0 -48
- package/template-vscode-vue/index.html +0 -14
- package/template-vscode-vue/package.json +0 -80
- package/template-vscode-vue/package.nls.json +0 -4
- package/template-vscode-vue/package.nls.zh-cn.json +0 -4
- package/template-vscode-vue/resources/logo.png +0 -0
- package/template-vscode-vue/src/App.vue +0 -58
- package/template-vscode-vue/src/main.ts +0 -4
- package/template-vscode-vue/src/utils/index.ts +0 -1
- package/template-vscode-vue/src/utils/vscode.ts +0 -83
- package/template-vscode-vue/src/vite-env.d.ts +0 -1
- package/template-vscode-vue/tsconfig.json +0 -10
- package/template-vscode-vue/tsconfig.node.json +0 -7
- package/template-vscode-vue/vite.config.ts +0 -29
- package/template-vue/README.md +0 -3
- package/template-vue/_eslintrc.cjs +0 -7
- package/template-vue/_lintstagedrc.cjs +0 -6
- package/template-vue/index.html +0 -14
- package/template-vue/package.json +0 -42
- package/template-vue/public/vite.svg +0 -1
- package/template-vue/src/App.vue +0 -32
- package/template-vue/src/assets/vue.svg +0 -1
- package/template-vue/src/components/HelloWorld.vue +0 -37
- package/template-vue/src/main.ts +0 -6
- package/template-vue/src/style.css +0 -80
- package/template-vue/src/vite-env.d.ts +0 -1
- package/template-vue/tsconfig.json +0 -5
- package/template-vue/tsconfig.node.json +0 -7
- package/template-vue/vite.config.ts +0 -7
package/template-vscode/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023-PRESENT {{user.name}}<{{user.email}}>
|
|
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.
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vscode-extension",
|
|
3
|
-
"displayName": "%displayName%",
|
|
4
|
-
"description": "%description%",
|
|
5
|
-
"version": "0.0.0",
|
|
6
|
-
"publisher": "{{git.org}}",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"engines": {
|
|
9
|
-
"node": ">=14",
|
|
10
|
-
"vscode": "^1.75.0"
|
|
11
|
-
},
|
|
12
|
-
"main": "dist/index.js",
|
|
13
|
-
"keywords": [
|
|
14
|
-
"vscode"
|
|
15
|
-
],
|
|
16
|
-
"categories": [
|
|
17
|
-
"Other"
|
|
18
|
-
],
|
|
19
|
-
"activationEvents": [],
|
|
20
|
-
"contributes": {
|
|
21
|
-
"commands": [
|
|
22
|
-
{
|
|
23
|
-
"command": "hello-world.showHelloWorld",
|
|
24
|
-
"title": "Hello World: Show"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+{{git.url}}.git"
|
|
31
|
-
},
|
|
32
|
-
"bugs": {
|
|
33
|
-
"url": "git+{{git.url}}/issues"
|
|
34
|
-
},
|
|
35
|
-
"homepage": "{{git.url}}/blob/main/README.md",
|
|
36
|
-
"icon": "resources/logo.png",
|
|
37
|
-
"vsce": {
|
|
38
|
-
"dependencies": false,
|
|
39
|
-
"yarn": false
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"dev": "tsup --watch",
|
|
43
|
-
"build": "tsup --minify",
|
|
44
|
-
"lint": "run-s lint:eslint lint:prettier",
|
|
45
|
-
"lint:eslint": "eslint \"{src,scripts}/**/*.{js,cjs,ts}\" *.{js,cjs,ts} --fix --cache",
|
|
46
|
-
"lint:prettier": "prettier --write .",
|
|
47
|
-
"prepare": "husky"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@commitlint/cli": "^19.3.0",
|
|
51
|
-
"@tomjs/commitlint": "^3.0.0",
|
|
52
|
-
"@tomjs/eslint": "^2.3.0",
|
|
53
|
-
"@tomjs/prettier": "^1.3.0",
|
|
54
|
-
"@tomjs/tsconfig": "^1.5.0",
|
|
55
|
-
"@types/node": "^18.19.33",
|
|
56
|
-
"@types/vscode": "^1.75.0",
|
|
57
|
-
"eslint": "^8.57.0",
|
|
58
|
-
"husky": "^9.0.11",
|
|
59
|
-
"lint-staged": "^15.2.2",
|
|
60
|
-
"npm-run-all": "^4.1.5",
|
|
61
|
-
"prettier": "^3.2.5",
|
|
62
|
-
"rimraf": "^5.0.7",
|
|
63
|
-
"tsup": "^8.0.2",
|
|
64
|
-
"typescript": "~5.4.5"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
Binary file
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ExtensionContext } from 'vscode';
|
|
2
|
-
import { commands, window } from 'vscode';
|
|
3
|
-
|
|
4
|
-
export function activate(context: ExtensionContext) {
|
|
5
|
-
context.subscriptions.push(
|
|
6
|
-
commands.registerCommand('hello-world.showHelloWorld', async () => {
|
|
7
|
-
window.showInformationMessage('Hello World');
|
|
8
|
-
}),
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function deactivate() {}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup';
|
|
2
|
-
|
|
3
|
-
export default defineConfig(options => {
|
|
4
|
-
return {
|
|
5
|
-
entry: ['src/index.ts'],
|
|
6
|
-
format: ['cjs'],
|
|
7
|
-
target: ['es2020', 'node14'],
|
|
8
|
-
external: ['vscode'],
|
|
9
|
-
clean: true,
|
|
10
|
-
splitting: true,
|
|
11
|
-
sourcemap: !!options.watch,
|
|
12
|
-
};
|
|
13
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
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/extension/*.js"
|
|
17
|
-
],
|
|
18
|
-
"preLaunchTask": "${defaultBuildTask}"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
extension
|
|
58
|
-
|
|
59
|
-
.husky
|
|
60
|
-
.commitlintrc*
|
|
61
|
-
.editorconfig
|
|
62
|
-
.eslintrc*
|
|
63
|
-
.eslintignore
|
|
64
|
-
.gitattributes
|
|
65
|
-
.gitignore
|
|
66
|
-
.lintstagedrc*
|
|
67
|
-
.prettierrc*
|
|
68
|
-
.prettierignore
|
|
69
|
-
pnpm-lock.yaml
|
|
70
|
-
tsconfig.json
|
|
71
|
-
tsconfig.*.json
|
|
72
|
-
*.config.ts
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023-PRESENT {{user.name}}<{{user.email}}>
|
|
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.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@tomjs/vite-plugin-vscode/env" />
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ExtensionContext } from 'vscode';
|
|
2
|
-
import { commands } from 'vscode';
|
|
3
|
-
import { MainPanel } from './views/panel';
|
|
4
|
-
|
|
5
|
-
export function activate(context: ExtensionContext) {
|
|
6
|
-
context.subscriptions.push(
|
|
7
|
-
commands.registerCommand('hello-world.showHelloWorld', async () => {
|
|
8
|
-
MainPanel.render(context.extensionUri);
|
|
9
|
-
}),
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function deactivate() {}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Disposable, ExtensionContext, WebviewPanel } from 'vscode';
|
|
2
|
-
import { ViewColumn, window } from 'vscode';
|
|
3
|
-
import { WebviewHelper } from './helper';
|
|
4
|
-
|
|
5
|
-
export class MainPanel {
|
|
6
|
-
public static currentPanel: MainPanel | undefined;
|
|
7
|
-
private readonly _panel: WebviewPanel;
|
|
8
|
-
private _disposables: Disposable[] = [];
|
|
9
|
-
|
|
10
|
-
private constructor(panel: WebviewPanel, context: ExtensionContext) {
|
|
11
|
-
this._panel = panel;
|
|
12
|
-
|
|
13
|
-
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
|
|
14
|
-
this._panel.webview.html = WebviewHelper.setupHtml(this._panel.webview, context);
|
|
15
|
-
|
|
16
|
-
WebviewHelper.setupWebviewHooks(this._panel.webview, this._disposables);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public static render(context: ExtensionContext) {
|
|
20
|
-
if (MainPanel.currentPanel) {
|
|
21
|
-
MainPanel.currentPanel._panel.reveal(ViewColumn.One);
|
|
22
|
-
} else {
|
|
23
|
-
const panel = window.createWebviewPanel('showHelloWorld', 'Hello World', ViewColumn.One, {
|
|
24
|
-
enableScripts: true,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
MainPanel.currentPanel = new MainPanel(panel, context);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Cleans up and disposes of webview resources when the webview panel is closed.
|
|
33
|
-
*/
|
|
34
|
-
public dispose() {
|
|
35
|
-
MainPanel.currentPanel = undefined;
|
|
36
|
-
|
|
37
|
-
// Dispose of the current webview panel
|
|
38
|
-
this._panel.dispose();
|
|
39
|
-
|
|
40
|
-
// Dispose of all disposables (i.e. commands) for the current webview panel
|
|
41
|
-
while (this._disposables.length) {
|
|
42
|
-
const disposable = this._disposables.pop();
|
|
43
|
-
if (disposable) {
|
|
44
|
-
disposable.dispose();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
|
7
|
-
<title>Vite + VSCode Extension + React</title>
|
|
8
|
-
</head>
|
|
9
|
-
|
|
10
|
-
<body>
|
|
11
|
-
<div id="app"></div>
|
|
12
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vscode-extension",
|
|
3
|
-
"displayName": "%displayName%",
|
|
4
|
-
"description": "%description%",
|
|
5
|
-
"version": "0.0.0",
|
|
6
|
-
"publisher": "{{git.org}}",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"engines": {
|
|
9
|
-
"node": ">=14",
|
|
10
|
-
"vscode": "^1.75.0"
|
|
11
|
-
},
|
|
12
|
-
"main": "dist/extension/index.js",
|
|
13
|
-
"keywords": [
|
|
14
|
-
"vscode"
|
|
15
|
-
],
|
|
16
|
-
"categories": [
|
|
17
|
-
"Other"
|
|
18
|
-
],
|
|
19
|
-
"activationEvents": [],
|
|
20
|
-
"contributes": {
|
|
21
|
-
"commands": [
|
|
22
|
-
{
|
|
23
|
-
"command": "hello-world.showHelloWorld",
|
|
24
|
-
"title": "Hello World: Show"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+{{git.url}}.git"
|
|
31
|
-
},
|
|
32
|
-
"bugs": {
|
|
33
|
-
"url": "git+{{git.url}}/issues"
|
|
34
|
-
},
|
|
35
|
-
"homepage": "{{git.url}}/blob/main/README.md",
|
|
36
|
-
"icon": "resources/logo.png",
|
|
37
|
-
"vsce": {
|
|
38
|
-
"dependencies": false,
|
|
39
|
-
"yarn": false
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"dev": "vite",
|
|
43
|
-
"build": "npm run clean && vite build",
|
|
44
|
-
"clean": "rimraf ./dist",
|
|
45
|
-
"lint": "run-s lint:eslint lint:stylelint lint:prettier",
|
|
46
|
-
"lint:eslint": "eslint \"{src,extension,scripts}/**/*.{js,cjs,ts,tsx}\" *.{js,cjs,ts} --fix --cache",
|
|
47
|
-
"lint:stylelint": "stylelint \"{src,extension,scripts}/**/*.{css,scss,less,html}\" --fix --cache",
|
|
48
|
-
"lint:prettier": "prettier --write .",
|
|
49
|
-
"prepare": "husky"
|
|
50
|
-
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@vscode/webview-ui-toolkit": "^1.4.0",
|
|
53
|
-
"react": "^18.3.1",
|
|
54
|
-
"react-dom": "^18.3.1"
|
|
55
|
-
},
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"@commitlint/cli": "^19.3.0",
|
|
58
|
-
"@tomjs/commitlint": "^3.0.0",
|
|
59
|
-
"@tomjs/eslint": "^2.3.0",
|
|
60
|
-
"@tomjs/prettier": "^1.3.0",
|
|
61
|
-
"@tomjs/stylelint": "^2.3.0",
|
|
62
|
-
"@tomjs/tsconfig": "^1.5.0",
|
|
63
|
-
"@tomjs/vite-plugin-vscode": "^2.2.0",
|
|
64
|
-
"@types/node": "^18.19.33",
|
|
65
|
-
"@types/react": "^18.3.2",
|
|
66
|
-
"@types/react-dom": "^18.3.0",
|
|
67
|
-
"@types/vscode": "^1.75.0",
|
|
68
|
-
"@types/vscode-webview": "^1.57.5",
|
|
69
|
-
"@vitejs/plugin-react-swc": "^3.6.0",
|
|
70
|
-
"cross-env": "^7.0.3",
|
|
71
|
-
"eslint": "^8.57.0",
|
|
72
|
-
"husky": "^9.0.11",
|
|
73
|
-
"lint-staged": "^15.2.2",
|
|
74
|
-
"npm-run-all": "^4.1.5",
|
|
75
|
-
"prettier": "^3.2.5",
|
|
76
|
-
"rimraf": "^5.0.7",
|
|
77
|
-
"stylelint": "^16.5.0",
|
|
78
|
-
"tsx": "^4.10.2",
|
|
79
|
-
"typescript": "~5.4.5",
|
|
80
|
-
"vite": "^5.2.11"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
Binary file
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { VSCodeButton, VSCodeTextField } from '@vscode/webview-ui-toolkit/react';
|
|
3
|
-
import { vscode } from './utils/vscode';
|
|
4
|
-
|
|
5
|
-
import './App.css';
|
|
6
|
-
|
|
7
|
-
function App() {
|
|
8
|
-
function onPostMessage() {
|
|
9
|
-
vscode.postMessage({
|
|
10
|
-
command: 'hello',
|
|
11
|
-
text: 'Hey there partner! 🤠',
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const [message, setMessage] = useState('');
|
|
16
|
-
const [state, setState] = useState('');
|
|
17
|
-
|
|
18
|
-
const onSetState = () => {
|
|
19
|
-
vscode.setState(state);
|
|
20
|
-
};
|
|
21
|
-
const onGetState = () => {
|
|
22
|
-
setState(vscode.getState() as string);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<main>
|
|
27
|
-
<h1>Hello React!</h1>
|
|
28
|
-
<VSCodeButton onClick={onPostMessage}>Test VSCode Message</VSCodeButton>
|
|
29
|
-
<div>
|
|
30
|
-
<VSCodeTextField value={message} onInput={e => setMessage(e.target.value)}>
|
|
31
|
-
Please enter a message
|
|
32
|
-
</VSCodeTextField>
|
|
33
|
-
<div>Message is: {message}</div>
|
|
34
|
-
</div>
|
|
35
|
-
<div>
|
|
36
|
-
<VSCodeTextField value={state} onInput={e => setState(e.target.value)}>
|
|
37
|
-
Please enter a state
|
|
38
|
-
</VSCodeTextField>
|
|
39
|
-
<div>State is: {state}</div>
|
|
40
|
-
<div>
|
|
41
|
-
<VSCodeButton onClick={onSetState}>setState</VSCodeButton>
|
|
42
|
-
<VSCodeButton style={{ marginLeft: '8px' }} onClick={onGetState}>
|
|
43
|
-
getState
|
|
44
|
-
</VSCodeButton>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</main>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default App;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vscode';
|