-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support nx.json extends property (#1124)
- Loading branch information
Showing
8 changed files
with
141 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { cacheJson, readAndCacheJsonFile } from '@nx-console/server'; | ||
import { NxJsonConfiguration } from '@nrwl/devkit'; | ||
import { join } from 'path'; | ||
import { getNxWorkspacePackageFileUtils } from './get-nx-workspace-package'; | ||
|
||
export function getNxConfig(baseDir: string): NxJsonConfiguration { | ||
try { | ||
let cachedNxJson = cacheJson('nx.json', baseDir).json; | ||
|
||
if (!cachedNxJson) { | ||
const nxJson = getNxWorkspacePackageFileUtils().readNxJson( | ||
join(baseDir, 'nx.json') | ||
); | ||
|
||
cachedNxJson = cacheJson('nx.json', baseDir, nxJson).json; | ||
} | ||
return cachedNxJson; | ||
} catch (e) { | ||
return readAndCacheJsonFile('nx.json', baseDir).json; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { readAndCacheJsonFile, cacheJson } from '@nx-console/server'; | ||
import { getNxWorkspacePackageFileUtils } from './get-nx-workspace-package'; | ||
import type { WorkspaceJsonConfiguration } from '@nrwl/devkit'; | ||
|
||
export function getNxWorkspaceConfig( | ||
basedir: string, | ||
workspaceJsonPath: string | ||
): WorkspaceJsonConfiguration { | ||
// try and use the workspace version of nx | ||
try { | ||
let cachedWorkspaceJson = cacheJson(workspaceJsonPath).json; | ||
if (!cachedWorkspaceJson) { | ||
const workspace = getNxWorkspacePackageFileUtils().readWorkspaceConfig({ | ||
format: 'nx', | ||
path: basedir, | ||
} as any); | ||
cachedWorkspaceJson = cacheJson(workspaceJsonPath, '', workspace).json; | ||
} | ||
return cachedWorkspaceJson; | ||
} catch (e) { | ||
return readAndCacheJsonFile(workspaceJsonPath).json; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.