Skip to content

Commit

Permalink
Merge pull request #578 from nkbt/Need-to-maintain-same-build-file-lo…
Browse files Browse the repository at this point in the history
…cations-577

Maintain the same build file paths
  • Loading branch information
nkbt authored Nov 17, 2019
2 parents 5d64304 + 6f886ea commit 9e3ce95
Show file tree
Hide file tree
Showing 9 changed files with 1,182 additions and 728 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": [
["@babel/env", { "modules": false, "loose": true }],
["@babel/env", { "modules": "commonjs", "loose": true }],
"@babel/flow",
"@babel/react"
],
Expand Down
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
build
coverage
dist
lib
node_modules
**/*/all.js
webpack.*.js
server.js
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ bower_components
.DS_Store

/demos/**/all.*
dist
/build/
/lib/
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
# sublime
/*.sublime-project
/*.sublime-workspace

/rollup.config.js
24 changes: 12 additions & 12 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"dist/react-motion.js": {
"bundled": 76939,
"minified": 22593,
"gzipped": 6614
"build/react-motion.js": {
"bundled": 77059,
"minified": 22596,
"gzipped": 6616
},
"dist/react-motion.min.js": {
"bundled": 52361,
"minified": 15207,
"gzipped": 4445
"build/react-motion.min.js": {
"bundled": 52481,
"minified": 15210,
"gzipped": 4446
},
"dist/react-motion.esm.js": {
"bundled": 43178,
"minified": 14591,
"gzipped": 3582,
"lib/react-motion.esm.js": {
"bundled": 43290,
"minified": 14594,
"gzipped": 3583,
"treeshaked": {
"rollup": {
"code": 6381,
Expand Down
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: node_js

node_js:
- 6
- 10

script:
- npm run -s lint
- npm run -s flow_check
script:
- npm run -s lint
- npm run -s flow_check
- npm run -s test:travis
43 changes: 24 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
"name": "react-motion",
"version": "0.5.2",
"description": "A spring that solves your animation problems.",
"main": "dist/react-motion.cjs.js",
"module": "dist/react-motion.esm.js",
"main": "lib/react-motion.js",
"module": "lib/react-motion.esm.js",
"peerDependencies": {
"react": "^0.14.9 || ^15.3.0 || ^16.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0-rc.1",
"@babel/plugin-proposal-class-properties": "^7.0.0-rc.1",
"@babel/plugin-transform-modules-commonjs": "^7.0.0-rc.1",
"@babel/plugin-transform-runtime": "^7.0.0-rc.1",
"@babel/polyfill": "^7.0.0-rc.1",
"@babel/preset-env": "^7.0.0-rc.1",
"@babel/preset-flow": "^7.0.0-rc.1",
"@babel/preset-react": "^7.0.0-rc.1",
"babel-eslint": "^9.0.0-beta.3",
"babel-loader": "^8.0.0-beta.4",
"babel-plugin-transform-react-remove-prop-types": "^0.4.14",
"@babel/cli": "^7.0.0-rc.1",
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-transform-modules-commonjs": "^7.7.0",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/polyfill": "^7.7.0",
"@babel/preset-env": "^7.7.1",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.7.0",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"codemirror": "^5.5.0",
"cross-env": "^5.2.0",
"css-loader": "^0.28.11",
Expand All @@ -31,6 +32,7 @@
"eslint-plugin-jsx-a11y": "^6.1.0",
"eslint-plugin-react": "^7.10.0",
"flow-bin": "^0.53.1",
"flow-copy-source": "^1.1.0",
"husky": "^0.14.3",
"inject-loader": "^4.0.1",
"isparta-loader": "^2.0.0",
Expand All @@ -48,7 +50,7 @@
"react-codemirror": ">=0.1.2",
"react-dom": ">=15.5.0",
"rollup": "^0.62.0",
"rollup-plugin-babel": "^4.0.0-beta.8",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^9.1.4",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",
Expand All @@ -61,13 +63,16 @@
},
"scripts": {
"start": "node server.js",
"build:code": "rollup -c",
"build:flow": "echo \"// @flow\n\nexport * from '../src/react-motion.js';\" > dist/react-motion.cjs.js.flow",
"build": "rm -rf dist && npm run build:code && npm run build:flow",
"prebuild:dist": "rm -rf build",
"build:dist": "rollup -c",
"prebuild:lib": "rm -rf lib",
"build:lib": "babel src --out-dir lib",
"build:flow": "flow-copy-source -v src lib",
"build": "npm run build:dist && npm run build:lib && npm run build:flow",
"build-demos": "webpack",
"lint": "eslint --ext .js,.jsx .",
"flow_check": "flow check",
"prepublish": "npm run build",
"prepublishOnly": "npm run build",
"test": "cross-env NODE_ENV=test karma start ./karma.conf.js --single-run",
"test:travis": "cross-env NODE_ENV=test karma start ./karma.conf.js --single-run",
"test:dev": "cross-env NODE_ENV=test karma start ./karma.conf.js --no-single-run --auto-watch",
Expand Down Expand Up @@ -107,7 +112,7 @@
],
"license": "MIT",
"dependencies": {
"@babel/runtime": "7.0.0-rc.1",
"@babel/runtime": "7.7.2",
"performance-now": "^2.1.0",
"prop-types": "^15.5.8",
"raf": "^3.1.0"
Expand Down
31 changes: 17 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ const globals = {
const external = id =>
!id.startsWith('\0') && !id.startsWith('.') && !id.startsWith('/');

const getBabelOptions = ({ useESModules }) => ({
const getBabelOptions = () => ({
babelrc: false,
exclude: '**/node_modules/**',
runtimeHelpers: true,
plugins: [['@babel/transform-runtime', { useESModules }]],
plugins: [
['@babel/proposal-class-properties', { loose: true }],
['transform-react-remove-prop-types', { mode: 'unsafe-wrap' }],
['@babel/transform-runtime', { useESModules: true }],
],
presets: [
['@babel/env', { modules: false, loose: true }],
'@babel/flow',
'@babel/react',
],
});

const commonjsOptions = {
Expand All @@ -29,11 +39,11 @@ const commonjsOptions = {
export default [
{
input,
output: { file: 'dist/react-motion.js', format: 'umd', name, globals },
output: { file: 'build/react-motion.js', format: 'umd', name, globals },
external: Object.keys(globals),
plugins: [
nodeResolve(),
babel(getBabelOptions({ useESModules: true })),
babel(getBabelOptions()),
commonjs(commonjsOptions),
replace({ 'process.env.NODE_ENV': JSON.stringify('development') }),
sizeSnapshot(),
Expand All @@ -42,11 +52,11 @@ export default [

{
input,
output: { file: 'dist/react-motion.min.js', format: 'umd', name, globals },
output: { file: 'build/react-motion.min.js', format: 'umd', name, globals },
external: Object.keys(globals),
plugins: [
nodeResolve(),
babel(getBabelOptions({ useESModules: true })),
babel(getBabelOptions()),
commonjs(commonjsOptions),
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
sizeSnapshot(),
Expand All @@ -58,13 +68,6 @@ export default [
input,
output: { file: pkg.module, format: 'esm' },
external,
plugins: [babel(getBabelOptions({ useESModules: true })), sizeSnapshot()],
},

{
input,
output: { file: pkg.main, format: 'cjs' },
external,
plugins: [babel(getBabelOptions({ useESModules: false }))],
plugins: [babel(getBabelOptions()), sizeSnapshot()],
},
];
Loading

0 comments on commit 9e3ce95

Please sign in to comment.