Skip to content

Commit eb0d61d

Browse files
author
Paul Marbach
committed
fix(web-scripts): drop the fix command
Pardon our dust! `fix` was meant to be dropped before open-sourcing in favor of the clarified and revamped `precommit`. It's not documented, and would only have been visible if you ran `web-scripts --help`. In the future this would obviously be a major version, but I'd like to avoid bumping to 2.0.0 three days after open sourcing.
1 parent 520f576 commit eb0d61d

File tree

3 files changed

+12
-48
lines changed

3 files changed

+12
-48
lines changed

packages/web-scripts/README.md

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,32 @@
22

33
## Description
44

5-
Build, lint, test, fix, and release your JS/TS library. This CLI tool bundles all the necessary configuration and dependencies so you can focus on the code.
5+
Build, lint, test, format, and release your JS/TS library. This CLI tool bundles all the necessary configuration and dependencies so you can focus on the code.
66

77
## Usage
88

99
```sh
10-
yarn add @spotify/web-scripts
10+
yarn add --dev @spotify/web-scripts husky
1111
```
1212

13-
Add the scripts to your package.json:
13+
Add the scripts and commit hooks to your package.json:
1414

1515
```json
16+
{
17+
"scripts": {
1618
"test": "web-scripts test",
1719
"lint": "web-scripts lint",
18-
"fix": "web-scripts fix",
1920
"build": "web-scripts build",
2021
"commit": "web-scripts commit",
2122
"release": "web-scripts release"
22-
```
23-
24-
Add a husky precommit hook:
25-
26-
```sh
27-
yarn add --dev husky
28-
```
29-
30-
And in your package.json:
31-
32-
```json
23+
},
3324
"husky": {
3425
"hooks": {
3526
"commit-msg": "web-scripts commitmsg",
3627
"pre-commit": "web-scripts precommit"
3728
}
3829
}
30+
}
3931
```
4032

4133
If you plan to use `web-scripts build` to build ESM, CommonJS, and types for your library with ease, update your package.json to define the locations where those will end up. [Read more about our the build script](#the-build-script).
@@ -48,7 +40,7 @@ If you plan to use `web-scripts build` to build ESM, CommonJS, and types for you
4840
}
4941
```
5042

51-
### Editor support steps:
43+
### Editor support steps
5244

5345
Add a root tsconfig.json:
5446

@@ -93,9 +85,9 @@ web-scripts test --watch
9385

9486
`web-scripts build` runs three parallel calls to the TypeScript compiler.
9587

96-
* One of them transpiles the files as CommonJS and outputs it to the `cjs` directory. Your repo should have `"cjs/index.js"` set as `main` in your package.json. You can turn this off using `--no-cjs` when running build.
97-
* Another does the exact same thing but only transpiles to [EcmaScript modules](https://github.com/standard-things/esm). This is super helpful if your consuming project is using Babel or TypeScript, and you'll end up avoiding playing games of transpilation telephone along the way. Your repo should have `"esm/index.js"` set as `module` in your package.json if using this. You can turn this off with the `--no-esm` flag when running build.
98-
* Finally, tsc will be run to output type definitions. Your repo should have the `"types"` directory set as `types` in your package.json if using this. You can turn this off with the `--no-types` flag when running build.
88+
- One of them transpiles the files as CommonJS and outputs it to the `cjs` directory. Your repo should have `"cjs/index.js"` set as `main` in your package.json. You can turn this off using `--no-cjs` when running build.
89+
- Another does the exact same thing but only transpiles to [EcmaScript modules](https://github.com/standard-things/esm). This is super helpful if your consuming project is using Babel or TypeScript, and you'll end up avoiding playing games of transpilation telephone along the way. Your repo should have `"esm/index.js"` set as `module` in your package.json if using this. You can turn this off with the `--no-esm` flag when running build.
90+
- Finally, tsc will be run to output type definitions. Your repo should have the `"types"` directory set as `types` in your package.json if using this. You can turn this off with the `--no-types` flag when running build.
9991

10092
These parallel builds are set up to share resources and work efficiently.
10193

packages/web-scripts/src/index.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,34 +86,6 @@ program
8686
handleSpawnResult(lintTask(t));
8787
});
8888

89-
program
90-
.command('fix')
91-
.allowUnknownOption()
92-
.description('DEPRECATED - use `web-scripts precommit`')
93-
.option(
94-
'--prettier-config [path]',
95-
'path to prettier config',
96-
PRETTIER_CONFIG,
97-
)
98-
.option('--eslint-config [path]', 'path to eslint config', ESLINT_CONFIG)
99-
.action((cmd: Command) => {
100-
const {
101-
'eslint-config': eslintConfig,
102-
'prettier-config': prettierConfig,
103-
} = cmd.opts();
104-
const t: PrecommitTaskDesc = {
105-
name: 'precommit',
106-
fix: true,
107-
tests: false,
108-
jestConfig: JEST_CONFIG,
109-
eslintConfig,
110-
prettierConfig,
111-
restOptions: parseRestOptions(cmd),
112-
};
113-
114-
handleSpawnResult(precommitTask(t));
115-
});
116-
11789
program
11890
.command('precommit')
11991
.allowUnknownOption()

packages/web-scripts/src/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe('integration tests', () => {
154154
// this is what is making the tests fail
155155
// for some reason in docker it can't set the registry to the internal one
156156
await exec('yarn', { cwd: PKG_ROOT });
157-
// Required for the `fix`, `commit`, and `commitmsg` tasks.
157+
// Required for the `commit` and `commitmsg` tasks.
158158
await exec('git init', { cwd: PKG_ROOT });
159159
}
160160

0 commit comments

Comments
 (0)