From 643a1c95a117d62d0e2c3a1ea7f6d60bfaae1994 Mon Sep 17 00:00:00 2001 From: plouc Date: Fri, 17 Dec 2021 08:05:46 +0900 Subject: [PATCH] feat(build): init support for development builds --- Makefile | 16 ++++++++-------- babel.config.js | 5 ++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 628cf7e000..93bc99431d 100644 --- a/Makefile +++ b/Makefile @@ -124,31 +124,31 @@ packages-lint-fix: ##@1 packages run eslint on all packages with a fix option @yarn eslint "./packages/*/{src,tests}/**/*.{js,ts,tsx}" --fix package-test-cover-%: ##@1 packages run tests for a package with code coverage - @yarn jest -c ./packages/jest.config.js --rootDir . --coverage ./packages/${*}/tests + @export BABEL_ENV=development; yarn jest -c ./packages/jest.config.js --rootDir . --coverage ./packages/${*}/tests package-test-%: ##@1 packages run tests for a package - @yarn jest -c ./packages/jest.config.js --rootDir . ./packages/${*}/tests + @export BABEL_ENV=development; yarn jest -c ./packages/jest.config.js --rootDir . ./packages/${*}/tests package-watch-test-%: ##@1 packages run tests for a package and watch for changes - @yarn jest -c ./packages/jest.config.js --rootDir . ./packages/${*}/tests --watch + @export BABEL_ENV=development; yarn jest -c ./packages/jest.config.js --rootDir . ./packages/${*}/tests --watch package-update-test-%: ##@1 packages run tests for a package and update its snapshots - @yarn jest -c ./packages/jest.config.js --rootDir . ./packages/${*}/tests -u + @export BABEL_ENV=development; yarn jest -c ./packages/jest.config.js --rootDir . ./packages/${*}/tests -u package-watch-test-%: ##@1 packages run tests for a package and watch for changes - @yarn jest -c ./packages/jest.config.js --rootDir . ./packages/${*}/tests --watch + @export BABEL_ENV=development; yarn jest -c ./packages/jest.config.js --rootDir . ./packages/${*}/tests --watch packages-test: ##@1 packages run tests for all packages @echo "${YELLOW}Running test suites for all packages${RESET}" - @yarn jest -c ./packages/jest.config.js --rootDir . ./packages/*/tests + @export BABEL_ENV=development; yarn jest -c ./packages/jest.config.js --rootDir . ./packages/*/tests packages-watch-test: ##@1 packages run tests for all packages and watch for changes @echo "${YELLOW}Running test suites watcher for all packages${RESET}" - @yarn jest -c ./packages/jest.config.js --rootDir . ./packages/*/tests --watch + @export BABEL_ENV=development; yarn jest -c ./packages/jest.config.js --rootDir . ./packages/*/tests --watch packages-test-cover: ##@1 packages run tests for all packages with code coverage @echo "${YELLOW}Running test suites coverage for all packages${RESET}" - @yarn jest -c ./packages/jest.config.js --rootDir . --coverage ./packages/*/tests + @export BABEL_ENV=development; yarn jest -c ./packages/jest.config.js --rootDir . --coverage ./packages/*/tests packages-types: ##@1 packages build all package types @echo "${YELLOW}Building TypeScript types for all packages${RESET}" diff --git a/babel.config.js b/babel.config.js index 8e58e2cf9a..4333bb1d47 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,7 +1,10 @@ module.exports = { presets: [ ['@babel/preset-env', { loose: true }], - ['@babel/preset-react', { runtime: 'automatic' }], + ['@babel/preset-react', { + development: process.env.BABEL_ENV === "development", + runtime: 'automatic' + }], '@babel/preset-typescript', ], }