Skip to content

Commit 0990e72

Browse files
authored
chore(@gatsbyjs/parcel-namer-relative-to-cwd): Improve README (#38049)
1 parent a9603e0 commit 0990e72

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

packages/gatsby-parcel-namer-relative-to-cwd/README.md

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
# `@gatsbyjs/parcel-namer-relative-to-cwd`
22

3-
Parcel by default is trying to find common/shared directory between entries and output paths are impacted by it. See https://github.com/parcel-bundler/parcel/issues/5476#issuecomment-769058504.
3+
This [namer plugin](https://parceljs.org/plugin-system/namer/) is used by [Gatsby](https://www.gatsbyjs.com/) internally. You can reuse it inside your app if you want.
4+
5+
If you're just using Gatsby, you don't need to care about this package/plugin.
6+
7+
## Usage
8+
9+
```shell
10+
npm install --save-dev @gatsbyjs/parcel-namer-relative-to-cwd
11+
```
12+
13+
And inside your `.parcelrc`:
14+
15+
```
16+
{
17+
"extends": "@parcel/config-default",
18+
"namers": ["@gatsbyjs/parcel-namer-relative-to-cwd", "..."]
19+
}
20+
```
21+
22+
## Why & How
23+
24+
By default, Parcel is trying to find common/shared directories between entries and output paths that are impacted by it. See [this issue comment](https://github.com/parcel-bundler/parcel/issues/5476#issuecomment-769058504) for more information.
425

526
With these inputs files:
627

@@ -15,9 +36,9 @@ You get:
1536
- `parcel build sub/b.html` => `dist/b.html`
1637
- `parcel build a.html sub/b.html` => `dist/a.html`, `dist/sub/b.html`
1738

18-
We can see that `sub/b.html` entry might result in either `dist/b.html` or `dist/sub/b.html` (depending wether `a.html` is entry or not). This makes builds not deterministic, which is very problematic where entries are "optional".
39+
You can see that `sub/b.html` entry might result in either `dist/b.html` or `dist/sub/b.html` (depending wether `a.html` is entry or not). This makes builds not deterministic, which is very problematic where entries are "optional".
1940

20-
This namer plugin stabilize output, so inside `distDir` the hierarchy is the same as entry file in relation to current working directory (CWD):
41+
This namer plugin stabilizes the output, so inside `distDir` the hierarchy is the same as entry file in relation to current working directory (CWD):
2142

2243
- `parcel build a.html` => `dist/a.html`
2344
- `parcel build sub/b.html` => `dist/sub/b.html`

packages/gatsby-parcel-namer-relative-to-cwd/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"main": "lib/index.js",
44
"version": "2.10.0-next.1",
55
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-parcel-namer-relative-to-cwd#readme",
6-
"description": "Parcel namer that preserve directory structure to stabilize output and keep the hierarchy.",
6+
"description": "Parcel namer that preserves directory structures to stabilize output and keep the hierarchy.",
77
"author": "Michal Piechowiak <[email protected]>",
88
"repository": {
99
"type": "git",

0 commit comments

Comments
 (0)