Comparing version 0.1.5 to 0.1.6
@@ -6,6 +6,6 @@ "use strict"; | ||
const { join, basename } = require('path'); | ||
const { URL } = require('url'); | ||
const chalk = require('chalk'); | ||
const urljoin = require('url-join'); | ||
const yaml = require('js-yaml'); | ||
const { URL } = require('url'); | ||
const Canvas_1 = require("./Canvas"); | ||
@@ -100,2 +100,30 @@ const Utils_1 = require("./Utils"); | ||
}); | ||
// check for manifests.yml. if it exists, parse and add to members | ||
const manifestsPath = join(this.filePath, 'manifests.yml'); | ||
if (existsSync(manifestsPath)) { | ||
const manifestsYml = yaml.safeLoad(readFileSync(manifestsPath, 'utf8')); | ||
manifestsYml.manifests.forEach((manifest) => { | ||
const memberJson = Utils_1.Utils.cloneJson(collectionMemberBoilerplate); | ||
memberJson.id = manifest.id; | ||
if (manifest.label) { | ||
memberJson.label = manifest.label; | ||
} | ||
else { | ||
// no label supplied, use the last fragment of the url | ||
const url = new URL(memberJson.id); | ||
const pathname = url.pathname.split('/'); | ||
if (pathname.length > 1) { | ||
memberJson.label = pathname[pathname.length - 2]; | ||
} | ||
} | ||
if (manifest.thumbnail) { | ||
memberJson.thumbnail = manifest.thumbnail; | ||
} | ||
this.indexJson.members.push(memberJson); | ||
}); | ||
console.log(chalk.green('parsed manifests.yml for: ') + this.filePath); | ||
} | ||
else { | ||
console.log(chalk.green('no manifests.yml found for: ') + this.filePath); | ||
} | ||
} | ||
@@ -102,0 +130,0 @@ else { |
{ | ||
"name": "biiif", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A CLI to build IIIF collections", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,4 +23,6 @@ # biiif (build iiif) 👷✨📃 | ||
Note: This uses the [IIIF Presentation API v3](http://prezi3.iiif.io/api/presentation/3.0/) (currently in alpha), but is compatible with the [Universal Viewer](http://universalviewer.io) v3 (in development). | ||
Note: This uses the [IIIF Presentation API v3](http://prezi3.iiif.io/api/presentation/3.0/) (currently in alpha), but is compatible with the [Universal Viewer](http://universalviewer.io) v3 (in beta). | ||
If you want to build a website with biiif, try [uv-app-starter](https://github.com/UniversalViewer/uv-app-starter) which comes with the [Universal Viewer](http://universalviewer.io) and biiif already set up. | ||
## Conventions | ||
@@ -97,2 +99,1 @@ | ||
24142
472
98