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

chore(build): add distribution files #186

Merged
merged 2 commits into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Generated files
dist/
lib/
flow-typed/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules/

# generated files
lib/
dist/

# generated site
site/
Expand Down
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,21 @@
"version": "2.6.4",
"description": "Beautiful, accessible drag and drop for lists with React.js",
"author": "Alex Reardon <[email protected]>",
"keywords": [
"drag and drop",
"dnd",
"react",
"react.js",
"natural",
"beautiful"
],
"keywords": ["drag and drop", "dnd", "react", "react.js", "natural", "beautiful"],
"bugs": {
"url": "https://github.com/atlassian/react-beautiful-dnd/issues"
},
"main": "lib/index.js",
"files": [
"/lib"
],
"files": ["/lib", "/dist"],
Copy link

@treshugart treshugart Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to also add a browser field next to main that maps to dist/index.js (it will be minified by bundlers, however unpkg won't serve the min file).

"scripts": {
"test": "jest --config ./jest.config.js",
"validate": "yarn run lint && yarn run typecheck",
"lint": "eslint .",
"typecheck": "flow check",
"build": "yarn run build:clean && yarn run build:lib && yarn run build:flow",
"build":
"yarn run build:clean && yarn run build:lib && yarn run build:flow && yarn run build:dist",
"build:clean": "rimraf lib",
"build:dist": "rollup -c && rollup -c --min",
"build:lib": "babel src -d lib",
"build:flow": "flow-copy-source --verbose src lib",
"storybook": "start-storybook -p 9002",
Expand Down Expand Up @@ -71,6 +64,11 @@
"react-dom": "^15.6.1",
"react-test-renderer": "^15.6.1",
"rimraf": "^2.6.2",
"rollup": "^0.51.8",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-uglify": "^2.0.1",
"styled-components": "^2.2.3"
},
"license": "Apache-2.0",
Expand Down
23 changes: 23 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';
import babel from 'rollup-plugin-babel';
import yargs from 'yargs';

const args = yargs.argv;
const external = ['react'];

export default {
input: './lib/index.js',
output: {
file: `dist/index${args.min ? '.min' : ''}.js`,
format: 'umd',
},
name: 'ReactBeautifulDnd',
plugins: [babel({ exclude: 'node_modules/**', babelrc: false }), resolve(), commonjs()].concat(
args.min ? uglify() : []
),
sourceMap: false,
external,
globals: { react: 'React' },
};
Loading