Skip to content

Commit 63b4290

Browse files
committed
revert back since arrow functions are supported
1 parent ea71a78 commit 63b4290

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

scripts/start.js

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ var PORT = 3000;
2323
// TODO: hide this behind a flag and eliminate dead code on eject.
2424
// This shouldn't be exposed to the user.
2525
var handleCompile;
26-
var isSmokeTest = process.argv.some(function(arg) {
27-
return arg.indexOf('--smoke-test') > -1
28-
});
29-
26+
var isSmokeTest = process.argv.some(arg =>
27+
arg.indexOf('--smoke-test') > -1
28+
);
3029
if (isSmokeTest) {
31-
handleCompile = function(err, stats) {
30+
handleCompile = function (err, stats) {
3231
if (err || stats.hasErrors() || stats.hasWarnings()) {
3332
process.exit(1);
3433
} else {
@@ -70,21 +69,19 @@ function clearConsole() {
7069
}
7170

7271
var compiler = webpack(config, handleCompile);
73-
detect(PORT, function(error, _port) {
72+
detect(PORT, (error, _port) => {
7473

7574
if (PORT !== _port) {
7675
var rl = readline.createInterface({
7776
input: process.stdin,
7877
output: process.stdout
7978
});
8079

81-
rl.question('Something is already running at http://localhost:' + PORT + '. Would you like to run the app at another port instead? [Y/n] ', function(answer) {
80+
rl.question('Something is already running at http://localhost:' + PORT + '. Would you like to run the app at another port instead? [Y/n] ', (answer) => {
8281
if(answer === 'Y') {
8382
PORT = _port;
8483
// Replace the port in webpack config
85-
config.entry = config.entry.map(function(c) {
86-
return c.replace(/(\d+)/g, PORT)
87-
});
84+
config.entry = config.entry.map(c => c.replace(/(\d+)/g, PORT));
8885
compiler = webpack(config, handleCompile);
8986
setupCompiler();
9087
runDevServer();
@@ -116,12 +113,12 @@ function setupCompiler() {
116113
}
117114

118115
var json = stats.toJson();
119-
var formattedErrors = json.errors.map(function(message) {
120-
return 'Error in ' + formatMessage(message)
121-
});
122-
var formattedWarnings = json.warnings.map(function(message) {
123-
return 'Warning in ' + formatMessage(message)
124-
});
116+
var formattedErrors = json.errors.map(message =>
117+
'Error in ' + formatMessage(message)
118+
);
119+
var formattedWarnings = json.warnings.map(message =>
120+
'Warning in ' + formatMessage(message)
121+
);
125122

126123
if (hasErrors) {
127124
console.log(chalk.red('Failed to compile.'));
@@ -132,7 +129,7 @@ function setupCompiler() {
132129
// preceding a much more useful Babel syntax error.
133130
formattedErrors = formattedErrors.filter(isLikelyASyntaxError);
134131
}
135-
formattedErrors.forEach(function(message) {
132+
formattedErrors.forEach(message => {
136133
console.log(message);
137134
console.log();
138135
});
@@ -143,7 +140,7 @@ function setupCompiler() {
143140
if (hasWarnings) {
144141
console.log(chalk.yellow('Compiled with warnings.'));
145142
console.log();
146-
formattedWarnings.forEach(function(message) {
143+
formattedWarnings.forEach(message => {
147144
console.log(message);
148145
console.log();
149146
});
@@ -182,7 +179,7 @@ function runDevServer() {
182179
hot: true, // Note: only CSS is currently hot reloaded
183180
publicPath: config.output.publicPath,
184181
quiet: true
185-
}).listen(PORT, 'localhost', function(err, result) {
182+
}).listen(PORT, 'localhost', (err, result) => {
186183
if (err) {
187184
return console.log(err);
188185
}

0 commit comments

Comments
 (0)