Skip to content
This repository has been archived by the owner on Aug 17, 2019. It is now read-only.

feat(opts): support full range of relevant CLI opts #19

Merged
merged 1 commit into from
Oct 4, 2017

Conversation

zkat
Copy link
Owner

@zkat zkat commented Sep 9, 2017

Fixes: #17

@zkat zkat force-pushed the zkat/pacote-opts branch 3 times, most recently from 8bbbc85 to e7b997b Compare September 9, 2017 15:28
Repository owner deleted a comment from coveralls Sep 9, 2017
Repository owner deleted a comment from coveralls Sep 9, 2017
Repository owner deleted a comment from coveralls Sep 9, 2017
Copy link
Collaborator

@mikesherov mikesherov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far! Just a few changes minus tests.

@@ -47,6 +46,9 @@ class Installer {
}
)
}).then(() => {
return config(this.prefix, process.argv, this.pkg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can avoid needing this.pkg for the UA, then this can be done as part of the previous join in parallel to reading package.json etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind ^

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually this won't be slow so it won't matter anyway, and if it does matter, we can address later.

lib/config.js Outdated
if (_config) return BB.resolve(_config)
return readConfig().then(config => {
_config = {
config,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be passed to lifecycle for printing config as env variables.

lib/config.js Outdated
failOk: false,
force: config.force,
group: config.group,
ignorePrepublish: config['ignore-prepublish'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options in lifecycle are all camelcased. This will cause ignorePrepublish to not be respected.

lib/config.js Outdated
force: config.force,
group: config.group,
ignorePrepublish: config['ignore-prepublish'],
ignoreScripts: config['ignore-scripts'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

lib/config.js Outdated
log,
production: config.production,
scriptShell: config['script-shell'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

production: config.production,
scriptShell: config['script-shell'],
scriptsPrependNodePath: config['scripts-prepend-node-path'],
unsafePerm: config['unsafe-perm'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

return opts
}

function calculateOwner () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this logic can move into pacote itself.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not move this to pacote itself, because I'm trying to keep pacote easy to isolate: this involves keeping certain state around that only really makes sense to have at an application level. I'd rather not have pacote reading env vars.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair.

strictSSL: npmOpts['strict-ssl'],
userAgent: npmOpts['user-agent'],

dmode: parseInt('0777', 8) & (~npmOpts['umask']),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this and fmode can move into pacote itself, considering its derived from umask

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure pacote itself even needs to be setting these, since they are only used when a tarball doesn't contain mode details for file(s) it contains, which it should. This value is also the same as the default dmode in tar. Same with fmode below.

_config = {
config,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be passed to lifecycle for printing config as env variables.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, saw you preserved below after I commented.

lib/config.js Outdated
failOk: false,
force: config.force,
group: config.group,
ignorePrepublish: config['ignore-prepublish'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need a lifecycleOpts, to do the camelcasing!

Copy link
Contributor

@rmg rmg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if some of the settings like fmode/dmode/umask are worth the complexity they add for readers of the code.

strictSSL: npmOpts['strict-ssl'],
userAgent: npmOpts['user-agent'],

dmode: parseInt('0777', 8) & (~npmOpts['umask']),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure pacote itself even needs to be setting these, since they are only used when a tarball doesn't contain mode details for file(s) it contains, which it should. This value is also the same as the default dmode in tar. Same with fmode below.


dmode: parseInt('0777', 8) & (~npmOpts['umask']),
fmode: parseInt('0666', 8) & (~npmOpts['umask']),
umask: npmOpts['umask']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is umask necessary? I can't really think of a scenario where cipm, npm, or even pacote would actually have a use for this. Especially since it is already set as part of the OS process and accessible via process.umask().

@zkat zkat force-pushed the zkat/pacote-opts branch 3 times, most recently from f80372b to eb63ae1 Compare September 29, 2017 23:57
Copy link
Collaborator

@mikesherov mikesherov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@zkat zkat merged commit 6f2bd51 into latest Oct 4, 2017
@zkat zkat deleted the zkat/pacote-opts branch October 4, 2017 00:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants