From d9a1e3fe4afb2b566201af5a2f10ba1e24dab2e7 Mon Sep 17 00:00:00 2001 From: Stephen Fraser Date: Wed, 31 Jan 2024 11:01:21 +0000 Subject: [PATCH 1/2] Updated to `@iiif/helpers` and `@iiif/parser` v2 --- __tests__/canvas-builder.tests.ts | 115 ++++++++++++++++++ __tests__/collection-builder.tests.ts | 6 + package.json | 7 +- rollup.config.js | 4 +- src/annotation-page-builder.ts | 3 +- src/base-entity-builder.ts | 17 +-- src/canvas-builder.ts | 4 +- src/collection-builder.ts | 2 +- src/iiif-builder.ts | 7 +- src/manifest-builder.ts | 2 +- yarn.lock | 163 ++++++++++---------------- 11 files changed, 206 insertions(+), 124 deletions(-) diff --git a/__tests__/canvas-builder.tests.ts b/__tests__/canvas-builder.tests.ts index 0c80c65..4c447ac 100644 --- a/__tests__/canvas-builder.tests.ts +++ b/__tests__/canvas-builder.tests.ts @@ -1,5 +1,6 @@ import { IIIFBuilder } from '../src'; import { ContentResource } from '@iiif/presentation-3'; +import { AnnotationNormalized } from '@iiif/presentation-3-normalized'; describe('Canvas builder', () => { test('Ensure array works as expected', () => { @@ -184,4 +185,118 @@ describe('Canvas builder', () => { } `); }); + + test('Canvas with annotation page', () => { + const builder = new IIIFBuilder(); + const manifest = builder.createManifest( + 'https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/manifest.json', + (manifest) => { + manifest.addLabel('John Dee performing an experiment before Queen Elizabeth I.', 'en'); + manifest.createCanvas('https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/canvas/p1', (canvas) => { + canvas.height = 1271; + canvas.width = 2000; + + canvas.createAnnotation( + 'https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/annotation/p0001-image', + { + id: 'https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/annotation/p0001-image', + type: 'Annotation', + motivation: 'painting', + body: { + id: 'https://iiif.io/api/image/3.0/example/reference/421e65be2ce95439b3ad6ef1f2ab87a9-dee-natural/full/max/0/default.jpg', + type: 'Image', + format: 'image/jpeg', + width: 2000, + height: 1271, + label: { + en: ['Natural Light'], + }, + } as ContentResource, + } + ); + + canvas.createAnnotationPage( + 'https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/canvas/p1/annotations', + (annoPage) => { + annoPage.createAnnotation({ + id: `${canvas.id}/annopage-2/anno-0`, + type: 'Annotation', + motivation: 'commenting', + body: { + type: 'TextualBody', + format: 'text/html', + value: '

Testing an annotation

', + }, + target: canvas.id, + }); + } + ); + }); + } + ); + + expect(builder.toPresentation3(manifest)).toMatchInlineSnapshot(` + { + "@context": "http://iiif.io/api/presentation/3/context.json", + "id": "https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/manifest.json", + "items": [ + { + "height": 1271, + "id": "https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/canvas/p1", + "items": [ + { + "id": "https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/canvas/p1/annotation-page", + "items": [ + { + "body": { + "format": "image/jpeg", + "height": 1271, + "id": "https://iiif.io/api/image/3.0/example/reference/421e65be2ce95439b3ad6ef1f2ab87a9-dee-natural/full/max/0/default.jpg", + "label": { + "en": [ + "Natural Light", + ], + }, + "type": "Image", + "width": 2000, + }, + "id": "https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/annotation/p0001-image", + "motivation": "painting", + "target": "https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/canvas/p1", + "type": "Annotation", + }, + ], + "type": "AnnotationPage", + }, + { + "id": "https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/canvas/p1/annotations", + "items": [ + { + "body": { + "format": "text/html", + "type": "TextualBody", + "value": "

Testing an annotation

", + }, + "id": "https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/canvas/p1/annopage-2/anno-0", + "motivation": "commenting", + "target": "https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/canvas/p1", + "type": "Annotation", + }, + ], + "type": "AnnotationPage", + }, + ], + "type": "Canvas", + "width": 2000, + }, + ], + "label": { + "en": [ + "John Dee performing an experiment before Queen Elizabeth I.", + ], + }, + "type": "Manifest", + } + `); + }); }); diff --git a/__tests__/collection-builder.tests.ts b/__tests__/collection-builder.tests.ts index a099215..2e50703 100644 --- a/__tests__/collection-builder.tests.ts +++ b/__tests__/collection-builder.tests.ts @@ -78,6 +78,7 @@ describe('Collection builder', () => { collection.addSummary(summary, 'none'); collection.setHomepage({ id: homepage, + type: 'Text', }); items.forEach((item) => { collection.createCollection(item.id, (manifest) => { @@ -85,9 +86,11 @@ describe('Collection builder', () => { manifest.addSummary(item.summary, 'none'); manifest.setHomepage({ id: homepage, + type: 'Text', }); manifest.addThumbnail({ id: 'http://localhost:5001/...', + type: 'Image', }); }); }); @@ -99,6 +102,7 @@ describe('Collection builder', () => { "homepage": [ { "id": "https://example.org/homepage", + "type": "Text", }, ], "id": "https://example.org/collection-1", @@ -118,6 +122,7 @@ describe('Collection builder', () => { "thumbnail": [ { "id": "http://localhost:5001/...", + "type": "Image", }, ], "type": "Collection", @@ -137,6 +142,7 @@ describe('Collection builder', () => { "thumbnail": [ { "id": "http://localhost:5001/...", + "type": "Image", }, ], "type": "Collection", diff --git a/package.json b/package.json index 7ee1987..a676d99 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,10 @@ "test": "jest" }, "dependencies": { - "@iiif/parser": "1.x", - "@iiif/presentation-3": "1.x", - "@iiif/vault": "0.9.x || 1.x" + "@iiif/parser": "^2.0.1", + "@iiif/presentation-3": "^2.1.3", + "@iiif/presentation-3-normalized": "^0.9.7", + "@iiif/helpers": "^1.0.4" }, "devDependencies": { "@types/jest": "^27.4.0", diff --git a/rollup.config.js b/rollup.config.js index dbd0e46..b1b4b52 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -8,8 +8,8 @@ const baseConfig = { }, }; -const external = ['@iiif/vault', '@iiif/vault/actions']; -const bundled = ['@iiif/parser']; +const external = ['@iiif/helpers/vault']; +const bundled = ['@iiif/parser', '@iiif/helpers/vault/actions']; const nodeExternal = []; // Roll up configs diff --git a/src/annotation-page-builder.ts b/src/annotation-page-builder.ts index 08e44e0..690ae27 100644 --- a/src/annotation-page-builder.ts +++ b/src/annotation-page-builder.ts @@ -1,4 +1,5 @@ -import { Annotation, AnnotationPageNormalized, ChoiceBody } from '@iiif/presentation-3'; +import { Annotation } from '@iiif/presentation-3'; +import { AnnotationPageNormalized } from '@iiif/presentation-3-normalized'; import { IIIFBuilder } from './iiif-builder'; import { BaseEntityBuilder } from './base-entity-builder'; diff --git a/src/base-entity-builder.ts b/src/base-entity-builder.ts index 11c7d3f..76ae0c8 100644 --- a/src/base-entity-builder.ts +++ b/src/base-entity-builder.ts @@ -1,18 +1,21 @@ import { - CanvasNormalized, - CollectionNormalized, MetadataItem, - ManifestNormalized, InternationalString, ContentResource, Reference, ViewingDirection, CollectionItemSchemas, - AnnotationPageNormalized, AnnotationPage, Annotation, + SpecificResource, } from '@iiif/presentation-3'; -import { ServiceNormalized } from '@iiif/presentation-3/resources/service'; +import { + CanvasNormalized, + CollectionNormalized, + ManifestNormalized, + AnnotationPageNormalized, + ServiceNormalized, +} from '@iiif/presentation-3-normalized'; import { IIIFBuilder } from './iiif-builder'; import { normalize } from '@iiif/parser'; @@ -396,11 +399,11 @@ export class BaseEntityBuilder< } // ✅ start - set start(start: Reference<'Canvas' | 'Selector'>) { + set start(start: SpecificResource> | null) { this.setStart(start); } - setStart(start: Reference<'Canvas' | 'Selector'>) { + setStart(start: SpecificResource> | null) { if (this.isManifest(this.entity)) { this.entity.start = start; } diff --git a/src/canvas-builder.ts b/src/canvas-builder.ts index 6826bbd..273e5ca 100644 --- a/src/canvas-builder.ts +++ b/src/canvas-builder.ts @@ -1,5 +1,5 @@ -import { Annotation, CanvasNormalized } from '@iiif/presentation-3'; - +import { Annotation } from '@iiif/presentation-3'; +import { CanvasNormalized } from '@iiif/presentation-3-normalized'; import { AnnotationPageInstanceBuilder } from './annotation-page-builder'; import { BaseEntityBuilder } from './base-entity-builder'; import { IIIFBuilder } from './iiif-builder'; diff --git a/src/collection-builder.ts b/src/collection-builder.ts index 29ed24b..e720c68 100644 --- a/src/collection-builder.ts +++ b/src/collection-builder.ts @@ -1,4 +1,4 @@ -import { CollectionNormalized } from '@iiif/presentation-3'; +import { CollectionNormalized } from '@iiif/presentation-3-normalized'; import { IIIFBuilder } from './iiif-builder'; import { BaseEntityBuilder } from './base-entity-builder'; import { emptyCollection, emptyManifest } from '@iiif/parser'; diff --git a/src/iiif-builder.ts b/src/iiif-builder.ts index 41661df..6c71b36 100644 --- a/src/iiif-builder.ts +++ b/src/iiif-builder.ts @@ -1,7 +1,8 @@ import { emptyCollection, emptyManifest } from '@iiif/parser'; -import { entityActions, mappingActions } from '@iiif/vault/actions'; -import { Reference, ManifestNormalized, CollectionNormalized } from '@iiif/presentation-3'; -import { Vault } from '@iiif/vault'; +import { entityActions, mappingActions } from '@iiif/helpers/vault/actions'; +import { Reference } from '@iiif/presentation-3'; +import { ManifestNormalized, CollectionNormalized } from '@iiif/presentation-3-normalized'; +import { Vault } from '@iiif/helpers/vault'; import { BaseEntityBuilder } from './base-entity-builder'; import { ManifestInstanceBuilder } from './manifest-builder'; import { CollectionInstanceBuilder } from './collection-builder'; diff --git a/src/manifest-builder.ts b/src/manifest-builder.ts index e68fe50..e03c12e 100644 --- a/src/manifest-builder.ts +++ b/src/manifest-builder.ts @@ -1,5 +1,5 @@ import { emptyCanvas } from '@iiif/parser'; -import { CanvasNormalized, ManifestNormalized } from '@iiif/presentation-3'; +import { CanvasNormalized, ManifestNormalized } from '@iiif/presentation-3-normalized'; import { IIIFBuilder } from './iiif-builder'; import { BaseEntityBuilder } from './base-entity-builder'; import { CanvasInstanceBuilder } from './canvas-builder'; diff --git a/yarn.lock b/yarn.lock index de60c6f..4937c1d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -409,13 +409,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.16.7" -"@babel/runtime@^7.9.2": - version "7.17.9" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.9.tgz#d19fbf802d01a8cb6cf053a64e472d42c434ba72" - integrity sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg== - dependencies: - regenerator-runtime "^0.13.4" - "@babel/template@^7.16.7", "@babel/template@^7.3.3": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" @@ -543,40 +536,48 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@iiif/parser@1.*", "@iiif/parser@1.x": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@iiif/parser/-/parser-1.0.7.tgz#9ffdea2573ec9f1ca40158bd5cd10297dda7df29" - integrity sha512-AW1922SlL5svf28OowndP9rurM/bKf05AvQw3FnAfIOsh9xNY9UKrkvE8bxToPu3RoC3DozHfHgcvf0UtBaM/Q== +"@iiif/helpers@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@iiif/helpers/-/helpers-1.0.4.tgz#8c54fdcab5821eb1b8c0066fa31ccf093bd20456" + integrity sha512-TNUit742imTCBg+UJWKwRJDye+YaDwYw0Npt75jtug7eM6/Lcu+1UfRwDbvmDVezjc3UZQW4sOzQUvU8w7FDjw== dependencies: - "@iiif/presentation-2" "^1.0.1" - "@iiif/presentation-3" "^1.0.4" - "@types/geojson" "^7946.0.8" + "@iiif/presentation-2" "1.0.4" + "@iiif/presentation-3" "2.1.3" + "@iiif/presentation-3-normalized" "0.9.7" + "@types/geojson" "7946.0.13" + optionalDependencies: + abs-svg-path "^0.1.1" + parse-svg-path "^0.1.2" + svg-arc-to-cubic-bezier "^3.2.0" -"@iiif/presentation-2@1.*", "@iiif/presentation-2@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@iiif/presentation-2/-/presentation-2-1.0.1.tgz#0d76fedfeac65b31afcc30d9a8dc17f2e57041e4" - integrity sha512-iWF6rgAi9ksSwbH/4uJW1/49DOL1wN2mLKovu0qy1GYtCTg42bryAxYtnBsw6LrJZWykTStv7R3DynChfECmnA== +"@iiif/parser@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@iiif/parser/-/parser-2.0.1.tgz#2140adb92b5b27db3c70104b069e20bc8cbdcb84" + integrity sha512-RnHzBnYiI49I+cV9uxkhvUBqNSqj90pX+0hRRZgQ51EO0Sww7l1G44e6pg66PFxiDsIRXrkk34I63fYB9L1VrA== + dependencies: + "@iiif/presentation-2" "^1.0.4" + "@iiif/presentation-3" "^2.1.3" + "@iiif/presentation-3-normalized" "^0.9.7" + "@types/geojson" "^7946.0.10" -"@iiif/presentation-3@1.*", "@iiif/presentation-3@1.x", "@iiif/presentation-3@^1.0.4": +"@iiif/presentation-2@1.0.4", "@iiif/presentation-2@^1.0.4": version "1.0.4" - resolved "https://registry.yarnpkg.com/@iiif/presentation-3/-/presentation-3-1.0.4.tgz#9433c38c6a26e95ef94d1f9e0232962398611d70" - integrity sha512-L5fPMyNAZ3UaDOR7D4mcv9Z1YJIqx9/nI9kaNcq3azLB4lp5w7cv7O1her3gjIPSH/mLCOuUG5KTBOfE/SgXUg== + resolved "https://registry.yarnpkg.com/@iiif/presentation-2/-/presentation-2-1.0.4.tgz#1664aee995462fdf66ec8dfbae54fc22b4f79c97" + integrity sha512-hJakpq62VBajesLJrYPtFm6hcn6c/HkKP7CmKZ5atuzu40m0nifWYsqigR1l9sZGvhhHb/DRshPmiW/0GNrJoA== + +"@iiif/presentation-3-normalized@0.9.7", "@iiif/presentation-3-normalized@^0.9.7": + version "0.9.7" + resolved "https://registry.yarnpkg.com/@iiif/presentation-3-normalized/-/presentation-3-normalized-0.9.7.tgz#19386234e07c91c996d15ac5e1d86d1e1882e128" + integrity sha512-Aqk0sYBFIH5W3wmVxW02tnAFbNzUU5oPygGQjvszB3PP2nSkFQ1skVjqJhQPPZTyi/de1qcJUrgSy0vp6s+c5A== dependencies: - "@types/geojson" "^7946.0.7" + "@iiif/presentation-3" "^2.0.5" -"@iiif/vault@0.9.x || 1.x": - version "0.9.18" - resolved "https://registry.yarnpkg.com/@iiif/vault/-/vault-0.9.18.tgz#07d6a90411f45a764635c95908b5b67c873a8384" - integrity sha512-714/6X5ZyIuiDGeElUZx1mm8nKFabtxORzfMX7MZyc4IAtASjn1HK68xfTtyolN2cFYDhqFiY3Tz08F7HNIKGQ== +"@iiif/presentation-3@2.1.3", "@iiif/presentation-3@^2.0.5", "@iiif/presentation-3@^2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@iiif/presentation-3/-/presentation-3-2.1.3.tgz#745cf3ec1f8d828b1e3aba88c3f15e6dc8e80710" + integrity sha512-0V9LL+UPGknn4vdEJuJnuK0BsOL93dmr4PrdXg9fSE9HUq/2P0jkp4yGJR13f7N9OpmcRsEQjqWqVceWHB8Bow== dependencies: - "@iiif/parser" "1.*" - "@iiif/presentation-2" "1.*" - "@iiif/presentation-3" "1.*" - mitt "^3.0.0" - node-fetch "^3.1.1" - redux "^4.1.2" - tiny-invariant "^1.2.0" - typesafe-actions "^5.1.0" + "@types/geojson" "^7946.0.10" "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" @@ -968,10 +969,15 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== -"@types/geojson@^7946.0.7", "@types/geojson@^7946.0.8": - version "7946.0.8" - resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.8.tgz#30744afdb385e2945e22f3b033f897f76b1f12ca" - integrity sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA== +"@types/geojson@7946.0.13": + version "7946.0.13" + resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.13.tgz#e6e77ea9ecf36564980a861e24e62a095988775e" + integrity sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ== + +"@types/geojson@^7946.0.10": + version "7946.0.14" + resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.14.tgz#319b63ad6df705ee2a65a73ef042c8271e696613" + integrity sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg== "@types/graceful-fs@^4.1.3": version "4.1.5" @@ -1126,6 +1132,11 @@ "@typescript-eslint/types" "5.12.0" eslint-visitor-keys "^3.0.0" +abs-svg-path@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/abs-svg-path/-/abs-svg-path-0.1.1.tgz#df601c8e8d2ba10d4a76d625e236a9a39c2723bf" + integrity sha512-d8XPSGjfyzlXC3Xx891DJRyZfqk5JU0BJrDQcsWomFIV1/BIzPW5HDH5iDdWpqWaav0YVIEzT1RHTwWr0FFshA== + acorn-jsx@^5.3.1: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -1458,11 +1469,6 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -data-uri-to-buffer@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b" - integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA== - debug@^4.1.0, debug@^4.1.1: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -1916,14 +1922,6 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -fetch-blob@^3.1.2, fetch-blob@^3.1.4: - version "3.1.5" - resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.1.5.tgz#0077bf5f3fcdbd9d75a0b5362f77dbb743489863" - integrity sha512-N64ZpKqoLejlrwkIAnb9iLSA3Vx/kjgzpcDhygcqJ2KKjky8nCgUQ+dzXtbrLaWZGZNmNfQTsiQ0weZ1svglHg== - dependencies: - node-domexception "^1.0.0" - web-streams-polyfill "^3.0.3" - file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" @@ -1964,13 +1962,6 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== -formdata-polyfill@^4.0.10: - version "4.0.10" - resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" - integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== - dependencies: - fetch-blob "^3.1.2" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -2779,11 +2770,6 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -mitt@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.0.tgz#69ef9bd5c80ff6f57473e8d89326d01c414be0bd" - integrity sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ== - module-details-from-path@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/module-details-from-path/-/module-details-from-path-1.0.3.tgz#114c949673e2a8a35e9d35788527aa37b679da2b" @@ -2799,20 +2785,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -node-domexception@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" - integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== - -node-fetch@^3.1.1: - version "3.2.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.2.3.tgz#a03c9cc2044d21d1a021566bd52f080f333719a6" - integrity sha512-AXP18u4pidSZ1xYXRDPY/8jdv3RAozIt/WLNR/MBGZAz+xjtlr90RvCnsvHQRiXyWliZF/CpytExp32UU67/SA== - dependencies: - data-uri-to-buffer "^4.0.0" - fetch-blob "^3.1.4" - formdata-polyfill "^4.0.10" - node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -2909,6 +2881,11 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +parse-svg-path@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/parse-svg-path/-/parse-svg-path-0.1.2.tgz#7a7ec0d1eb06fa5325c7d3e009b859a09b5d49eb" + integrity sha512-JyPSBnkTJ0AI8GGJLfMXvKq42cj5c006fnLz6fXy6zfoVjJizi8BNTpu8on8ziI1cKy9d9DGNuY17Ce7wuejpQ== + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -3019,18 +2996,6 @@ react-is@^18.0.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== -redux@^4.1.2: - version "4.2.0" - resolved "https://registry.yarnpkg.com/redux/-/redux-4.2.0.tgz#46f10d6e29b6666df758780437651eeb2b969f13" - integrity sha512-oSBmcKKIuIR4ME29/AeNUnl5L+hvBq7OaJWzaptTQJAntaPvxIJqfnjbaEiCzzaIz+XmVILfqAM3Ob0aXLPfjA== - dependencies: - "@babel/runtime" "^7.9.2" - -regenerator-runtime@^0.13.4: - version "0.13.9" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" - integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== - regexpp@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" @@ -3312,6 +3277,11 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +svg-arc-to-cubic-bezier@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/svg-arc-to-cubic-bezier/-/svg-arc-to-cubic-bezier-3.2.0.tgz#390c450035ae1c4a0104d90650304c3bc814abe6" + integrity sha512-djbJ/vZKZO+gPoSDThGNpKDO+o+bAeA4XQKovvkNCqnIS2t+S4qnLAGQhyyrulhCFRl1WWzAp0wUDV8PpTVU3g== + test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -3326,11 +3296,6 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -tiny-invariant@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.2.0.tgz#a1141f86b672a9148c72e978a19a73b9b94a15a9" - integrity sha512-1Uhn/aqw5C6RI4KejVeTg6mIS7IqxnLJ8Mv2tV5rTc0qWobay7pDUz6Wi392Cnc8ak1H0F2cjoRzb2/AW4+Fvg== - tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -3396,11 +3361,6 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -typesafe-actions@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/typesafe-actions/-/typesafe-actions-5.1.0.tgz#9afe8b1e6a323af1fd59e6a57b11b7dd6623d2f1" - integrity sha512-bna6Yi1pRznoo6Bz1cE6btB/Yy8Xywytyfrzu/wc+NFW3ZF0I+2iCGImhBsoYYCOWuICtRO4yHcnDlzgo1AdNg== - typescript@^4.5.4: version "4.5.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" @@ -3473,11 +3433,6 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" -web-streams-polyfill@^3.0.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" - integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== - which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" From 58a3c7aba44b9acd5f268b170434c3b6bf0f8557 Mon Sep 17 00:00:00 2001 From: Stephen Fraser Date: Mon, 12 Feb 2024 12:13:11 +0000 Subject: [PATCH 2/2] Updated depenedncies + release script --- .github/workflows/build-test.yml | 6 +-- .github/workflows/release.yml | 65 ++++++++++++++++++++++++++++++++ package.json | 4 +- yarn.lock | 16 ++++---- 4 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 98a4226..3a49694 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -2,16 +2,16 @@ name: Yarn build + test on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: runs-on: ubuntu-latest strategy: matrix: - node: [ '16', '14' ] + node: ['18', '20'] name: Node ${{ matrix.node }} build steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6817834 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +name: Release NPM package + +on: + push: + tags: ['v*'] + +jobs: + build: + runs-on: ubuntu-latest + name: Node build + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: '18.x' + + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn + + - run: yarn install --frozen-lockfile --non-interactive + + - run: yarn run build + + - run: yarn run test + + release: + needs: [build] + runs-on: ubuntu-latest + name: Release + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: '18.x' + + - name: Set tag + id: tagName + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn + + - run: yarn install --frozen-lockfile --non-interactive + + - uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index a676d99..97b8a10 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,10 @@ "test": "jest" }, "dependencies": { - "@iiif/parser": "^2.0.1", + "@iiif/parser": "^2.0.2", "@iiif/presentation-3": "^2.1.3", "@iiif/presentation-3-normalized": "^0.9.7", - "@iiif/helpers": "^1.0.4" + "@iiif/helpers": "^1.0.5" }, "devDependencies": { "@types/jest": "^27.4.0", diff --git a/yarn.lock b/yarn.lock index 4937c1d..c7b5e13 100644 --- a/yarn.lock +++ b/yarn.lock @@ -536,10 +536,10 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@iiif/helpers@^1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@iiif/helpers/-/helpers-1.0.4.tgz#8c54fdcab5821eb1b8c0066fa31ccf093bd20456" - integrity sha512-TNUit742imTCBg+UJWKwRJDye+YaDwYw0Npt75jtug7eM6/Lcu+1UfRwDbvmDVezjc3UZQW4sOzQUvU8w7FDjw== +"@iiif/helpers@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@iiif/helpers/-/helpers-1.0.5.tgz#266c1351f3a736d440d26bd4e45e644dc96e5d45" + integrity sha512-YaRtJdacwPXs7K+TT1Go7SMhbRS33SIEYutVJMN5bZ1z4Gx4t67nzKWrngCh7bbn+qMBfOjv2zhSssIbyvqi+g== dependencies: "@iiif/presentation-2" "1.0.4" "@iiif/presentation-3" "2.1.3" @@ -550,10 +550,10 @@ parse-svg-path "^0.1.2" svg-arc-to-cubic-bezier "^3.2.0" -"@iiif/parser@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@iiif/parser/-/parser-2.0.1.tgz#2140adb92b5b27db3c70104b069e20bc8cbdcb84" - integrity sha512-RnHzBnYiI49I+cV9uxkhvUBqNSqj90pX+0hRRZgQ51EO0Sww7l1G44e6pg66PFxiDsIRXrkk34I63fYB9L1VrA== +"@iiif/parser@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@iiif/parser/-/parser-2.0.2.tgz#0bd054429d635b197c7875cc45ad173658b7b834" + integrity sha512-ffqki1eJVVbWp1A+ulRgiojeCJH8eGyRIrAkyT60tHNXBWfYlkLTadFjFfyHlwWavT5BFI4nZtFTrwQXDtylQA== dependencies: "@iiif/presentation-2" "^1.0.4" "@iiif/presentation-3" "^2.1.3"