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
Copy file name to clipboardExpand all lines: website/docs/concepts/configuring-published-files.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ This is only useful for publishing if the packages in your monorepo have a simpl
22
22
23
23
In v7, we introduced a more powerful, more focused `--directory` option for `lerna publish`. Please prefer that over the `--contents` option, which will likely be deprecated in future.
24
24
25
-
## `--directory"`
25
+
## `--directory`
26
26
27
27
In v7, we introduced a more powerful, more focused `--directory` option for `lerna publish`.
28
28
@@ -73,6 +73,11 @@ An example configuration for a package that publishes from a `dist/packages/foo`
73
73
}
74
74
```
75
75
76
+
:::info
77
+
You will need to make sure that your custom directory location contains a valid `package.json` which will be used for the registry publish. You could create this via a lifecycle script such as `prepare`, `prepublishOnly`, or `prepack` if you need more complex custom logic involved, or simply have it copied for you from the package's source automatically by configuring it as an asset. See the upcoming section on **Including Additional Assets in Published Packages** for full details.
78
+
79
+
:::
80
+
76
81
If you wanted to make one of your packages behave like a standard lerna package and publish from source, you could override its publish config like so:
77
82
78
83
```json
@@ -83,8 +88,7 @@ If you wanted to make one of your packages behave like a standard lerna package
83
88
"lerna": {
84
89
"command": {
85
90
"publish": {
86
-
"directory": ".",
87
-
"assets": []
91
+
"directory": "."
88
92
}
89
93
}
90
94
}
@@ -95,8 +99,6 @@ If you wanted to make one of your packages behave like a standard lerna package
95
99
96
100
Lerna can copy files from your source directory to the directory specified for publishing. Just as with the `directory` option, this can be configured in the `lerna.json` (including using dynamic placeholders within asset definitions), or within the `package.json` of a particular package.
97
101
98
-
By default, Lerna will copy the `README.md` and `package.json` files. If you decided to override the `assets` configuration, you must make sure to include `"package.json"` in your asset definitions.
99
-
100
102
Regardless of which file it is configured in, the `"assets"` property should be an array of glob patterns or objects with a `"from"` and `"to"` property. The `"from"` property should be a specific file or glob pattern that matches files in the source directory, and the `"to"` property is the path to copy the file to within the publish directory.
101
103
102
104
This example package builds its output to a root `dist/packages/bar` directory. Lerna is configured to copy additional files to this directory, then publish the contents of `dist/packages/bar` to npm.
0 commit comments