This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "presets": ["env", "react"] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm i babel-cli -D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "main": "dist/index.js", | |
| "scripts": { | |
| ... | |
| "transpile": "babel src -d dist --copy-files" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "scripts": { | |
| ... | |
| "prepublishOnly": "npm run transpile" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .npmignore | |
| src | |
| examples | |
| .babelrc | |
| .gitignore | |
| webpack.config.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "scripts": { | |
| ... | |
| "build": "webpack --mode production", | |
| "deploy": "gh-pages -d examples/dist", | |
| "publish-demo": "npm run build && npm run deploy" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| output: { | |
| path: path.join(__dirname, "examples/dist"), | |
| filename: "bundle.js" | |
| }, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .gitignore | |
| node_modules | |
| dist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PasswordGenerator extends Component { | |
| constructor(props){ | |
| super(props) | |
| this.state = { | |
| password: '', | |
| length: 12, | |
| digits: 4, | |
| symbols: 2, | |
| copy: false, | |
| strengthScore: 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| componentDidMount(){ | |
| this.generatePassword() | |
| this.checkPasswordStrength() | |
| document.getElementById("copy_btn").addEventListener("click", this.copyToClipboard); | |
| } | |
| componentWillUnmount(){ | |
| document.getElementById("copy_btn").removeEventListener("click", this.copyToClipboard); | |
| } |