Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions packages/angular/cli/src/utilities/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,18 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { readFileSync } from 'fs';
import { resolve } from 'path';

// Same structure as used in framework packages
class Version {
public readonly major: string;
public readonly minor: string;
public readonly patch: string;
readonly major: string;
readonly minor: string;
readonly patch: string;

constructor(public readonly full: string) {
constructor(readonly full: string) {
const [major, minor, patch] = full.split('-', 1)[0].split('.', 3);
this.major = major;
this.minor = minor;
this.patch = patch;
}
}

// TODO(bazel): Convert this to use build-time version stamping after flipping the build script to use bazel
// export const VERSION = new Version('0.0.0-PLACEHOLDER');
export const VERSION = new Version(
(
JSON.parse(readFileSync(resolve(__dirname, '../../package.json'), 'utf-8')) as {
version: string;
}
).version,
);
export const VERSION = new Version('0.0.0-PLACEHOLDER');
Loading