-
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
Isaacs/update libnpmetc stuff #968
Conversation
Note: this closes #935 as well. |
c6d224f
to
924d85b
Compare
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.
Some discussion points, @isaacs let me know if you want me to handle any of this minutia.
lib/utils/otplease.js
Outdated
const readUserInfo = require('./read-user-info.js') | ||
|
||
const isOtpError = err => | ||
err.code === 'EOTP' || err.code === 'E401' && /one-time pass/.test(err.body) |
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.
Silly question, does this need brackets to evaluate correctly?
err.code === 'EOTP' || err.code === 'E401' && /one-time pass/.test(err.body) | |
err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body)) |
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 does not. &&
has higher priority than ||
. In most expressions of boolean calculus, you can think of and
(or any intersection operator) like multiplication or division, and or
(or any union operator) like addition or subtraction. So a || b && c || d
is like a + b * c + d
, so it's like a + (b * c) + d
and thus a || (b && c) || d
.
lib/config/flat-options.js
Outdated
@@ -182,7 +183,6 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({ | |||
strictSSL: npm.config.get('strict-ssl'), | |||
defaultTag: npm.config.get('tag'), | |||
get tag () { | |||
log.warn('FIXME', 'using tag option, should be defaultTag') |
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.
nit: I thought we wanted this? At least until we have more stability in npm@7?
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.
The problem is that it warns every time we do ...npm.flatOptions
, which we do a lot of times. And we can't make the option non-enumerable, or else it won't be carried over in those cases. We'd have to do a custom clone function that does Object.getOwnPropertyDescriptors
and turns the setter into a setter on the resulting object, and then use that everywhere, but then our deps also do ...opts
all over the place, so actually making that change would be almost as bad as figgy-pudding.
It was a reasonable idea, but doesn't actually work, turns out.
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.
Totally makes sense, I hadn't realised that. Completely agree we should just pull this out for now. Might be worth just commenting it, so we remember where our warnings were?
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, if you wanna, go for it. I was just gonna leave it as a pre-v7 todo item to remove the getters from here and grep for any usage of those field names.
Fixed the nits, replaced the read-json util with parse-json-even-better-errors, found 2 more bluebird |
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.
LGTM
lib/team.js
Outdated
opts = TeamConfig(opts).concat({description: null}) | ||
// XXX: "description" option to libnpmteam is used as a description of the | ||
// team, but in npm's options, this is a boolean meaning "show the | ||
// description in npm search output". Hence its being set to null here. |
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.
Not important, but eventually we can remove this.
PR-URL: #968 Credit: @isaacs and @mikemimik Close: #968
PR-URL: #968 Credit: @isaacs and @mikemimik Close: #968
53b67a1
to
bf3370b
Compare
PR-URL: #968 Credit: @isaacs and @mikemimik Close: #968
Refactor of
mikemimik/update-libnpmhook
branch from pairing earlier today. Removes a lot of figgy-pudding and blue birds.Commands updated with a new lib:
Other random stuff:
Utils:
Still todo: