-
Notifications
You must be signed in to change notification settings - Fork 450
Bundle Actions using esbuild #3054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 67d4718
Compile sources to separate directory for tests
henrymercer 8b7a4ec
Remove `node_modules` directory
henrymercer 88d8b86
Check in compiled files
henrymercer 6d34e4e
Use "Rebuild" workflow instead of "Update dependencies"
henrymercer 31ee7f5
Install dependencies in PR checks
henrymercer 06f83b7
Run more checks on `push`
henrymercer 3edad3e
Combine basic jobs to reduce Actions usage
henrymercer a2df83b
Cache npm dependencies
henrymercer d8905c2
Don't run linter in CI on Windows
henrymercer f04e228
Merge branch 'main' into henrymercer/bundle
henrymercer 3e725de
Copy `defaults.json` to `lib`
henrymercer f8c0d73
Install dependencies in code scanning config test
henrymercer 879c788
Install npm dependencies where necessary in generated workflows
henrymercer 88f7d3d
Install dependencies in query filters tests
henrymercer 36468ba
Delete expected queries runs check
henrymercer 786d3aa
Remove unused import in build script
henrymercer 4da503e
Use `npm ci` in CI
henrymercer 8a3bfe6
Transpile separately in both build and test steps
henrymercer e274fb8
Implement clean and copy as custom plugins
henrymercer ca5a69b
Specify esbuild target
henrymercer d7c1640
Avoid automatic semicolon insertion
henrymercer d2dfa8c
Check in precompiled `upload-lib.ts` for testing environments
henrymercer 68be0dc
Merge branch 'main' into henrymercer/bundle
henrymercer 6d7d2c6
Bump minor version number
henrymercer 138655e
Update `CONTRIBUTING.md`
henrymercer 3e493e7
Remove `removeNPMAbsolutePaths`
henrymercer File filter
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.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { rm } from "node:fs/promises"; | ||
|
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", | ||
|
henrymercer marked this conversation as resolved.
|
||
| plugins: [typecheckPlugin(), onEndPlugin], | ||
| }); | ||
|
|
||
| await context.rebuild(); | ||
| await context.dispose(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.