Skip to content

Commit be8c7bf

Browse files
committed
fix: Show deprecation warning regarding elm.json usage
1 parent 2d907c8 commit be8c7bf

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

scripts/build.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
2323
const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
2424
const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
2525
const formatElmCompilerErrors = require('./utils/formatElmCompilerErrors');
26+
const warn = require('./utils/warn');
2627

2728
const measureFileSizesBeforeBuild =
2829
FileSizeReporter.measureFileSizesBeforeBuild;
@@ -72,6 +73,7 @@ measureFileSizesBeforeBuild(paths.appBuild)
7273
console.log('File sizes after gzip:\n');
7374
printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild);
7475
console.log();
76+
warn(paths.elmJson);
7577
},
7678
err => {
7779
console.error(chalk.red('Failed to compile.\n'));
@@ -83,6 +85,7 @@ measureFileSizesBeforeBuild(paths.appBuild)
8385
// Create the production build and print the deployment instructions.
8486
function build(previousFileSizes) {
8587
const withDebugger = process.env.ELM_DEBUGGER === 'true' ? true : false;
88+
console.log();
8689
if (withDebugger) {
8790
console.log(
8891
`Creating a ${process.env.NODE_ENV} build with debugger enabled...`

scripts/start.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const openBrowser = require('react-dev-utils/openBrowser');
3131
const createDevServerConfig = require('../config/webpackDevServer.config');
3232
const formatElmCompilerErrors = require('./utils/formatElmCompilerErrors');
3333
const paths = require('../config/paths');
34+
const warn = require('./utils/warn');
3435

3536
if (fs.existsSync('elm.json') === false) {
3637
console.log('Please, run the build script from project root directory');
@@ -108,8 +109,10 @@ function createCompiler(webpack, config, appName, urls) {
108109
if (isSuccessful) {
109110
console.log(chalk.green('Compiled successfully!'));
110111
}
112+
111113
if (isSuccessful && (isInteractive || isFirstCompile)) {
112114
printInstructions(appName, urls);
115+
warn(paths.elmJson);
113116
}
114117
isFirstCompile = false;
115118

scripts/utils/warn.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const chalk = require('chalk');
2+
3+
module.exports = function warn(elmJsonPath) {
4+
const elmJson = require(elmJsonPath);
5+
if (elmJson.homepage || elmJson.proxy) {
6+
console.log();
7+
console.log(chalk.yellow('Warning:'));
8+
console.log();
9+
console.log(
10+
' Using elm.json for configuring "homebage" and "proxy" is deprecated.'
11+
);
12+
console.log(' This feature will be removed in the future versions.');
13+
console.log();
14+
}
15+
};

0 commit comments

Comments
 (0)