Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add nx.json, workspace.json, and project.json JSON schemas #10228

Merged
merged 9 commits into from
May 10, 2022
9 changes: 5 additions & 4 deletions packages/nx/src/generators/utils/project-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,10 @@ function addProjectToWorkspaceJson(
(mode === 'create' && standalone) || !workspaceConfigPath
? joinPathFragments(project.root, 'project.json')
: getProjectFileLocation(tree, projectName);
const shouldAddJsonSchema = configFile && mode === 'create' && standalone;
const jsonSchema =
configFile && mode === 'create' && standalone
nartc marked this conversation as resolved.
Show resolved Hide resolved
? { $schema: getRelativeProjectJsonSchemaPath(tree, project) }
: {};

if (configFile) {
if (mode === 'delete') {
Expand All @@ -366,9 +369,7 @@ function addProjectToWorkspaceJson(

// update the project.json file
writeJson(tree, configFile, {
...(shouldAddJsonSchema
? { $schema: getRelativeProjectJsonSchemaPath(tree, project) }
: {}),
...jsonSchema,
...project,
root: undefined,
});
Expand Down