Skip to content
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

V2 #14

Closed
wants to merge 11 commits into from
Closed

V2 #14

wants to merge 11 commits into from

Conversation

isaacs
Copy link
Contributor

@isaacs isaacs commented Jan 5, 2020

Native promises and updated CLI environment.

BREAKING CHANGE: Promises are now Promises, rather than blue birds.

Fix #13
@coveralls
Copy link

coveralls commented Jan 5, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling c141781 on v2 into 32132c9 on latest.

Just use a no-op 'logger' if there isn't one in the options.
isaacs added a commit to npm/arborist that referenced this pull request Jan 6, 2020
Note: floating a dependency on a git fork until
npm/bin-links#14 lands.
@isaacs
Copy link
Contributor Author

isaacs commented Jan 26, 2020

Note: do not land yet. New goal for v2 is to refactor this module so that it isn't smeared out across so many packages. (Most especially: gentle-fs, which is a junk-drawer of sorts.)

@isaacs
Copy link
Contributor Author

isaacs commented Jan 27, 2020

Ok, this is ready for review now.

Pulled in everything that was smeared out across gentle-fs and here, organized the codebase a bit more, and ironed out all the edge cases.

@isaacs isaacs requested a review from a team January 27, 2020 22:45
Copy link

@mikemimik mikemimik left a comment

Choose a reason for hiding this comment

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

LGTM; would just want the README to be fixed.

  • Small fix in the README
  • Clarification question

README.md Outdated
@@ -38,10 +38,12 @@ jump in if you'd like to, or even ask us questions if something isn't clear.

### API

#### <a name="binLinks"></a> `> binLinks(pkg, folder, global, opts, cb)`
#### <a name="binLinks"></a> `> binLinks(pkg, folder, global, opts)`

Choose a reason for hiding this comment

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

The function you created destructures a single parameter.

Suggested change
#### <a name="binLinks"></a> `> binLinks(pkg, folder, global, opts)`
#### <a name="binLinks"></a> `> binLinks({ pkg, folder, global, opts })`

README.md Outdated
binLinks(pkg, folder, global, opts).then(() => console.log('bins linked!'))

Choose a reason for hiding this comment

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

Should be denoting an object parameter, than positional params

Suggested change
binLinks(pkg, folder, global, opts).then(() => console.log('bins linked!'))
binLinks({ pkg, folder, global, opts }).then(() => console.log('bins linked!'))

"bugs": {
"url": "https://github.com/npm/bin-links/issues"
},
"homepage": "https://github.com/npm/bin-links#readme",

Choose a reason for hiding this comment

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

nit: We should probably keep this "homepage" property as npmjs.com uses this in the UI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It gets the default from the repository field, so there's no need for it.

Qv: https://github.com/npm/arborist/blob/master/package.json vs http://npm.im/@npmcli/arborist

return SKIP // skip it, already set up like we want it.

target = resolve(dirname(to), target)
if (target.indexOf(path) === 0 || force)

Choose a reason for hiding this comment

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

Is it possible for target.indexOf(path) === 0 to be false as well as force? If that were the case, this closer never returns anything, which means we're assuming that's acceptable for line 54. The "else" case that is caused would always want symlink(from, to, 'file').then(() => true) to happen.

This seems correct, but just thought I'd say it out loud and confirmation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there's an stTo, and we're not in force mode, and we're not allowed to delete it, then we just don't delete it. Then the promise resolves, and the symlink() fails with EEXIST, which is the msot appropriate possible error message.

So yes, working as intended.

@isaacs
Copy link
Contributor Author

isaacs commented Jan 31, 2020

Updated docs. Merging and publishing.

@isaacs isaacs closed this in 5ce48a1 Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants