mirror of
https://github.com/iconify/iconify.git
synced 2025-01-07 07:34:22 +00:00
Retrieve list of files to build from package.json exports in utils
This commit is contained in:
parent
91f5f8a7e4
commit
6c3284e1c3
@ -1,50 +1,31 @@
|
||||
import { defineBuildConfig } from 'unbuild'
|
||||
import { BuildEntry, defineBuildConfig } from 'unbuild';
|
||||
import packageJSON from './package.json';
|
||||
|
||||
const entries: BuildEntry[] = [];
|
||||
const exportsList = packageJSON['exports'];
|
||||
const match = './lib/';
|
||||
|
||||
Object.keys(exportsList).forEach((key) => {
|
||||
if (key.slice(0, match.length) !== match) {
|
||||
return;
|
||||
}
|
||||
|
||||
const importValue = exportsList[key]['import'];
|
||||
if (importValue === key + '.mjs') {
|
||||
const name = key.slice(match.length);
|
||||
entries.push({
|
||||
input: 'src/' + name,
|
||||
name,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export default defineBuildConfig({
|
||||
outDir: './lib',
|
||||
entries: [
|
||||
{ input: 'src/colors/types', name: 'colors/types' },
|
||||
{ input: 'src/colors/keywords', name: 'colors/keywords' },
|
||||
{ input: 'src/colors/index', name: 'colors/index' },
|
||||
{ input: 'src/customisations/bool', name: 'customisations/bool' },
|
||||
{ input: 'src/customisations/compare', name: 'customisations/compare' },
|
||||
{ input: 'src/customisations/index', name: 'customisations/index' },
|
||||
{ input: 'src/customisations/rotate', name: 'customisations/rotate' },
|
||||
{ input: 'src/customisations/shorthand', name: 'customisations/shorthand' },
|
||||
{ input: 'src/icon/index', name: 'icon/index' },
|
||||
{ input: 'src/icon/merge', name: 'icon/merge' },
|
||||
{ input: 'src/icon/name', name: 'icon/name' },
|
||||
{ input: 'src/icon-set/convert-info', name: 'icon-set/convert-info' },
|
||||
{ input: 'src/icon-set/expand', name: 'icon-set/expand' },
|
||||
{ input: 'src/icon-set/get-icon', name: 'icon-set/get-icon' },
|
||||
{ input: 'src/icon-set/get-icons', name: 'icon-set/get-icons' },
|
||||
{ input: 'src/icon-set/minify', name: 'icon-set/minify' },
|
||||
{ input: 'src/icon-set/parse', name: 'icon-set/parse' },
|
||||
{ input: 'src/icon-set/validate', name: 'icon-set/validate' },
|
||||
{ input: 'src/loader/custom', name: 'loader/custom' },
|
||||
{ input: 'src/loader/fs', name: 'loader/fs' },
|
||||
{ input: 'src/loader/install-pkg', name: 'loader/install-pkg' },
|
||||
{ input: 'src/loader/loader', name: 'loader/loader' },
|
||||
{ input: 'src/loader/modern', name: 'loader/modern' },
|
||||
{ input: 'src/loader/node-loader', name: 'loader/node-loader' },
|
||||
{ input: 'src/loader/node-loaders', name: 'loader/node-loaders' },
|
||||
{ input: 'src/loader/types', name: 'loader/types' },
|
||||
{ input: 'src/loader/utils', name: 'loader/utils' },
|
||||
{ input: 'src/loader/warn', name: 'loader/warn' },
|
||||
{ input: 'src/misc/strings', name: 'misc/strings' },
|
||||
{ input: 'src/svg/build', name: 'svg/build' },
|
||||
{ input: 'src/svg/encode-svg-for-css', name: 'svg/encode-svg-for-css' },
|
||||
{ input: 'src/svg/id', name: 'svg/id' },
|
||||
{ input: 'src/svg/size', name: 'svg/size' },
|
||||
{ input: 'src/index', name: 'index' },
|
||||
],
|
||||
entries,
|
||||
clean: true,
|
||||
declaration: true,
|
||||
externals: [
|
||||
'local-pkg',
|
||||
'fs',
|
||||
],
|
||||
rollup: {
|
||||
emitCJS: true,
|
||||
},
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user