Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mean-bushes-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"scaffolder-toolkit": patch
---

feat: Add short aliases (pm, lang, cache) for configuration keys
42 changes: 15 additions & 27 deletions packages/devkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Here are some examples of how to use the new options:

```bash
# List all templates, including the Scaffolder's built-in defaults
dk list --include-defaults
dk list -d

# List templates only from the local configuration file
dk list --local
Expand All @@ -212,28 +212,28 @@ dk list --mode table -d

---

### Manage your CLI configuration
### Manage your CLI configuration (`dk config` / `dk conf`)

The `dk config` command is a central hub for all configuration and template management. It works with subcommands to handle different tasks.
The `dk config` command is the central hub for managing your CLI settings and templates.

#### Get and Set Configuration Values
#### Get and Set Configuration Values (Core)

The core `dk config` command allows you to **get** or **set** configuration values directly using arguments and options.
The main `dk config` command allows you to **get** or **set** simple configuration values like your preferred package manager or language.

- To **get** a value, provide the key as a direct argument (e.g., `dk config language`). You can retrieve multiple values by listing their keys.
- To **set** one or more values, use the `--set` or `-s` flag followed by key-value pairs (e.g., `dk config --set language fr`).

> **Note:** Running `dk config` without arguments or options is not supported and will result in an error.
| Action | Command Syntax | Description |
| :-------------- | :------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **GET** (Read) | `dk config <key...>` | Retrieve the value(s) for the specified configuration key(s). Supported keys include: **pm** / **defaultPackageManager**, **lang** / **language**, and **cache** / **cacheStrategy**. |
| **SET** (Write) | `dk config --set <key value...>` | Set one or more configuration properties in bulk (key-value pairs). |

```bash
# Get the value of the 'defaultPackageManager' setting
dk config defaultPackageManager
# Get the value of the 'defaultPackageManager' setting using its short alias
dk config pm

# Get the value of the 'language' setting from the global config
dk config language --global
# Get the value of both 'language' and 'cacheStrategy' from the global config
dk config language cacheStrategy --global

# Set your default package manager to pnpm and the language to French in a single command (local)
dk config --set defaultPackageManager pnpm language fr
dk config --set pm pnpm lang fr

# Set your default package manager to npm in your global config
dk config --set defaultPackageManager npm --global
Expand Down Expand Up @@ -322,17 +322,6 @@ dk config remove node node-api --global

---

#### Manage cache strategy for a template

Use the `dk config cache` command to update the cache strategy for a specific template.

```bash
# Set the cache strategy for the 'react' template to 'always-refresh'
dk config cache react always-refresh
```

---

### Shortcuts

For a faster workflow, the following commands have shortcuts:
Expand All @@ -349,7 +338,6 @@ For a faster workflow, the following commands have shortcuts:
| `config remove` | `conf rm` |
| `config update` | `conf up` |
| `config list` | `conf ls` |
| `cache` | `c` |
| `version` | `v` |
| `help` | `h` |

Expand Down Expand Up @@ -419,7 +407,7 @@ You can also define an **`alias`** to make it easier to reference a specific tem
Once an alias is configured, you can use it in place of the full template name for faster commands.

```bash
# Create a new project using the alias 'gh-template'
# Create a new project from the alias 'gh-template'
dk new javascript my-new-project-name -t gh-template
```

Expand Down
4 changes: 2 additions & 2 deletions packages/devkit/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ This document tracks all planned and completed tasks for the Dev Kit project.
- [x] **Enhance `list` Command**: Add options to **filter by properties** (e.g., `packageManager`, `alias`, etc.).
- [x] **Enhance `list` Command**: Add flag to also see default config `--include-defaults`.
- [x] Explain the usage of `{pm}` role inside the config in the documentation.
- [x] Add a `--settings, -s` to the `dk list` command to display the current configuration settings only
- [x] Add a `--settings, -s` to the `dk list` command to display the current configuration settings Only
- [x] Add wildcard support for template name in the `dk config update` and `dk config remove` commands.
- [ ] add short keys to get config using `dk config` like `dk config lang` for `dk config language`
- [x] add short keys to get config using `dk config` like `dk config lang` for `dk config language`
- [ ] ** Enhance for organization Purpose **: Add new language `Typescript(ts)` with same code as javascript(js), also support for nodejs(node) template name for those who prefer it than the programming language name
- [ ] Add a configuration validation step when updating the config file to ensure all required fields are present and correctly formatted.
- [ ] **Testing**: Stabilize the integration test of the `new` command
Expand Down
Loading