@tomjs/create-app 0.15.0 → 1.0.0-alpha.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 (170) hide show
  1. package/dist/index.js +25 -0
  2. package/package.json +25 -20
  3. package/dist/index.mjs +0 -11
  4. package/template-config/.commitlintrc.cjs +0 -3
  5. package/template-config/.editorconfig +0 -15
  6. package/template-config/.eslintignore +0 -14
  7. package/template-config/.gitattributes +0 -203
  8. package/template-config/.husky/commit-msg +0 -1
  9. package/template-config/.husky/pre-commit +0 -1
  10. package/template-config/.prettierignore +0 -17
  11. package/template-config/.prettierrc.cjs +0 -1
  12. package/template-config/.stylelintignore +0 -16
  13. package/template-config/.stylelintrc.cjs +0 -3
  14. package/template-config/_gitignore +0 -60
  15. package/template-electron-react/.vscode/launch.json +0 -28
  16. package/template-electron-react/.vscode/tasks.json +0 -37
  17. package/template-electron-react/README.md +0 -97
  18. package/template-electron-react/_eslintrc.cjs +0 -7
  19. package/template-electron-react/_lintstagedrc.cjs +0 -5
  20. package/template-electron-react/electron/env.d.ts +0 -1
  21. package/template-electron-react/electron/main/index.ts +0 -128
  22. package/template-electron-react/electron/polyfills.ts +0 -4
  23. package/template-electron-react/electron/preload/index.ts +0 -1
  24. package/template-electron-react/index.html +0 -15
  25. package/template-electron-react/package.json +0 -54
  26. package/template-electron-react/public/img/icon.png +0 -0
  27. package/template-electron-react/public/vite.svg +0 -1
  28. package/template-electron-react/src/App.css +0 -45
  29. package/template-electron-react/src/App.tsx +0 -42
  30. package/template-electron-react/src/assets/electron.svg +0 -10
  31. package/template-electron-react/src/assets/react.svg +0 -1
  32. package/template-electron-react/src/index.css +0 -69
  33. package/template-electron-react/src/main.tsx +0 -11
  34. package/template-electron-react/src/vite-env.d.ts +0 -1
  35. package/template-electron-react/tsconfig.json +0 -10
  36. package/template-electron-react/tsconfig.node.json +0 -7
  37. package/template-electron-react/vite.config.ts +0 -27
  38. package/template-electron-vue/.vscode/launch.json +0 -28
  39. package/template-electron-vue/.vscode/tasks.json +0 -37
  40. package/template-electron-vue/README.md +0 -92
  41. package/template-electron-vue/_eslintrc.cjs +0 -7
  42. package/template-electron-vue/_lintstagedrc.cjs +0 -6
  43. package/template-electron-vue/electron/env.d.ts +0 -1
  44. package/template-electron-vue/electron/main/index.ts +0 -123
  45. package/template-electron-vue/electron/polyfills.ts +0 -4
  46. package/template-electron-vue/electron/preload/index.ts +0 -1
  47. package/template-electron-vue/index.html +0 -15
  48. package/template-electron-vue/package.json +0 -52
  49. package/template-electron-vue/public/img/icon.png +0 -0
  50. package/template-electron-vue/public/vite.svg +0 -1
  51. package/template-electron-vue/src/App.vue +0 -55
  52. package/template-electron-vue/src/assets/electron.svg +0 -10
  53. package/template-electron-vue/src/assets/vue.svg +0 -1
  54. package/template-electron-vue/src/components/HelloWorld.vue +0 -43
  55. package/template-electron-vue/src/main.ts +0 -6
  56. package/template-electron-vue/src/style.css +0 -80
  57. package/template-electron-vue/src/vite-env.d.ts +0 -1
  58. package/template-electron-vue/tsconfig.json +0 -10
  59. package/template-electron-vue/tsconfig.node.json +0 -7
  60. package/template-electron-vue/vite.config.ts +0 -26
  61. package/template-node/.vscode/launch.json +0 -19
  62. package/template-node/.vscode/tasks.json +0 -36
  63. package/template-node/LICENSE +0 -21
  64. package/template-node/README.md +0 -13
  65. package/template-node/README.zh_CN.md +0 -13
  66. package/template-node/_eslintrc.cjs +0 -7
  67. package/template-node/_lintstagedrc.cjs +0 -4
  68. package/template-node/_lintstagedrc.examples.cjs +0 -6
  69. package/template-node/package.json +0 -79
  70. package/template-node/scripts/info.ts +0 -12
  71. package/template-node/src/index.ts +0 -3
  72. package/template-node/test/index.test.ts +0 -7
  73. package/template-node/tsconfig.json +0 -4
  74. package/template-node/tsconfig.test.json +0 -4
  75. package/template-node/tsup.config.ts +0 -16
  76. package/template-node/vite.config.ts +0 -42
  77. package/template-node/vitest.workspace.ts +0 -3
  78. package/template-react/README.md +0 -3
  79. package/template-react/_eslintrc.cjs +0 -7
  80. package/template-react/_lintstagedrc.cjs +0 -5
  81. package/template-react/index.html +0 -14
  82. package/template-react/package.json +0 -44
  83. package/template-react/public/vite.svg +0 -1
  84. package/template-react/src/App.css +0 -42
  85. package/template-react/src/App.tsx +0 -32
  86. package/template-react/src/assets/react.svg +0 -1
  87. package/template-react/src/index.css +0 -69
  88. package/template-react/src/main.tsx +0 -11
  89. package/template-react/src/vite-env.d.ts +0 -1
  90. package/template-react/tsconfig.json +0 -5
  91. package/template-react/tsconfig.node.json +0 -7
  92. package/template-react/vite.config.ts +0 -7
  93. package/template-vscode/.vscode/launch.json +0 -21
  94. package/template-vscode/.vscode/tasks.json +0 -36
  95. package/template-vscode/.vscodeignore +0 -71
  96. package/template-vscode/LICENSE +0 -21
  97. package/template-vscode/README.md +0 -3
  98. package/template-vscode/_eslintrc.cjs +0 -7
  99. package/template-vscode/_lintstagedrc.cjs +0 -5
  100. package/template-vscode/package.json +0 -66
  101. package/template-vscode/package.nls.json +0 -4
  102. package/template-vscode/package.nls.zh-cn.json +0 -4
  103. package/template-vscode/resources/logo.png +0 -0
  104. package/template-vscode/src/index.ts +0 -12
  105. package/template-vscode/tsconfig.json +0 -5
  106. package/template-vscode/tsup.config.ts +0 -13
  107. package/template-vscode-react/.vscode/launch.json +0 -21
  108. package/template-vscode-react/.vscode/tasks.json +0 -36
  109. package/template-vscode-react/.vscodeignore +0 -72
  110. package/template-vscode-react/LICENSE +0 -21
  111. package/template-vscode-react/README.md +0 -3
  112. package/template-vscode-react/_eslintrc.cjs +0 -7
  113. package/template-vscode-react/_lintstagedrc.cjs +0 -5
  114. package/template-vscode-react/extension/env.d.ts +0 -1
  115. package/template-vscode-react/extension/index.ts +0 -13
  116. package/template-vscode-react/extension/views/helper.ts +0 -27
  117. package/template-vscode-react/extension/views/panel.ts +0 -48
  118. package/template-vscode-react/index.html +0 -14
  119. package/template-vscode-react/package.json +0 -82
  120. package/template-vscode-react/package.nls.json +0 -4
  121. package/template-vscode-react/package.nls.zh-cn.json +0 -4
  122. package/template-vscode-react/resources/logo.png +0 -0
  123. package/template-vscode-react/src/App.css +0 -7
  124. package/template-vscode-react/src/App.tsx +0 -51
  125. package/template-vscode-react/src/main.tsx +0 -9
  126. package/template-vscode-react/src/utils/index.ts +0 -1
  127. package/template-vscode-react/src/utils/vscode.ts +0 -83
  128. package/template-vscode-react/src/vite-env.d.ts +0 -1
  129. package/template-vscode-react/tsconfig.json +0 -10
  130. package/template-vscode-react/tsconfig.node.json +0 -7
  131. package/template-vscode-react/vite.config.ts +0 -20
  132. package/template-vscode-vue/.vscode/launch.json +0 -21
  133. package/template-vscode-vue/.vscode/tasks.json +0 -36
  134. package/template-vscode-vue/.vscodeignore +0 -72
  135. package/template-vscode-vue/LICENSE +0 -21
  136. package/template-vscode-vue/README.md +0 -3
  137. package/template-vscode-vue/_eslintrc.cjs +0 -7
  138. package/template-vscode-vue/_lintstagedrc.cjs +0 -6
  139. package/template-vscode-vue/extension/env.d.ts +0 -1
  140. package/template-vscode-vue/extension/index.ts +0 -13
  141. package/template-vscode-vue/extension/views/helper.ts +0 -27
  142. package/template-vscode-vue/extension/views/panel.ts +0 -48
  143. package/template-vscode-vue/index.html +0 -14
  144. package/template-vscode-vue/package.json +0 -80
  145. package/template-vscode-vue/package.nls.json +0 -4
  146. package/template-vscode-vue/package.nls.zh-cn.json +0 -4
  147. package/template-vscode-vue/resources/logo.png +0 -0
  148. package/template-vscode-vue/src/App.vue +0 -58
  149. package/template-vscode-vue/src/main.ts +0 -4
  150. package/template-vscode-vue/src/utils/index.ts +0 -1
  151. package/template-vscode-vue/src/utils/vscode.ts +0 -83
  152. package/template-vscode-vue/src/vite-env.d.ts +0 -1
  153. package/template-vscode-vue/tsconfig.json +0 -10
  154. package/template-vscode-vue/tsconfig.node.json +0 -7
  155. package/template-vscode-vue/vite.config.ts +0 -29
  156. package/template-vue/README.md +0 -3
  157. package/template-vue/_eslintrc.cjs +0 -7
  158. package/template-vue/_lintstagedrc.cjs +0 -6
  159. package/template-vue/index.html +0 -14
  160. package/template-vue/package.json +0 -42
  161. package/template-vue/public/vite.svg +0 -1
  162. package/template-vue/src/App.vue +0 -32
  163. package/template-vue/src/assets/vue.svg +0 -1
  164. package/template-vue/src/components/HelloWorld.vue +0 -37
  165. package/template-vue/src/main.ts +0 -6
  166. package/template-vue/src/style.css +0 -80
  167. package/template-vue/src/vite-env.d.ts +0 -1
  168. package/template-vue/tsconfig.json +0 -5
  169. package/template-vue/tsconfig.node.json +0 -7
  170. package/template-vue/vite.config.ts +0 -7
@@ -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,3 +0,0 @@
1
- # extension
2
-
3
- vscode extension
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- env: {
3
- node: true,
4
- es6: true,
5
- },
6
- extends: [require.resolve('@tomjs/eslint/node')],
7
- };
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- '*.{js,cjs,ts}': ['eslint --fix', 'prettier --write'],
3
- '*.{json,md}': ['prettier --write'],
4
- '*.{css,scss,less,html}': ['stylelint --fix', 'prettier --write'],
5
- };
@@ -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
- }
@@ -1,4 +0,0 @@
1
- {
2
- "displayName": "VSCode Extension",
3
- "description": "This is a VSCode Extension"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "displayName": "VSCode 扩展",
3
- "description": "这是一个 VSCode 扩展"
4
- }
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,5 +0,0 @@
1
- {
2
- "extends": "@tomjs/tsconfig/node.json",
3
- "compilerOptions": {},
4
- "include": ["src", "scripts", "package.json", "vite.config.ts"]
5
- }
@@ -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,3 +0,0 @@
1
- # extension-react
2
-
3
- vite + extension + react
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- env: {
3
- node: true,
4
- es6: true,
5
- },
6
- extends: [require.resolve('@tomjs/eslint/react')],
7
- };
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- '*.{js,cjs,ts,tsx}': ['eslint --fix', 'prettier --write'],
3
- '*.{json,md}': ['prettier --write'],
4
- '*.{css,scss,less,html}': ['stylelint --fix', 'prettier --write'],
5
- };
@@ -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
- }
@@ -1,4 +0,0 @@
1
- {
2
- "displayName": "VSCode Extension",
3
- "description": "This is a VSCode Extension"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "displayName": "VSCode 扩展",
3
- "description": "这是一个 VSCode 扩展"
4
- }
@@ -1,7 +0,0 @@
1
- main {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: center;
5
- align-items: flex-start;
6
- height: 100%;
7
- }
@@ -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,9 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom/client';
3
- import App from './App.tsx';
4
-
5
- ReactDOM.createRoot(document.getElementById('app')!).render(
6
- <React.StrictMode>
7
- <App />
8
- </React.StrictMode>,
9
- );
@@ -1 +0,0 @@
1
- export * from './vscode';