Skip to content

Commit df98e25

Browse files
committed
🐛 fix: fix an issue with Makefile when commands have more than one hyphen
1 parent d26537f commit df98e25

3 files changed

Lines changed: 82 additions & 15 deletions

File tree

template/Makefile.jinja

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ actions = \
1212
coverage \
1313
{%- if with_doppler %}
1414
dc \
15-
doppler-create-config \
16-
doppler-create-token \
17-
doppler-set-token \
18-
doppler-delete-config \
19-
doppler-upload-secrets \
2015
{%- endif %}
2116
{%- if dockerfile %}
2217
docker-build \
@@ -30,7 +25,6 @@ actions = \
3025
docs-deploy \
3126
{%- endif %}
3227
format \
33-
mise-setup-completions \
3428
{%- if publish_to_pypi %}
3529
publish \
3630
{%- endif %}
@@ -56,6 +50,23 @@ _check-mise:
5650
$(actions): _check-mise
5751
@mise run "$(subst -,:,$@)"
5852

53+
{%- if with_doppler %}
54+
doppler_actions = \
55+
doppler-create-config \
56+
doppler-create-token \
57+
doppler-set-token \
58+
doppler-delete-config \
59+
doppler-upload-secrets
60+
61+
.PHONY: $(doppler_actions)
62+
$(doppler_actions): _check-mise
63+
@mise run "doppler:$(patsubst doppler-%,%,$@)"
64+
{%- endif %}
65+
66+
.PHONY: mise-setup-completions
67+
mise-setup-completions: _check-mise
68+
@mise run "mise:setup-completions"
69+
5970
.PHONY: pre-commit
6071
pre-commit: _check-mise
6172
@mise run "pre-commit"

template/docs/development/setup.md.jinja

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,50 @@ docker compose up --build
6868

6969
This project uses [Doppler](https://www.doppler.com/) for secrets management.
7070

71+
### Initial Setup
72+
73+
Authenticate and link this directory to a Doppler config:
74+
7175
```bash
7276
doppler setup
7377
```
7478

7579
Once configured, secrets are automatically injected into your environment when running tasks through mise.
80+
81+
### Common Tasks
82+
83+
| Task | mise |
84+
|------|------|
85+
| Upload a local `.env` to Doppler | `mise run doppler:upload-secrets` |
86+
| Create a branch config | `mise run doppler:create-config` |
87+
| Delete a branch config | `mise run doppler:delete-config` |
88+
| Create a service token | `mise run doppler:create-token` |
89+
| Set a preexisting service token | `mise run doppler:set-token` |
90+
91+
> For the full list of options and flags, see the [Task Runner](task-runner.md#doppler-secrets-management) guide.
92+
93+
### Branch Configs
94+
95+
Each developer or feature branch can have its own Doppler config:
96+
97+
```bash
98+
mise run doppler:create-config --config dev.alice
99+
mise run doppler:delete-config --config dev.alice
100+
```
101+
102+
### Service Tokens
103+
104+
Provision a read-only token for CI or another environment:
105+
106+
```bash
107+
mise run doppler:create-token --token-name ci-token
108+
```
109+
110+
Or configure an existing token interactively:
111+
112+
```bash
113+
mise run doppler:set-token
114+
```
76115
{% endif %}
77116
{%- if tox %}
78117

template/docs/development/task-runner.md.jinja

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ mise tasks # same thing, via mise directly
1111

1212
## How It Works
1313

14-
The Makefile proxies every target to mise by converting hyphens to colons:
14+
Most Makefile targets are proxied to mise by converting hyphens to colons:
1515

1616
```
1717
make docker-build → mise run docker:build
1818
make check-all → mise run check:all
1919
```
2020

21-
This is done via `$(subst -,:,$@)` in the Makefile. You never need to edit both files for existing tasks — the Makefile target list (`actions`) and the mise task definition are the only two places a task is registered.
21+
This is done via `$(subst -,:,$@)` in the Makefile for targets in the `actions` list.
22+
23+
Multi-word targets where the mise task name retains a hyphen in the action part (e.g. `doppler:create-config`, `mise:setup-completions`) require explicit rules, since the generic substitution would incorrectly convert every hyphen:
24+
25+
```
26+
make doppler-create-config → mise run doppler:create-config (explicit rule)
27+
make mise-setup-completions → mise run mise:setup-completions (explicit rule)
28+
```
2229

2330
## Task Reference
2431

@@ -158,14 +165,24 @@ mise run release --dry-run
158165
run = "echo hello"
159166
```
160167

161-
2. Add the hyphenated target name to the `actions` list in `Makefile`:
168+
2. Register the target in `Makefile`:
162169

163-
```makefile
164-
actions = \
165-
...
166-
mycat-mytask \
167-
...
168-
```
170+
- **Simple two-part tasks** (`category:action` → `category-action`): add to the `actions` list — the generic `$(subst -,:,$@)` substitution handles the rest.
171+
172+
```makefile
173+
actions = \
174+
...
175+
mycat-mytask \
176+
...
177+
```
178+
179+
- **Multi-part tasks where the action contains a hyphen** (e.g. `mycat:do-thing`): add an explicit rule so the hyphen in the action part is preserved.
180+
181+
```makefile
182+
.PHONY: mycat-do-thing
183+
mycat-do-thing: _check-mise
184+
@mise run "mycat:do-thing"
185+
```
169186

170187
Naming convention: colons (`:`) in mise, hyphens (`-`) in make.
171188

0 commit comments

Comments
 (0)