From aab20f1fbc77366a828a2015111a8f7a2e0605bc Mon Sep 17 00:00:00 2001 From: ANich Date: Wed, 25 May 2016 06:56:08 -0700 Subject: [PATCH 1/6] Added build and minify npm scripts, references #262 --- package.json | 4 +++- webpack.config.js | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 webpack.config.js diff --git a/package.json b/package.json index a1fd24fd1b85f7..a2bbb8774d7ec8 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,12 @@ }, "homepage": "http://material-ui.com/", "scripts": { - "build": "npm run build:icon-index && npm run build:babel && npm run build:copy-files", + "build": "npm run build:icon-index && npm run build:babel && npm run build:copy-files && npm run build:umd && npm run build:min", "build:icon-index": "babel-node ./scripts/icon-index-generator.js", "build:babel": "babel ./src --ignore *.spec.js --out-dir ./build", "build:copy-files": "babel-node ./scripts/copy-files.js", + "build:umd": "cross-env NODE_ENV=development webpack src/index.js build/umd/MaterialUI.js", + "build:min": "cross-env NODE_ENV=production webpack -p src/index.js build/umd/MaterialUI.min.js", "clean:build": "rimraf build", "lint": "eslint src docs/src test/integration && echo \"eslint: no lint errors\"", "lint:find-rules": "eslint-find-rules -u .eslintrc.js", diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000000000..372e0864e97cd5 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,55 @@ +var webpack = require('webpack') + +module.exports = { + + output: { + library: 'MaterialUI', + libraryTarget: 'umd' + }, + + externals: [ + { + 'react': { + root: 'React', + commonjs2: 'react', + commonjs: 'react', + amd: 'react' + }, + 'react-dom': { + root: 'ReactDOM', + commonjs2: 'react-dom', + commonjs: 'react-dom', + amd: 'react-dom' + }, + 'react-tap-event-plugin': { + root: 'injectTapEventPlugin', + commonjs2: 'react-tap-event-plugin', + commonjs: 'react-tap-event-plugin', + amd: 'react-tap-event-plugin' + } + } + ], + + module: { + loaders: [ + { + test: /\.js$/, + loaders: ['babel'], + exclude: /node_modules/ + } + ] + }, + + node: { + Buffer: false + }, + + plugins: [ + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) + }) + ] +} + + From 1c61d92de07f66ebd7dc9a069355e3c1fc0c6101 Mon Sep 17 00:00:00 2001 From: ANich Date: Wed, 25 May 2016 09:10:17 -0700 Subject: [PATCH 2/6] CS fix --- webpack.config.js | 98 +++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 372e0864e97cd5..fd120f6b09e13a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,54 +2,52 @@ var webpack = require('webpack') module.exports = { - output: { - library: 'MaterialUI', - libraryTarget: 'umd' - }, - - externals: [ - { - 'react': { - root: 'React', - commonjs2: 'react', - commonjs: 'react', - amd: 'react' - }, - 'react-dom': { - root: 'ReactDOM', - commonjs2: 'react-dom', - commonjs: 'react-dom', - amd: 'react-dom' - }, - 'react-tap-event-plugin': { - root: 'injectTapEventPlugin', - commonjs2: 'react-tap-event-plugin', - commonjs: 'react-tap-event-plugin', - amd: 'react-tap-event-plugin' - } - } - ], - - module: { - loaders: [ - { - test: /\.js$/, - loaders: ['babel'], - exclude: /node_modules/ - } - ] - }, - - node: { - Buffer: false - }, - - plugins: [ - new webpack.optimize.OccurenceOrderPlugin(), - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) - }) - ] + output: { + library: 'MaterialUI', + libraryTarget: 'umd' + }, + + externals: [ + { + 'react': { + root: 'React', + commonjs2: 'react', + commonjs: 'react', + amd: 'react' + }, + 'react-dom': { + root: 'ReactDOM', + commonjs2: 'react-dom', + commonjs: 'react-dom', + amd: 'react-dom' + }, + 'react-tap-event-plugin': { + root: 'injectTapEventPlugin', + commonjs2: 'react-tap-event-plugin', + commonjs: 'react-tap-event-plugin', + amd: 'react-tap-event-plugin' + } + } + ], + + module: { + loaders: [ + { + test: /\.js$/, + loaders: ['babel'], + exclude: /node_modules/ + } + ] + }, + + node: { + Buffer: false + }, + + plugins: [ + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) + }) + ] } - - From 5d945559b325c6d75c9d08fbbec8c87d4b3f3f93 Mon Sep 17 00:00:00 2001 From: ANich Date: Thu, 26 May 2016 09:01:30 -0700 Subject: [PATCH 3/6] Added index.umd.js to export src/styles and call injectTapEventPlugin(). Removed react-tap-event-plugin as an external --- package.json | 4 ++-- src/index.umd.js | 5 +++++ webpack.config.js | 6 ------ 3 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 src/index.umd.js diff --git a/package.json b/package.json index a2bbb8774d7ec8..70115d6ae3ff7b 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "build:icon-index": "babel-node ./scripts/icon-index-generator.js", "build:babel": "babel ./src --ignore *.spec.js --out-dir ./build", "build:copy-files": "babel-node ./scripts/copy-files.js", - "build:umd": "cross-env NODE_ENV=development webpack src/index.js build/umd/MaterialUI.js", - "build:min": "cross-env NODE_ENV=production webpack -p src/index.js build/umd/MaterialUI.min.js", + "build:umd": "cross-env NODE_ENV=development webpack src/index.umd.js build/umd/MaterialUI.js", + "build:min": "cross-env NODE_ENV=production webpack -p src/index.umd.js build/umd/MaterialUI.min.js", "clean:build": "rimraf build", "lint": "eslint src docs/src test/integration && echo \"eslint: no lint errors\"", "lint:find-rules": "eslint-find-rules -u .eslintrc.js", diff --git a/src/index.umd.js b/src/index.umd.js new file mode 100644 index 00000000000000..fdbed7d70d661b --- /dev/null +++ b/src/index.umd.js @@ -0,0 +1,5 @@ +import injectTapEventPlugin from 'react-tap-event-plugin'; +injectTapEventPlugin(); + +export * from './index' +export * from './styles'; diff --git a/webpack.config.js b/webpack.config.js index fd120f6b09e13a..c724c8f6addc50 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,12 +20,6 @@ module.exports = { commonjs2: 'react-dom', commonjs: 'react-dom', amd: 'react-dom' - }, - 'react-tap-event-plugin': { - root: 'injectTapEventPlugin', - commonjs2: 'react-tap-event-plugin', - commonjs: 'react-tap-event-plugin', - amd: 'react-tap-event-plugin' } } ], From dd64aeef312b4fd5ef132bcc8eadb543768beef8 Mon Sep 17 00:00:00 2001 From: ANich Date: Thu, 26 May 2016 09:21:47 -0700 Subject: [PATCH 4/6] Missing semi --- src/index.umd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.umd.js b/src/index.umd.js index fdbed7d70d661b..36274407fa36f3 100644 --- a/src/index.umd.js +++ b/src/index.umd.js @@ -1,5 +1,5 @@ import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); -export * from './index' +export * from './index'; export * from './styles'; From 2f10ad7afd34662b0383056977106ff034def7a1 Mon Sep 17 00:00:00 2001 From: ANich Date: Fri, 3 Jun 2016 17:27:06 -0700 Subject: [PATCH 5/6] Changed target directory from build to dist (build is for the NPM package) --- .gitignore | 1 + package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 14cb44c16ad615..ceb66e63309652 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules npm-debug.log build +dist coverage # Exclude compiled files diff --git a/package.json b/package.json index 70115d6ae3ff7b..3fc315d8fb20c2 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "build:icon-index": "babel-node ./scripts/icon-index-generator.js", "build:babel": "babel ./src --ignore *.spec.js --out-dir ./build", "build:copy-files": "babel-node ./scripts/copy-files.js", - "build:umd": "cross-env NODE_ENV=development webpack src/index.umd.js build/umd/MaterialUI.js", - "build:min": "cross-env NODE_ENV=production webpack -p src/index.umd.js build/umd/MaterialUI.min.js", + "build:umd": "cross-env NODE_ENV=development webpack src/index.umd.js dist/MaterialUI.js", + "build:min": "cross-env NODE_ENV=production webpack -p src/index.umd.js dist/MaterialUI.min.js", "clean:build": "rimraf build", "lint": "eslint src docs/src test/integration && echo \"eslint: no lint errors\"", "lint:find-rules": "eslint-find-rules -u .eslintrc.js", From 4ccd66be3632f0608c6913f5be2cc21ca28b3af5 Mon Sep 17 00:00:00 2001 From: ANich Date: Sat, 23 Jul 2016 13:20:55 -0700 Subject: [PATCH 6/6] Added transition-group and create-fragment addons as exernals --- webpack.config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index c724c8f6addc50..e4d225cb7a0edd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,6 +20,18 @@ module.exports = { commonjs2: 'react-dom', commonjs: 'react-dom', amd: 'react-dom' + }, + 'react-addons-transition-group': { + root: ['React', 'addons', 'TransitionGroup'], + commonjs2: 'react-addons-transition-group', + commonjs: 'react-addons-transition-group', + amd: 'react-addons-transition-group', + }, + 'react-addons-create-fragment': { + root: ['React', 'addons', 'createFragment'], + commonjs2: 'react-addons-create-fragment', + commonjs: 'react-addons-create-fragment', + amd: 'react-addons-create-fragment', } } ],