Skip to content

Commit 9dff7c4

Browse files
committed
refactor: revert versions change
1 parent 41f9af2 commit 9dff7c4

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed
Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
export const cpNxPluginVersion = 'latest';
2-
export const cpModelVersion = 'latest';
3-
export const cpUtilsVersion = 'latest';
4-
export const cpCliVersion = 'latest';
1+
import { readJsonFile } from '@nx/devkit';
2+
import * as path from 'node:path';
3+
import type { PackageJson } from 'nx/src/utils/package-json';
4+
5+
const workspaceRoot = path.join(__dirname, '../../');
6+
const projectsFolder = path.join(__dirname, '../../../');
7+
8+
export const cpNxPluginVersion = loadPackageJson(workspaceRoot).version;
9+
export const cpModelVersion = loadPackageJson(
10+
path.join(projectsFolder, 'cli'),
11+
).version;
12+
export const cpUtilsVersion = loadPackageJson(
13+
path.join(projectsFolder, 'utils'),
14+
).version;
15+
export const cpCliVersion = loadPackageJson(
16+
path.join(projectsFolder, 'models'),
17+
).version;
18+
19+
/**
20+
* Load the package.json file from the given folder path.
21+
* @param folderPath
22+
*/
23+
function loadPackageJson(folderPath: string): PackageJson {
24+
return readJsonFile<PackageJson>(path.join(folderPath, 'package.json'));
25+
}

0 commit comments

Comments
 (0)