Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[treeshaking]: fix treeshaking and add esm and umd versions #1045

Merged
merged 31 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
242b49d
chore(gitignore): add compiled folders to gitignore
davidicus Mar 24, 2020
000de6b
chore(babelconfig): add plugin to remove proptypes
davidicus Mar 24, 2020
46245a5
chore(babelconfig): conditonally load plugin to babel config
davidicus Mar 24, 2020
4dff3ef
feat(packagejson): chng pkgjson to support multiple versions
davidicus Mar 24, 2020
8779713
feat(rollupconfig): add diff builds
davidicus Mar 24, 2020
0cdb7d9
Merge branch 'master' of github.com:IBM/carbon-addons-iot-react into …
davidicus Mar 24, 2020
18b0b3d
fix(card): fix import of css. blowing up build
davidicus Mar 24, 2020
614675b
feat(rollup): add style build
davidicus Mar 25, 2020
822fee9
Merge branch 'master' of github.com:IBM/carbon-addons-iot-react into …
davidicus Mar 25, 2020
7ee3c5f
chore(rollup): troublshooting build
davidicus Mar 26, 2020
b1020f2
fix(rollup): changae imports on deps
davidicus Mar 27, 2020
f4ad175
fix(rollup): fix build errors
davidicus Mar 27, 2020
9c4fe0b
fix(jest): map modules to accept es
davidicus Mar 27, 2020
6b603b7
chore(snaps): update snaps
davidicus Mar 27, 2020
b525455
feat(rollup): add UMD build and copy styles
davidicus Mar 29, 2020
f78533f
chore(pkgjs): fix typo in path
davidicus Mar 29, 2020
b97f52f
chore(pkgjs): add entry points in package.json
davidicus Mar 29, 2020
7403c2a
fix(snapshots): regenerate with correct version of Carbon
tay1orjones Mar 30, 2020
bcbc516
fix(babel): fix how we handle proptypes
davidicus Mar 30, 2020
c9c6db3
fix(storybook): add styles to storybook config
davidicus Mar 30, 2020
524cd4b
fix(jest): add comment to explain mappin in jest.config
davidicus Mar 30, 2020
8fe8191
Merge branch 'master' into tree-shake-build
davidicus Mar 30, 2020
2079b78
chore(tests): regen snapshots for ValueCard mismatch
tay1orjones Mar 30, 2020
c5521ef
docs(readme): update scss entrypoint path
tay1orjones Mar 30, 2020
9abae80
fix(umd): remove umd build until it can be fixed.
davidicus Mar 31, 2020
152c3d6
fix(rollup): change umd output until we can troubleshoot
davidicus Mar 31, 2020
0e8da63
Merge branch 'tree-shake-build' of github.com:IBM/carbon-addons-iot-r…
davidicus Mar 31, 2020
8901ea3
fix(rollup): add umd version
davidicus Mar 31, 2020
41913cd
fix(rollup): remove comment
davidicus Mar 31, 2020
21fcc11
fix(storybook): change config to allow for sideEffects
davidicus Apr 1, 2020
64f8d53
Merge branch 'master' of github.com:IBM/carbon-addons-iot-react into …
davidicus Apr 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ node_modules/
coverage/
config/
lib/
es/
umd/
storybook-static/
results/
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ coverage

# Compiled binary addons (http://nodejs.org/api/addons.html)
lib
es
scss
umd
css
tmp
storybook-static

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
Expand Down
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { BABEL_ENV } = process.env;

module.exports = function generateConfig(api) {
api.cache(true);
return {
Expand All @@ -9,6 +11,7 @@ module.exports = function generateConfig(api) {
browsers: ['last 2 version', 'ie >= 11'],
},
useBuiltIns: 'usage',
modules: BABEL_ENV === 'production' ? false : 'auto',
corejs: 2,
},
],
Expand All @@ -17,6 +20,9 @@ module.exports = function generateConfig(api) {
],
ignore: ['__mocks__'],
plugins: [
...(BABEL_ENV === 'production'
? ['transform-react-remove-prop-types', { mode: 'unsafe-wrap' }]
: []),
'babel-plugin-lodash',
'babel-plugin-styled-components',
'babel-plugin-react-docgen',
Expand Down
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,7 @@ module.exports = {
// https://github.com/storybookjs/storybook/pull/9795#issuecomment-587808019
// either way, this can be removed in the future
'react-syntax-highlighter/dist/esm/(.*)': 'react-syntax-highlighter/dist/cjs/$1',
'@carbon/icons-react/es/(.*)': '@carbon/icons-react/lib/$1',
'carbon-components-react/es/(.*)': 'carbon-components-react/lib/$1',
},
};
21 changes: 15 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
{
"name": "carbon-addons-iot-react",
"main": "lib/index.js",
"main": "lib/src/index.js",
"module": "es/src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/IBM/carbon-addons-iot-react.git"
},
"license": "Apache-2",
"files": [
"lib"
"lib/**/*",
"es/**/*",
"umd/**/*",
"scss/**/*",
"css/**/*"
],
"bugs": {
"url": "https://github.com/IBM/carbon-addons-iot-react/issues"
},
"homepage": "https://carbon-addons-iot-react.com",
"scripts": {
"build": "yarn build:pre && rollup -c",
"build:pre": "rimraf lib storybook-static",
"build": "cross-env BABEL_ENV='production' NODE_ENV='production' yarn build:pre && rollup -c && yarn build:post",
"build:pre": "rimraf lib es umd css scss tmp storybook-static",
"build:post": "rimraf tmp",
"build:storybook": "NODE_OPTIONS='--max-old-space-size=16384' build-storybook -s public/production",
"format": "prettier --write \"**/*.{scss,css,js,jsx,md,ts}\"",
"format:diff": "prettier --list-different \"**/*.{scss,css,js,jsx,md,ts}\"",
Expand Down Expand Up @@ -91,6 +97,7 @@
"react-sizeme": "^2.6.3",
"react-transition-group": "^2.6.0",
"react-visibility-sensor": "^5.0.2",
"rollup-plugin-auto-external": "^2.0.0",
"styled-components": "^4.1.3",
"use-deep-compare-effect": "^1.2.0",
"use-resize-observer": "^5.0.0",
Expand Down Expand Up @@ -148,6 +155,7 @@
"babel-plugin-react-docgen": "^2.0.0",
"babel-plugin-require-context-hook": "^1.0.0",
"babel-plugin-styled-components": "^1.10.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"coveralls": "^3.0.2",
"cross-env": "^6.0.3",
"css-loader": "^2.1.0",
Expand Down Expand Up @@ -188,7 +196,7 @@
"react-test-renderer": "^16.8.6",
"rimraf": "^3.0.0",
"rollup": "^1.1.0",
"rollup-plugin-babel": "^4.3.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-copy": "^3.2.0",
"rollup-plugin-filesize": "^6.0.0",
Expand All @@ -198,7 +206,7 @@
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-uglify": "^6.0.1",
"rollup-plugin-uglify": "^6.0.4",
"sass-loader": "^7.1.0",
"semantic-release": "^16.0.0-beta.39",
"storybook-addon-rtl": "^0.2.2",
Expand All @@ -210,5 +218,6 @@
"webpack": "^4.28.4",
"whatwg-fetch": "^3.0.0"
},
"sideEffects": false,
"version": "0.0.0-development"
}
Loading