Skip to content

Commit c4de5ef

Browse files
authored
Merge pull request #519 from jlengrand/feat/update-more-deps
Upgrade all deprecated dependencies
2 parents efcb696 + 3093214 commit c4de5ef

File tree

6 files changed

+40
-31
lines changed

6 files changed

+40
-31
lines changed

CONTRIBUTING.md

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ Following these guidelines helps to communicate that you respect the time of the
1616

1717
3. Run `npm link` in the root `create-elm-app` folder to install local module globally.
1818

19+
## Running tests
20+
21+
You can run tests by running `$npm run test`.
22+
23+
If you run into failures while ugrading dependencies, running `$npm run app:build` will allow you to check the build faster.
24+
25+
_NOTE: Functional tests may take a while to run because they interact with your system_.
26+
27+
1928
## Submitting a Pull Request
2029

2130
When you have a local copy of the project up and running, create a new branch with a name, such as `patch-1`

config/paths.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
const path = require('path');
44
const fs = require('fs');
55
const url = require('url');
6-
const cosmiconfig = require('cosmiconfig');
6+
const { cosmiconfigSync } = require('cosmiconfig');
77

88
// Make sure any symlinks in the project folder are resolved:
99
// https://github.com/facebookincubator/create-react-app/issues/637
1010
const appDirectory = fs.realpathSync(process.cwd());
11-
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
11+
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);
1212

1313
// We look for configration in files supported by cosmiconfig by default:
1414
// https://github.com/davidtheclark/cosmiconfig
15-
const explorer = cosmiconfig('elmapp');
16-
const result = explorer.searchSync(appDirectory);
15+
const explorerSync = cosmiconfigSync('elmapp');
16+
const result = explorerSync.search(appDirectory);
1717
const config = result ? result.config : loadElmJson();
18-
const id = x => x;
18+
const id = (x) => x;
1919
const configureWebpack =
2020
typeof config.configureWebpack === 'function' ? config.configureWebpack : id;
2121

@@ -46,7 +46,7 @@ function ensureSlash(path, needsSlash) {
4646
return path;
4747
}
4848

49-
const getPublicUrl = appConfig => {
49+
const getPublicUrl = (appConfig) => {
5050
if (envPublicUrl) {
5151
return envPublicUrl;
5252
}
@@ -81,5 +81,5 @@ module.exports = {
8181
servedPath: getServedPath(config),
8282
proxy: config.proxy,
8383
setupProxy: config.setupProxy,
84-
configureWebpack
84+
configureWebpack,
8585
};

config/webpack.config.prod.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ module.exports = {
6161
minimizer: [
6262
new UglifyJsPlugin({
6363
uglifyOptions: {
64+
warnings: false,
6465
// ES5 is required in the minified code if you want compatibility with IE11,
6566
// otherwise you can bump it up to ES8
6667
ecma: 5,
6768
// Compression settings mostly based on <https://guide.elm-lang.org/optimization/asset_size.html>
6869
compress: {
6970
passes: 2,
70-
warnings: false,
7171
// Disabled because of an issue with Uglify breaking seemingly valid code:
7272
// https://github.com/facebook/create-react-app/issues/2376
7373
// Pending further investigation:
@@ -96,9 +96,6 @@ module.exports = {
9696
'F9',
9797
],
9898
},
99-
mangle: {
100-
safari10: true,
101-
},
10299
output: {
103100
comments: false,
104101
// Turned on because emoji and regex is not minified properly using default
@@ -346,7 +343,9 @@ module.exports = {
346343
publicPath: publicPath,
347344
}),
348345
// Copies the public folder to the build folder
349-
new CopyPlugin([{ from: './public/', to: './' }]),
346+
new CopyPlugin({
347+
patterns: [{ from: './public/', to: './' }],
348+
}),
350349
// Generate a service worker script that will precache, and keep up to date,
351350
// the HTML & assets that are part of the Webpack build.
352351
new workboxPlugin.GenerateSW({

package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,35 @@
2727
"babel-loader": "8.2.2",
2828
"babel-runtime": "6.26.0",
2929
"case-sensitive-paths-webpack-plugin": "2.3.0",
30-
"chalk": "2.4.2",
30+
"chalk": "4.1.0",
3131
"cli-table": "0.3.4",
3232
"connect-history-api-fallback": "1.6.0",
33-
"copy-webpack-plugin": "5.1.2",
34-
"cosmiconfig": "5.2.1",
33+
"copy-webpack-plugin": "6.2.0",
34+
"cosmiconfig": "7.0.0",
3535
"cross-spawn": "7.0.3",
3636
"css-loader": "4.3.0",
3737
"dotenv": "8.2.0",
3838
"elm": "latest-0.19.1",
3939
"elm-asset-webpack-loader": "1.1.2",
4040
"elm-hot-webpack-loader": "1.1.7",
4141
"elm-test": "latest-0.19.1",
42-
"elm-webpack-loader": "6.0.1",
42+
"elm-webpack-loader": "7.0.1",
4343
"file-loader": "6.2.0",
44-
"fs-extra": "6.0.1",
44+
"fs-extra": "9.0.1",
4545
"html-webpack-plugin": "4.5.0",
46-
"http-proxy-middleware": "0.21.0",
46+
"http-proxy-middleware": "1.0.5",
4747
"mini-css-extract-plugin": "0.12.0",
4848
"minimist": "1.2.5",
4949
"object-assign": "4.1.1",
50-
"optimize-css-assets-webpack-plugin": "5.0.3",
50+
"optimize-css-assets-webpack-plugin": "5.0.4",
5151
"postcss-flexbugs-fixes": "4.2.1",
5252
"postcss-loader": "4.1.0",
5353
"postcss-safe-parser": "5.0.2",
5454
"promise": "8.1.0",
5555
"prompt": "1.0.0",
5656
"react-dev-utils": "6.1.1",
57-
"react-error-overlay": "4.0.1",
58-
"sockjs-client": "1.4.0",
57+
"react-error-overlay": "6.0.7",
58+
"sockjs-client": "1.5.0",
5959
"string-replace-loader": "2.3.0",
6060
"strip-ansi": "6.0.0",
6161
"style-loader": "1.3.0",
@@ -65,7 +65,7 @@
6565
"webpack-dev-server": "3.11.0",
6666
"webpack-manifest-plugin": "2.2.0",
6767
"whatwg-fetch": "3.5.0",
68-
"workbox-webpack-plugin": "4.3.1"
68+
"workbox-webpack-plugin": "5.1.4"
6969
},
7070
"devDependencies": {
7171
"@commitlint/cli": "11.0.0",
@@ -141,3 +141,4 @@
141141
}
142142
}
143143
}
144+

scripts/utils/formatElmCompilerErrors.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
var chalk = require('chalk');
4-
var ctx = new chalk.constructor({ enabled: true });
4+
var ctx = new chalk.Instance({ enabled: true });
55
var error = ctx.bold.red;
66
var filename = ctx.cyan;
77
var isBrowser = typeof window === 'object';
@@ -28,16 +28,16 @@ module.exports = function formatElmCompilerErrors(messages) {
2828
return errors.length > 0
2929
? {
3030
errors: errors
31-
.map(x =>
31+
.map((x) =>
3232
x
3333
.replace(/(--\s[A-Z\s]+-+\s.*\.elm\r?\n)/g, filename('$1'))
3434
.replace(/(\n\s*)(\^+)/g, '$1' + error('$2'))
3535
.replace(/(\d+)(\|>)/g, '$1' + error('$2'))
3636
)
3737
.map(stripRedundantInfo)
3838
// drop errors that only contain whitespace
39-
.filter(err => err.trim()),
40-
warnings: warnings
39+
.filter((err) => err.trim()),
40+
warnings: warnings,
4141
}
4242
: messages;
4343
};

tests/elm-app.eject.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ const testAppDir = path.join(rootDir, testAppName);
1212
const createElmAppCmd = path.join(rootDir, 'bin/create-elm-app-cli.js');
1313
const elmAppCmd = path.join(rootDir, 'bin/elm-app-cli.js');
1414

15-
describe('Ejecting Elm application. (Please wait...)', function() {
15+
describe('Ejecting Elm application. (Please wait...)', function () {
1616
this.timeout(60000);
1717

18-
before(done => {
18+
before((done) => {
1919
const { status } = spawn.sync('node', [createElmAppCmd, testAppName]);
2020
if (status === 0) {
2121
process.chdir(testAppDir);
@@ -33,7 +33,7 @@ describe('Ejecting Elm application. (Please wait...)', function() {
3333
it(`'elm-app eject' should succeed in '${testAppName}'`, () => {
3434
const { status, output } = spawn.sync('node', [elmAppCmd, 'eject']);
3535
const outputString = output
36-
.map(out => (out !== null ? out.toString() : ''))
36+
.map((out) => (out !== null ? out.toString() : ''))
3737
.join('');
3838

3939
expect(status, 'to be', 0);
@@ -50,7 +50,7 @@ describe('Ejecting Elm application. (Please wait...)', function() {
5050
start: 'node scripts/start.js',
5151
make: 'elm make',
5252
repl: 'elm repl',
53-
reactor: 'elm reactor'
53+
reactor: 'elm reactor',
5454
});
5555
});
5656

@@ -77,7 +77,7 @@ describe('Ejecting Elm application. (Please wait...)', function() {
7777
it('It should be possible to build ejected application, using npm scripts', () => {
7878
const { status, output } = spawn.sync('npm', ['run', 'build']);
7979
const outputString = output
80-
.map(out => (out !== null ? out.toString() : ''))
80+
.map((out) => (out !== null ? out.toString() : ''))
8181
.join('');
8282

8383
expect(status, 'to be', 0);

0 commit comments

Comments
 (0)