@canopy-iiif/app 1.5.17 → 1.6.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.
@@ -131,6 +131,15 @@ function attachSignalHandlers() {
131
131
  async function orchestrate(options = {}) {
132
132
  const argv = options.argv || process.argv.slice(2);
133
133
  const env = options.env || process.env;
134
+ if (
135
+ argv.includes('--debug-iiif') ||
136
+ argv.includes('--iiif-debug') ||
137
+ argv.includes('--debug')
138
+ ) {
139
+ if (!env.CANOPY_IIIF_DEBUG) env.CANOPY_IIIF_DEBUG = '1';
140
+ if (!process.env.CANOPY_IIIF_DEBUG) process.env.CANOPY_IIIF_DEBUG = '1';
141
+ log('IIIF debug logging enabled');
142
+ }
134
143
 
135
144
  process.title = 'canopy-app';
136
145
  const mode = getMode(argv, env);
@@ -460,16 +460,43 @@ async function writeSearchIndex(records) {
460
460
  console.warn('Search: index size is large (', Math.round(approxBytes / (1024 * 1024)), 'MB ). Consider narrowing sources.');
461
461
  }
462
462
  await fsp.writeFile(idxPath, indexJson, 'utf8');
463
+ try {
464
+ const { logLine } = require('./log');
465
+ const approxKb = Math.round(approxBytes / 1024);
466
+ logLine(
467
+ `• search-index.json written (${indexRecords.length} records, ${approxKb} KB)`,
468
+ 'blue',
469
+ { dim: true }
470
+ );
471
+ } catch (_) {}
463
472
 
464
473
  const displayPath = path.join(apiDir, 'search-records.json');
465
474
  const displayJson = JSON.stringify(displayRecords);
466
475
  const displayBytes = Buffer.byteLength(displayJson, 'utf8');
467
476
  await fsp.writeFile(displayPath, displayJson, 'utf8');
477
+ try {
478
+ const { logLine } = require('./log');
479
+ const approxKb = Math.round(displayBytes / 1024);
480
+ logLine(
481
+ `• search-records.json written (${displayRecords.length} entries, ${approxKb} KB)`,
482
+ 'blue',
483
+ { dim: true }
484
+ );
485
+ } catch (_) {}
468
486
  let annotationsBytes = 0;
469
487
  if (annotationRecords.length) {
470
488
  const annotationsJson = JSON.stringify(annotationRecords);
471
489
  annotationsBytes = Buffer.byteLength(annotationsJson, 'utf8');
472
490
  await fsp.writeFile(annotationsPath, annotationsJson, 'utf8');
491
+ try {
492
+ const { logLine } = require('./log');
493
+ const approxKb = Math.round(annotationsBytes / 1024);
494
+ logLine(
495
+ `• search-index-annotations.json written (${annotationRecords.length} entries, ${approxKb} KB)`,
496
+ 'blue',
497
+ { dim: true }
498
+ );
499
+ } catch (_) {}
473
500
  } else {
474
501
  try {
475
502
  if (fs.existsSync(annotationsPath)) await fsp.unlink(annotationsPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopy-iiif/app",
3
- "version": "1.5.17",
3
+ "version": "1.6.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mat Jordan <mat@northwestern.edu>",