@turbo/gen 1.9.6 → 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -53
- package/dist/cli.js +111 -111
- package/dist/templates/simple-js/config.js +31 -0
- package/dist/templates/simple-js/templates/turborepo-generators.hbs +5 -0
- package/dist/templates/simple-ts/config.ts +33 -0
- package/dist/templates/simple-ts/templates/turborepo-generators.hbs +5 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,66 +1,38 @@
|
|
|
1
1
|
# `@turbo/gen`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Easily extend your Turborepo with new apps, and packages. Create new empty workspaces, copy existing workspaces, add workspaces from remote sources (just like `create-turbo`!) or run custom generators defined using [Plop](https://plopjs.com/) configurations.
|
|
3
|
+
Types for working with [Turborepo Generators](https://turbo.build/repo/docs/core-concepts/monorepos/code-generation).
|
|
6
4
|
|
|
7
5
|
## Usage
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
Usage: @turbo/gen [options] [command]
|
|
11
|
-
|
|
12
|
-
Extend your Turborepo
|
|
13
|
-
|
|
14
|
-
Options:
|
|
15
|
-
-v, --version Output the current version
|
|
16
|
-
-h, --help Display help for command
|
|
17
|
-
|
|
18
|
-
Commands:
|
|
19
|
-
add|a [options] Add a new package or app to your project
|
|
20
|
-
generate|g [options] [generator-name] Run custom generators
|
|
21
|
-
help [command] display help for command
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Add
|
|
25
|
-
|
|
26
|
-
Extend your Turborepo with new apps or packages. Create new empty workspaces, copy existing workspaces, or add workspaces from remote sources (just like `create-turbo`!).
|
|
27
|
-
|
|
28
|
-
### Usage
|
|
29
|
-
|
|
30
|
-
#### Blank Workspace
|
|
7
|
+
Install:
|
|
31
8
|
|
|
32
9
|
```bash
|
|
33
|
-
@turbo/gen
|
|
10
|
+
pnpm add @turbo/gen --save-dev
|
|
34
11
|
```
|
|
35
12
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
@turbo/gen
|
|
13
|
+
Use types within your generator `config.ts`:
|
|
14
|
+
|
|
15
|
+
```ts filename="turbo/generators/config.ts"
|
|
16
|
+
import type { PlopTypes } from "@turbo/gen";
|
|
17
|
+
|
|
18
|
+
export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
|
19
|
+
// create a generator
|
|
20
|
+
plop.setGenerator("Generator name", {
|
|
21
|
+
description: "Generator description",
|
|
22
|
+
// gather information from the user
|
|
23
|
+
prompts: [
|
|
24
|
+
...
|
|
25
|
+
],
|
|
26
|
+
// perform actions based on the prompts
|
|
27
|
+
actions: [
|
|
28
|
+
...
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
40
32
|
```
|
|
41
33
|
|
|
42
|
-
|
|
34
|
+
Learn more about Turborepo Generators in the [docs](https://turbo.build/repo/docs/core-concepts/monorepos/code-generation)
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
@turbo/gen add -e <git-url>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Generate
|
|
49
|
-
|
|
50
|
-
Extend your Turborepo with custom generators defined using [Plop](https://plopjs.com/) configurations.
|
|
51
|
-
|
|
52
|
-
### Usage
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
@turbo/gen generate [generator-name]
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Writing Generators
|
|
59
|
-
|
|
60
|
-
`@turbo/gen` will search the root of your monorepo, and every workspace for generators defined at:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
turbo/generators/config.js
|
|
64
|
-
```
|
|
36
|
+
---
|
|
65
37
|
|
|
66
|
-
|
|
38
|
+
For more information about Turborepo, visit [turbo.build](https://turbo.build) and follow us on Twitter ([@turborepo](https://twitter.com/turborepo))!
|