Skip to content

Commit

Permalink
chore: remove duplicate types file and references
Browse files Browse the repository at this point in the history
  • Loading branch information
skjalgepalg committed Oct 10, 2023
1 parent 3e4cb00 commit 0db018c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 36 deletions.
8 changes: 0 additions & 8 deletions bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ 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)
Expand Down Expand Up @@ -142,13 +140,11 @@ 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.dts)
fse.writeFileSync(path.join(npmPath, `${bundleName}.d.mts`), icons.dts)

// 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') {
Expand All @@ -166,24 +162,20 @@ 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.dts)
fse.writeFileSync(path.join(npmLargePath, `${largeBundleName}.d.mts`), largeIcons.dts)

// 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)
Expand Down
50 changes: 22 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,59 @@
"./core-icons-iife.js",
"./core-icons.js",
"./core-icons.mjs",
"./core-icons.d.ts",
"./core-icons.d.mts"
"./core-icons.d.ts"
],
"exports": {
".": {
"import": {
"types": "./core-icons.d.mts",
"default": "./core-icons.mjs"
},
"require": {
"types": "./core-icons.d.ts",
"default": "./core-icons.js"
},
"types": "./core-icons.d.ts",
"require": "./core-icons.js",
"import": "./core-icons.mjs",
"browser": "./core-icons-iife.js"
},
"./logo": {
"types": "./logo/core-icons-logo.d.ts",
"require": "./logo/core-icons-logo.js",
"import": "./logo/core-icons-logo.mjs",
"types": "./logo/core-icons-logo.d.ts"
"import": "./logo/core-icons-logo.mjs"
},
"./logo/large": {
"types": "./logo/large/core-icons-logo-large.d.ts",
"require": "./logo/large/core-icons-logo-large.js",
"import": "./logo/large/core-icons-logo-large.mjs",
"types": "./logo/large/core-icons-logo-large.d.ts"
"import": "./logo/large/core-icons-logo-large.mjs"
},
"./expressive": {
"types": "./expressive/core-icons-expressive.d.ts",
"require": "./expressive/core-icons-expressive.js",
"import": "./expressive/core-icons-expressive.mjs",
"types": "./expressive/core-icons-expressive.d.ts"
"import": "./expressive/core-icons-expressive.mjs"
},
"./preview": {
"types": "./preview/core-icons-preview.d.ts",
"require": "./preview/core-icons-preview.js",
"import": "./preview/core-icons-preview.mjs",
"types": "./preview/core-icons-preview.d.ts"
"import": "./preview/core-icons-preview.mjs"
},
"./jsx": {
"types": "./jsx/core-icons.d.ts",
"require": "./jsx/core-icons.js",
"import": "./jsx/core-icons.mjs",
"types": "./jsx/core-icons.d.ts"
"import": "./jsx/core-icons.mjs"
},
"./jsx/logo": {
"types": "./jsx/logo/core-icons-logo.d.ts",
"require": "./jsx/logo/core-icons-logo.js",
"import": "./jsx/logo/core-icons-logo.mjs",
"types": "./jsx/logo/core-icons-logo.d.ts"
"import": "./jsx/logo/core-icons-logo.mjs"
},
"./jsx/logo/large": {
"types": "./jsx/logo/large/core-icons-logo-large.d.ts",
"require": "./jsx/logo/large/core-icons-logo-large.js",
"import": "./jsx/logo/large/core-icons-logo-large.mjs",
"types": "./jsx/logo/large/core-icons-logo-large.d.ts"
"import": "./jsx/logo/large/core-icons-logo-large.mjs"
},
"./jsx/expressive": {
"types": "./jsx/expressive/core-icons-expressive.d.ts",
"require": "./jsx/expressive/core-icons-expressive.js",
"import": "./jsx/expressive/core-icons-expressive.mjs",
"types": "./jsx/expressive/core-icons-expressive.d.ts"
"import": "./jsx/expressive/core-icons-expressive.mjs"
},
"./jsx/preview": {
"types": "./jsx/preview/core-icons-preview.d.ts",
"require": "./jsx/preview/core-icons-preview.js",
"import": "./jsx/preview/core-icons-preview.mjs",
"types": "./jsx/preview/core-icons-preview.d.ts"
"import": "./jsx/preview/core-icons-preview.mjs"
}
},
"scripts": {
Expand Down

0 comments on commit 0db018c

Please sign in to comment.