Skip to content

Commit 9e3ce95

Browse files
authored
Merge pull request #578 from nkbt/Need-to-maintain-same-build-file-locations-577
Maintain the same build file paths
2 parents 5d64304 + 6f886ea commit 9e3ce95

File tree

9 files changed

+1182
-728
lines changed

9 files changed

+1182
-728
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"presets": [
3-
["@babel/env", { "modules": false, "loose": true }],
3+
["@babel/env", { "modules": "commonjs", "loose": true }],
44
"@babel/flow",
55
"@babel/react"
66
],

.eslintignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
node_modules
1+
build
22
coverage
3-
dist
3+
lib
4+
node_modules
45
**/*/all.js
56
webpack.*.js
67
server.js

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ bower_components
1212
.DS_Store
1313

1414
/demos/**/all.*
15-
dist
15+
/build/
16+
/lib/

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
# sublime
1414
/*.sublime-project
1515
/*.sublime-workspace
16+
17+
/rollup.config.js

.size-snapshot.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"dist/react-motion.js": {
3-
"bundled": 76939,
4-
"minified": 22593,
5-
"gzipped": 6614
2+
"build/react-motion.js": {
3+
"bundled": 77059,
4+
"minified": 22596,
5+
"gzipped": 6616
66
},
7-
"dist/react-motion.min.js": {
8-
"bundled": 52361,
9-
"minified": 15207,
10-
"gzipped": 4445
7+
"build/react-motion.min.js": {
8+
"bundled": 52481,
9+
"minified": 15210,
10+
"gzipped": 4446
1111
},
12-
"dist/react-motion.esm.js": {
13-
"bundled": 43178,
14-
"minified": 14591,
15-
"gzipped": 3582,
12+
"lib/react-motion.esm.js": {
13+
"bundled": 43290,
14+
"minified": 14594,
15+
"gzipped": 3583,
1616
"treeshaked": {
1717
"rollup": {
1818
"code": 6381,

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: node_js
22

33
node_js:
4-
- 6
4+
- 10
55

6-
script:
7-
- npm run -s lint
8-
- npm run -s flow_check
6+
script:
7+
- npm run -s lint
8+
- npm run -s flow_check
99
- npm run -s test:travis

package.json

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22
"name": "react-motion",
33
"version": "0.5.2",
44
"description": "A spring that solves your animation problems.",
5-
"main": "dist/react-motion.cjs.js",
6-
"module": "dist/react-motion.esm.js",
5+
"main": "lib/react-motion.js",
6+
"module": "lib/react-motion.esm.js",
77
"peerDependencies": {
88
"react": "^0.14.9 || ^15.3.0 || ^16.0.0"
99
},
1010
"devDependencies": {
11-
"@babel/core": "^7.0.0-rc.1",
12-
"@babel/plugin-proposal-class-properties": "^7.0.0-rc.1",
13-
"@babel/plugin-transform-modules-commonjs": "^7.0.0-rc.1",
14-
"@babel/plugin-transform-runtime": "^7.0.0-rc.1",
15-
"@babel/polyfill": "^7.0.0-rc.1",
16-
"@babel/preset-env": "^7.0.0-rc.1",
17-
"@babel/preset-flow": "^7.0.0-rc.1",
18-
"@babel/preset-react": "^7.0.0-rc.1",
19-
"babel-eslint": "^9.0.0-beta.3",
20-
"babel-loader": "^8.0.0-beta.4",
21-
"babel-plugin-transform-react-remove-prop-types": "^0.4.14",
11+
"@babel/cli": "^7.0.0-rc.1",
12+
"@babel/core": "^7.7.2",
13+
"@babel/plugin-proposal-class-properties": "^7.7.0",
14+
"@babel/plugin-transform-modules-commonjs": "^7.7.0",
15+
"@babel/plugin-transform-runtime": "^7.6.2",
16+
"@babel/polyfill": "^7.7.0",
17+
"@babel/preset-env": "^7.7.1",
18+
"@babel/preset-flow": "^7.0.0",
19+
"@babel/preset-react": "^7.7.0",
20+
"babel-eslint": "^10.0.3",
21+
"babel-loader": "^8.0.6",
22+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
2223
"codemirror": "^5.5.0",
2324
"cross-env": "^5.2.0",
2425
"css-loader": "^0.28.11",
@@ -31,6 +32,7 @@
3132
"eslint-plugin-jsx-a11y": "^6.1.0",
3233
"eslint-plugin-react": "^7.10.0",
3334
"flow-bin": "^0.53.1",
35+
"flow-copy-source": "^1.1.0",
3436
"husky": "^0.14.3",
3537
"inject-loader": "^4.0.1",
3638
"isparta-loader": "^2.0.0",
@@ -48,7 +50,7 @@
4850
"react-codemirror": ">=0.1.2",
4951
"react-dom": ">=15.5.0",
5052
"rollup": "^0.62.0",
51-
"rollup-plugin-babel": "^4.0.0-beta.8",
53+
"rollup-plugin-babel": "^4.3.3",
5254
"rollup-plugin-commonjs": "^9.1.4",
5355
"rollup-plugin-node-resolve": "^3.3.0",
5456
"rollup-plugin-replace": "^2.0.0",
@@ -61,13 +63,16 @@
6163
},
6264
"scripts": {
6365
"start": "node server.js",
64-
"build:code": "rollup -c",
65-
"build:flow": "echo \"// @flow\n\nexport * from '../src/react-motion.js';\" > dist/react-motion.cjs.js.flow",
66-
"build": "rm -rf dist && npm run build:code && npm run build:flow",
66+
"prebuild:dist": "rm -rf build",
67+
"build:dist": "rollup -c",
68+
"prebuild:lib": "rm -rf lib",
69+
"build:lib": "babel src --out-dir lib",
70+
"build:flow": "flow-copy-source -v src lib",
71+
"build": "npm run build:dist && npm run build:lib && npm run build:flow",
6772
"build-demos": "webpack",
6873
"lint": "eslint --ext .js,.jsx .",
6974
"flow_check": "flow check",
70-
"prepublish": "npm run build",
75+
"prepublishOnly": "npm run build",
7176
"test": "cross-env NODE_ENV=test karma start ./karma.conf.js --single-run",
7277
"test:travis": "cross-env NODE_ENV=test karma start ./karma.conf.js --single-run",
7378
"test:dev": "cross-env NODE_ENV=test karma start ./karma.conf.js --no-single-run --auto-watch",
@@ -107,7 +112,7 @@
107112
],
108113
"license": "MIT",
109114
"dependencies": {
110-
"@babel/runtime": "7.0.0-rc.1",
115+
"@babel/runtime": "7.7.2",
111116
"performance-now": "^2.1.0",
112117
"prop-types": "^15.5.8",
113118
"raf": "^3.1.0"

rollup.config.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,20 @@ const globals = {
1616
const external = id =>
1717
!id.startsWith('\0') && !id.startsWith('.') && !id.startsWith('/');
1818

19-
const getBabelOptions = ({ useESModules }) => ({
19+
const getBabelOptions = () => ({
20+
babelrc: false,
2021
exclude: '**/node_modules/**',
2122
runtimeHelpers: true,
22-
plugins: [['@babel/transform-runtime', { useESModules }]],
23+
plugins: [
24+
['@babel/proposal-class-properties', { loose: true }],
25+
['transform-react-remove-prop-types', { mode: 'unsafe-wrap' }],
26+
['@babel/transform-runtime', { useESModules: true }],
27+
],
28+
presets: [
29+
['@babel/env', { modules: false, loose: true }],
30+
'@babel/flow',
31+
'@babel/react',
32+
],
2333
});
2434

2535
const commonjsOptions = {
@@ -29,11 +39,11 @@ const commonjsOptions = {
2939
export default [
3040
{
3141
input,
32-
output: { file: 'dist/react-motion.js', format: 'umd', name, globals },
42+
output: { file: 'build/react-motion.js', format: 'umd', name, globals },
3343
external: Object.keys(globals),
3444
plugins: [
3545
nodeResolve(),
36-
babel(getBabelOptions({ useESModules: true })),
46+
babel(getBabelOptions()),
3747
commonjs(commonjsOptions),
3848
replace({ 'process.env.NODE_ENV': JSON.stringify('development') }),
3949
sizeSnapshot(),
@@ -42,11 +52,11 @@ export default [
4252

4353
{
4454
input,
45-
output: { file: 'dist/react-motion.min.js', format: 'umd', name, globals },
55+
output: { file: 'build/react-motion.min.js', format: 'umd', name, globals },
4656
external: Object.keys(globals),
4757
plugins: [
4858
nodeResolve(),
49-
babel(getBabelOptions({ useESModules: true })),
59+
babel(getBabelOptions()),
5060
commonjs(commonjsOptions),
5161
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
5262
sizeSnapshot(),
@@ -58,13 +68,6 @@ export default [
5868
input,
5969
output: { file: pkg.module, format: 'esm' },
6070
external,
61-
plugins: [babel(getBabelOptions({ useESModules: true })), sizeSnapshot()],
62-
},
63-
64-
{
65-
input,
66-
output: { file: pkg.main, format: 'cjs' },
67-
external,
68-
plugins: [babel(getBabelOptions({ useESModules: false }))],
71+
plugins: [babel(getBabelOptions()), sizeSnapshot()],
6972
},
7073
];

0 commit comments

Comments
 (0)