quizmill 0.3.43 → 0.3.44
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 +1 -0
- package/bin/quizmill.js +38 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ npx quizmill build my-topic # static app in my-topic-app/ — deploy anywhe
|
|
|
20
20
|
| `validate <dir>` | schema + cross-reference checks (agents loop on this) |
|
|
21
21
|
| `run [dir\|owner/repo]` | activate a pack and start the app |
|
|
22
22
|
| `build [dir\|owner/repo]` | emit a deployable static app in `<pack-id>-app/` |
|
|
23
|
+
| `bundle <dir> [--out file]` | validate + write one `<pack-id>.bundle.json` (images inside) that any quizmill app inserts at `/packs` |
|
|
23
24
|
| `list` | published packs you can install |
|
|
24
25
|
| `upgrade` | update the cached engine in `~/.quizmill` |
|
|
25
26
|
|
package/bin/quizmill.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* npx quizmill run my-topic activate a pack and start the app
|
|
13
13
|
* npx quizmill run owner/repo ...straight from a GitHub pack repo
|
|
14
14
|
* npx quizmill build my-topic static site in <pack-id>-app/
|
|
15
|
+
* npx quizmill bundle my-topic one <pack-id>.bundle.json to hand over
|
|
15
16
|
* npx quizmill list published packs
|
|
16
17
|
* npx quizmill upgrade update the cached engine
|
|
17
18
|
*/
|
|
@@ -203,6 +204,40 @@ function cmdValidate(arg) {
|
|
|
203
204
|
engineNpm(['run', 'pack:validate', src]);
|
|
204
205
|
}
|
|
205
206
|
|
|
207
|
+
/** The pack id from <dir>/pack.json, for naming the default bundle file;
|
|
208
|
+
* null when the manifest can't be read (the engine's validator will
|
|
209
|
+
* explain why, so don't die here). */
|
|
210
|
+
function packIdOf(dir) {
|
|
211
|
+
try {
|
|
212
|
+
const id = JSON.parse(fs.readFileSync(path.join(dir, 'pack.json'), 'utf8')).id;
|
|
213
|
+
return typeof id === 'string' && id ? id : null;
|
|
214
|
+
} catch {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function cmdBundle(arg, rest) {
|
|
220
|
+
if (!arg) die('usage: quizmill bundle <pack-dir> [--out file]');
|
|
221
|
+
const src = packSource(arg);
|
|
222
|
+
if (!fs.existsSync(src)) die(`not a directory: ${arg}`);
|
|
223
|
+
let out = null;
|
|
224
|
+
for (let i = 0; i < rest.length; i++) {
|
|
225
|
+
const a = rest[i];
|
|
226
|
+
if (a === '--out' || a === '-o') {
|
|
227
|
+
out = rest[++i];
|
|
228
|
+
if (!out) die('--out needs a file path');
|
|
229
|
+
} else if (a.startsWith('--out=')) {
|
|
230
|
+
out = a.slice('--out='.length);
|
|
231
|
+
} else {
|
|
232
|
+
die(`unknown option "${a}" — usage: quizmill bundle <pack-dir> [--out file]`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// The engine runs from its own checkout, so hand it an absolute target
|
|
236
|
+
// (default: <pack-id>.bundle.json where the user typed the command).
|
|
237
|
+
const target = path.resolve(out || `${packIdOf(src) || path.basename(src)}.bundle.json`);
|
|
238
|
+
engineNpm(['run', 'pack:bundle', '--', src, '--out', target]);
|
|
239
|
+
}
|
|
240
|
+
|
|
206
241
|
function cmdUpgrade() {
|
|
207
242
|
if (process.env.QUIZMILL_ENGINE) {
|
|
208
243
|
ensureEngine();
|
|
@@ -227,6 +262,7 @@ usage:
|
|
|
227
262
|
quizmill validate <dir> schema + cross-reference checks
|
|
228
263
|
quizmill run [dir|owner/repo] activate a pack (default: current/demo) and start the app
|
|
229
264
|
quizmill build [dir|owner/repo] build a static app into <pack-id>-app/
|
|
265
|
+
quizmill bundle <dir> [--out file] one <pack-id>.bundle.json, images inside — insert it at /packs
|
|
230
266
|
quizmill list published packs you can install
|
|
231
267
|
quizmill upgrade update the cached engine (~/.quizmill)
|
|
232
268
|
quizmill --version print the CLI version (stamped into builds)
|
|
@@ -235,13 +271,14 @@ A learning pack is three JSON files. You can write them, but the
|
|
|
235
271
|
intended author is your AI agent — see the create-learning-pack skill
|
|
236
272
|
in the engine repo.`;
|
|
237
273
|
|
|
238
|
-
const [cmd, arg] = process.argv.slice(2);
|
|
274
|
+
const [cmd, arg, ...rest] = process.argv.slice(2);
|
|
239
275
|
try {
|
|
240
276
|
switch (cmd) {
|
|
241
277
|
case 'new': cmdNew(arg); break;
|
|
242
278
|
case 'validate': cmdValidate(arg); break;
|
|
243
279
|
case 'run': cmdRun(arg); break;
|
|
244
280
|
case 'build': cmdBuild(arg); break;
|
|
281
|
+
case 'bundle': cmdBundle(arg, rest); break;
|
|
245
282
|
case 'list': engineNpm(['run', 'pack:list']); break;
|
|
246
283
|
case 'upgrade': cmdUpgrade(); break;
|
|
247
284
|
case 'version':
|
package/package.json
CHANGED