Skip to content

PNPM, Vitest, tsup #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"sandboxes": ["new", "vanilla"],
"node": "16"
"node": "18"
}
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

33 changes: 0 additions & 33 deletions .eslintrc.json

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18', '20']

name: Node ${{ matrix.node }} build
steps:
- uses: actions/checkout@v1
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- uses: pnpm/action-setup@v3
with:
version: 8
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]

- run: pnpm run build
- run: pnpm run test
- run: pnpm run lint
- run: pnpm run typecheck
- run: node pkg-tests/node-load.cjs
- run: node pkg-tests/node-load.mjs
32 changes: 0 additions & 32 deletions .github/workflows/yarn.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .idea/fesk-ts.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/jsLibraryMappings.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
18
8 changes: 1 addition & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"fluid": false
"singleQuote": true
}
8 changes: 4 additions & 4 deletions __tests__/get-image-services.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { describe, expect, test } from 'vitest';

import { getImageServices } from '../src';

describe('getImageServices', () => {
test('It can work when a resource has no height/width', () => {
expect(
getImageServices({
id:
'https://api.bl.uk/image/iiif/ark:/81055/vdc_100113995491.0x000001/full/max/0/default.jpg',
id: 'https://api.bl.uk/image/iiif/ark:/81055/vdc_100113995491.0x000001/full/max/0/default.jpg',
type: 'Image',
format: 'image/jpg',
service: [
@@ -19,8 +20,7 @@ describe('getImageServices', () => {
width: 256,
},
],
id:
'https://api.bl.uk/image/iiif/ark:/81055/vdc_100113995491.0x000001',
id: 'https://api.bl.uk/image/iiif/ark:/81055/vdc_100113995491.0x000001',
type: 'ImageService2',
profile: 'level2',
},
109 changes: 55 additions & 54 deletions __tests__/image-service-loader.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest';
import { ImageServiceLoader } from '../src/image-service-loader';
import { Service } from '../src/types';
import { ImageService } from '@iiif/presentation-3';
@@ -105,8 +106,8 @@ describe('image service loader', () => {

expect(Object.keys(loader.knownImageServers)).toEqual(['damsssl.llgc.org.uk']);

expect(loader.knownImageServers['damsssl.llgc.org.uk'].verified).toEqual(false);
expect(loader.knownImageServers['damsssl.llgc.org.uk'].sampledId).toEqual(
expect(loader.knownImageServers['damsssl.llgc.org.uk']!.verified).toEqual(false);
expect(loader.knownImageServers['damsssl.llgc.org.uk']!.sampledId).toEqual(
'https://damsssl.llgc.org.uk/iiif/2.0/image/4694557'
);
});
@@ -136,7 +137,7 @@ describe('image service loader', () => {
).not.toEqual(null);

expect(Object.keys(loader.knownImageServers)).toEqual(['damsssl.llgc.org.uk']);
expect(loader.knownImageServers['damsssl.llgc.org.uk'].verified).toEqual(true);
expect(loader.knownImageServers['damsssl.llgc.org.uk']!.verified).toEqual(true);
});

test('it wont predict if there is not enough verifications', async () => {
@@ -169,7 +170,7 @@ describe('image service loader', () => {
})
).not.toEqual(null);

expect(loader.knownImageServers['damsssl.llgc.org.uk'].verifications).toEqual(1);
expect(loader.knownImageServers['damsssl.llgc.org.uk']!.verifications).toEqual(1);
});
});

@@ -332,53 +333,53 @@ describe('image service loader', () => {
expect(image3Prediction.sizes).toEqual(image3.sizes);

expect(Object.keys(loader.knownImageServers)).toEqual(['iiif.bodleian.ox.ac.uk']);
expect(loader.knownImageServers['iiif.bodleian.ox.ac.uk'].verified).toEqual(true);
expect(loader.knownImageServers['iiif.bodleian.ox.ac.uk']!.verified).toEqual(true);
});
});

describe('sbb', () => {
const sbbInfo = {
'@context': 'http://iiif.io/api/image/2/context.json',
'@id': 'https://iiif-content.crossasia.org/xasia/dllm+dllm_0005978+233695',
'@type': 'iiif:Image',
protocol: 'http://iiif.io/api/image',
width: 1741,
height: 2381,
sizes: [
{ width: 150, height: 100 },
{
width: 600,
height: 400,
},
{ width: 2400, height: 4000 },
{ width: 1722, height: 2304 },
],
tiles: [
{ width: 256, scaleFactors: [1] },
{
width: 512,
scaleFactors: [2, 4],
},
{ width: 1024, scaleFactors: [8, 16] },
],
logo: {
'@id': 'https://iiif-content.crossasia.org/xasia/logo',
service: {
'@context': 'http://iiif.io/api/image/2/context.json',
'@id': 'https://iiif-content.crossasia.org/xasia/logo',
profile: 'http://iiif.io/api/image/2/level2.json',
},
},
profile: [
'http://iiif.io/api/image/2/level2.json',
{
formats: ['jpg', 'png', 'webp', 'tif'],
qualities: ['color', 'gray'],
supports: ['canonicalLinkHeader', 'rotationArbitrary', 'profileLinkHeader'],
},
],
};
});
// describe('sbb', () => {
// const sbbInfo = {
// '@context': 'http://iiif.io/api/image/2/context.json',
// '@id': 'https://iiif-content.crossasia.org/xasia/dllm+dllm_0005978+233695',
// '@type': 'iiif:Image',
// protocol: 'http://iiif.io/api/image',
// width: 1741,
// height: 2381,
// sizes: [
// { width: 150, height: 100 },
// {
// width: 600,
// height: 400,
// },
// { width: 2400, height: 4000 },
// { width: 1722, height: 2304 },
// ],
// tiles: [
// { width: 256, scaleFactors: [1] },
// {
// width: 512,
// scaleFactors: [2, 4],
// },
// { width: 1024, scaleFactors: [8, 16] },
// ],
// logo: {
// '@id': 'https://iiif-content.crossasia.org/xasia/logo',
// service: {
// '@context': 'http://iiif.io/api/image/2/context.json',
// '@id': 'https://iiif-content.crossasia.org/xasia/logo',
// profile: 'http://iiif.io/api/image/2/level2.json',
// },
// },
// profile: [
// 'http://iiif.io/api/image/2/level2.json',
// {
// formats: ['jpg', 'png', 'webp', 'tif'],
// qualities: ['color', 'gray'],
// supports: ['canonicalLinkHeader', 'rotationArbitrary', 'profileLinkHeader'],
// },
// ],
// };
// });

describe('getty quire example (level0)', () => {
const infoA = {
@@ -452,13 +453,13 @@ describe('image service loader', () => {
await loader.sample(infoB as any);
// await loader.sample();

const prediection = loader.predict({
const prediction = loader.predict({
id: infoC['@id'],
width: infoC.width as number,
height: infoC.height as number,
}) as Service;

expect(prediection).toEqual(null);
expect(prediction).toEqual(null);
});
test('C -> B -> A', async () => {
const loader = new ImageServiceLoader({ approximateServices: true });
@@ -468,13 +469,13 @@ describe('image service loader', () => {
await loader.sample(infoB as any);
// await loader.sample();

const prediection = loader.predict({
const prediction = loader.predict({
id: infoA['@id'],
width: infoA.width as number,
height: infoA.height as number,
}) as Service;

expect(prediection).toEqual(null);
expect(prediction).toEqual(null);
});
test('A -> C -> B', async () => {
const loader = new ImageServiceLoader({ approximateServices: true });
@@ -484,13 +485,13 @@ describe('image service loader', () => {
await loader.sample(infoC as any);
// await loader.sample();

const prediection = loader.predict({
const prediction = loader.predict({
id: infoB['@id'],
width: infoB.width as number,
height: infoB.height as number,
}) as Service;

expect(prediection).toEqual(null);
expect(prediction).toEqual(null);
});
});
});
Loading