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: products/workers/src/content/tutorials/manage-projects-with-lerna/index.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ import TutorialsBeforeYouStart from "../../_partials/_tutorials-before-you-start
13
13
14
14
## Overview
15
15
16
-
Using [`lerna`](https://github.com/lerna/lerna), a tool for managing multiple JavaScript codebases inside a single "monorepo", developers can work with multiple Wrangler projects and share dependencies between them. If your codebase is already managed with `lerna`, you can also add a new Wrangler project into your existing monorepo without disrupting your workflow.
16
+
Using [`lerna`](https://github.com/lerna/lerna), a tool for managing multiple JavaScript codebases inside a single monorepo, developers can work with multiple Wrangler projects and share dependencies between them. If your codebase is already managed with `lerna`, you can also add a new Wrangler project into your existing monorepo without disrupting your workflow.
17
17
18
18
Begin by installing `lerna`, and creating a new project in the folder `workers-monorepo`:
This approach to managing your Workers projects can become incredibly powerful when you begin to share dependencies between the projects. Imagine that your codebase has a pre-defined set of API handlers that you want to re-use between our public and private APIs, in the packages `public-api` and `private-api`:
43
+
This approach to managing your Workers projects can become incredibly powerful when you begin to share dependencies between projects. Imagine that your codebase has a pre-defined set of API handlers that you want to reuse between your public and private APIs, in the packages `public-api` and `private-api`:
44
44
45
45
```sh
46
46
---
@@ -51,7 +51,7 @@ $ wrangler generate public-api
51
51
$ wrangler generate private-api
52
52
```
53
53
54
-
Adjacent to your API projects, you can create a new package `handlers`, which can be imported into each project:
54
+
Next to your API projects, create a new package `handlers`, which can be imported into each project:
Using the `bootstrap` command, you can link the packages together and use them inside of your code:
74
+
Link the packages together using the `bootstrap` command and use them inside of your code:
75
75
76
76
```sh
77
77
---
@@ -92,9 +92,9 @@ const handler = request => {
92
92
}
93
93
```
94
94
95
-
After adding an identical `dependency` to `private-api/package.json`, you can run `lerna bootstrap` again, and begin sharing code between your projects.
95
+
After adding an identical `dependency` to `private-api/package.json`, run `lerna bootstrap` again, and begin sharing code between your projects.
96
96
97
-
When you’re ready to deploy your codebases, you can coordinate deploying them simultaneously by defining scripts in each package’s `package.json` file, that can be read by `lerna run`:
97
+
When you are ready to deploy your codebases, define a script in each package’s `package.json` file (for example, `publish`), so that you can later deploy both codebases in a coordinated manner using the command `lerna run <SCRIPT_NAME>`:
98
98
99
99
```json
100
100
---
@@ -144,4 +144,4 @@ lerna success - public-api
144
144
lerna success - private-api
145
145
```
146
146
147
-
If you’d like to explore an example repository, check out the accompanying open-source codebase on [GitHub](https://github.com/signalnerve/lerna-wrangler-monorepo-example) for this tutorial.
147
+
If you would like to review an example repository, refer to the accompanying open-source codebase on [GitHub](https://github.com/signalnerve/lerna-wrangler-monorepo-example) for this tutorial.
0 commit comments