Skip to content

Commit aa40a96

Browse files
committed
update for function declartion style
1 parent ac6d9d2 commit aa40a96

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

scripts/start.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ 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(arg =>
26+
var isSmokeTest = process.argv.some(function(arg) {
2727
arg.indexOf('--smoke-test') > -1
28-
);
28+
});
29+
2930
if (isSmokeTest) {
30-
handleCompile = (err, stats) => {
31+
handleCompile = function(err, stats) {
3132
if (err || stats.hasErrors() || stats.hasWarnings()) {
3233
process.exit(1);
3334
} else {
@@ -69,19 +70,21 @@ function clearConsole() {
6970
}
7071

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

7475
if (PORT !== _port) {
7576
var rl = readline.createInterface({
7677
input: process.stdin,
7778
output: process.stdout
7879
});
7980

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 => {
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) {
8182
if(answer === 'Y') {
8283
PORT = _port;
83-
// Replace the port in webpack config
84-
config.entry = config.entry.map(c => c.replace(/(\d+)/g, PORT));
84+
// Replace the port in webpack config
85+
config.entry = config.entry.map(function(c) {
86+
return c.replace(/(\d+)/g, PORT)
87+
});
8588
compiler = webpack(config, handleCompile);
8689
setupCompiler();
8790
runDevServer();
@@ -95,12 +98,12 @@ detect(PORT, (error, _port) => {
9598
});
9699

97100
function setupCompiler() {
98-
compiler.plugin('invalid', () => {
101+
compiler.plugin('invalid', function() {
99102
clearConsole();
100103
console.log('Compiling...');
101104
});
102105

103-
compiler.plugin('done', stats => {
106+
compiler.plugin('done', function(stats) {
104107
clearConsole();
105108
var hasErrors = stats.hasErrors();
106109
var hasWarnings = stats.hasWarnings();
@@ -113,12 +116,12 @@ function setupCompiler() {
113116
}
114117

115118
var json = stats.toJson();
116-
var formattedErrors = json.errors.map(message =>
119+
var formattedErrors = json.errors.map(function(message) {
117120
'Error in ' + formatMessage(message)
118-
);
119-
var formattedWarnings = json.warnings.map(message =>
121+
});
122+
var formattedWarnings = json.warnings.map(function(message) {
120123
'Warning in ' + formatMessage(message)
121-
);
124+
});
122125

123126
if (hasErrors) {
124127
console.log(chalk.red('Failed to compile.'));
@@ -129,7 +132,7 @@ function setupCompiler() {
129132
// preceding a much more useful Babel syntax error.
130133
formattedErrors = formattedErrors.filter(isLikelyASyntaxError);
131134
}
132-
formattedErrors.forEach(message => {
135+
formattedErrors.forEach(function(message) {
133136
console.log(message);
134137
console.log();
135138
});
@@ -140,7 +143,7 @@ function setupCompiler() {
140143
if (hasWarnings) {
141144
console.log(chalk.yellow('Compiled with warnings.'));
142145
console.log();
143-
formattedWarnings.forEach(message => {
146+
formattedWarnings.forEach(function(message) {
144147
console.log(message);
145148
console.log();
146149
});
@@ -179,7 +182,7 @@ function runDevServer() {
179182
hot: true, // Note: only CSS is currently hot reloaded
180183
publicPath: config.output.publicPath,
181184
quiet: true
182-
}).listen(PORT, 'localhost', (err, result) => {
185+
}).listen(PORT, 'localhost', function(err, result) {
183186
if (err) {
184187
return console.log(err);
185188
}

0 commit comments

Comments
 (0)