Skip to content

Commit d21c021

Browse files
Update build scripts (#3217)
1 parent da3aec1 commit d21c021

37 files changed

Lines changed: 225 additions & 203 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Setup node
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Install pnpm
7+
uses: pnpm/action-setup@v4
8+
9+
- name: Set up Node.js
10+
uses: actions/setup-node@v6
11+
with:
12+
node-version-file: .nvmrc
13+
cache: pnpm
14+
15+
- name: Install dependencies
16+
shell: bash
17+
run: pnpm --color install
Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,8 @@ jobs:
2323
# Deploy the exact commit that passed the test workflow.
2424
ref: ${{ github.event.workflow_run.head_sha }}
2525

26-
- name: Install pnpm
27-
uses: pnpm/action-setup@v4
28-
2926
- name: Set up Node.js
30-
uses: actions/setup-node@v6
31-
with:
32-
node-version-file: .nvmrc
33-
cache: pnpm
34-
35-
- name: Install dependencies
36-
run: pnpm --color install
27+
uses: ./.github/actions/setup-node
3728

3829
- name: Compile
3930
run: pnpm --color compile
@@ -73,17 +64,8 @@ jobs:
7364
# Deploy the exact commit that passed the test workflow.
7465
ref: ${{ github.event.workflow_run.head_sha }}
7566

76-
- name: Install pnpm
77-
uses: pnpm/action-setup@v4
78-
7967
- name: Set up Node.js
80-
uses: actions/setup-node@v6
81-
with:
82-
node-version-file: .nvmrc
83-
cache: pnpm
84-
85-
- name: Install dependencies
86-
run: pnpm --color install
68+
uses: ./.github/actions/setup-node
8769

8870
- name: Compile
8971
run: pnpm --color compile

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,7 @@ jobs:
2727
with:
2828
python-version-file: "pyproject.toml"
2929

30-
- name: Install pnpm
31-
uses: pnpm/action-setup@v4
32-
33-
- name: Set up Node.js
34-
uses: actions/setup-node@v6
35-
with:
36-
node-version-file: .nvmrc
37-
cache: pnpm
38-
39-
- name: Install dependencies
40-
run: pnpm --color install
30+
- uses: ./.github/actions/setup-node
4131

4232
- name: Install lua
4333
uses: leafo/gh-actions-lua@v12

.github/workflows/test-docs.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,8 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v6
1818

19-
- name: Install pnpm
20-
uses: pnpm/action-setup@v4
21-
2219
- name: Set up Node.js
23-
uses: actions/setup-node@v6
24-
with:
25-
node-version-file: .nvmrc
26-
cache: pnpm
20+
uses: ./.github/actions/setup-node
2721

2822
- name: Build website
2923
run: bash -x scripts/build-and-assemble-website.sh

.github/workflows/test.yml

Lines changed: 63 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,27 @@ on:
1111
branches: [main]
1212
workflow_dispatch:
1313

14+
env:
15+
CURSORLESS_REPO_ROOT: ${{ github.workspace }}
16+
TEMP_DIR: ${{ github.workspace }}/temp
17+
NODE_OPTIONS: "--max-old-space-size=4096"
18+
1419
jobs:
15-
test:
20+
lint:
21+
name: Lint
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v6
27+
28+
- name: Set up Node.js
29+
uses: ./.github/actions/setup-node
30+
31+
- name: Lint
32+
run: pnpm --color lint
33+
34+
test-main:
1635
name: Test
1736
strategy:
1837
fail-fast: false
@@ -23,15 +42,10 @@ jobs:
2342
- os: ubuntu-latest
2443
app_version: legacy
2544
runs-on: ${{ matrix.os }}
26-
2745
env:
2846
APP_VERSION: ${{ matrix.app_version }}
29-
NEOVIM_VERSION: ${{ matrix.app_version == 'stable' && 'stable' || 'v0.10.0' }}
3047
VSCODE_CRASH_DIR: ${{ github.workspace }}/artifacts/dumps
3148
VSCODE_LOGS_DIR: ${{ github.workspace }}/artifacts/logs
32-
CURSORLESS_REPO_ROOT: ${{ github.workspace }}
33-
TEMP_DIR: ${{ github.workspace }}/temp
34-
NODE_OPTIONS: "--max-old-space-size=4096"
3549

3650
steps:
3751
- name: Git config
@@ -40,31 +54,19 @@ jobs:
4054
- name: Checkout repository
4155
uses: actions/checkout@v6
4256

43-
- name: Install pnpm
44-
uses: pnpm/action-setup@v4
45-
4657
- name: Set up Node.js
47-
uses: actions/setup-node@v6
48-
with:
49-
node-version-file: .nvmrc
50-
cache: pnpm
58+
uses: ./.github/actions/setup-node
5159

5260
- name: Creating log directories
5361
run: mkdir -p "${{ env.VSCODE_CRASH_DIR }}" "${{ env.VSCODE_LOGS_DIR }}" "${{ env.TEMP_DIR }}"
5462
shell: bash
5563

56-
- name: Install dependencies
57-
run: pnpm --color install
58-
5964
- name: Compile
6065
run: pnpm --color compile
6166

6267
- name: Build
6368
run: pnpm --color --filter '!cursorless-org' --filter '!cursorless-org-*' build
6469

65-
- name: Lint
66-
run: pnpm --color lint
67-
6870
- name: Run unit tests (Linux)
6971
run: xvfb-run -a pnpm --color test
7072
if: runner.os == 'Linux'
@@ -87,40 +89,15 @@ jobs:
8789

8890
- name: Run Talon-JS tests (Win,Mac)
8991
run: pnpm -F @cursorless/test-harness test:talonJs
90-
if: runner.os != 'Linux' && matrix.app_version == 'stable'
92+
if: runner.os != 'Linux'
9193

9294
- name: Run Cursorless-everywhere-talon tests (Linux)
9395
run: xvfb-run -a pnpm -F @cursorless/cursorless-everywhere-talon-e2e test:quickjs
9496
if: runner.os == 'Linux' && matrix.app_version == 'stable'
9597

9698
- name: Run Cursorless-everywhere-talon tests (Win,Mac)
9799
run: pnpm -F @cursorless/cursorless-everywhere-talon-e2e test:quickjs
98-
if: runner.os != 'Linux' && matrix.app_version == 'stable'
99-
100-
- name: Install neovim dependencies
101-
run: bash -x scripts/install-neovim-dependencies.sh
102-
103-
- name: Setup neovim (Linux)
104-
uses: rhysd/action-setup-vim@v1
105-
id: vim
106-
if: runner.os == 'Linux' && matrix.app_version == 'stable'
107-
with:
108-
version: ${{ env.NEOVIM_VERSION }}
109-
neovim: true
110-
111-
- name: Run neovim tests (Linux)
112-
run: xvfb-run -a pnpm -F @cursorless/test-harness test:neovim
113-
if: runner.os == 'Linux' && matrix.app_version == 'stable'
114-
env:
115-
NEOVIM_PATH: ${{ steps.vim.outputs.executable }}
116-
117-
- name: Run neovim lua tests (Linux)
118-
uses: ./.github/actions/test-neovim-lua/
119-
if: runner.os == 'Linux' && matrix.app_version == 'stable'
120-
121-
- name: Run neovim lua lint (Linux)
122-
uses: ./.github/actions/lint-lua-ls/
123-
if: runner.os == 'Linux' && matrix.app_version == 'stable'
100+
if: runner.os != 'Linux'
124101

125102
- name: Create vscode dist that can be installed locally
126103
run: pnpm -F @cursorless/cursorless-vscode populate-dist --local-install
@@ -158,3 +135,43 @@ jobs:
158135
name: dumps-${{ matrix.os }}-${{ matrix.app_version }}
159136
path: ${{ env.VSCODE_CRASH_DIR }}
160137
if: failure()
138+
139+
test-neovim:
140+
name: Test Neovim
141+
runs-on: ubuntu-latest
142+
143+
steps:
144+
- name: Git config
145+
run: git config --global core.autocrlf false
146+
147+
- name: Checkout repository
148+
uses: actions/checkout@v6
149+
150+
- name: Set up Node.js
151+
uses: ./.github/actions/setup-node
152+
153+
- name: Compile
154+
run: pnpm --color compile
155+
156+
- name: Build
157+
run: pnpm --color --filter '!cursorless-org' --filter '!cursorless-org-*' build
158+
159+
- name: Install neovim dependencies
160+
run: bash -x scripts/install-neovim-dependencies.sh
161+
162+
- name: Setup neovim
163+
uses: rhysd/action-setup-vim@v1
164+
id: vim
165+
with:
166+
neovim: true
167+
168+
- name: Run neovim tests
169+
run: xvfb-run -a pnpm -F @cursorless/test-harness test:neovim
170+
env:
171+
NEOVIM_PATH: ${{ steps.vim.outputs.executable }}
172+
173+
- name: Run neovim lua tests
174+
uses: ./.github/actions/test-neovim-lua/
175+
176+
- name: Run neovim lua lint
177+
uses: ./.github/actions/lint-lua-ls/

.meta-updater/main.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
import { updater } from "../packages/meta-updater/dist/index.cjs";
1+
// eslint-disable-next-line import/no-relative-packages
2+
import { updater } from "../packages/meta-updater/src/index.ts";
23

34
export default updater;

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ repos:
6969
name: format-recorded-tests
7070
files: ^data/fixtures/recorded/.*/[^/]*\.yml$
7171
language: system
72-
entry: pnpm exec ./packages/common/scripts/my-ts-node.js packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts
72+
entry: pnpm transform-recorded-tests
7373

7474
- repo: local
7575
hooks:
7676
- id: check-recorded-test-marks
7777
name: check-recorded-test-marks
7878
files: ^data/fixtures/recorded/.*/[^/]*\.yml$
7979
language: system
80-
entry: pnpm exec ./packages/common/scripts/my-ts-node.js packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts --check-marks
80+
entry: pnpm transform-recorded-tests --check-marks
8181

8282
- repo: https://github.com/astral-sh/ruff-pre-commit
8383
rev: v0.15.5

.vscode/settings.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
"[python]": {
66
"editor.defaultFormatter": "charliermarsh.ruff"
77
},
8-
"[scm]": {
9-
"editor.defaultFormatter": "AndreasArvidsson.andreas-talon",
10-
"editor.tabSize": 2
11-
},
12-
"[talon]": {
13-
"editor.defaultFormatter": "wenkokke.talonfmt-vscode"
8+
"[talon][talon-list][scm]": {
9+
"editor.defaultFormatter": "AndreasArvidsson.andreas-talon"
1410
},
1511
"cSpell.words": [
1612
"Autoformatting",

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@
1313
"build": "pnpm -r build",
1414
"clean": "pnpm -r clean",
1515
"compile": "tsc --build && pnpm -r compile:esbuild",
16-
"fix:meta": "pnpm run meta-updater:base && pnpm -r exec prettier --write tsconfig.json package.json",
16+
"fix:meta": "pnpm run meta-updater && pnpm -r exec prettier --write tsconfig.json package.json",
1717
"fix:syncpack": "syncpack fix",
1818
"fix:eslint": "pnpm lint:ts --fix",
1919
"fix:prettier": "prettier --write --list-different .",
20-
"lint:meta": "pnpm run meta-updater:base --test",
20+
"lint:meta": "pnpm run meta-updater --test",
2121
"lint:syncpack": "syncpack lint",
22-
"lint:ts": "eslint packages --ext ts,tsx,mts",
22+
"lint:ts": "eslint packages",
2323
"lint:prettier": "prettier --check .",
2424
"lint": "pnpm run lint:meta && pnpm run lint:syncpack && pnpm run lint:ts",
25-
"init-vscode-sandbox": "pnpm --filter=@cursorless/cursorless-vscode init-launch-sandbox",
26-
"meta-updater:base": "pnpm --filter=@cursorless/meta-updater build && meta-updater",
25+
"init-vscode-sandbox": "pnpm -F=@cursorless/cursorless-vscode init-launch-sandbox",
26+
"meta-updater": "env NODE_OPTIONS='--import=tsx --conditions=cursorless:bundler' meta-updater",
2727
"preinstall": "npx only-allow pnpm",
2828
"test-compile": "tsc --build",
2929
"test": "pnpm -r test",
3030
"test:subset": "pnpm -r test:subset",
3131
"test:update": "pnpm -r test:update",
3232
"test:update:subset": "pnpm -r test:update:subset",
3333
"generate-grammar": "pnpm -r generate-grammar",
34-
"transform-recorded-tests": "./packages/common/scripts/my-ts-node.js packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts",
34+
"transform-recorded-tests": "pnpm exec ./packages/common/scripts/my-ts-node.js ./packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts",
3535
"watch": "pnpm run -w --parallel '/^watch:.*/'",
3636
"watch:esbuild": "pnpm run -r --parallel watch:esbuild",
3737
"watch:tsc": "tsc --build --watch"
@@ -53,6 +53,7 @@
5353
"prettier": "^3.8.1",
5454
"prettier-plugin-tailwindcss": "^0.7.2",
5555
"syncpack": "^14.0.2",
56+
"tsx": "^4.21.0",
5657
"typescript": "^5.9.3",
5758
"typescript-eslint": "^8.56.1"
5859
},

packages/cheatsheet-local/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"scripts": {
2222
"compile": "tsc --build",
2323
"watch": "tsc --build --watch",
24-
"webpack": "pnpm -w compile && env NODE_OPTIONS=--loader=ts-node/esm webpack --config ./src/webpack.config.ts",
2524
"build": "pnpm build:prod",
2625
"build:dev": "pnpm webpack --mode=development",
2726
"build:prod": "pnpm webpack --mode=production --node-env=production",
27+
"webpack": "env NODE_OPTIONS=--loader=ts-node/esm webpack --config ./src/webpack.config.ts",
2828
"clean": "rm -rf ./out tsconfig.tsbuildinfo ./dist ./build"
2929
},
3030
"dependencies": {

0 commit comments

Comments
 (0)