flagstaff 0.4.0 → 0.4.1
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/dist/cli.js +30 -4
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
2
3
|
import { resolve } from 'node:path';
|
|
3
4
|
import { pathToFileURL } from 'node:url';
|
|
4
5
|
import { hoist, manualClock } from './loop.js';
|
|
@@ -77,12 +78,37 @@ function describe(value) {
|
|
|
77
78
|
return '(not serializable — shown as given)';
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
const USAGE = 'usage: flagstaff check <plugin-file>\n';
|
|
82
|
+
const HELP = `${USAGE}
|
|
83
|
+
Load a plugin file, validate it against the family schema, and render every contribution in
|
|
84
|
+
all five output modes side by side. Exit 0 when it renders, 1 on a refusal (with a code and
|
|
85
|
+
a fix), 2 on a usage error.
|
|
86
|
+
|
|
87
|
+
-h, --help show this help
|
|
88
|
+
-V, --version print the version
|
|
89
|
+
`;
|
|
90
|
+
function version() {
|
|
91
|
+
return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
92
|
+
}
|
|
93
|
+
function target(arg, write) {
|
|
94
|
+
if (arg === '--help' || arg === '-h') {
|
|
95
|
+
write(HELP);
|
|
96
|
+
return EXIT_OK;
|
|
97
|
+
}
|
|
98
|
+
if (arg === '--version' || arg === '-V') {
|
|
99
|
+
write(`${version()}\n`);
|
|
100
|
+
return EXIT_OK;
|
|
101
|
+
}
|
|
102
|
+
if (arg === undefined || arg.startsWith('-')) {
|
|
103
|
+
write(arg === undefined ? USAGE : `unknown option ${arg}\n${USAGE}`);
|
|
84
104
|
return EXIT_USAGE;
|
|
85
105
|
}
|
|
106
|
+
return arg;
|
|
107
|
+
}
|
|
108
|
+
async function main(argv, write) {
|
|
109
|
+
const file = target(argv[0], write);
|
|
110
|
+
if (typeof file === 'number')
|
|
111
|
+
return file;
|
|
86
112
|
const before = new Set(registered().plugins);
|
|
87
113
|
const loaded = (await import(pathToFileURL(resolve(file)).href));
|
|
88
114
|
const plugin = loaded.default ?? loaded;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flagstaff",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "The staff the flag flies from. A terminal frame loop with a static projection for agents and screen readers, and a plugin host for spinners, progress, boxes and tables. Drop-in paths for ora, log-update, boxen and cli-table3. No dependency outside the burgee family.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"json"
|
|
122
122
|
],
|
|
123
123
|
"dependencies": {
|
|
124
|
-
"closeout": "^0.5.
|
|
125
|
-
"linegauge": "^0.5.
|
|
126
|
-
"paratext": "^0.6.
|
|
127
|
-
"roundel": "^0.5.
|
|
124
|
+
"closeout": "^0.5.1",
|
|
125
|
+
"linegauge": "^0.5.1",
|
|
126
|
+
"paratext": "^0.6.1",
|
|
127
|
+
"roundel": "^0.5.1"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"fast-check": "^4.10.1",
|