Skip to content

Commit 19e3093

Browse files
committed
fix(github-actions): improve error logging and fix ESM node resolution
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
1 parent a67b584 commit 19e3093

File tree

21 files changed

+120365
-110196
lines changed

21 files changed

+120365
-110196
lines changed

.github/local-actions/changelog/main.js

+12,277-10,739
Large diffs are not rendered by default.

bazel/esbuild/index.bzl

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def esbuild_esm_bundle(name, **kwargs):
2929

3030
args = dict(
3131
resolveExtensions = [".mjs", ".js", ".json"],
32-
mainFields = ["module", "main"],
3332
outExtension = {".js": ".mjs"},
3433
# Workaround for: https://github.com/evanw/esbuild/issues/1921.
3534
banner = {

github-actions/commit-message-based-labels/lib/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class CommitMessageBasedLabelManager {
9393
// to prevent the action from actually running in a fork of a repository with this action set up.
9494
if (context.repo.owner === 'angular') {
9595
CommitMessageBasedLabelManager.run().catch((e: Error) => {
96-
core.error(e);
96+
console.error(e);
9797
core.setFailed(e.message);
9898
});
9999
} else {

github-actions/commit-message-based-labels/main.js

+15,890-14,430
Large diffs are not rendered by default.

github-actions/create-pr-for-changes/lib/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ async function main(): Promise<void> {
201201
}
202202
} catch (err: any) {
203203
core.setOutput('result', ActionResult.failed);
204-
core.error(err);
204+
console.error(err);
205205
core.setFailed(err.message);
206206
}
207207
}

github-actions/create-pr-for-changes/main.js

+6,143-7,455
Large diffs are not rendered by default.

github-actions/feature-request/main.js

+11,917-10,398
Large diffs are not rendered by default.

github-actions/google-internal-tests/lib/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ async function findExistingTestStatus(
9797
}
9898

9999
main().catch((e: Error) => {
100-
core.error(e);
100+
console.error(e);
101101
core.setFailed(e.message);
102102
});

github-actions/google-internal-tests/main.js

+6,929-7,580
Large diffs are not rendered by default.

github-actions/labels-sync/main.js

+11,849-10,330
Large diffs are not rendered by default.

github-actions/lock-closed/lib/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async function runLockClosedAction(github: Octokit): Promise<void> {
115115
// Runs triggered via 'workflow_dispatch' are also allowed to run.
116116
if (context.repo.owner === 'angular' || context.eventName === 'workflow_dispatch') {
117117
main().catch((e: Error) => {
118-
core.error(e);
118+
console.error(e);
119119
core.setFailed(e.message);
120120
});
121121
} else {

github-actions/lock-closed/main.js

+11,848-10,329
Large diffs are not rendered by default.

github-actions/org-file-sync/main.js

+11,882-10,363
Large diffs are not rendered by default.

github-actions/post-approval-changes/lib/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async function runPostApprovalChangesAction(client: Octokit): Promise<void> {
136136
// Runs triggered via 'workflow_dispatch' are also allowed to run.
137137
if (context.repo.owner === 'angular') {
138138
main().catch((e: Error) => {
139-
core.error(e);
139+
console.error(e);
140140
core.setFailed(e.message);
141141
});
142142
} else {

github-actions/post-approval-changes/main.js

+11,870-10,351
Large diffs are not rendered by default.

github-actions/slash-commands/lib/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function runSlashCommandsAction(
121121
// to prevent the action from actually running in a fork of a repository with this action set up.
122122
if (context.repo.owner === 'angular') {
123123
main().catch((e: Error) => {
124-
core.error(e);
124+
console.error(e);
125125
core.setFailed(e.message);
126126
});
127127
} else {

github-actions/slash-commands/main.js

+19,730-18,212
Large diffs are not rendered by default.

ng-dev/caretaker/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ ts_library(
88
"//ng-dev:__subpackages__",
99
],
1010
deps = [
11+
"//tools/esm-interop:jsonc-parser",
1112
"@npm//@types/minimatch",
1213
"@npm//@types/node",
13-
"@npm//jsonc-parser",
1414
"@npm//minimatch",
1515
],
1616
)

ng-dev/caretaker/g3-sync-config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import minimatch from 'minimatch';
1010
import fs from 'fs';
11-
import * as jsonc from 'jsonc-parser';
11+
import * as jsonc from '../../tools/esm-interop/jsonc-parser.js';
1212

1313
/** Configuration describing how files are synced into Google. */
1414
export interface GoogleSyncConfig {

tools/esm-interop/BUILD.bazel

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
2+
load("//tools:defaults.bzl", "esbuild")
3+
4+
package(default_visibility = [
5+
"//github-actions:__subpackages__",
6+
"//ng-dev:__subpackages__",
7+
])
8+
9+
esbuild(
10+
name = "jsonc_parser_bundle",
11+
entry_point = "@npm//:node_modules/jsonc-parser/lib/esm/main.js",
12+
output = "jsonc-parser.js",
13+
deps = ["@npm//jsonc-parser"],
14+
)
15+
16+
# Workaround for: https://github.com/microsoft/node-jsonc-parser/issues/57.
17+
js_library(
18+
name = "jsonc-parser",
19+
srcs = ["jsonc-parser.d.ts"],
20+
deps = [":jsonc_parser_bundle"],
21+
)

tools/esm-interop/jsonc-parser.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from 'jsonc-parser';

0 commit comments

Comments
 (0)