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

Remove packages in non-empty namespace (#1992) #2036

Merged
merged 5 commits into from Nov 29, 2016
Merged

Remove packages in non-empty namespace (#1992) #2036

merged 5 commits into from Nov 29, 2016

Conversation

DenisGorbachev
Copy link
Contributor

Summary

This PR solves #1992.

Test plan

mkdir -p /tmp/issue-1992
cd /tmp/issue-1992
~/workspace/yarn/bin/yarn add @types/lodash
~/workspace/yarn/bin/yarn add @types/chai
~/workspace/yarn/bin/yarn remove @types/chai
ls node_modules/@types/

I've decided not to add a new test, so as not to complicate the test suite (keep testing time low).

@torifat
Copy link
Member

torifat commented Nov 25, 2016

I've decided not to add a new test, so as not to complicate the test suite (keep testing time low).

You don't have to worry about it.

@DenisGorbachev
Copy link
Contributor Author

DenisGorbachev commented Nov 26, 2016 via email

@wyze
Copy link
Member

wyze commented Nov 26, 2016

A test would be helpful.

@bestander
Copy link
Member

@DenisGorbachev, yes, definitely better add tests.
We don't want to regress and loose this fix in case of a refactoring

@DenisGorbachev
Copy link
Contributor Author

Added tests - could you please take a look?

@torifat
Copy link
Member

torifat commented Nov 27, 2016

I was wondering why 311 files have changed 😕

@DenisGorbachev
Copy link
Contributor Author

DenisGorbachev commented Nov 27, 2016 via email

@torifat
Copy link
Member

torifat commented Nov 27, 2016

@DenisGorbachev no worries. Just do a rebase 😄

@DenisGorbachev
Copy link
Contributor Author

@torifat

  1. I rebased my commits.
  2. Actually, 311 files were changed because I added two packages in __tests__/fixtures/remove/scoped-package/node_modules/@types. It was necessary to add those packages to write the test.

@bestander
Copy link
Member

@DenisGorbachev all those files are lodash, can you find a smaller package that will serve the purpose?
Maybe a dummy package with one file?

@DenisGorbachev
Copy link
Contributor Author

Is it better now?

@wyze
Copy link
Member

wyze commented Nov 29, 2016

Yes, much better to review now.

let subfilepath;
for (const subfile of subfiles) {
subfilepath = path.join(filepath, subfile);
possibleExtraneous.add(subfilepath);
Copy link
Member

Choose a reason for hiding this comment

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

I think we could avoid the subfilepath variable here and just do possibleExtraneous.add(path.join(filepath, subfile));

@DenisGorbachev
Copy link
Contributor Author

Done; May I ask the reason?

@wyze
Copy link
Member

wyze commented Nov 29, 2016

I just found the variable declaration unnecessary there when only used in one place. Especially as a let. Probably wouldn't have stood out as much as a const inside the loop.

@wyze wyze merged commit d8b72f3 into yarnpkg:master Nov 29, 2016
@wyze
Copy link
Member

wyze commented Nov 29, 2016

Looks good, thanks!

@DenisGorbachev
Copy link
Contributor Author

Thanks everyone for reviewing and merging!

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.

None yet

4 participants