quizmill 0.2.4 → 0.2.5
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/bin/quizmill.js +27 -3
- package/package.json +1 -1
package/bin/quizmill.js
CHANGED
|
@@ -47,6 +47,14 @@ function ensureEngine() {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
function engineSha() {
|
|
51
|
+
try {
|
|
52
|
+
return execSync('git rev-parse --short HEAD', { cwd: ENGINE }).toString().trim();
|
|
53
|
+
} catch {
|
|
54
|
+
return '?';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
50
58
|
function engineNpm(args) {
|
|
51
59
|
ensureEngine();
|
|
52
60
|
const env = { ...process.env };
|
|
@@ -163,11 +171,27 @@ function cmdValidate(arg) {
|
|
|
163
171
|
|
|
164
172
|
function cmdUpgrade() {
|
|
165
173
|
ensureEngine();
|
|
166
|
-
if (
|
|
167
|
-
|
|
174
|
+
if (process.env.QUIZMILL_ENGINE) {
|
|
175
|
+
log('QUIZMILL_ENGINE points at your own checkout — its update is up to you.');
|
|
176
|
+
} else {
|
|
177
|
+
const before = engineSha();
|
|
178
|
+
try {
|
|
179
|
+
// The cache is a depth-1 shallow clone, so `git pull --ff-only` can't
|
|
180
|
+
// fast-forward across the grafted history once main advances. Fetch
|
|
181
|
+
// the latest main and hard-reset onto it — the cache holds no local
|
|
182
|
+
// commits worth keeping (gitignored content/ and out/ are untouched).
|
|
183
|
+
run('git', ['fetch', '--depth', '1', 'origin', 'main'], { cwd: ENGINE });
|
|
184
|
+
run('git', ['reset', '--hard', 'FETCH_HEAD'], { cwd: ENGINE });
|
|
185
|
+
} catch {
|
|
186
|
+
log('… update failed — re-cloning the engine fresh');
|
|
187
|
+
fs.rmSync(ENGINE, { recursive: true, force: true });
|
|
188
|
+
ensureEngine();
|
|
189
|
+
}
|
|
190
|
+
const after = engineSha();
|
|
191
|
+
log(before === after ? `engine already current (${after})` : `engine ${before} → ${after}`);
|
|
168
192
|
}
|
|
169
193
|
run('npm', ['install', '--no-fund', '--no-audit'], { cwd: ENGINE });
|
|
170
|
-
log(
|
|
194
|
+
log(`✓ quizmill ${CLI_VERSION} ready — engine deps installed`);
|
|
171
195
|
}
|
|
172
196
|
|
|
173
197
|
const HELP = `quizmill — the mill that grinds questions into knowledge
|
package/package.json
CHANGED