diff --git a/package-lock.json b/package-lock.json index c13e4cf2096cd0..aa33280ae23cf5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,9 @@ "version": "19.3.0", "hasInstallScript": true, "license": "GPL-2.0-or-later", + "workspaces": [ + "packages/*" + ], "dependencies": { "@wordpress/a11y": "file:packages/a11y", "@wordpress/annotations": "file:packages/annotations", diff --git a/package.json b/package.json index 5ecd0ef57b3516..6da3d23b20455c 100644 --- a/package.json +++ b/package.json @@ -385,5 +385,8 @@ "**/tsconfig.json": [ "npm run lint:tsconfig" ] - } + }, + "workspaces": [ + "packages/*" + ] } diff --git a/packages/README.md b/packages/README.md index b8d2c913a91b9d..15ada08424a022 100644 --- a/packages/README.md +++ b/packages/README.md @@ -1,6 +1,6 @@ # Managing Packages -This repository uses [monorepo] to manage WordPress modules and publish them with [lerna] as packages to [npm]. +This repository uses [monorepo](https://monorepo.tools) to manage WordPress modules and publish them with [lerna](https://lerna.js.org/) as packages to [npm](https://www.npmjs.com/). ## Creating a New Package @@ -70,12 +70,12 @@ Production dependencies are stored in the `dependencies` section of the package #### Adding New Dependencies -The simplest way to add a production dependency to one of the packages is to run a very convenient [lerna add](https://github.com/lerna/lerna/tree/HEAD/commands/add#readme) command from the root of the project. +The simplest way to add a production dependency to one of the packages is to run a command like the following from the root of the project. _Example:_ ```bash -lerna add change-case packages/a11y +npm install change-case -w packages/a11y ``` This command adds the latest version of `change-case` as a dependency to the `@wordpress/a11y` package, which is located in `packages/a11y` folder. @@ -239,10 +239,6 @@ For consumers to use the published type declarations, we'll set the `types` fiel Ensure that the `build-types` directory will be included in the published package, for example if a `files` field is declared. -[lerna]: https://lerna.js.org/ -[monorepo]: https://monorepo.tools -[npm]: https://www.npmjs.com/ - ## Optimizing for bundlers In order for bundlers to tree-shake packages effectively, they often need to know whether a package includes side effects in its code. This is done through the `sideEffects` field in the package's `package.json`.