From d8b8d4e12a8b56b65695f297fc2df0d8712cdc27 Mon Sep 17 00:00:00 2001 From: naman Date: Mon, 6 Apr 2020 22:45:15 +0530 Subject: [PATCH] fix: copy icons and tokens for commonjs as well --- lib/index.js | 3 +++ scripts/build.js | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 8f720ad0b..f2ebeab9e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -15,6 +15,7 @@ import Label from './components/atoms/Label'; import Tag, { TagVanilla } from './components/atoms/Tag'; import Textarea, { TextareaVanilla } from './components/atoms/Textarea'; import Video, { VideoVanilla } from './components/atoms/Video'; +import Icon, { IconVanilla } from './components/atoms/Icon'; /** * Molecules @@ -96,4 +97,6 @@ export { Carousel, CarouselVanilla, GlobalStyles, + Icon, + IconVanilla, }; diff --git a/scripts/build.js b/scripts/build.js index ef87edd9d..03f0f5b60 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -26,12 +26,18 @@ const shell = (cmd) => execa(cmd, { stdio: ['pipe', 'pipe', 'inherit'], shell: t const has = (t) => !targets.length || targets.includes(t); +const copyStyles = async (target) => { + await shell(`cp -a ${srcRoot}/styles/themes/base/icons/. ${target}/styles/themes/base/icons/`); + await shell(`cp -a ${srcRoot}/styles/themes/base/tokens/. ${target}/styles/themes/base/tokens/`); +}; + /** * Run babel over the src directory and output * compiled common js files to ./lib. */ const buildLib = step('commonjs modules', libRoot, async () => { await shell(`npx babel ${srcRoot} --out-dir ${libRoot} --env-name "lib"`); + await copyStyles(libRoot); await shell('echo "// @flow\n\nexport * from \'../lib\'" > dist/index.js.flow'); }); @@ -41,8 +47,7 @@ const buildLib = step('commonjs modules', libRoot, async () => { */ const buildEsm = step('es modules', esRoot, async () => { await shell(`npx babel ${srcRoot} --out-dir ${esRoot} --env-name "esm"`); - await shell(`cp -a ${srcRoot}/styles/themes/base/icons/. ${esRoot}/styles/themes/base/icons/`); - await shell(`cp -a ${srcRoot}/styles/themes/base/tokens/. ${esRoot}/styles/themes/base/tokens/`); + await copyStyles(esRoot); await shell('echo "// @flow\n\nexport * from \'../../lib\'" > dist/es/index.js.flow'); });