Skip to content

Commit

Permalink
Update the documentation to provide better instruction for uninstalli…
Browse files Browse the repository at this point in the history
…ng npm dependencies from packages
  • Loading branch information
gziolo committed Oct 18, 2024
1 parent c676375 commit d10c7d6
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,24 @@ _Example:_
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.
This command adds the `change-case` as a dependency to the `@wordpress/a11y` package, which is located in `packages/a11y` folder. If there was the same dependency installed then the version specified in the `package-lock.json` file is going to be reused. If you want to enforce a different version, you can do so by adding the `@` suffix to the package name.

_Example:_

```bash
npm install change-case@latest -w packages/a11y
```

#### Removing Existing Dependencies

Removing a dependency from one of the WordPress packages requires some manual work. You need to remove the line in the corresponding `dependencies` section of the `package.json` file.
Removing a dependency from one of the WordPress packages is similar to installation. You need to run a command like the following from the root of the project.

_Example:_

```diff
+++ b/packages/scripts/package.json
@@ -43,7 +43,6 @@
"check-node-version": "^4.1.0",
"cross-spawn": "^5.1.0",
"eslint": "^7.1.0",
- "jest": "^29.6.2",
"minimist": "^1.2.0",
"npm-package-json-lint": "^6.4.0",
```bash
npm uninstall change-case -w packages/a11y
```

Next, you need to run `npm install` in the root of the project to ensure that `package-lock.json` file gets properly regenerated.

#### Updating Existing Dependencies

This is the most confusing part of working with [monorepo] which causes a lot of hassles for contributors. The most successful strategy so far is to do the following:
Expand Down

0 comments on commit d10c7d6

Please sign in to comment.