Skip to content

Commit

Permalink
feat(devkit): add method to read installed Nx version
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Feb 21, 2023
1 parent f8d4995 commit f74139f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/generated/devkit/nrwl_devkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ It only uses language primitives and immutable objects

### Utils Variables

- [NX_VERSION](../../devkit/documents/nrwl_devkit#nx_version)
- [appRootPath](../../devkit/documents/nrwl_devkit#approotpath)
- [cacheDir](../../devkit/documents/nrwl_devkit#cachedir)
- [output](../../devkit/documents/nrwl_devkit#output)
Expand Down Expand Up @@ -794,6 +795,12 @@ Implementation of a target of a project that handles multiple projects to be bat

## Utils Variables

### NX_VERSION

**NX_VERSION**: `string`

---

### appRootPath

**appRootPath**: `string` = `workspaceRoot`
Expand Down
7 changes: 7 additions & 0 deletions docs/generated/packages/devkit/documents/nrwl_devkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ It only uses language primitives and immutable objects

### Utils Variables

- [NX_VERSION](../../devkit/documents/nrwl_devkit#nx_version)
- [appRootPath](../../devkit/documents/nrwl_devkit#approotpath)
- [cacheDir](../../devkit/documents/nrwl_devkit#cachedir)
- [output](../../devkit/documents/nrwl_devkit#output)
Expand Down Expand Up @@ -794,6 +795,12 @@ Implementation of a target of a project that handles multiple projects to be bat

## Utils Variables

### NX_VERSION

**NX_VERSION**: `string`

---

### appRootPath

**appRootPath**: `string` = `workspaceRoot`
Expand Down
1 change: 1 addition & 0 deletions packages/devkit/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export {
addDependenciesToPackageJson,
ensurePackage,
removeDependenciesFromPackageJson,
NX_VERSION,
} from './src/utils/package-json';

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/devkit/src/utils/package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,5 @@ function getPackageVersion(pkg: string): undefined | string {
return undefined;
}
}

export const NX_VERSION = getPackageVersion('nx');

0 comments on commit f74139f

Please sign in to comment.