Skip to content

Commit 572187b

Browse files
jimmytheneutrinobestander
authored andcommitted
Rename yarn clean (#52)
* Initial RFC: rename yarn clean * Rename rename-yarn-clean.md to 0000-rename-yarn-clean.md * Fix a proposed name * Delete a leftover paragraph * Change new name to autoclean
1 parent ec136a6 commit 572187b

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

text/0000-rename-yarn-clean.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
- Start Date: 2017-03-13
2+
- RFC PR: (leave this empty)
3+
- Yarn Issue: (leave this empty)
4+
5+
# Summary
6+
7+
Rename `yarn clean` command.
8+
9+
# Motivation
10+
11+
1. People might expect `yarn clean` to do a different thing (to clean build artifacts)
12+
than it actually does
13+
(cleans node modules of some files and sets the system to clean it automatically in the future).
14+
This is a very natural expectation because it is usually possible to do, e.g.,
15+
`yarn watch`, `yarn dist`, and of course, `yarn clean` seems like a logical command
16+
(compare with gradle clean, mvn clean, gulp clean).
17+
18+
Next, when `yarn clean` is executed a user realizes that it is not the correct command
19+
but it does not seem to do anything drastic (probably just cleans some yarn caches) and
20+
forgets about it.
21+
(Of course, the right thing to do would be to look at https://yarnpkg.com/en/docs/cli/clean instead.)
22+
The result often is that the project is broken and the bug is hard to detect.
23+
There are a lot of such bugs in this project and more elsewhere (example: twbs/bootstrap-sass#1097).
24+
25+
The name is confusing and the best way to stop confusion seems to be renaming the command.
26+
27+
2. Also, it is nice to be able to run a user-defined `yarn clean` if you already can run a user-defined `yarn build`.
28+
29+
# Detailed design
30+
The command is to be renamed to `autoclean`.
31+
32+
Next, `clean` should be available for redefinition by user scripts.
33+
34+
It should be more or less safe after that to produce an error in a standard way when `clean`
35+
is executed but the user script is missing. This is because the command is not usually run
36+
during a build but is mostly executed manually and its state persisted in cvs as a `.yarnclean` file.
37+
38+
39+
# How We Teach This
40+
The documentation should only reflect the change of the command name.
41+
42+
Release notes should provide a note about a possible breaking change.
43+
44+
# Drawbacks
45+
46+
We should not do this if yarn does not want to promote using `yarn command`
47+
for user defined scripts. Note that then the existing usage of such commands
48+
should also be deprecated.
49+
50+
# Alternatives
51+
1. Produce big and nice warnings when the command is used
52+
and on subsequent installation of modules (listing cleaned/ignored files).
53+
(This does not solve point 2. of the Motivation.)
54+
2. Deprecate `yarn command` for user-defined scripts. (So that only `yarn run command` is supported.)
55+
3. Deprecate running user-defined commands through yarn altogether (and optionally provide
56+
a different default command for running user-scripts, e.g., `yarun`).
57+
4. Some alternative proposed new name candidates are:
58+
`delete-module-bloat`, `delete-package-assets`, `remove-module-files`,
59+
`enable-advanced-auto-disk-space-optimizations`, `prune`, `pruneModules`,
60+
`strip`, `shrink`, `stripModules`, `shrinkModules`, `cleanModules`,
61+
`stripPackages`, `yarn-clean`.

0 commit comments

Comments
 (0)