Skip to content

Commit

Permalink
Upgrade to pure ESM exports (#800)
Browse files Browse the repository at this point in the history
* Upgrade to pure ESM exports.
* Upgrade dependencies blocked on ESM.
  • Loading branch information
donmccurdy authored Jan 25, 2023
1 parent 950336a commit 482a718
Show file tree
Hide file tree
Showing 9 changed files with 336 additions and 190 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"@types/node-gzip": "1.1.0",
"@types/sharp": "^0.31.1",
"@types/tape": "4.13.2",
"@typescript-eslint/eslint-plugin": "5.48.2",
"@typescript-eslint/parser": "5.48.2",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.49.0",
"ava": "^5.1.1",
"c8": "^7.12.0",
"canvas": "2.11.0",
Expand All @@ -47,7 +47,7 @@
"gltf-validator": "2.0.0-dev.3.9",
"lerna": "6.4.1",
"meshoptimizer": "0.18.1",
"microbundle": "0.14.2",
"microbundle": "0.15.1",
"mikktspace": "1.1.1",
"prettier": "2.8.3",
"source-map-support": "0.5.21",
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@gltf-transform/core": "^3.0.0-alpha.4",
"@gltf-transform/extensions": "^3.0.0-alpha.4",
"@gltf-transform/functions": "^3.0.0-alpha.4",
"@types/inquirer": "^8.2.1",
"@types/inquirer": "^9.0.3",
"@types/language-tags": "^1.0.1",
"@types/micromatch": "^4.0.2",
"@types/node-fetch": "^2.6.2",
Expand All @@ -40,15 +40,15 @@
"csv-stringify": "^6.2.3",
"draco3dgltf": "^1.5.5",
"gltf-validator": "^2.0.0-dev.3.9",
"inquirer": "^8.2.2",
"inquirer": "^9.1.4",
"ktx-parse": "^0.4.5",
"language-tags": "^1.0.7",
"meshoptimizer": "^0.18.1",
"micromatch": "^4.0.5",
"mikktspace": "^1.1.1",
"node-fetch": "^2.6.6",
"node-fetch": "^3.3.0",
"node-gzip": "^1.1.2",
"p-limit": "3.1.0",
"p-limit": "4.0.0",
"semver": "^7.3.8",
"sharp": "^0.31.3",
"spdx-correct": "^3.1.1",
Expand Down
24 changes: 12 additions & 12 deletions packages/cli/src/transforms/xmp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Document, ILogger, Transform } from '@gltf-transform/core';
import { Packet, KHRXMP } from '@gltf-transform/extensions';
import inquirer from 'inquirer';
import inquirer, { Question, QuestionCollection } from 'inquirer';
import languageTags from 'language-tags';
import validateSPDX from 'spdx-correct';
import fs from 'fs/promises';
Expand Down Expand Up @@ -30,7 +30,7 @@ enum Prompt {
RIGHTS,
}

async function* generateQuestions(results: Record<string, unknown>): AsyncGenerator<inquirer.Question> {
async function* generateQuestions(results: Record<string, unknown>): AsyncGenerator<Question> {
let lang = (results['dc:language'] as string) || DEFAULT_LANG;

yield {
Expand All @@ -53,7 +53,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
new inquirer.Separator(),
{ value: Prompt.PREFERRED_SURFACE, name: 'Preferred surfaces (AR)' },
],
} as inquirer.Question;
} as Question;

const prompts = new Set<Prompt>(results._prompts as Prompt[]);

Expand All @@ -80,7 +80,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
suffix: ' (dc:creator)',
filter: (input: string) => createList([input]),
transformer: formatXMP,
} as inquirer.Question;
} as Question;
}

if (prompts.has(Prompt.TITLE)) {
Expand All @@ -91,7 +91,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
suffix: ' (dc:title)',
filter: (input: string) => createLanguageAlternative(input, lang),
transformer: formatXMP,
} as inquirer.Question;
} as Question;
}

if (prompts.has(Prompt.DESCRIPTION)) {
Expand All @@ -102,7 +102,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
suffix: ' (dc:description)',
filter: (input: string) => createLanguageAlternative(input, lang),
transformer: formatXMP,
} as inquirer.Question;
} as Question;
}

if (prompts.has(Prompt.RELATED)) {
Expand All @@ -113,7 +113,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
suffix: ' Comma-separated URLs. (dc:relation)',
filter: (input: string) => createList(input.split(/[,\n]/).map((url) => url.trim())),
transformer: formatXMP,
} as inquirer.Question;
} as Question;
}

if (prompts.has(Prompt.RIGHTS)) {
Expand Down Expand Up @@ -143,7 +143,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
},
{ value: 'OTHER', name: 'Other license' },
],
} as inquirer.Question;
} as Question;

if (results._rights === 'UNLICENSED') {
results['xmpRights:Marked'] = true;
Expand All @@ -155,7 +155,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
suffix: ' (xmpRights:Owner)',
filter: (input: string) => createList([input]),
transformer: formatXMP,
} as inquirer.Question;
} as Question;

yield {
type: 'input',
Expand Down Expand Up @@ -197,7 +197,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
suffix: ' (dc:rights)',
filter: (input: string) => createLanguageAlternative(input, lang),
transformer: formatXMP,
} as inquirer.Question;
} as Question;
}
}
}
Expand Down Expand Up @@ -245,7 +245,7 @@ async function* generateQuestions(results: Record<string, unknown>): AsyncGenera
],
filter: (input: string[]) => createList(input),
transformer: formatXMP,
} as inquirer.Question;
} as Question;
}
}

Expand Down Expand Up @@ -280,7 +280,7 @@ export const xmp = (_options: XMPOptions = XMP_DEFAULTS): Transform => {

try {
for await (const question of generateQuestions(results)) {
Object.assign(results, await inquirer.prompt(question as inquirer.QuestionCollection));
Object.assign(results, await inquirer.prompt(question as QuestionCollection));
}
} catch (e) {
checkTTY(e, logger);
Expand Down
7 changes: 3 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"license": "MIT",
"type": "module",
"sideEffects": false,
"main": "./dist/core.cjs",
"module": "./dist/core.modern.js",
"exports": "./dist/core.modern.js",
"source": "./src/core.ts",
Expand All @@ -19,9 +18,9 @@
"node >= 14"
],
"scripts": {
"dist": "microbundle --format modern,cjs --define PACKAGE_VERSION=$npm_package_version",
"watch": "microbundle watch --format modern,cjs --define PACKAGE_VERSION=$npm_package_version",
"watch:debug": "microbundle watch --no-compress --format modern,cjs --define PACKAGE_VERSION=$npm_package_version"
"dist": "microbundle --format modern --define PACKAGE_VERSION=$npm_package_version",
"watch": "microbundle watch --format modern --define PACKAGE_VERSION=$npm_package_version",
"watch:debug": "microbundle watch --format modern --define PACKAGE_VERSION=$npm_package_version --no-compress"
},
"keywords": [
"gltf",
Expand Down
7 changes: 3 additions & 4 deletions packages/extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"license": "MIT",
"type": "module",
"sideEffects": false,
"main": "./dist/extensions.cjs",
"module": "./dist/extensions.modern.js",
"exports": "./dist/extensions.modern.js",
"source": "./src/extensions.ts",
Expand All @@ -19,9 +18,9 @@
"node >= 14"
],
"scripts": {
"dist": "microbundle --format modern,cjs",
"watch": "microbundle watch --format modern,cjs",
"watch:debug": "microbundle watch --no-compress --format modern,cjs"
"dist": "microbundle --format modern",
"watch": "microbundle watch --format modern",
"watch:debug": "microbundle watch --format modern --no-compress"
},
"keywords": [
"gltf",
Expand Down
7 changes: 3 additions & 4 deletions packages/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"license": "MIT",
"type": "module",
"sideEffects": false,
"main": "./dist/functions.cjs",
"module": "./dist/functions.modern.js",
"exports": "./dist/functions.modern.js",
"source": "./src/index.ts",
Expand All @@ -19,9 +18,9 @@
"node >= 14"
],
"scripts": {
"dist": "microbundle --format modern,cjs",
"watch": "microbundle watch --format modern,cjs",
"watch:debug": "microbundle watch --no-compress --format modern,cjs"
"dist": "microbundle --format modern",
"watch": "microbundle watch --format modern",
"watch:debug": "microbundle watch --format modern --no-compress"
},
"keywords": [
"gltf",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"name": "@gltf-transform/test-utils",
"version": "3.0.0-alpha.4",
"type": "module",
"sideEffects": false,
"exports": "./dist/test-utils.modern.js",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"sideEffects": false,
"scripts": {
"dist": "microbundle --format modern --no-compress",
"watch": "microbundle watch --format modern --no-compress"
Expand Down
29 changes: 0 additions & 29 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,12 @@
"github>donmccurdy/renovate-config"
],
"packageRules": [
{
"description": "https://github.com/donmccurdy/glTF-Transform/pull/631",
"matchPackageNames": [
"microbundle"
],
"enabled": false
},
{
"description": "https://github.com/TypeStrong/typedoc/issues/1633",
"matchPackageNames": [
"typedoc"
],
"enabled": false
},
{
"description": "ESM: https://github.com/node-fetch/node-fetch/issues/1279",
"matchPackageNames": [
"node-fetch"
],
"enabled": false
},
{
"description": "ESM: https://github.com/sindresorhus/p-limit/issues/57",
"matchPackageNames": [
"p-limit"
],
"enabled": false
},
{
"description": "ESM: https://github.com/SBoudrias/Inquirer.js/issues/999",
"matchPackageNames": [
"inquirer",
"@types/inquirer"
],
"enabled": false
}
]
}
Loading

0 comments on commit 482a718

Please sign in to comment.