hammerkit 1.12.0 → 1.13.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/dist/program.js +8 -0
- package/package.json +1 -1
package/dist/program.js
CHANGED
|
@@ -277,12 +277,17 @@ async function getProgram(environment, argv) {
|
|
|
277
277
|
.default('checksum')
|
|
278
278
|
.choices(['checksum', 'modify-date', 'none']))
|
|
279
279
|
.addOption(new commander_1.Option('--json', 'emit the explanation as JSON').default(false))
|
|
280
|
+
.addOption(new commander_1.Option('--check', 'exit with code 1 when any task would be a cache miss').default(false))
|
|
280
281
|
.action(async (task, options) => {
|
|
281
282
|
try {
|
|
282
283
|
const cli = await createCli(fileName, environment, task ? { taskName: task, environmentName: options.env ?? null } : parseWorkLabelScope(options));
|
|
283
284
|
const explanations = await cli.explain({ cacheDefault: options.cache });
|
|
285
|
+
const missed = explanations.filter((explanation) => explanation.status === 'miss');
|
|
284
286
|
if (options.json) {
|
|
285
287
|
environment.stdout.write(`${JSON.stringify(explanations, null, 2)}\n`);
|
|
288
|
+
if (options.check && missed.length > 0) {
|
|
289
|
+
program.error('', { exitCode: 1 });
|
|
290
|
+
}
|
|
286
291
|
return;
|
|
287
292
|
}
|
|
288
293
|
for (const explanation of explanations) {
|
|
@@ -296,6 +301,9 @@ async function getProgram(environment, argv) {
|
|
|
296
301
|
(0, log_1.printProperty)(environment, 'cause', (0, explain_1.describeCause)(cause));
|
|
297
302
|
}
|
|
298
303
|
}
|
|
304
|
+
if (options.check && missed.length > 0) {
|
|
305
|
+
program.error(`${missed.length} of ${explanations.length} tasks would be a cache miss`, { exitCode: 1 });
|
|
306
|
+
}
|
|
299
307
|
}
|
|
300
308
|
catch (e) {
|
|
301
309
|
if (e instanceof commander_1.CommanderError) {
|
package/package.json
CHANGED