From e50cc92aa610f7baa7b1021e98da58c81338d600 Mon Sep 17 00:00:00 2001 From: plouc Date: Thu, 5 Nov 2020 08:53:45 +0900 Subject: [PATCH] feat(build): generate package types during build if tsconfig exists --- Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7dcff2826a..cfd06b96e2 100644 --- a/Makefile +++ b/Makefile @@ -177,12 +177,17 @@ packages-build: packages-types ##@1 packages build all packages | xargs -I '{}' sh -c '$(MAKE) package-build-{}' package-types-%: ##@1 packages build a package types - @echo "${YELLOW}Building TypeScript types for package ${WHITE}@nivo/${*}${RESET}" - @-rm -rf ./packages/${*}/dist/types - @-rm -rf ./packages/${*}/dist/tsconfig.tsbuildinfo - @yarn tsc -b ./packages/${*} - -package-build-%: ##@1 packages build a package + @if [ -f "./packages/${*}/tsconfig.json" ]; \ + then \ + echo "${YELLOW}Building TypeScript types for package ${WHITE}@nivo/${*}${RESET}"; \ + rm -rf ./packages/${*}/dist/types; \ + rm -rf ./packages/${*}/dist/tsconfig.tsbuildinfo; \ + yarn tsc -b ./packages/${*}; \ + else \ + echo "${YELLOW}Package ${WHITE}@nivo/${*}${RESET}${YELLOW} does not have tsconfig, skipping"; \ + fi; + +package-build-%: package-types-% ##@1 packages build a package @echo "${YELLOW}Building package ${WHITE}@nivo/${*}${RESET}" @-rm -rf ./packages/${*}/dist @export PACKAGE=${*}; NODE_ENV=production BABEL_ENV=production ./node_modules/.bin/rollup -c conf/rollup.config.js