@runfile/cli 0.39.1 → 0.41.0
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 +70 -8
- package/bin/darwin-arm64/run +0 -0
- package/bin/darwin-x64/run +0 -0
- package/bin/linux-arm64/run +0 -0
- package/bin/linux-x64/run +0 -0
- package/bin/run.js +4 -3
- package/bin/win32-arm64/run.exe +0 -0
- package/bin/win32-x64/run.exe +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -629,14 +629,9 @@ $ run :generate zed-tasks
|
|
|
629
629
|
$ run :generate jetbrains-run-configurations
|
|
630
630
|
```
|
|
631
631
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
For `jetbrains-run-configurations`, which produces one file per target, each block is delimited by a
|
|
636
|
-
`<!-- .run/<file> -->` comment when more than one is emitted.
|
|
637
|
-
|
|
638
|
-
By default only the local Runfile's own targets are generated. Two independent flags widen the set,
|
|
639
|
-
and both compose with `--stdout` and the on-disk writers:
|
|
632
|
+
Each writes its editor's config to disk (`.vscode/tasks.json`, `.zed/tasks.json`, `.run/*.run.xml`),
|
|
633
|
+
merging with any existing file. By default only the local Runfile's own targets are generated; two
|
|
634
|
+
independent flags widen the set:
|
|
640
635
|
|
|
641
636
|
- `--include-namespaces` also generates entries for targets pulled in via `includes` — namespaced
|
|
642
637
|
targets carry their `namespace:` prefixes, exactly as `run :list` shows them (e.g. `run api:build`).
|
|
@@ -644,6 +639,39 @@ and both compose with `--stdout` and the on-disk writers:
|
|
|
644
639
|
`run :config global-files` — the same ones `run :list` folds in. Handy when an editor integration
|
|
645
640
|
should offer your machine-wide targets (e.g. `run c`, `run backup-git`) alongside a project's own.
|
|
646
641
|
|
|
642
|
+
##### Building your own integration: `task-descriptors`
|
|
643
|
+
|
|
644
|
+
For tooling that builds its **own** editor integration (like the
|
|
645
|
+
[Runfile VS Code extension](https://github.com/JoaaoVerona/runfile)), there's an editor-agnostic
|
|
646
|
+
alternative that always prints to stdout and never touches disk:
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
$ run :generate task-descriptors
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
It always resolves `includes` and merges registered global files (no `--include-*` flags), and emits
|
|
653
|
+
a stable JSON document describing every runnable target grouped by its source file, with per-target
|
|
654
|
+
provenance so a client can bucket local vs. included vs. global targets itself:
|
|
655
|
+
|
|
656
|
+
```jsonc
|
|
657
|
+
{
|
|
658
|
+
"formatVersion": 1,
|
|
659
|
+
"sources": [
|
|
660
|
+
{
|
|
661
|
+
"filePath": "/abs/path/Runfile.json",
|
|
662
|
+
"kind": "local", // "local" | "included" | "global"
|
|
663
|
+
"targets": [
|
|
664
|
+
{
|
|
665
|
+
"name": "api:build", // full canonical invocation name
|
|
666
|
+
"namespace": "api", // omitted for un-namespaced targets
|
|
667
|
+
"description": "Build the API"
|
|
668
|
+
}
|
|
669
|
+
]
|
|
670
|
+
}
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
```
|
|
674
|
+
|
|
647
675
|
Skip a target from the generated configs by setting `metadata.excludeFromGenerateCommand: true`. The
|
|
648
676
|
`metadata` block on `globals` and on each target is **fully open** — any property of any JSON type
|
|
649
677
|
(strings, numbers, booleans, arrays, deeply-nested objects) is accepted and round-trips untouched, so
|
|
@@ -656,6 +684,40 @@ output is formatted to match the settings that apply to each written path — th
|
|
|
656
684
|
sets the newline sequence, `insert_final_newline` and `trim_trailing_whitespace` are applied, and
|
|
657
685
|
`charset = utf-8-bom` prepends a BOM. When no `.editorconfig` applies, the previous defaults are kept.
|
|
658
686
|
|
|
687
|
+
#### Preparation targets (like `npm prepare`, but enforced)
|
|
688
|
+
|
|
689
|
+
Most projects have a one-time setup step — install git hooks, pull dependencies, generate config.
|
|
690
|
+
It's easy to forget, and easy to fall behind when it changes. Point `globals.prepare` at a target and
|
|
691
|
+
Runfile makes it a precondition for **every** target in the file:
|
|
692
|
+
|
|
693
|
+
```jsonc
|
|
694
|
+
{
|
|
695
|
+
"globals": { "prepare": "@setup" },
|
|
696
|
+
"targets": {
|
|
697
|
+
"setup": { "commands": ["git config core.hooksPath .githooks", "npm ci"] },
|
|
698
|
+
"build": { "commands": ["npm run build"] },
|
|
699
|
+
"test": { "commands": ["npm test"], "prepare": "@setup-tests" },
|
|
700
|
+
"setup-tests": { "commands": ["./scripts/seed-test-db.sh"] }
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
Run anything before setup has run and you get a clear stop, not a confusing failure:
|
|
706
|
+
|
|
707
|
+
```console
|
|
708
|
+
$ run build
|
|
709
|
+
Error: target "build" requires preparation steps that haven't been completed:
|
|
710
|
+
• run setup (never run)
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
Once you `run setup`, Runfile records a hash of its commands (following `@target` calls, so nested
|
|
714
|
+
setups count too). Future runs pass silently — **until those commands change**, at which point the
|
|
715
|
+
requirement re-triggers and everyone is prompted to re-run it. A target's own `prepare` is *additive*
|
|
716
|
+
on top of the global one, so `run test` above requires both `setup` and `setup-tests`.
|
|
717
|
+
|
|
718
|
+
Preparation is a developer-machine concern, so the gate is **skipped automatically in CI** (detected
|
|
719
|
+
via `CI`, `GITHUB_ACTIONS`, and friends). Set `RUNFILE_SKIP_PREPARE=1` to bypass it manually.
|
|
720
|
+
|
|
659
721
|
#### Migrate in seconds
|
|
660
722
|
|
|
661
723
|
```bash
|
package/bin/darwin-arm64/run
CHANGED
|
Binary file
|
package/bin/darwin-x64/run
CHANGED
|
Binary file
|
package/bin/linux-arm64/run
CHANGED
|
Binary file
|
package/bin/linux-x64/run
CHANGED
|
Binary file
|
package/bin/run.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
const path = require('node:path');
|
|
4
4
|
const { spawnSync } = require('node:child_process');
|
|
5
|
-
|
|
6
5
|
const KEY = process.platform + '-' + process.arch;
|
|
7
6
|
const BINARIES = {
|
|
8
7
|
"linux-x64": "run",
|
|
@@ -12,8 +11,8 @@ const BINARIES = {
|
|
|
12
11
|
"win32-x64": "run.exe",
|
|
13
12
|
"win32-arm64": "run.exe"
|
|
14
13
|
};
|
|
15
|
-
|
|
16
14
|
const bin = BINARIES[KEY];
|
|
15
|
+
|
|
17
16
|
if (!bin) {
|
|
18
17
|
console.error(`run: unsupported platform ${KEY}. Supported: ${Object.keys(BINARIES).join(', ')}`);
|
|
19
18
|
process.exit(1);
|
|
@@ -21,8 +20,10 @@ if (!bin) {
|
|
|
21
20
|
|
|
22
21
|
const binPath = path.join(__dirname, KEY, bin);
|
|
23
22
|
const result = spawnSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
23
|
+
|
|
24
24
|
if (result.error) {
|
|
25
25
|
console.error(`run: failed to spawn ${binPath}: ${result.error.message}`);
|
|
26
26
|
process.exit(1);
|
|
27
27
|
}
|
|
28
|
+
|
|
28
29
|
process.exit(result.status == null ? 1 : result.status);
|
package/bin/win32-arm64/run.exe
CHANGED
|
Binary file
|
package/bin/win32-x64/run.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED