Files
test-repo/scripts/build/README.md
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

108 lines
1.9 KiB
Markdown
Raw Normal View History

2021-11-27 18:47:02 +08:00
# Prettier Build Script
2021-12-02 20:59:38 +09:00
## Requirements
2022-07-17 00:08:47 +09:00
- Node.js version `>= 16.16`.
2021-12-02 20:59:38 +09:00
2021-11-27 18:47:02 +08:00
## Usage
```sh
yarn build
```
## Flags
2025-05-27 09:35:31 +08:00
### `--package`
What package to build, will build all packages if omitted.
```
yarn build
yarn build --package prettier
yarn build --package prettier --package @prettier/plugin-oxc
```
2022-02-02 10:23:51 +08:00
### `--clean`
Remove `dist` directory before bundle files.
```sh
yarn build --clean
```
2021-11-27 18:47:02 +08:00
### `--playground`
Run script with `--playground` flag will only build files needed for the website.
```sh
yarn build --playground
```
### `--print-size`
To print the bundled file sizes:
```sh
yarn build --print-size
```
2022-02-07 12:00:43 +08:00
### `--compare-size`
2021-11-27 18:47:02 +08:00
2022-02-07 12:00:43 +08:00
Print the file size changes compare to the last released version:
2021-11-27 18:47:02 +08:00
```sh
2022-02-07 12:00:43 +08:00
yarn build --compare-size
2021-11-27 18:47:02 +08:00
```
### `--file`
2022-01-27 09:37:55 +08:00
To build specific file(s):
2021-11-27 18:47:02 +08:00
```sh
2022-01-27 09:37:55 +08:00
yarn build --file=esm/parser-babel.mjs
```
```sh
yarn build --file=standalone.js --file=parser-meriyah.js
```
### `--save-as`
To save bundled file to a different location, this flag can only use together with ONE `--file` flag
```sh
yarn build --file=parser-babel.js --save-as=babel-for-test.js
2021-11-27 18:47:02 +08:00
```
2022-01-27 11:16:50 +08:00
### `--report`
Visualize and analyze your esbuild bundle to see which modules are taking up space.
2022-01-27 16:53:07 +08:00
Available reporter formats:
- `html` Generate a HTML report file, saved next to the bundled file with `.report.html` suffix.
- `text` Generate a plain text report file, saved next to the bundled file with `.report.txt` suffix.
- `stdout` Log report information in console.
2022-01-27 11:16:50 +08:00
```sh
yarn build --report=all
2022-01-27 16:53:07 +08:00
yarn build --report=stdout --report=text --report=html
2022-01-27 11:16:50 +08:00
```
2021-11-27 18:47:02 +08:00
### `--minify` and `--no-minify`
By default, the file minification is controlled by `config.mjs` and `bundler.mjs`, these flags are added to override that behavior.
These should only be used for debugging purposes, suggest to use them together with the `--file` flag.
Force minify files:
```sh
yarn build --file=index.js --minify
```
Disable minify files:
```sh
yarn build --file=parser-babel.js --no-minify
```