feat(core): export a function returning a normalized workspace config
Storybook expects the format of workspace.json to match angular.json. This is not the case. Storybook now will read the workspace.json file using the new function. This will allow us to manage the new formats. ISSUES CLOSED: #4305
This commit is contained in:
parent
0c0a29da71
commit
8cfda00009
@ -20,7 +20,11 @@ export {
|
||||
export { output } from './src/utils/output';
|
||||
export { commandsObject } from './src/command-line/nx-commands';
|
||||
export { supportedNxCommands } from './src/command-line/supported-nx-commands';
|
||||
export { readWorkspaceJson, readNxJson } from './src/core/file-utils';
|
||||
export {
|
||||
readWorkspaceJson,
|
||||
readNxJson,
|
||||
readWorkspaceConfig,
|
||||
} from './src/core/file-utils';
|
||||
export { NxJson } from './src/core/shared-interfaces';
|
||||
export {
|
||||
ProjectGraphNode,
|
||||
|
||||
@ -12,7 +12,7 @@ import { ProjectGraphNode } from './project-graph';
|
||||
import { Environment, NxJson } from './shared-interfaces';
|
||||
import { defaultFileHasher } from './hasher/file-hasher';
|
||||
import { performance } from 'perf_hooks';
|
||||
import { Workspaces } from '@nrwl/tao/src/shared/workspace';
|
||||
import { toOldFormatOrNull, Workspaces } from '@nrwl/tao/src/shared/workspace';
|
||||
|
||||
const ignore = require('ignore');
|
||||
|
||||
@ -168,6 +168,16 @@ export function readWorkspaceJson(): any {
|
||||
return ws.readWorkspaceConfiguration();
|
||||
}
|
||||
|
||||
export function readWorkspaceConfig(opts: { format: 'angularCli' | 'nx' }) {
|
||||
const json = readWorkspaceJson();
|
||||
if (opts.format === 'angularCli') {
|
||||
const formatted = toOldFormatOrNull(json);
|
||||
return formatted ? formatted : json;
|
||||
} else {
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
export function workspaceFileName() {
|
||||
if (fileExists(`${appRootPath}/angular.json`)) {
|
||||
return 'angular.json';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user