File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed
packages/nx-plugin/src/internal Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments