Skip to content

Commit 86647d5

Browse files
committed
fix(nx-plugin): move version logic
1 parent 518e734 commit 86647d5

File tree

2 files changed

+18
-25
lines changed

2 files changed

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

packages/nx-plugin/src/utils/versions.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)