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): validate that outputs is an array of strings #22371

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

MJez29
Copy link
Contributor

@MJez29 MJez29 commented Mar 18, 2024

Current Behavior

I accidentally configured my target outputs as

outputs: "{projectRoot}/dist"

And was confused by the error message

The following outputs are invalid:
- {
- p
- r
- o
- j
...
Please run "nx repair" to repair your configuration

Expected Behavior

A slightly nicer error message

The 'outputs' field must be an array

I also made it so that if you enter non-string values in the array it flags them

The 'outputs' field must contain only strings, but received types: [string, number, object, boolean, object, object]

@MJez29 MJez29 requested a review from a team as a code owner March 18, 2024 15:14
@MJez29 MJez29 requested a review from AgentEnder March 18, 2024 15:14
Copy link

vercel bot commented Mar 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Mar 22, 2024 7:33pm

Comment on lines 138 to 142
const invalidOutputsTypeError =
InvalidOutputsTypeError.maybeGetError(outputs);
if (invalidOutputsTypeError) {
throw invalidOutputsTypeError;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you change this to an assert function please?

Something like assertOutputsAreValidType

@MJez29 MJez29 force-pushed the validate-outputs-type branch from e9bb48c to b19eacb Compare March 22, 2024 19:32
@MJez29 MJez29 requested a review from FrozenPandaz March 22, 2024 19:33
@FrozenPandaz FrozenPandaz merged commit 8631b40 into nrwl:master Apr 30, 2024
6 checks passed
Copy link

github-actions bot commented May 6, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2024
@MJez29 MJez29 deleted the validate-outputs-type branch May 6, 2024 14:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants