Fix up for webpack 5.

This commit is contained in:
Douglas Muth 2021-03-12 17:08:21 -05:00
parent aa00770b32
commit d174c20888
7 changed files with 3175 additions and 2612 deletions

View file

@ -53,13 +53,21 @@ design feature of this app--I want it to be as easy to get up and running as pos
A local webserver can be set up by running `npm install http-server -g` to install it, then `http-server` to listen on http://localhost:8080/ A local webserver can be set up by running `npm install http-server -g` to install it, then `http-server` to listen on http://localhost:8080/
In summary: ## In summary:
- `npp run clean` - Cleanup after a previous run
- `npm install` - Install NPM packages used by Diceware - `npm install` - Install NPM packages used by Diceware
- `webpack --watch --mode development` - Pack Javscript files - `npm run dev-build` - Run webpack to pack Javascript files and watch for changes.
- `http-server` - `http-server`
- `npm test` - Make sure you didn't break any of the core logic! - `npm test` - Make sure you didn't break any of the core logic!
- `webpack` - Pack Javscript files in production mode (smaller file but takes longer) - `npm run build` - Webpack Javscript files in production mode (smaller file but takes longer)
- `./go-sync-to-s3.sh` - Do this if you're me, to upload to S3. If you're not me, you'll need to do something else, or possibly nothing at all.
## In practice:
- `npm run clean; npm run dev-build` - Run webpack in dev mode while working on Javascript
- `npm run clean; npm run build` - Run webpack in prod mode to produce final Javascript bundle
- `./go-sync-to-s3.sh` - Do this if you're me, to upload to S3. If you're not me, you'll need to do something else, or possibly nothing at all. - `./go-sync-to-s3.sh` - Do this if you're me, to upload to S3. If you're not me, you'll need to do something else, or possibly nothing at all.

10
dist/bundle.js vendored

File diff suppressed because one or more lines are too long

35
dist/bundle.js.LICENSE.txt vendored Normal file
View file

@ -0,0 +1,35 @@
/* @preserve
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Petka Antonov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* 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.
*
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

View file

@ -163,7 +163,7 @@
Weak passwords are a big flaw in computer security due to a lack of "entropy" Weak passwords are a big flaw in computer security due to a lack of "entropy"
or randomness. For example, how many times have you used the name of a pet or relative or street or randomness. For example, how many times have you used the name of a pet or relative or street
in a password, or perhaps the number "1"? Not very random, is it? :-) in a password, or perhaps the number "1"? Not very random, is it? 😃
Worse still, if Worse still, if
passwords are reused between services, <a href="http://www.businessinsider.com/biggest-password-mistake-2014-8" passwords are reused between services, <a href="http://www.businessinsider.com/biggest-password-mistake-2014-8"
>that increases your security risk</a>. This is not theoretical, <a href="http://www.techspot.com/news/65255-hackers-access-github-accounts-reusing-passwords-previous-leaks.html" >that increases your security risk</a>. This is not theoretical, <a href="http://www.techspot.com/news/65255-hackers-access-github-accounts-reusing-passwords-previous-leaks.html"
@ -340,13 +340,12 @@ There are several ways to get in touch with me:
<li><a href="https://github.com/dmuth/diceware/issues">Opening an Issue in GitHub</a> <li><a href="https://github.com/dmuth/diceware/issues">Opening an Issue in GitHub</a>
</ul> </ul>
Feel free to reach out to me if you have any comments, suggestions, bug reports, or wish to buy me a beer. :-) Feel free to reach out to me if you have any comments, suggestions, bug reports, or wish to buy me a beer. 😃🍻
<br/> <br/>
<br/> <br/>
<br/> <br/>
<br/> <br/>
</div> </div>
</div> </div>

5664
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,10 @@
"test": "tests" "test": "tests"
}, },
"scripts": { "scripts": {
"test": "mocha ./tests/test.js" "test": "mocha ./tests/test.js",
"clean": "rm -rfv dist/*bundle.js* node_modules package-lock.json",
"build": "npm install; webpack --mode production",
"dev-build": "npm install; webpack --watch --mode development"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -23,10 +26,15 @@
"devDependencies": { "devDependencies": {
"mocha": "^4.0.1", "mocha": "^4.0.1",
"should": "^13.1.3", "should": "^13.1.3",
"webpack": "^3.8.1" "webpack": "^5.25.0",
"webpack-cli": "^4.5.0"
}, },
"dependencies": { "dependencies": {
"bluebird": "^3.5.1", "buffer": "^6.0.3",
"random-number-csprng": "^1.0.2" "crypto-browserify": "^3.12.0",
"process": "^0.11.10",
"random-number-csprng": "^1.0.2",
"stream-browserify": "^3.0.0",
"vm-browserify": "^1.1.2"
} }
} }

View file

@ -4,6 +4,8 @@
// //
var path = require('path'); var path = require('path');
const webpack = require('webpack')
// //
// Compile main.js (and its dependencies) into dist/bundle.js. // Compile main.js (and its dependencies) into dist/bundle.js.
// //
@ -12,6 +14,19 @@ module.exports = {
output: { output: {
filename: 'bundle.js', filename: 'bundle.js',
path: path.resolve(__dirname, 'dist') path: path.resolve(__dirname, 'dist')
},
resolve: {
fallback: {
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"vm": require.resolve("vm-browserify")
} }
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser.js'
})
]
}; };