Skip to content

Commit 12bc5f3

Browse files
committed
docs: adding new feature as set config
1 parent 820a141 commit 12bc5f3

1 file changed

Lines changed: 112 additions & 90 deletions

File tree

  • src/content/docs/getting-started
Lines changed: 112 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,112 @@
1-
---
2-
title: How to use the schematics CLI?
3-
description: How to get all the benefits of the CLI.
4-
---
5-
6-
## Introduction
7-
8-
`@pbuilder/cli` is designed to assist with everything related to schematics. To fully benefit from the CLI, it is essential to understand its useful commands. The CLI is agnostic of any JavaScript framework, so if you need to create a set of schematics for a specific framework or solution, consider developing your own CLI to handle those schematics.
9-
10-
## Create a Schematic Project
11-
12-
```ansi title="Creation of schematic library project"
13-
builder new <project-name> [author] --bundler <bundler-name> --package-manager <manager> --skip-installation --dry-run --help
14-
```
15-
16-
## Execute schematics
17-
18-
`builder exec | g` is a command that allows you to execute any schematics, whether they are installed or not.
19-
| Option | Description |
20-
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------|
21-
| --dry-run | Report actions that would be taken without writing out results. (default: false) |
22-
| --registry <registry> | The NPM registry to use. |
23-
| --keep-installed | If the collection is not install you could keep installed (default: false) |
24-
| --package-manager <manager> | The package manager used to install dependencies. [string] [choices: "npm", "yarn", "pnpm", "cnpm", "bun"] (default: "npm") |
25-
| --send-pm | Send the package manager to the schematic (default: false) |
26-
| --send-registry | Send the registry to the schematic (default: false) |
27-
| -h, --help | display help for command |
28-
29-
### Local schematic
30-
31-
If you have created schematics within your project and want to build and test them, use the following command:
32-
33-
```ansi
34-
builder exec ./dist/collection.json my-schematic
35-
```
36-
37-
### Published schematics
38-
39-
For executing schematics from a published collection, use this command:
40-
41-
```ansi
42-
builder g [collection-name] [schematic-name] [options]
43-
```
44-
45-
:::note
46-
If the collection is not installed, the CLI will install it temporarily. To keep it installed, you can use the `--keep-install` option:
47-
48-
```ansi
49-
builder g [collection-name] [schematic-name] [options] --keep-install
50-
```
51-
52-
:::
53-
54-
### Private packages
55-
56-
To execute schematics from private packages, specify the registry with the following command:
57-
58-
```ansi
59-
builder exec [collection-name] [schematic-name] [options] --registry="http://localhost:4873"
60-
```
61-
62-
## Get info about a schematic
63-
64-
Before using a new set of schematics, it's important to gather information about them. This helps you understand what each schematic does and the options it offers.
65-
66-
### Get all the schematics of a collection
67-
68-
To list all schematics available in a collection, use this command:
69-
70-
```ansi
71-
builder info [collection-name]
72-
```
73-
74-
### Get all the options of a schematic
75-
76-
To get detailed information about the options for a specific schematic, use the following command:
77-
78-
```ansi
79-
builder info [collection-name] [schematic-name]
80-
```
81-
82-
## Builder add
83-
84-
Some schematic projects have a special schematic named `builder-add` or `ng-add`. This schematic is automatically executed after the collection is installed. To trigger this, use the following command:
85-
86-
```ansi
87-
builder add [collection-name]
88-
```
89-
90-
This completes our basic introduction to using the CLI for schematics. With these commands, you are well-equipped to start working with schematics effectively. Happy coding!
1+
---
2+
title: How to use the schematics CLI?
3+
description: How to get all the benefits of the CLI.
4+
---
5+
6+
## Introduction
7+
8+
`@pbuilder/cli` is designed to assist with everything related to schematics. To fully benefit from the CLI, it is essential to understand its useful commands. The CLI is agnostic of any JavaScript framework, so if you need to create a set of schematics for a specific framework or solution, consider developing your own CLI to handle those schematics.
9+
10+
## Create a Schematic Project
11+
12+
```ansi title="Creation of schematic library project"
13+
builder new <project-name> [author] --bundler <bundler-name> --package-manager <manager> --skip-installation --dry-run --help
14+
```
15+
16+
## Execute schematics
17+
18+
`builder exec | g` is a command that allows you to execute any schematics, whether they are installed or not.
19+
| Option | Description |
20+
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------|
21+
| --dry-run | Report actions that would be taken without writing out results. (default: false) |
22+
| --registry <registry> | The NPM registry to use. |
23+
| --keep-installed | If the collection is not install you could keep installed (default: false) |
24+
| --package-manager <manager> | The package manager used to install dependencies. [string] [choices: "npm", "yarn", "pnpm", "cnpm", "bun"] (default: "npm") |
25+
| --send-pm | Send the package manager to the schematic (default: false) |
26+
| --send-registry | Send the registry to the schematic (default: false) |
27+
| -h, --help | display help for command |
28+
29+
### Local schematic
30+
31+
If you have created schematics within your project and want to build and test them, use the following command:
32+
33+
```ansi
34+
builder exec ./dist/collection.json my-schematic
35+
```
36+
37+
### Published schematics
38+
39+
For executing schematics from a published collection, use this command:
40+
41+
```ansi
42+
builder g [collection-name] [schematic-name] [options]
43+
```
44+
45+
:::note
46+
If the collection is not installed, the CLI will install it temporarily. To keep it installed, you can use the `--keep-install` option:
47+
48+
```ansi
49+
builder g [collection-name] [schematic-name] [options] --keep-install
50+
```
51+
52+
:::
53+
54+
### Private packages
55+
56+
To execute schematics from private packages, specify the registry with the following command:
57+
58+
```ansi
59+
builder exec [collection-name] [schematic-name] [options] --registry="http://localhost:4873"
60+
```
61+
## 📦 `builder config` Command
62+
The `builder config` command allows you to read, write, delete, and list configuration values used by the CLI.
63+
64+
### 🧠 How Configuration Works
65+
66+
1. **Local Config (`./builder.config.json`)**
67+
- If found, it overrides global config.
68+
- Project-specific settings.
69+
70+
2. **Global Config (`~/.config/builder-cli/config.json`)**
71+
- Loaded when no local config exists.
72+
- Used for user-wide settings.
73+
74+
3. **Default Config (applied automatically if no config exists):**
75+
76+
```ts
77+
const DEFAULT_CONFIG = {
78+
cli: {
79+
showBanner: true,
80+
},
81+
};
82+
```
83+
84+
## Get info about a schematic
85+
86+
Before using a new set of schematics, it's important to gather information about them. This helps you understand what each schematic does and the options it offers.
87+
88+
### Get all the schematics of a collection
89+
90+
To list all schematics available in a collection, use this command:
91+
92+
```ansi
93+
builder info [collection-name]
94+
```
95+
96+
### Get all the options of a schematic
97+
98+
To get detailed information about the options for a specific schematic, use the following command:
99+
100+
```ansi
101+
builder info [collection-name] [schematic-name]
102+
```
103+
104+
## Builder add
105+
106+
Some schematic projects have a special schematic named `builder-add` or `ng-add`. This schematic is automatically executed after the collection is installed. To trigger this, use the following command:
107+
108+
```ansi
109+
builder add [collection-name]
110+
```
111+
112+
This completes our basic introduction to using the CLI for schematics. With these commands, you are well-equipped to start working with schematics effectively. Happy coding!

0 commit comments

Comments
 (0)