Skip to content

Commit

Permalink
fix(TypeScript): fix export of type definitions
Browse files Browse the repository at this point in the history
This PR fixes #1075
  • Loading branch information
tujoworker committed Oct 28, 2021
1 parent 74b7106 commit eb85869
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/dnb-eufemia/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const config = {
testEnvironment: 'jsdom',
testURL: 'http://localhost',
testRegex: '(/__tests__/\\.js|(\\.|/)(test|spec))\\.[jt]s?$',
testRegex: '(/__tests__/\\.js|(\\.|/)(test|spec))\\.(js|jsx|ts)?$',
modulePathIgnorePatterns: [
'not_in_use',
'<rootDir>/build/',
Expand Down
9 changes: 3 additions & 6 deletions packages/dnb-eufemia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,21 @@
"build": "yarn build:prebuild && yarn build:esm && yarn build:copy",
"prebuild:ci": "yarn build",
"postbuild:ci": "yarn build:types && yarn build:cjs && yarn build:es && yarn build:umd && yarn build:esm && yarn build:copy && yarn prettier:other && echo \"Can be enabled in future -> yarn build:resources\"",
"build:cjs": "cross-env NODE_ENV=production BABEL_ENV=cjs babel ./src --extensions .cjs,.js,.ts,.tsx --keep-file-extension --config-file ./babel.config.js --out-dir ./build/cjs --copy-files --no-copy-ignored --ignore 'src/esm,src/umd,src/core,**/*.test.js,**/__tests__/**/*'",
"build:cjs": "./scripts/release/babel-cjs.sh",
"build:clean": "rm -rf build/**",
"build:component": "cross-env NODE_ENV=production BABEL_ENV=esm babel ./src/components/global-status --extensions .js,.ts,.tsx --config-file ./babel.config.js --out-dir ./build/esm/components/global-status",
"build:copy": "./scripts/release/copy-build-artifacts.sh",
"build:es": "cross-env NODE_ENV=production BABEL_ENV=es babel ./src --extensions .js,.ts,.tsx --config-file ./babel.config.js --out-dir ./build/es --copy-files --no-copy-ignored --ignore 'src/cjs,src/esm,src/umd,src/core,**/*.test.js,**/__tests__/**/*'",
"build:esm": "cross-env NODE_ENV=production BABEL_ENV=esm babel ./src --extensions .js,.ts,.tsx --config-file ./babel.config.js --out-dir ./build/esm --copy-files --no-copy-ignored --ignore 'src/cjs,src/esm,src/umd,src/core,**/*.test.js,**/__tests__/**/*'",
"build:es": "./scripts/release/babel-es.sh",
"build:esm": "./scripts/release/babel-esm.sh",
"prebuild:figma:ci": "yarn figma",
"postbuild:figma:ci": "yarn test:update && yarn test:screenshots:update && babel-node ./scripts/figma/tasks/commitChanges",
"build:pack": "yarn build && yarn publish:prepare && cd ./build && yarn pack",
"build:prebuild": "babel-node ./scripts/prepub/runPrepub.js",
"build:resources": "babel-node ./scripts/prepub/resources/makeResourcesPackage.js",
"build:shared": "cross-env NODE_ENV=production BABEL_ENV=esm babel ./src/shared --extensions .js,.ts,.tsx --config-file ./babel.config.js --out-dir ./build/esm/shared --ignore '**/__tests__/**/*'",
"build:types": "babel-node ./scripts/prepub/generateTypes.js && TEST_POST_TYPES=1 jest ./postTypeGeneration.test.js",
"build:types:dev": "nodemon --exec 'babel-node ./scripts/prepub/generateTypes.js' --ext js --watch './src/**/*' --watch './scripts/**/*'",
"build:umd": "cross-env NODE_ENV=production BABEL_ENV=umd rollup -c ./rollup.config.js",
"precommit": "yarn lint-staged",
"dev:cjs": "nodemon --exec 'yarn build:cjs && yarn build:copy' --ext js,html,json,css,scss --watch './src/**/*' --ignore './**/*'",
"dev:components": "nodemon --exec 'yarn build:component && yarn build:shared && yarn build:copy' --ext js,html,json,css,scss --watch './src/**/*' --ignore '*.json'",
"dev:icons": "nodemon --exec 'babel-node ./scripts/tools/convertIcons' --ignore '/icons/**' --ignore '*.json'",
"dev:resources": "nodemon --exec 'babel-node ./scripts/prepub/resources/makeResourcesPackage.js' --ext js,html,json,css,scss --watch './build/style/**/*' --watch './scripts/**/*' --ignore '*.json'",
"dev:tasks": "nodemon --exec 'babel-node ./scripts/prepub/dev.js' --watch 'rollup.config.js' --ext js,html,json,css,scss --watch './src/components/**/*' --watch './src/style/**/*' --watch './scripts/**/*' --ignore '*.json'",
Expand Down
21 changes: 21 additions & 0 deletions packages/dnb-eufemia/scripts/release/babel-cjs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

echo 'Building cjs ...'

cross-env \
NODE_ENV=production \
BABEL_ENV=cjs \
babel ./src \
--extensions '.cjs,.js,.ts,.tsx' \
--keep-file-extension \
--config-file ./babel.config.js \
--out-dir ./build/cjs \
--copy-files \
--no-copy-ignored \
--ignore 'src/esm,src/umd,src/core,**/*.test.js,**/__tests__/**/*,**/*.d.ts'

echo 'Building cjs done!'

echo 'Copy .d.ts files ...'

cd ./src && find . -name '*.d.ts' | cpio -p -dumv ../build/cjs && cd ../
21 changes: 21 additions & 0 deletions packages/dnb-eufemia/scripts/release/babel-es.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

echo 'Building es ...'

cross-env \
NODE_ENV=production \
BABEL_ENV=es \
babel ./src \
--extensions '.js,.ts,.tsx' \
--keep-file-extension \
--config-file ./babel.config.js \
--out-dir ./build/es \
--copy-files \
--no-copy-ignored \
--ignore 'src/cjs,src/esm,src/umd,src/core,**/*.test.js,**/__tests__/**/*,**/*.d.ts'

echo 'Building es done!'

echo 'Copy .d.ts files ...'

cd ./src && find . -name '*.d.ts' | cpio -p -dumv ../build/es && cd ../
21 changes: 21 additions & 0 deletions packages/dnb-eufemia/scripts/release/babel-esm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

echo 'Building esm ...'

cross-env \
NODE_ENV=production \
BABEL_ENV=esm \
babel ./src \
--extensions '.js,.ts,.tsx' \
--keep-file-extension \
--config-file ./babel.config.js \
--out-dir ./build/esm \
--copy-files \
--no-copy-ignored \
--ignore 'src/cjs,src/esm,src/umd,src/core,**/*.test.js,**/__tests__/**/*,**/*.d.ts'

echo 'Building esm done!'

echo 'Copy .d.ts files ...'

cd ./src && find . -name '*.d.ts' | cpio -p -dumv ../build/esm && cd ../

0 comments on commit eb85869

Please sign in to comment.