Skip to content

Commit 934136c

Browse files
committed
chore: setup build with vite
1 parent 175ee00 commit 934136c

File tree

11 files changed

+817
-584
lines changed

11 files changed

+817
-584
lines changed

.eslintignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.eslintrc.js
2-
vite.config.js
32
.lintstagedrc.js
4-
jest.config.js
3+
*.config.js
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
vite.config.js
2-
node_modules
3-
jest.config.js
1+
*.config.js
2+
node_modules

packages/vs-code-extension/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

packages/vs-code-extension/.vscode/launch.json

+27-15
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,31 @@
33
// Hover to view descriptions of existing attributes.
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
{
6-
"version": "0.2.0",
7-
"configurations": [
8-
{
9-
"name": "Run 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-
]
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": "npm: dev"
19+
},
20+
{
21+
"name": "Preview Extension",
22+
"type": "extensionHost",
23+
"request": "launch",
24+
"args": [
25+
"--extensionDevelopmentPath=${workspaceFolder}"
26+
],
27+
"outFiles": [
28+
"${workspaceFolder}/dist/extension/*.js"
29+
],
30+
"preLaunchTask": "npm: build"
31+
}
32+
]
2133
}
+42-39
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1-
// See https://go.microsoft.com/fwlink/?LinkId=733558
2-
// for the documentation about the tasks.json format
31
{
4-
"version": "2.0.0",
5-
"tasks": [
6-
{
7-
"type": "npm",
8-
"script": "watch",
9-
"problemMatcher": "$ts-webpack-watch",
10-
"isBackground": true,
11-
"presentation": {
12-
"reveal": "never",
13-
"group": "watchers"
14-
},
15-
"group": {
16-
"kind": "build",
17-
"isDefault": true
18-
}
19-
},
20-
{
21-
"type": "npm",
22-
"script": "watch-tests",
23-
"problemMatcher": "$tsc-watch",
24-
"isBackground": true,
25-
"presentation": {
26-
"reveal": "never",
27-
"group": "watchers"
28-
},
29-
"group": "build"
30-
},
31-
{
32-
"label": "tasks: watch-tests",
33-
"dependsOn": [
34-
"npm: watch",
35-
"npm: watch-tests"
36-
],
37-
"problemMatcher": []
38-
}
39-
]
40-
}
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "dev",
7+
"problemMatcher": {
8+
"owner": "typescript",
9+
"fileLocation": "relative",
10+
"pattern": {
11+
"regexp": "^([a-zA-Z]\\:/?([\\w\\-]/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
12+
"file": 1,
13+
"line": 3,
14+
"column": 4,
15+
"code": 5,
16+
"message": 6
17+
},
18+
"background": {
19+
"activeOnStart": true,
20+
"beginsPattern": "^.*extension build start*$",
21+
"endsPattern": "^.*extension (build|rebuild) success.*$"
22+
}
23+
},
24+
"isBackground": true,
25+
"presentation": {
26+
"reveal": "never"
27+
},
28+
"group": {
29+
"kind": "build",
30+
"isDefault": true
31+
}
32+
},
33+
{
34+
"type": "npm",
35+
"script": "build",
36+
"group": {
37+
"kind": "build",
38+
"isDefault": true
39+
},
40+
"problemMatcher": []
41+
}
42+
]
43+
}

packages/vs-code-extension/package.json

+23-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"Other"
1111
],
1212
"activationEvents": [],
13-
"main": "./dist/extension.js",
13+
"main": "./dist/extension/index.js",
1414
"contributes": {
1515
"commands": [
1616
{
@@ -21,27 +21,38 @@
2121
},
2222
"scripts": {
2323
"vscode:prepublish": "yarn run package",
24-
"compile": "webpack",
25-
"watch": "webpack --watch",
26-
"package": "webpack --mode production --devtool hidden-source-map",
2724
"compile-tests": "tsc -p . --outDir out",
2825
"watch-tests": "tsc -p . -w --outDir out",
29-
"pretest": "yarn run compile-tests && yarn run compile && yarn run lint",
26+
"pretest": "yarn run compile-tests && yarn run build && yarn run lint",
3027
"lint": "eslint src --ext ts",
31-
"test": "vscode-test"
28+
"test": "vscode-test",
29+
"build": "vite build",
30+
"preview": "vite preview"
3231
},
3332
"devDependencies": {
34-
"@types/vscode": "^1.87.0",
33+
"@tomjs/vite-plugin-vscode": "^2.2.0",
34+
"@tomjs/vscode-extension-webview": "^1.2.0",
3535
"@types/mocha": "^10.0.6",
3636
"@types/node": "18.x",
37+
"@types/react": "^18.2.75",
38+
"@types/react-dom": "^18.2.24",
39+
"@types/vscode": "^1.87.0",
3740
"@typescript-eslint/eslint-plugin": "^7.4.0",
3841
"@typescript-eslint/parser": "^7.4.0",
42+
"@vitejs/plugin-react-swc": "^3.6.0",
43+
"@vscode/test-cli": "^0.0.8",
44+
"@vscode/test-electron": "^2.3.9",
3945
"eslint": "^8.57.0",
40-
"typescript": "^5.3.3",
4146
"ts-loader": "^9.5.1",
42-
"webpack": "^5.91.0",
43-
"webpack-cli": "^5.1.4",
44-
"@vscode/test-cli": "^0.0.8",
45-
"@vscode/test-electron": "^2.3.9"
47+
"typescript": "^5.3.3",
48+
"vite": "^5.2.8",
49+
"vite-tsconfig-paths": "^4.3.2"
50+
},
51+
"dependencies": {
52+
"dbml-to-json-table-schema": "0.0.0",
53+
"json-table-schema-visualizer": "1.0.0",
54+
"react": "^18.2.0",
55+
"react-dom": "^18.2.0",
56+
"shared": "0.0.0"
4657
}
4758
}

packages/vs-code-extension/src/test/extension.test.ts

-15
This file was deleted.
+16-14
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
2-
"compilerOptions": {
3-
"module": "Node16",
4-
"target": "ES2022",
5-
"lib": [
6-
"ES2022"
7-
],
8-
"sourceMap": true,
9-
"rootDir": "src",
10-
"strict": true /* enable all strict type-checking options */
11-
/* Additional Checks */
12-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
13-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
14-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
15-
}
2+
"compilerOptions": {
3+
"module": "Node16",
4+
"target": "ES2022",
5+
"lib": ["ES2022", "DOM"],
6+
"sourceMap": true,
7+
"rootDir": "./",
8+
"baseUrl": "./src",
9+
"strict": true,
10+
"jsx": "react-jsx",
11+
"paths": {
12+
"@/*": ["./*"]
13+
},
14+
"skipLibCheck": true
15+
},
16+
"exclude": ["node_modules", "vite.config.js"],
17+
"include": ["**/*.ts", "**/*.tsx"]
1618
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import vscode from "@tomjs/vite-plugin-vscode";
2+
import react from "@vitejs/plugin-react-swc";
3+
import { defineConfig } from "vite";
4+
import tsconfigPaths from 'vite-tsconfig-paths';
5+
6+
// https://vitejs.dev/config/
7+
export default defineConfig({
8+
plugins: [tsconfigPaths() , react(), vscode()],
9+
});

packages/vs-code-extension/webpack.config.js

-48
This file was deleted.

0 commit comments

Comments
 (0)