You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: packages/web-scripts/README.md
+11-19Lines changed: 11 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,40 +2,32 @@
2
2
3
3
## Description
4
4
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.
6
6
7
7
## Usage
8
8
9
9
```sh
10
-
yarn add @spotify/web-scripts
10
+
yarn add --dev @spotify/web-scripts husky
11
11
```
12
12
13
-
Add the scripts to your package.json:
13
+
Add the scripts and commit hooks to your package.json:
14
14
15
15
```json
16
+
{
17
+
"scripts": {
16
18
"test": "web-scripts test",
17
19
"lint": "web-scripts lint",
18
-
"fix": "web-scripts fix",
19
20
"build": "web-scripts build",
20
21
"commit": "web-scripts commit",
21
22
"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
+
},
33
24
"husky": {
34
25
"hooks": {
35
26
"commit-msg": "web-scripts commitmsg",
36
27
"pre-commit": "web-scripts precommit"
37
28
}
38
29
}
30
+
}
39
31
```
40
32
41
33
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
48
40
}
49
41
```
50
42
51
-
### Editor support steps:
43
+
### Editor support steps
52
44
53
45
Add a root tsconfig.json:
54
46
@@ -93,9 +85,9 @@ web-scripts test --watch
93
85
94
86
`web-scripts build` runs three parallel calls to the TypeScript compiler.
95
87
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.
99
91
100
92
These parallel builds are set up to share resources and work efficiently.
0 commit comments