@runfile/cli 0.39.1 → 0.40.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 +34 -0
- 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
|
@@ -656,6 +656,40 @@ output is formatted to match the settings that apply to each written path — th
|
|
|
656
656
|
sets the newline sequence, `insert_final_newline` and `trim_trailing_whitespace` are applied, and
|
|
657
657
|
`charset = utf-8-bom` prepends a BOM. When no `.editorconfig` applies, the previous defaults are kept.
|
|
658
658
|
|
|
659
|
+
#### Preparation targets (like `npm prepare`, but enforced)
|
|
660
|
+
|
|
661
|
+
Most projects have a one-time setup step — install git hooks, pull dependencies, generate config.
|
|
662
|
+
It's easy to forget, and easy to fall behind when it changes. Point `globals.prepare` at a target and
|
|
663
|
+
Runfile makes it a precondition for **every** target in the file:
|
|
664
|
+
|
|
665
|
+
```jsonc
|
|
666
|
+
{
|
|
667
|
+
"globals": { "prepare": "@setup" },
|
|
668
|
+
"targets": {
|
|
669
|
+
"setup": { "commands": ["git config core.hooksPath .githooks", "npm ci"] },
|
|
670
|
+
"build": { "commands": ["npm run build"] },
|
|
671
|
+
"test": { "commands": ["npm test"], "prepare": "@setup-tests" },
|
|
672
|
+
"setup-tests": { "commands": ["./scripts/seed-test-db.sh"] }
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Run anything before setup has run and you get a clear stop, not a confusing failure:
|
|
678
|
+
|
|
679
|
+
```console
|
|
680
|
+
$ run build
|
|
681
|
+
Error: target "build" requires preparation steps that haven't been completed:
|
|
682
|
+
• run setup (never run)
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
Once you `run setup`, Runfile records a hash of its commands (following `@target` calls, so nested
|
|
686
|
+
setups count too). Future runs pass silently — **until those commands change**, at which point the
|
|
687
|
+
requirement re-triggers and everyone is prompted to re-run it. A target's own `prepare` is *additive*
|
|
688
|
+
on top of the global one, so `run test` above requires both `setup` and `setup-tests`.
|
|
689
|
+
|
|
690
|
+
Preparation is a developer-machine concern, so the gate is **skipped automatically in CI** (detected
|
|
691
|
+
via `CI`, `GITHUB_ACTIONS`, and friends). Set `RUNFILE_SKIP_PREPARE=1` to bypass it manually.
|
|
692
|
+
|
|
659
693
|
#### Migrate in seconds
|
|
660
694
|
|
|
661
695
|
```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