Skip to content

Commit

Permalink
stripping comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreardon committed Apr 17, 2018
1 parent 19d9db7 commit 084eafc
Show file tree
Hide file tree
Showing 6 changed files with 475 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .babelrc
@@ -1,3 +1,4 @@
{
"presets": ["flow"]
}
"presets": ["flow", ["env", { "modules": false, "loose": true }]],
"comments": false
}
6 changes: 0 additions & 6 deletions .gitignore
Expand Up @@ -11,12 +11,6 @@ node_modules/
# generated files
dist/

# generated site
site/

# coverage reports
coverage/

# logs
yarn-error.log
npm-debug.log
Expand Down
14 changes: 11 additions & 3 deletions package.json
Expand Up @@ -5,20 +5,28 @@
"main": "dist/react-beautiful-dnd.cjs.js",
"module": "dist/react-beautiful-dnd.esm.js",
"sideEffects": false,
"files": ["/dist", "/src"],
"files": [
"/dist",
"/src"
],
"author": "Alex Reardon <alexreardon@gmail.com>",
"license": "MIT",
"scripts": {
"test": "yarn jest",
"lint": "yarn prettier --debug-check src/** test/**",
"typecheck": "yarn flow",
"validate": "yarn lint && yarn flow"
"validate": "yarn lint && yarn flow",
"build": "yarn rollup --config rollup.config.js"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-flow": "^6.23.0",
"flow-bin": "^0.70.0",
"jest": "^22.4.3",
"prettier": "^1.12.1"
"prettier": "^1.12.1",
"rollup": "^0.58.0",
"rollup-plugin-babel": "^3.0.3"
}
}
29 changes: 29 additions & 0 deletions rollup.config.js
@@ -0,0 +1,29 @@
import babel from 'rollup-plugin-babel';

const input = 'src/index.js';

const babelOptions = {
// only transpile our source code
exclude: 'node_modules/**',
};

export default [
// ESM build
{
input,
output: {
file: 'dist/tiny-invariant.esm.js',
format: 'es',
},
plugins: [babel()],
},
// CommonJS build
{
input,
output: {
file: 'dist/tiny-invariant.cjs.js',
format: 'cjs',
},
plugins: [babel()],
},
];
5 changes: 3 additions & 2 deletions src/index.js
Expand Up @@ -5,7 +5,8 @@ const prefix: string = 'Invariant failed';

// Throw an error if the condition fails
// Strip out error messages for production
export default (condition: mixed, message?: string = '') => {
// > Not providing an inline default argument for message as the result is smaller
export default (condition: mixed, message?: string) => {
if (condition) {
return;
}
Expand All @@ -18,5 +19,5 @@ export default (condition: mixed, message?: string = '') => {
}

// In other environments we throw with the message
throw new Error(`${prefix}: ${message}`);
throw new Error(`${prefix}: ${message || ''}`);
};

0 comments on commit 084eafc

Please sign in to comment.