Skip to content

Commit

Permalink
Upgrade dependencies. Replace build with rollup.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbuck committed Jun 2, 2019
1 parent 73d73c1 commit 062ff9a
Show file tree
Hide file tree
Showing 8 changed files with 3,643 additions and 16 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react'],
};
4 changes: 2 additions & 2 deletions license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Jacob Buck
Copyright (c) 2019 Jacob Buck

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
3,608 changes: 3,608 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"lib"
],
"scripts": {
"build": "babel --out-dir lib src",
"build": "rollup -c",
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "npm run build"
},
Expand All @@ -31,14 +31,19 @@
},
"homepage": "https://github.com/jacobbuck/react-beforeunload#readme",
"dependencies": {
"prop-types": "^15.5.10"
"prop-types": "^15.7.2"
},
"peerDependencies": {
"react": ">=15.3.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-es2015": "^6.24.1"
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"husky": "^2.3.0",
"lint-staged": "^8.1.7",
"prettier": "^1.17.1",
"rollup": "^1.13.1",
"rollup-plugin-babel": "^4.3.2"
}
}
4 changes: 4 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
singleQuote: true,
trailingComma: 'es5',
};
11 changes: 11 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import babel from 'rollup-plugin-babel';

export default {
input: 'src/Beforeunload.js',
output: {
file: 'lib/Beforeunload.js',
format: 'cjs',
},
external: ['prop-types', 'react'],
plugins: [babel()],
};
10 changes: 5 additions & 5 deletions src/Beforeunload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import React from "react";
import PropTypes from 'prop-types';
import React from 'react';

class Beforeunload extends React.Component {
static propTypes = {
Expand All @@ -8,11 +8,11 @@ class Beforeunload extends React.Component {
};

componentDidMount() {
window.addEventListener("beforeunload", this.handleBeforeunload);
window.addEventListener('beforeunload', this.handleBeforeunload);
}

componentWillUnmount() {
window.removeEventListener("beforeunload", this.handleBeforeunload);
window.removeEventListener('beforeunload', this.handleBeforeunload);
}

handleBeforeunload = event => {
Expand All @@ -23,7 +23,7 @@ class Beforeunload extends React.Component {
returnValue = onBeforeunload(event);
}

if (typeof returnValue === "string") {
if (typeof returnValue === 'string') {
event.returnValue = returnValue;
return returnValue;
}
Expand Down

0 comments on commit 062ff9a

Please sign in to comment.