-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathversions.ts
More file actions
25 lines (22 loc) · 837 Bytes
/
versions.ts
File metadata and controls
25 lines (22 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { readJsonFile } from '@nx/devkit';
import * as path from 'node:path';
import type { PackageJson } from 'nx/src/utils/package-json';
const workspaceRoot = path.join(__dirname, '../../');
const projectsFolder = path.join(__dirname, '../../../');
export const cpNxPluginVersion = loadPackageJson(workspaceRoot).version;
export const cpModelVersion = loadPackageJson(
path.join(projectsFolder, 'cli'),
).version;
export const cpUtilsVersion = loadPackageJson(
path.join(projectsFolder, 'utils'),
).version;
export const cpCliVersion = loadPackageJson(
path.join(projectsFolder, 'models'),
).version;
/**
* Load the package.json file from the given folder path.
* @param folderPath
*/
function loadPackageJson(folderPath: string): PackageJson {
return readJsonFile<PackageJson>(path.join(folderPath, 'package.json'));
}