Skip to content

Commit 214ac89

Browse files
committed
refactor(@angular/cli): replace VERSION with Bazel-stamped version
Previously, the version was retrieved from the `package.json`. With this update, the version is now sourced using Bazel stamping.
1 parent 9ad7d9b commit 214ac89

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

packages/angular/cli/src/utilities/version.ts

+5-16
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,18 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import { readFileSync } from 'fs';
10-
import { resolve } from 'path';
11-
129
// Same structure as used in framework packages
1310
class Version {
14-
public readonly major: string;
15-
public readonly minor: string;
16-
public readonly patch: string;
11+
readonly major: string;
12+
readonly minor: string;
13+
readonly patch: string;
1714

18-
constructor(public readonly full: string) {
15+
constructor(readonly full: string) {
1916
const [major, minor, patch] = full.split('-', 1)[0].split('.', 3);
2017
this.major = major;
2118
this.minor = minor;
2219
this.patch = patch;
2320
}
2421
}
2522

26-
// TODO(bazel): Convert this to use build-time version stamping after flipping the build script to use bazel
27-
// export const VERSION = new Version('0.0.0-PLACEHOLDER');
28-
export const VERSION = new Version(
29-
(
30-
JSON.parse(readFileSync(resolve(__dirname, '../../package.json'), 'utf-8')) as {
31-
version: string;
32-
}
33-
).version,
34-
);
23+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

0 commit comments

Comments
 (0)