Comparing version 0.3.14 to 0.3.15
@@ -53,3 +53,3 @@ "use strict"; | ||
let hasPaintingAnnotation = false; | ||
for (const file of customAnnotationFiles) { | ||
await Promise.all(customAnnotationFiles.map(async (file) => { | ||
let directoryName = dirname(file); | ||
@@ -150,3 +150,3 @@ directoryName = directoryName.substr(directoryName.lastIndexOf('/')); | ||
canvasJson.items[0].items.push(annotationJson); | ||
} | ||
})); | ||
if (!hasPaintingAnnotation) { | ||
@@ -179,3 +179,3 @@ // for each jpg/pdf/mp4/obj in the canvas directory | ||
async _annotateFiles(canvasJson, files) { | ||
for (let file of files) { | ||
await Promise.all(files.map(async (file) => { | ||
file = Utils_1.Utils.normaliseFilePath(file); | ||
@@ -215,3 +215,3 @@ const extName = extname(file); | ||
} | ||
} | ||
})); | ||
} | ||
@@ -218,0 +218,0 @@ async _getInfo() { |
@@ -40,11 +40,6 @@ "use strict"; | ||
}); | ||
// example of parallel processing | ||
//await Promise.all(canvases.map(async (canvas: string) => { ... }); | ||
// dropped parallel processing in favour of "deterministic" results | ||
// also, a lot of tasks in parallel can use too much memory: | ||
// https://blog.lavrton.com/javascript-loops-how-to-handle-async-await-6252dd3c795 | ||
for (const canvas of canvases) { | ||
await Promise.all(canvases.map(async (canvas) => { | ||
console.log(chalk.green('creating canvas for: ') + canvas); | ||
this.items.push(new Canvas_1.Canvas(canvas, this)); | ||
} | ||
})); | ||
// directories not starting with an underscore | ||
@@ -63,3 +58,3 @@ // these can be child manifests or child collections | ||
}); | ||
for (const directory of directories) { | ||
await Promise.all(directories.map(async (directory) => { | ||
console.log(chalk.green('creating directory for: ') + directory); | ||
@@ -71,3 +66,3 @@ const name = basename(directory); | ||
this.directories.push(newDirectory); | ||
} | ||
})); | ||
// if there are no canvas, manifest, or collection directories to read, | ||
@@ -132,3 +127,3 @@ // but there are paintable files in the current directory, | ||
// for each child directory, add a collectionitem or manifestitem json boilerplate to items. | ||
for (const directory of this.directories) { | ||
await Promise.all(this.directories.map(async (directory) => { | ||
let itemJson; | ||
@@ -145,3 +140,3 @@ if (directory.isCollection) { | ||
this.indexJson.items.push(itemJson); | ||
} | ||
})); | ||
// check for manifests.yml. if it exists, parse and add to items | ||
@@ -148,0 +143,0 @@ const hasManifestsYml = await Utils_1.Utils.hasManifestsYml(this.directoryPath); |
{ | ||
"name": "biiif", | ||
"version": "0.3.14", | ||
"version": "0.3.15", | ||
"description": "A CLI to build IIIF collections", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
54040
985