diff --git a/bin/build.js b/bin/build.js index 959eea4..6cc343a 100644 --- a/bin/build.js +++ b/bin/build.js @@ -45,10 +45,12 @@ function clean (groupNames) { fse.removeSync(path.join(npmPath, `${bundleName}.js`)) fse.removeSync(path.join(npmPath, `${bundleName}.mjs`)) fse.removeSync(path.join(npmPath, `${bundleName}.d.ts`)) + fse.removeSync(path.join(npmPath, `${bundleName}.d.mts`)) // Remove old npm jsx content fse.removeSync(path.join(npmJsxFolder, npmPath, `${bundleName}.js`)) fse.removeSync(path.join(npmJsxFolder, npmPath, `${bundleName}.mjs`)) fse.removeSync(path.join(npmJsxFolder, npmPath, `${bundleName}.d.ts`)) + fse.removeSync(path.join(npmJsxFolder, npmPath, `${bundleName}.d.mts`)) // Ensure npm folders exist (for icons it's '' which is falsy) if (npmPath) fse.mkdirsSync(npmPath) @@ -140,11 +142,13 @@ function buildIcons (groupName) { 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.dtsLiteral) + fse.writeFileSync(path.join(npmPath, `${bundleName}.d.mts`), icons.dtsLiteral) // Generate jsx and mjsx with types for icons and logos fse.writeFileSync(path.join(npmJsxFolder, npmPath, `${bundleName}.js`), icons.cjsx) fse.writeFileSync(path.join(npmJsxFolder, npmPath, `${bundleName}.mjs`), icons.esmx) fse.writeFileSync(path.join(npmJsxFolder, npmPath, `${bundleName}.d.ts`), icons.dtsx) + fse.writeFileSync(path.join(npmJsxFolder, npmPath, `${bundleName}.d.mts`), icons.dtsx) // Generate js/jsx artefacts for logo/large -files if (groupName === 'logo') { @@ -162,20 +166,24 @@ function buildIcons (groupName) { fse.removeSync(path.join(npmLargePath, `${largeBundleName}.js`)) fse.removeSync(path.join(npmLargePath, `${largeBundleName}.mjs`)) fse.removeSync(path.join(npmLargePath, `${largeBundleName}.d.ts`)) + fse.removeSync(path.join(npmLargePath, `${largeBundleName}.d.mts`)) // Remove old npm jsx content fse.removeSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.js`)) fse.removeSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.mjs`)) fse.removeSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.d.ts`)) + fse.removeSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.d.mts`)) // 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.dtsLiteral) + fse.writeFileSync(path.join(npmLargePath, `${largeBundleName}.d.mts`), largeIcons.dtsLiteral) // Generate jsx and mjsx with types for icons and logos fse.writeFileSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.js`), largeIcons.cjsx) fse.writeFileSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.mjs`), largeIcons.esmx) fse.writeFileSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.d.ts`), largeIcons.dtsx) + fse.writeFileSync(path.join(npmJsxFolder, npmLargePath, `${largeBundleName}.d.mts`), largeIcons.dtsx) } } catch (error) { console.error(`Failed to generate large js files for ${groupName} with error `, error) diff --git a/package.json b/package.json index 001aa09..e406334 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "./core-icons-iife.js", "./core-icons.js", "./core-icons.mjs", - "./core-icons.d.ts" + "./core-icons.d.ts", + "./core-icons.d.mts" ], "exports": { ".": { @@ -26,7 +27,7 @@ }, "import": { "default": "./core-icons.mjs", - "types": "./core-icons.d.ts" + "types": "./core-icons.d.mts" }, "browser": "./core-icons-iife.js" }, @@ -37,7 +38,7 @@ }, "import": { "default": "./logo/core-icons-logo.mjs", - "types": "./logo/core-icons-logo.d.ts" + "types": "./logo/core-icons-logo.d.mts" } }, "./logo/large": { @@ -47,7 +48,7 @@ }, "import": { "default": "./logo/large/core-icons-logo-large.mjs", - "types": "./logo/large/core-icons-logo-large.d.ts" + "types": "./logo/large/core-icons-logo-large.d.mts" } }, "./expressive": { @@ -57,7 +58,7 @@ }, "import": { "default": "./expressive/core-icons-expressive.mjs", - "types": "./expressive/core-icons-expressive.d.ts" + "types": "./expressive/core-icons-expressive.d.mts" } }, "./preview": { @@ -67,7 +68,7 @@ }, "import": { "default": "./preview/core-icons-preview.mjs", - "types": "./preview/core-icons-preview.d.ts" + "types": "./preview/core-icons-preview.d.mts" } }, "./jsx": { @@ -77,7 +78,7 @@ }, "import": { "default": "./jsx/core-icons.mjs", - "types": "./jsx/core-icons.d.ts" + "types": "./jsx/core-icons.d.mts" } }, "./jsx/logo": { @@ -87,7 +88,7 @@ }, "import": { "default": "./jsx/logo/core-icons-logo.mjs", - "types": "./jsx/logo/core-icons-logo.d.ts" + "types": "./jsx/logo/core-icons-logo.d.mts" } }, "./jsx/logo/large": { @@ -97,7 +98,7 @@ }, "import": { "default": "./jsx/logo/large/core-icons-logo-large.mjs", - "types": "./jsx/logo/large/core-icons-logo-large.d.ts" + "types": "./jsx/logo/large/core-icons-logo-large.d.mts" } }, "./jsx/expressive": { @@ -107,7 +108,7 @@ }, "import": { "default": "./jsx/expressive/core-icons-expressive.mjs", - "types": "./jsx/expressive/core-icons-expressive.d.ts" + "types": "./jsx/expressive/core-icons-expressive.d.mts" } }, "./jsx/preview": { @@ -117,7 +118,7 @@ }, "import": { "default": "./jsx/preview/core-icons-preview.mjs", - "types": "./jsx/preview/core-icons-preview.d.ts" + "types": "./jsx/preview/core-icons-preview.d.mts" } } },