-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Ignore home package.json no license field #3531
Ignore home package.json no license field #3531
Conversation
Please do that |
Should we maybe just ignore |
Running While I did this, I noticed that the checking of the package versions is always done with yarn if it's installed (https://github.com/storybooks/storybook/blob/master/lib/cli/lib/latest_version.js#L4), and that the
That would be easier yes, but is every warning from |
It would make sense to include
In this particular helper we only want to catch the fact that a package isn't published. User will still see the warnings when the actual installation will happen. |
Makes sense, will change it to ignore yarn warnings in general then.
Does it make sense to put this change into another PR, or should I include it here? |
Codecov Report
@@ Coverage Diff @@
## master #3531 +/- ##
=========================================
- Coverage 37.61% 37.6% -0.01%
=========================================
Files 459 459
Lines 10377 10378 +1
Branches 928 927 -1
=========================================
Hits 3903 3903
+ Misses 5932 5931 -1
- Partials 542 544 +2
Continue to review full report at Codecov.
|
I'm ok with both, please do whatever you're more comfortable with |
lib/cli/lib/latest_version.js
Outdated
reject(new Error(info.data)); | ||
} | ||
}); | ||
if (info.type !== 'warning') { |
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.
info.type === 'error'
would be more explicit
I will do it in another PR as at first glans it looks like the change will not be very trivial, isn't necessarily related to the original issue, and I don't want to block this patch cuz of it.
Changed it |
Ignore home package.json no license field
Issue: Fixes #3446
If the
/home/user
folder contained apackage.json
without alicense
field, the installation ofgetstorybook
is cancelled. This warning is thrown regardless of anything in the current folder that you're runninggetstorybook
in.Reproduction would be to create a package.json without a license field in your home directory, initialize a project that would normally work with
getstorybook
, like throughcreate-react-app
, and then rungetstorybook
.This is caused by the checking of the version of the generator dependencies which resulted in the warning being thrown and thus existing the installation at https://github.com/storybooks/storybook/blob/3539625d7f801a0fee1fb8c58f1ff57016c9513f/lib/cli/lib/latest_version.js#L34
(Thanks to @sunilhari for pointing this out).
In fact, if you for whatever reason have a
package.json
at your home directory without alicense
field (or anywhere along the path towards the current directory), the warning will be thrown at anyyarn
command. The result of actually running the command, however, is then outputted after the warning:What I did
Using the knowledge from the screenshot above, I basically added an array of warning texts that will not stop the entire installation process.
This fix is entirely based on
yarn
and I did not check yet how this works withnpm
and if there are any differences. But I wanted to open this PR in order to see whether this solution is desired before spending more time on it.