Skip to content

Commit

Permalink
fix(github-actions): improve error logging and fix ESM node resolution
Browse files Browse the repository at this point in the history
We recently prioritized `module` over `main` but this results in browser
code being prioritized sometimes. We revert that change and keep the
original/default ESBuild main field order.

This unveils an issue with `jsonc-parser` though- which ships an UMD
file for `main` that cannot be bundled. We can work around this by
processing `jsonc-parser`'s ESM output directly and then using that
instead of leaving resolution to ESBuild for this package.

There is an issue for this being tracked: microsoft/node-jsonc-parser#57
  • Loading branch information
devversion committed Oct 21, 2022
1 parent a67b584 commit c172725
Show file tree
Hide file tree
Showing 24 changed files with 120,370 additions and 110,196 deletions.
23,016 changes: 12,277 additions & 10,739 deletions .github/local-actions/changelog/main.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bazel/esbuild/index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def esbuild_esm_bundle(name, **kwargs):

args = dict(
resolveExtensions = [".mjs", ".js", ".json"],
mainFields = ["module", "main"],
outExtension = {".js": ".mjs"},
# Workaround for: https://github.com/evanw/esbuild/issues/1921.
banner = {
Expand Down
1 change: 1 addition & 0 deletions github-actions/auth-app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@octokit/auth-app';
2 changes: 1 addition & 1 deletion github-actions/commit-message-based-labels/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CommitMessageBasedLabelManager {
// to prevent the action from actually running in a fork of a repository with this action set up.
if (context.repo.owner === 'angular') {
CommitMessageBasedLabelManager.run().catch((e: Error) => {
core.error(e);
console.error(e);
core.setFailed(e.message);
});
} else {
Expand Down
30,320 changes: 15,890 additions & 14,430 deletions github-actions/commit-message-based-labels/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/create-pr-for-changes/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async function main(): Promise<void> {
}
} catch (err: any) {
core.setOutput('result', ActionResult.failed);
core.error(err);
console.error(err);
core.setFailed(err.message);
}
}
Expand Down
13,598 changes: 6,143 additions & 7,455 deletions github-actions/create-pr-for-changes/main.js

Large diffs are not rendered by default.

22,315 changes: 11,917 additions & 10,398 deletions github-actions/feature-request/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/google-internal-tests/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ async function findExistingTestStatus(
}

main().catch((e: Error) => {
core.error(e);
console.error(e);
core.setFailed(e.message);
});
14,509 changes: 6,929 additions & 7,580 deletions github-actions/google-internal-tests/main.js

Large diffs are not rendered by default.

Empty file.
22,179 changes: 11,849 additions & 10,330 deletions github-actions/labels-sync/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/lock-closed/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async function runLockClosedAction(github: Octokit): Promise<void> {
// Runs triggered via 'workflow_dispatch' are also allowed to run.
if (context.repo.owner === 'angular' || context.eventName === 'workflow_dispatch') {
main().catch((e: Error) => {
core.error(e);
console.error(e);
core.setFailed(e.message);
});
} else {
Expand Down
22,177 changes: 11,848 additions & 10,329 deletions github-actions/lock-closed/main.js

Large diffs are not rendered by default.

22,245 changes: 11,882 additions & 10,363 deletions github-actions/org-file-sync/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/post-approval-changes/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async function runPostApprovalChangesAction(client: Octokit): Promise<void> {
// Runs triggered via 'workflow_dispatch' are also allowed to run.
if (context.repo.owner === 'angular') {
main().catch((e: Error) => {
core.error(e);
console.error(e);
core.setFailed(e.message);
});
} else {
Expand Down
22,221 changes: 11,870 additions & 10,351 deletions github-actions/post-approval-changes/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/slash-commands/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async function runSlashCommandsAction(
// to prevent the action from actually running in a fork of a repository with this action set up.
if (context.repo.owner === 'angular') {
main().catch((e: Error) => {
core.error(e);
console.error(e);
core.setFailed(e.message);
});
} else {
Expand Down
Loading

0 comments on commit c172725

Please sign in to comment.