Skip to content

Commit 185f875

Browse files
committed
build: fix chalk runtime errors due to esmodule interop
The chalk usages in the `tools/` folder seems to fail at runtime given the `esModuleInterop` flag being enabled for the tools folder. We need to switch the namespace imports to default imports to work with the interop, and to follow the TS language-service recommendation (which actually proposes switching these imports to `import c from 'chalk'`) We should likely turn on the esmoduleinterop flag for the scripts folder as well to have consistent imports, and to prepare for future ESM consumption as the ecosystem moves forward.
1 parent 3c58011 commit 185f875

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

tools/release-checks/check-framework-peer-dependency.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {error} from '@angular/dev-infra-private/ng-dev/utils/console';
33
import {SemVer} from 'semver';
44
import {join} from 'path';
55
import {existsSync, readFileSync} from 'fs';
6-
import * as chalk from 'chalk';
6+
import chalk from 'chalk';
77

88
/** Path to the Bazel file that configures the release output. */
99
const bzlConfigPath = join(__dirname, '../../packages.bzl');

tools/release-checks/check-migration-collections.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {error} from '@angular/dev-infra-private/ng-dev/utils/console';
22
import {dirname, join} from 'path';
3-
import * as chalk from 'chalk';
3+
import chalk from 'chalk';
44
import {releasePackages} from '../../.ng-dev/release';
55
import {readFileSync} from 'fs';
6-
import * as semver from 'semver';
6+
import semver from 'semver';
77

88
/** Path to the directory containing all package sources. */
99
const packagesDir = join(__dirname, '../../src');

tools/release-checks/npm-package-output/check-package.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {error} from '@angular/dev-infra-private/ng-dev/utils/console';
2-
import * as chalk from 'chalk';
2+
import chalk from 'chalk';
33
import {existsSync} from 'fs';
44
import {sync as glob} from 'glob';
55
import {basename, dirname, join} from 'path';

tools/release-checks/npm-package-output/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {SemVer} from 'semver';
22
import {checkReleasePackage} from './check-package';
33
import {BuiltPackage} from '@angular/dev-infra-private/ng-dev/release/config';
44
import {error} from '@angular/dev-infra-private/ng-dev/utils/console';
5-
import * as chalk from 'chalk';
5+
import chalk from 'chalk';
66

77
/** Asserts that the given built packages are valid for public consumption. */
88
export async function assertValidNpmPackageOutput(

0 commit comments

Comments
 (0)