-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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] improve error on parsing files
in package.json
#8311
Labels
Comments
Seems like we just need to change this: Lines 83 to 94 in 17992a7
To something like: // `files` field
if (onlyFiles) {
+ if (!(onlyFiles instanceof Array)) throw new MessageError('"files" property in package.json must be an Array');
let lines = [
'*', // ignore all files except those that are explicitly included with a negation filter
];
lines = lines.concat(
onlyFiles.map((filename: string): string => `!${filename}`),
onlyFiles.map((filename: string): string => `!${path.join(filename, '**')}`),
);
const regexes = ignoreLinesToRegex(lines, './');
filters = filters.concat(regexes);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now if you have a String instead of an Array, it will yield this error on
yarn publish
:I suggest that we improve this error message to check the type, and if it is not an Array, then alert to the user that the
files
property inpackage.json
is a${typeof prop}
as opposed to erring on.map
not being a function as it currently does.Ref: #7815
The text was updated successfully, but these errors were encountered: