-
Notifications
You must be signed in to change notification settings - Fork 9
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
fix: invalid scripts warning fixed for undefined scripts #102
Conversation
lib/normalize.js
Outdated
@@ -264,7 +264,8 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase }) | |||
} | |||
} | |||
} else { | |||
changes?.push(`Removed invalid "scripts"`) | |||
// it only makes sense to fix if package.json has scripts field | |||
data.scripts && changes?.push(`Removed invalid "scripts"`) |
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.
Let's make this an else if
statement
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.
Sure, I see some other scenarios as well that I'll cover in next changes
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.
These changes were not respecting false values like null
, 0
or ''
. Instead modified top if condition to check if package has scripts
then only do the updates.
d7ae3c6
to
dcf39ad
Compare
🤖 I have created a release *beep* *boop* --- ## [5.1.1](v5.1.0...v5.1.1) (2024-05-28) ### Bug Fixes * [`54756d2`](54756d2) [#105](#105) apply `securePath` to package bin (#105) (@antongolub) * [`46c563b`](46c563b) add `normalizePackageMan` helper (#100) (@antongolub) * [`a974274`](a974274) prevent `directory.man` referencing outside the package root (#104) (@antongolub) * [`191b521`](191b521) [#102](#102) invalid scripts warning fixed for undefined scripts (#102) (@milaninfy) ### Chores * [`45a2937`](45a2937) [#98](#98) bump @npmcli/template-oss to 4.22.0 (@lukekarrys) * [`90863c1`](90863c1) [#98](#98) postinstall for dependabot template-oss PR (@lukekarrys) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fixes npm/cli#7127