Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fee3663
Bundle Actions using esbuild
henrymercer Aug 21, 2025
67d4718
Compile sources to separate directory for tests
henrymercer Aug 21, 2025
8b7a4ec
Remove `node_modules` directory
henrymercer Aug 21, 2025
88d8b86
Check in compiled files
henrymercer Aug 21, 2025
6d34e4e
Use "Rebuild" workflow instead of "Update dependencies"
henrymercer Aug 20, 2025
31ee7f5
Install dependencies in PR checks
henrymercer Aug 21, 2025
06f83b7
Run more checks on `push`
henrymercer Aug 21, 2025
3edad3e
Combine basic jobs to reduce Actions usage
henrymercer Aug 21, 2025
a2df83b
Cache npm dependencies
henrymercer Aug 21, 2025
d8905c2
Don't run linter in CI on Windows
henrymercer Aug 21, 2025
f04e228
Merge branch 'main' into henrymercer/bundle
henrymercer Aug 21, 2025
3e725de
Copy `defaults.json` to `lib`
henrymercer Aug 21, 2025
f8c0d73
Install dependencies in code scanning config test
henrymercer Aug 21, 2025
879c788
Install npm dependencies where necessary in generated workflows
henrymercer Aug 21, 2025
88f7d3d
Install dependencies in query filters tests
henrymercer Aug 21, 2025
36468ba
Delete expected queries runs check
henrymercer Aug 21, 2025
786d3aa
Remove unused import in build script
henrymercer Aug 21, 2025
4da503e
Use `npm ci` in CI
henrymercer Aug 21, 2025
8a3bfe6
Transpile separately in both build and test steps
henrymercer Aug 22, 2025
e274fb8
Implement clean and copy as custom plugins
henrymercer Aug 22, 2025
ca5a69b
Specify esbuild target
henrymercer Aug 22, 2025
d7c1640
Avoid automatic semicolon insertion
henrymercer Aug 22, 2025
d2dfa8c
Check in precompiled `upload-lib.ts` for testing environments
henrymercer Aug 27, 2025
68be0dc
Merge branch 'main' into henrymercer/bundle
henrymercer Aug 29, 2025
6d7d2c6
Bump minor version number
henrymercer Aug 29, 2025
138655e
Update `CONTRIBUTING.md`
henrymercer Aug 29, 2025
3e493e7
Remove `removeNPMAbsolutePaths`
henrymercer Aug 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
schedule:
interval: weekly
labels:
- Update dependencies
- Rebuild
# Ignore incompatible dependency updates
ignore:
# There is a type incompatibility issue between v0.0.9 and our other dependencies.
Expand Down
8 changes: 4 additions & 4 deletions .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def open_pr(
body.append(' - [ ] Ensure the docs team is aware of any documentation changes that need to be released.')

if not is_primary_release:
body.append(' - [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.')
body.append(' - [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.')
body.append(' - [ ] Remove and re-add the "Rebuild" label to the PR to trigger just this workflow.')
body.append(' - [ ] Wait for the "Rebuild" workflow to push a commit updating the distribution files.')

body.append(' - [ ] Mark the PR as ready for review to trigger the full set of PR checks.')
body.append(' - [ ] Approve and merge this PR. Make sure `Create a merge commit` is selected rather than `Squash and merge` or `Rebase and merge`.')
Expand All @@ -108,7 +108,7 @@ def open_pr(
body.append(' - [ ] Merge all backport PRs to older release branches, that will automatically be created once this PR is merged.')

title = f'Merge {source_branch} into {target_branch}'
labels = ['Update dependencies'] if not is_primary_release else []
labels = ['Rebuild'] if not is_primary_release else []

# Create the pull request
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft so that
Expand Down Expand Up @@ -389,7 +389,7 @@ def main():

# Migrate the package version number from a vLatest version number to a vOlder version number
print(f'Setting version number to {version} in package.json')
replace_version_package_json(get_current_version(), version) # We rely on the `Update dependencies` workflow to update package-lock.json
replace_version_package_json(get_current_version(), version) # We rely on the `Rebuild` workflow to update package-lock.json
run_git('add', 'package.json')

# Migrate the changelog notes from vLatest version numbers to vOlder version numbers
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/post-release-mergeback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# tag
# 2. Updates the `vN` tag to refer to this merge commit.
# 3. Iff vN == vLatest, merges any changes from the release back into the main branch.
# Typically, this is two commits – one to update the version number and one to update dependencies.
# Typically, this is two commits – one to update the version number and one to rebuild.
name: Tag release and merge back

on:
Expand Down Expand Up @@ -138,8 +138,8 @@ jobs:

Please do the following:

- [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.
- [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.
- [ ] Remove and re-add the "Rebuild" label to the PR to trigger just this workflow.
- [ ] Wait for the "Rebuild" workflow to push a commit updating the distribution files.
- [ ] Mark the PR as ready for review to trigger the full set of PR checks.
- [ ] Approve and merge the PR. When merging the PR, make sure "Create a merge commit" is
selected rather than "Squash and merge" or "Rebase and merge".
Expand All @@ -162,7 +162,7 @@ jobs:
--head "${NEW_BRANCH}" \
--base "${BASE_BRANCH}" \
--title "${pr_title}" \
--label "Update dependencies" \
--label "Rebuild" \
--body "${pr_body}" \
--assignee "${GITHUB_ACTOR}" \
--draft
Expand Down
25 changes: 5 additions & 20 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
contents: read
security-events: write # needed to upload ESLint results

strategy:
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Install dependencies
run: npm install

- name: Lint
id: lint
run: npm run-script lint-ci
run: npm run lint-ci

- name: Upload sarif
uses: github/codeql-action/upload-sarif@v3
Expand All @@ -37,21 +37,7 @@ jobs:
- name: Check generated JS
run: .github/workflows/script/check-js.sh

check-node-modules:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Check modules up to date
permissions:
contents: read
runs-on: macos-latest
timeout-minutes: 45

steps:
- uses: actions/checkout@v5
- name: Check node modules up to date
run: .github/workflows/script/check-node-modules.sh

check-file-contents:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
Comment thread
henrymercer marked this conversation as resolved.
name: Check file contents
permissions:
contents: read
Expand All @@ -72,9 +58,7 @@ jobs:
run: .github/workflows/script/verify-pr-checks.sh

npm-test:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Unit Test
needs: [check-js, check-node-modules]
strategy:
fail-fast: false
matrix:
Expand All @@ -91,6 +75,7 @@ jobs:
# Run any commands referenced in package.json using Bash, otherwise
# we won't be able to find them on Windows.
npm config set script-shell bash
npm install
npm test

check-node-version:
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/script/check-node-modules.sh

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/script/update-node-modules.sh

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/update-dependencies.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Ignore for example failing-tests.json from AVA
node_modules/.cache/
# Dependency directories
node_modules/
# Build output for tests
lib-test/
# Java build files
.gradle/
*.class
Expand All @@ -8,4 +10,4 @@ node_modules/.cache/
# eslint sarif report
eslint.sarif
# for local incremental compilation
tsconfig.tsbuildinfo
tsconfig.tsbuildinfo
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// transpiled JavaScript
"lib": true,
"lib-test": true,
},
// Installing a new Node package often triggers VS Code's git limit warnings as there is typically
// an intermediate stage where many files are modified. This setting suppresses these warnings.
Expand Down
38 changes: 38 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { rm } from "node:fs/promises";
Comment thread
henrymercer marked this conversation as resolved.
Outdated
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

import * as esbuild from "esbuild";
import { globSync } from "glob";
import { typecheckPlugin } from "@jgoz/esbuild-plugin-typecheck";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const OUT_DIR = "lib";

await rm(join(__dirname, OUT_DIR), { recursive: true, force: true });

// This will just log when a build ends
/** @type {esbuild.Plugin} */
const onEndPlugin = {
name: "on-end",
setup(build) {
build.onEnd((result) => {
// eslint-disable-next-line no-console
console.log(`Build ended with ${result.errors.length} errors`);
});
},
};

const context = await esbuild.context({
entryPoints: globSync(["src/*-action.ts", "src/*-action-post.ts"]),
bundle: true,
format: "cjs",
outdir: OUT_DIR,
platform: "node",
Comment thread
henrymercer marked this conversation as resolved.
plugins: [typecheckPlugin(), onEndPlugin],
});

await context.rebuild();
await context.dispose();
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ export default [
ignores: [
"**/webpack.config.js",
"lib/**/*",
"lib-test/**/*",
"src/testdata/**/*",
"tests/**/*",
"build.mjs",
"eslint.config.mjs",
".github/**/*",
],
Expand Down
Loading