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: provide json schema for nx.json #1186

Merged
merged 3 commits into from
Dec 5, 2021

Conversation

puku0x
Copy link
Contributor

@puku0x puku0x commented Dec 4, 2021

This PR adds a JSON schema to provide intellisense when configuring nx.json.

image

Related Issue(s)

nrwl/nx#7993

@nx-cloud
Copy link

nx-cloud bot commented Dec 4, 2021

Nx Cloud Report

CI ran the following commands for commit 81be231. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --all --parallel --target=build
#000000 nx run-many --all --parallel --target=test
#000000 nx run-many --all --parallel --target=lint

Sent with 💌 from NxCloud.

@puku0x puku0x marked this pull request as ready for review December 4, 2021 06:21
@puku0x

This comment has been minimized.

Copy link
Member

@Cammisuli Cammisuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workspace and project.json were a little more involved because they're auto generated based on whatever workspace Nx Console is opened in. Since the schema for nx.json doesn't need to be dynamic, we don't have to do the whole schema generation.

Instead we can just place a json file within the project and link that within the package.json in the app directory.

Add a new object here:

"jsonValidation": [
{
"fileMatch": "workspace.json",
"url": "./workspace-schema.json"
},
{
"fileMatch": "angular.json",
"url": "./workspace-schema.json"
},
{
"fileMatch": "project.json",
"url": "./project-schema.json"
}
]

with

{
  "fileMatch": "nx.json",
  "url": "./nx-schema.json"
},

Then create a file beside the package.json called nx-schema.json and put the string you have in createJsonSchema within that json file.

And that should be it 😄

Let me know if you have any questions.

@puku0x
Copy link
Contributor Author

puku0x commented Dec 5, 2021

Thank you for your advice! I reverted the generator and added nx-schema.json into the directory.

Copy link
Member

@Cammisuli Cammisuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for creating the schema for this!

@Cammisuli Cammisuli enabled auto-merge (squash) December 5, 2021 13:14
@Cammisuli Cammisuli merged commit 70e2bbb into nrwl:master Dec 5, 2021
@puku0x puku0x deleted the feat-add-nx-json-schema branch May 16, 2022 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants