From 4a32acde16512579f07990838a06b37f0b5cb47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torgeir=20Lorange=20=C3=98stby?= Date: Wed, 21 Aug 2024 12:13:47 +0200 Subject: [PATCH] Declare the icons "as const" instead of strings (#303) * Declare the icons as consts instead of strings, making them all unique. * chore: Update @nrk/svg-to-js to v3.1.0 * fix: Use dtsLiteral from svg-to-js instead of custom parser --------- Co-authored-by: Skjalg Teig --- bin/build.js | 4 ++-- package-lock.json | 17 +++++++++-------- package.json | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bin/build.js b/bin/build.js index 081012ca..959eea4a 100644 --- a/bin/build.js +++ b/bin/build.js @@ -139,7 +139,7 @@ function buildIcons (groupName) { // Generate js and mjs with types for icons and logos fse.writeFileSync(path.join(npmPath, `${bundleName}.js`), icons.cjs) fse.writeFileSync(path.join(npmPath, `${bundleName}.mjs`), icons.esm) - fse.writeFileSync(path.join(npmPath, `${bundleName}.d.ts`), icons.dts) + fse.writeFileSync(path.join(npmPath, `${bundleName}.d.ts`), icons.dtsLiteral) // Generate jsx and mjsx with types for icons and logos fse.writeFileSync(path.join(npmJsxFolder, npmPath, `${bundleName}.js`), icons.cjsx) @@ -170,7 +170,7 @@ function buildIcons (groupName) { // Generate js and mjs with types for icons and logos fse.writeFileSync(path.join(npmLargePath, `${largeBundleName}.js`), largeIcons.cjs) fse.writeFileSync(path.join(npmLargePath, `${largeBundleName}.mjs`), largeIcons.esm) - fse.writeFileSync(path.join(npmLargePath, `${largeBundleName}.d.ts`), largeIcons.dts) + fse.writeFileSync(path.join(npmLargePath, `${largeBundleName}.d.ts`), largeIcons.dtsLiteral) // Generate jsx and mjsx with types for icons and logos fse.writeFileSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.js`), largeIcons.cjsx) diff --git a/package-lock.json b/package-lock.json index 77a14140..fdbad0bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ }, "devDependencies": { "@arethetypeswrong/cli": "0.15.4", - "@nrk/svg-to-js": "3.0.1", + "@nrk/svg-to-js": "3.1.0", "@types/fs-extra": "11.0.4", "archiver": "6.0.1", "chokidar-cli": "3.0.0", @@ -280,10 +280,11 @@ } }, "node_modules/@nrk/svg-to-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@nrk/svg-to-js/-/svg-to-js-3.0.1.tgz", - "integrity": "sha512-HlIBPHpc2BUkNRf67rcx9S8k/gKe0R1o4328MsIeEltiDth1PHwmsM1SBE9v0CKg81GqSQHb0jdWxGjQ8RfSxg==", - "dev": true + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nrk/svg-to-js/-/svg-to-js-3.1.0.tgz", + "integrity": "sha512-mJCwu9kUkRvtnfzQzHwXdZZ0qJCo5hKeuXZLXjn5uw/q1ZCwNauhtUyo7cFOxNj2ZN7zKlG94xNlvv9Fl8N4+Q==", + "dev": true, + "license": "MIT" }, "node_modules/@sindresorhus/is": { "version": "4.6.0", @@ -6810,9 +6811,9 @@ } }, "@nrk/svg-to-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@nrk/svg-to-js/-/svg-to-js-3.0.1.tgz", - "integrity": "sha512-HlIBPHpc2BUkNRf67rcx9S8k/gKe0R1o4328MsIeEltiDth1PHwmsM1SBE9v0CKg81GqSQHb0jdWxGjQ8RfSxg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nrk/svg-to-js/-/svg-to-js-3.1.0.tgz", + "integrity": "sha512-mJCwu9kUkRvtnfzQzHwXdZZ0qJCo5hKeuXZLXjn5uw/q1ZCwNauhtUyo7cFOxNj2ZN7zKlG94xNlvv9Fl8N4+Q==", "dev": true }, "@sindresorhus/is": { diff --git a/package.json b/package.json index 212190be..d46bc15c 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ }, "devDependencies": { "@arethetypeswrong/cli": "0.15.4", - "@nrk/svg-to-js": "3.0.1", + "@nrk/svg-to-js": "3.1.0", "@types/fs-extra": "11.0.4", "archiver": "6.0.1", "chokidar-cli": "3.0.0",