Skip to content

Commit ab333ab

Browse files
Update build tooling (#42)
* Replace yarn with npm * Replace eslint with oxlint * Replace prettier with oxfmt * Update all dependency versions * Enable much stricter lint rules * Added test ci workflow
1 parent c3a63b2 commit ab333ab

33 files changed

Lines changed: 3175 additions & 1860 deletions

.eslintrc.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @cursorless-dev/code-owners
1+
* @cursorless-dev/code-owners

.github/workflows/deploy.yaml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,62 @@
11
name: Deploy
22

33
on:
4-
workflow_dispatch:
4+
workflow_run:
5+
workflows: [Test]
6+
types: [completed]
7+
branches: [main]
8+
9+
permissions:
10+
contents: write
511

612
jobs:
713
publish-extension:
814
name: Publish to marketplace
915
runs-on: ubuntu-latest
10-
environment: production
16+
environment: Production
17+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
18+
1119
steps:
1220
- name: Checkout repository
13-
uses: actions/checkout@v4
21+
uses: actions/checkout@v6
1422
with:
15-
fetch-depth: 0
23+
ref: ${{ github.event.workflow_run.head_sha }}
1624

1725
- name: Set up Node.js
18-
uses: actions/setup-node@v4
26+
uses: actions/setup-node@v6
1927
with:
2028
node-version-file: .nvmrc
21-
cache: yarn
29+
cache: npm
2230

2331
- name: Install dependencies
24-
run: yarn install
32+
run: npm --color ci
33+
34+
- name: Read version from package.json
35+
run: |
36+
VERSION=$(node -p "require('./package.json').version")
37+
echo "version=$VERSION" >> $GITHUB_ENV
38+
39+
- name: Check whether this version is already published
40+
run: |
41+
if git ls-remote --exit-code --tags origin "refs/tags/${{ env.version }}" > /dev/null; then
42+
echo "Version ${{ env.version }} is already tagged."
43+
exit 1
44+
fi
2545
2646
- name: Publish to Open VSX Registry
2747
id: publishToOpenVSX
28-
uses: HaaLeo/publish-vscode-extension@v1
48+
uses: HaaLeo/publish-vscode-extension@v2
2949
with:
3050
pat: ${{ secrets.OPEN_VSX_TOKEN }}
3151

3252
- name: Publish to Visual Studio Marketplace
33-
uses: HaaLeo/publish-vscode-extension@v1
53+
uses: HaaLeo/publish-vscode-extension@v2
3454
with:
3555
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
3656
registryUrl: https://marketplace.visualstudio.com
3757
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }}
58+
59+
- name: Create Git tag
60+
run: |
61+
git tag "${{ env.version }}"
62+
git push origin "${{ env.version }}"

.github/workflows/test.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
run-tests:
14+
name: Run tests
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v6
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v6
23+
with:
24+
node-version-file: .nvmrc
25+
cache: npm
26+
27+
- name: Install dependencies
28+
run: npm --color ci
29+
30+
- name: Build
31+
run: npm --color run build
32+
33+
- name: Run lint
34+
run: npm --color run lint
35+
36+
- name: Run tests
37+
run: xvfb-run -a npm --color run test:ci

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v21.1.0
1+
v24.14.0

.oxfmtrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 80,
4+
"sortPackageJson": false,
5+
"sortImports": {
6+
"newlinesBetween": false,
7+
"partitionByNewline": true
8+
}
9+
}

.prettierrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,24 @@
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
51
{
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}/out/**/*.js"
17-
],
18-
"preLaunchTask": "${defaultBuildTask}"
19-
},
20-
{
21-
"name": "Extension Tests",
22-
"type": "extensionHost",
23-
"request": "launch",
24-
"args": [
25-
"--extensionDevelopmentPath=${workspaceFolder}",
26-
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
27-
],
28-
"outFiles": [
29-
"${workspaceFolder}/out/test/**/*.js"
30-
],
31-
"preLaunchTask": "${defaultBuildTask}"
32-
}
33-
]
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Extension",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
9+
"outFiles": ["${workspaceFolder}/out/**/*.js"],
10+
"preLaunchTask": "${defaultBuildTask}"
11+
},
12+
{
13+
"name": "Extension Tests",
14+
"type": "extensionHost",
15+
"request": "launch",
16+
"args": [
17+
"--extensionDevelopmentPath=${workspaceFolder}",
18+
"--extensionTestsPath=${workspaceFolder}/out/test/runAllTests"
19+
],
20+
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
21+
"preLaunchTask": "${defaultBuildTask}"
22+
}
23+
]
3424
}

.vscode/settings.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
// Place your settings in this file to overwrite default and user settings.
21
{
3-
"files.exclude": {
4-
"out": false // set this to true to hide the "out" folder with the compiled JS files
5-
},
6-
"search.exclude": {
7-
"out": true // set this to false to include "out" folder in search results
8-
},
9-
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10-
"typescript.tsc.autoDetect": "off",
11-
"cSpell.words": [
12-
"eqeqeq"
13-
]
14-
}
2+
"editor.defaultFormatter": "oxc.oxc-vscode",
3+
"oxc.configPath": "./oxlint.config.mts"
4+
}

0 commit comments

Comments
 (0)