diff --git a/package.json b/package.json index a79f7362..28ec4ec6 100644 --- a/package.json +++ b/package.json @@ -128,9 +128,10 @@ }, "scripts": { "build": "yarn build-cjs && yarn build-declaration && yarn build-esm", - "build-cjs": "rm -rf dist && NODE_ENV=production BABEL_ENV=cjs babel src --out-dir dist --copy-files --extensions '.js,.jsx,.ts,.tsx'", - "build-esm": "rm -rf dist-esm && NODE_ENV=production BABEL_ENV=esm babel src --out-dir dist-esm --copy-files --extensions '.js,.jsx,.ts,.tsx'", - "build-declaration": "rm -rf dist-types && tsc --project tsconfig.json --outDir dist-types && tsc-alias -p tsconfig.json --outDir dist-types", + "build-base": "rm -rf $OUT_DIR && NODE_ENV=production BABEL_ENV=$BABEL_ENV babel src --out-dir $OUT_DIR --copy-files --no-copy-ignored --extensions '.js,.jsx,.ts,.tsx,.snap' --ignore '**/*.test.ts','**/*.test.tsx','**/*.stories.tsx','**/__snapshots__','src/setupTests.js','src/testing'", + "build-cjs": "OUT_DIR=dist BABEL_ENV=cjs yarn run build-base", + "build-esm": "OUT_DIR=dist-esm BABEL_ENV=esm yarn run build-base", + "build-declaration": "rm -rf dist-types && tsc --project tsconfig.build.json --outDir dist-types && tsc-alias -p tsconfig.build.json --outDir dist-types", "build-watch": "yarn run build-cjs --watch", "build-docs": "storybook build -c .storybook -o docs", "clean": "rm -rf node_modules dist .out", diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 00000000..c412aa2c --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "exclude": ["src/**/*.test.*", "src/**/*.stories.*"], + "extends": "./tsconfig.json" +} diff --git a/tsconfig.json b/tsconfig.json index 74e3892b..c11c2f2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,6 +30,5 @@ "utils": ["./utils"] } }, - "include": ["src/**/*.ts", "src/**/*.tsx"], - "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx"] + "include": ["src/**/*"] }