quizmill 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/bin/quizmill.js +16 -1
  2. package/package.json +1 -1
package/bin/quizmill.js CHANGED
@@ -23,6 +23,7 @@ const path = require('node:path');
23
23
  const ENGINE_REPO = 'https://github.com/quizmill/quizmill.git';
24
24
  const HOME = process.env.QUIZMILL_HOME || path.join(os.homedir(), '.quizmill');
25
25
  const ENGINE = process.env.QUIZMILL_ENGINE || path.join(HOME, 'engine');
26
+ const CLI_VERSION = require('../package.json').version;
26
27
 
27
28
  const log = (s) => console.log(s);
28
29
  const die = (s) => {
@@ -48,7 +49,17 @@ function ensureEngine() {
48
49
 
49
50
  function engineNpm(args) {
50
51
  ensureEngine();
51
- run('npm', args, { cwd: ENGINE });
52
+ const env = { ...process.env };
53
+ // The cached engine is a shallow, tagless clone, so its own
54
+ // `git describe` can't resolve a release tag — the in-app version would
55
+ // fall back to the 0.0.0-dev sentinel. Stamp the build with the CLI's
56
+ // version instead (the CLI is published in lockstep with the engine).
57
+ // Skipped when QUIZMILL_ENGINE points at a real checkout (let its git
58
+ // tags win) or when the caller set the version explicitly.
59
+ if (!process.env.QUIZMILL_ENGINE && !env.NEXT_PUBLIC_APP_VERSION) {
60
+ env.NEXT_PUBLIC_APP_VERSION = CLI_VERSION;
61
+ }
62
+ run('npm', args, { cwd: ENGINE, env });
52
63
  }
53
64
 
54
65
  /** Resolve a pack argument: absolute path for dirs, verbatim otherwise
@@ -169,6 +180,7 @@ usage:
169
180
  quizmill build [dir|owner/repo] build a static app into <pack-id>-app/
170
181
  quizmill list published packs you can install
171
182
  quizmill upgrade update the cached engine (~/.quizmill)
183
+ quizmill --version print the CLI version (stamped into builds)
172
184
 
173
185
  A learning pack is three JSON files. You can write them, but the
174
186
  intended author is your AI agent — see the create-learning-pack skill
@@ -183,6 +195,9 @@ try {
183
195
  case 'build': cmdBuild(arg); break;
184
196
  case 'list': engineNpm(['run', 'pack:list']); break;
185
197
  case 'upgrade': cmdUpgrade(); break;
198
+ case 'version':
199
+ case '--version':
200
+ case '-v': log(CLI_VERSION); break;
186
201
  case 'help':
187
202
  case '--help':
188
203
  case undefined: log(HELP); break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quizmill",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Turn a folder of JSON into an installable, offline-first practice app. The mill that grinds questions into knowledge.",
5
5
  "bin": {
6
6
  "quizmill": "bin/quizmill.js"