Skip to content

Commit 5dac4d8

Browse files
authored
feat: add VS Code extension (#545)
1 parent 980f7a5 commit 5dac4d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+6670
-358
lines changed

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,73 @@ jobs:
5959
- name: Publish to npm
6060
run: |
6161
pnpm -r publish --tag ${{ github.event.inputs.npm_tag }} --publish-branch ${{ github.event.inputs.branch }}
62+
63+
release_vscode_extension:
64+
name: Release VS Code Extension (${{ matrix.vsce-target }})
65+
if: github.repository == 'web-infra-dev/rstest' && github.event_name == 'workflow_dispatch'
66+
needs: release
67+
runs-on: ${{ matrix.runner }}
68+
environment: vscode-marketplace
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
include:
73+
- runner: ubuntu-latest
74+
vsce-target: linux-x64
75+
platform: linux
76+
arch: x64
77+
- runner: ubuntu-22.04-arm64
78+
vsce-target: linux-arm64
79+
platform: linux
80+
arch: arm64
81+
- runner: macos-13
82+
vsce-target: darwin-x64
83+
platform: darwin
84+
arch: x64
85+
- runner: macos-14
86+
vsce-target: darwin-arm64
87+
platform: darwin
88+
arch: arm64
89+
- runner: windows-2022
90+
vsce-target: win32-x64
91+
platform: win32
92+
arch: x64
93+
- runner: windows-latest
94+
vsce-target: win32-arm64
95+
platform: win32
96+
arch: arm64
97+
defaults:
98+
run:
99+
shell: bash
100+
env:
101+
npm_config_arch: ${{ matrix.arch }}
102+
npm_config_platform: ${{ matrix.platform }}
103+
VSCE_TARGET: ${{ matrix.vsce-target }}
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
107+
with:
108+
fetch-depth: 1
109+
ref: ${{ github.event.inputs.branch }}
110+
111+
- name: Setup Pnpm
112+
run: |
113+
npm install -g corepack@latest --force
114+
corepack enable
115+
116+
- name: Setup Node.js
117+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
118+
with:
119+
node-version: 22
120+
cache: 'pnpm'
121+
122+
- name: Install Dependencies
123+
run: pnpm install
124+
125+
- name: Package VS Code Extension
126+
run: pnpm --filter ./packages/vscode run package:vsce -o "rstest-${{ matrix.vsce-target }}.vsix"
127+
128+
- name: Publish VS Code Extension
129+
env:
130+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
131+
run: pnpm --filter ./packages/vscode exec vsce publish --target ${{ matrix.vsce-target }}

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,7 @@ jobs:
113113
- name: E2E Test
114114
if: steps.changes.outputs.changed == 'true'
115115
run: pnpm run e2e
116+
117+
- name: VS Code Extension Test
118+
if: steps.changes.outputs.changed == 'true'
119+
run: pnpm run test:vscode

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ test-temp-*
2323
.vscode/**/*
2424
!.vscode/settings.json
2525
!.vscode/extensions.json
26+
!.vscode/launch.json
27+
!.vscode/tasks.json
2628
.idea/
2729
.nx/
2830
.history/
@@ -34,5 +36,7 @@ test-results/
3436
fixtures-test/
3537
fixtures-test-*/
3638
.rslib/
37-
3839
!packages/core/src/coverage
40+
tests-dist/
41+
.vscode-test/
42+
packages/vscode/*.vsix

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"runtimeExecutable": "${execPath}",
13+
"args": [
14+
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode",
15+
"${workspaceFolder}/packages/vscode/sample"
16+
],
17+
"outFiles": ["${workspaceFolder}/packages/vscode/dist/**/*.js"],
18+
"preLaunchTask": "npm: build:local"
19+
}
20+
]
21+
}

.vscode/tasks.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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": "build:local",
9+
"path": "packages/vscode",
10+
"problemMatcher": "$tsc-watch",
11+
"isBackground": true,
12+
"presentation": {
13+
"reveal": "never"
14+
},
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
}
19+
}
20+
]
21+
}

biome.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
33
"assist": { "actions": { "source": { "organizeImports": "on" } } },
44
"vcs": {
55
"enabled": true,
@@ -9,7 +9,13 @@
99
},
1010
"files": {
1111
"ignoreUnknown": true,
12-
"includes": ["**", "!**/*.vue", "!**/dist", "!**/dist-types"]
12+
"includes": [
13+
"**",
14+
"!**/*.vue",
15+
"!**/dist",
16+
"!**/dist-types",
17+
"!**/.vscode-test.mjs"
18+
]
1319
},
1420
"formatter": {
1521
"indentStyle": "space"

e2e/scripts/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Cli {
1111
public stdout = '';
1212
public stderr = '';
1313
private stdoutListeners: Array<() => void> = [];
14-
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: will use it
1514
private stderrListeners: Array<() => void> = [];
1615

1716
constructor(

e2e/test-coverage/fixtures/src/string.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ export const countWords = (str: string): number => {
2121

2222
export const truncate = (str: string, maxLength: number): string => {
2323
if (str.length <= maxLength) return str;
24-
return str.slice(0, maxLength - 3) + '...';
24+
return `${str.slice(0, maxLength - 3)}...`;
2525
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"scripts": {
55
"typecheck": "cross-env NX_DAEMON=false nx run-many -t typecheck --exclude @examples/* --parallel=10",
66
"build": "cross-env NX_DAEMON=false nx run-many -t build --exclude @examples/* @rstest/tests-* --parallel=10",
7+
"test:vscode": "pnpm --filter ./packages/vscode test",
78
"e2e": "cd e2e && pnpm test",
89
"test": "rstest",
910
"change": "changeset",

0 commit comments

Comments
 (0)