-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add nx.json, workspace.json, and project.json JSON schemas (
#10228) * feat(core): add nx.json, workspace.json, and project.json JSON schemas ISSUES CLOSED: #8574, #2299 * fix(core): add ajv to test generated config files based on JSON schema * fix(core): only add $schema to project.json if it is standalone and in create mode * feat(core): add migration to add json schema to config files for 14.2.0 * fix(core): adjust schemas * chore(core): adjust tests across repo to adhere to JSON schema if generated * fix(core): construct the json schema object instead of using a boolean flag * chore(core): add ajv tests for workspacejson and nxjson * chore(core): remove unnecessary standalone check
- Loading branch information
Showing
21 changed files
with
563 additions
and
19 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
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
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,127 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema", | ||
"$id": "https://nx.dev/core-concepts/configuration#nxjson", | ||
"title": "JSON schema for Nx configuration", | ||
"type": "object", | ||
"properties": { | ||
"implicitDependencies": { | ||
"type": "object", | ||
"description": "Map of files to projects that implicitly depend on them." | ||
}, | ||
"affected": { | ||
"type": "object", | ||
"description": "Default options for `nx affected`.", | ||
"properties": { | ||
"defaultBase": { | ||
"type": "string", | ||
"description": "Default based branch used by affected commands." | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"npmScope": { | ||
"type": "string", | ||
"description": "NPM Scope that the workspace uses." | ||
}, | ||
"tasksRunnerOptions": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/definitions/tasksRunnerOptions" | ||
} | ||
}, | ||
"targetDependencies": { | ||
"type": "object", | ||
"description": "Dependencies between different target names across all projects.", | ||
"additionalProperties": { | ||
"$ref": "#/definitions/targetDependencyConfig" | ||
} | ||
}, | ||
"workspaceLayout": { | ||
"type": "object", | ||
"description": "Where new apps + libs should be placed.", | ||
"properties": { | ||
"libsDir": { | ||
"type": "string", | ||
"description": "Default folder name for libs." | ||
}, | ||
"appsDir": { | ||
"type": "string", | ||
"description": "Default folder name for apps." | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"cli": { | ||
"$ref": "#/definitions/cliOptions" | ||
}, | ||
"generators": { | ||
"$ref": "#/definitions/generatorOptions" | ||
}, | ||
"plugins": { | ||
"type": "array", | ||
"description": "Plugins for extending the project graph.", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"defaultProject": { | ||
"type": "string", | ||
"description": "Default project. When project isn't provided, the default project will be used." | ||
} | ||
}, | ||
"definitions": { | ||
"cliOptions": { | ||
"type": "object", | ||
"description": "Default generator collection.", | ||
"properties": { | ||
"packageManager": { | ||
"type": "string", | ||
"description": "The default package manager to use.", | ||
"enum": ["yarn", "pnpm", "npm"] | ||
}, | ||
"defaultCollection": { | ||
"type": "string", | ||
"description": "The default schematics collection to use." | ||
} | ||
} | ||
}, | ||
"generatorOptions": { | ||
"type": "object", | ||
"description": "List of default values used by generators." | ||
}, | ||
"tasksRunnerOptions": { | ||
"type": "object", | ||
"description": "Available Task Runners.", | ||
"properties": { | ||
"runner": { | ||
"type": "string", | ||
"description": "Path to resolve the runner." | ||
}, | ||
"options": { | ||
"type": "object", | ||
"description": "Default options for the runner." | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"targetDependencyConfig": { | ||
"type": "array", | ||
"description": "Target dependency.", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"projects": { | ||
"type": "string", | ||
"description": "The projects that the targets belong to.", | ||
"enum": ["self", "dependencies"] | ||
}, | ||
"target": { | ||
"type": "string", | ||
"description": "The name of the target." | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
} | ||
} | ||
} |
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,68 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema", | ||
"$id": "https://nx.dev/project-schema", | ||
"title": "JSON schema for Nx projects", | ||
"type": "object", | ||
"properties": { | ||
"targets": { | ||
"type": "object", | ||
"description": "Configures all the targets which define what tasks you can run against the project", | ||
"additionalProperties": { | ||
"type": "object", | ||
"properties": { | ||
"executor": { | ||
"description": "The function that Nx will invoke when you run this target", | ||
"type": "string" | ||
}, | ||
"options": { | ||
"type": "object" | ||
}, | ||
"outputs": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"configurations": { | ||
"type": "object", | ||
"description": "provides extra sets of values that will be merged into the options map", | ||
"additionalProperties": { | ||
"type": "object" | ||
} | ||
}, | ||
"dependsOn": { | ||
"type": "array", | ||
"description": "Target dependency.", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"projects": { | ||
"type": "string", | ||
"description": "The projects that the targets belong to.", | ||
"enum": ["self", "dependencies"] | ||
}, | ||
"target": { | ||
"type": "string", | ||
"description": "The name of the target." | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"tags": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"implicitDependencies": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
512237c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx.dev