-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: issue #7892 prevent package-lock.json creation without package.json #7960
base: latest
Are you sure you want to change the base?
Conversation
@wraithgar let me know how this stab looks. Appreciate the patience. |
workspaces/arborist/bin/reify.js
Outdated
if (!fs.existsSync(path.join(options.path, 'package.json'))) { | ||
log.error('No package.json found in the current directory.') | ||
log.error('Please navigate to the correct directory or run npm init.') | ||
return Promise.resolve('Aborted due to missing package.json') |
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.
I think you meant Promise.reject? and then you'd need to wrap the message in a new Error()
.
But we could just make this async
and throw properly too.
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.
I believe I have resolved this now.
Ready for review again, thank you for your patience again! |
@@ -30,19 +32,23 @@ const printDiff = diff => { | |||
}) | |||
} | |||
|
|||
module.exports = (options, time) => { | |||
module.exports = async (options, time) => { |
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.
This is a breaking change.
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.
Ah, didn't catch that this was a bin, not part of the export. This doesn't actually change arborist itself. All this changes is npx -p @npmcli/arborist reify
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.
Can you explain further or point me in the right direction?
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.
it's also not a breaking change (as long as the syntax is supported in all supported node's, which i believe it is), because the function already returns a promise.
Would be really nice to have this extremely annoying bug fixed. |
fix for npm install creating package-lock.json file when accidentally run in the wrong directory in a project.
References
Fixes #7892