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

Suggestion: rename "yarn clean" or produce warnings when it is used #2438

Closed
jimmytheneutrino opened this issue Jan 12, 2017 · 7 comments
Closed

Comments

@jimmytheneutrino
Copy link

I am sorry if this is already discussed somewhere. I could not find such a discussion.

"yarn clean" is a great feature but it might be a misnomer.

People might expect "yarn clean" to do a different thing (to clean build artifacts) than it actually does (cleans node modules of some files and sets the system to clean it automatically in the future). This is a very natural expectation because it is usually possible to do, e.g., "yarn watch", "yarn dist", and of course, "yarn clean" seems like a logical command (compare with gradle clean, mvn clean, gulp clean).

Next, when "yarn clean" is executed a user realizes that it is not the correct command but it does not seem to do anything drastic (probably just cleans some yarn caches) and forgets about it. (Of course, the right thing to do would be to look at https://yarnpkg.com/en/docs/cli/clean instead.) The result often is that the project is broken and the bug is hard to detect. There are a lot of such bugs in this project and more elsewhere (example: twbs/bootstrap-sass#1097).

IMHO, the name is confusing and the best way to stop confusion is to rename the command. Since the command is not usually used in builds, this would not even be a very breaking change. This would also allow to use "yarn clean" as a custom task for cleaning the artifacts. The possible new name candidates might be: "cleanModules", "stripModules", "strip", "shrinkModules", "shrink".

Alternatively, it might be good to produce nice warnings when the command is used and on subsequent installation of modules (listing cleaned/ignored files).

What do you think?

@jimmytheneutrino
Copy link
Author

jimmytheneutrino commented Jan 13, 2017

Some bugs apparently caused by this:
#2389,
#2324,
#2259,
sasstools/sass-lint#973

Here people know that the cause is yarn clean, but I think these bugs are still related:
#2424,
#2331

@6zz
Copy link

6zz commented Feb 7, 2017

maybe yarn-clean?

@bestander
Copy link
Member

Renaming a command should go through RFC, feel free to send one.
As for improving, send a PR with extra logs to educate people what this command does ,I think no one will object to that

@bestander
Copy link
Member

bestander commented May 17, 2017 via email

@BYK
Copy link
Member

BYK commented Sep 11, 2017

yarn clean was renamed to yarn autoclean so, closing this one :)

@BYK BYK closed this as completed Sep 11, 2017
@no-stack-dub-sack
Copy link

no-stack-dub-sack commented Oct 24, 2017

Wow - thank goodness for this issue. My project has a clean script to clean up production build files before re-building them, and I accidentally ran yarn clean at some point instead of running yarn run clean - I immediately realized what I did, but without any warnings or immediately noticeable results, I thought what I had done was fairly innocuous. I also encountered no problems at all running in dev mode, but after running my build scripts and subsequently spending a considerable amount of time chasing down a quite cryptic error message, I finally put 2 and 2 together and started wondering if it had anything to do with that darned yarn clean command I had accidentally run a few days ago. This issue (and originally #3427) helped point me in the right direction. Removing node_modules alone didn't do it, but both the lock file and node_modules, now that did the trick! This saved me potentially hours more of troubleshooting this problem!

I know that no one will ever probably read this since the issue is closed, but had to make a comment on my small victory of the day!

@alexey-sh
Copy link

yarn autoclean v1.9.4
info ".yarnclean" does not exist. Autoclean will delete files specified by ".yarnclean". Run "autoclean --init" to create ".yarnclean" with the default entries.
✨  Done in 0.03s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants