mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-28 17:28:11 +08:00
Prettier
This commit is contained in:
+19
-18
@@ -1,26 +1,27 @@
|
||||
/* eslint-disable */
|
||||
var path = require('path');
|
||||
var historyApiFallback = require('connect-history-api-fallback');
|
||||
var chalk = require('chalk');
|
||||
var express = require('express');
|
||||
var favicon = require('serve-favicon');
|
||||
var webpack = require('webpack');
|
||||
var config = require('../configuration/webpack/webpack.config.dev');
|
||||
var utils = require('./utils');
|
||||
// jshint esversion: 6
|
||||
var path = require("path");
|
||||
var historyApiFallback = require("connect-history-api-fallback");
|
||||
var chalk = require("chalk");
|
||||
var express = require("express");
|
||||
var favicon = require("serve-favicon");
|
||||
var webpack = require("webpack");
|
||||
var config = require("../configuration/webpack/webpack.config.dev");
|
||||
var utils = require("./utils");
|
||||
|
||||
process.env.NODE_ENV = 'development';
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
var PORT = process.env.PORT || 3000;
|
||||
|
||||
// Set up compiler
|
||||
var compiler = webpack(config);
|
||||
|
||||
compiler.plugin('invalid', () => {
|
||||
compiler.plugin("invalid", () => {
|
||||
utils.clearConsole();
|
||||
console.log('Compiling...');
|
||||
console.log("Compiling...");
|
||||
});
|
||||
|
||||
compiler.plugin('done', stats => {
|
||||
compiler.plugin("done", stats => {
|
||||
utils.formatStats(stats, PORT);
|
||||
});
|
||||
|
||||
@@ -30,18 +31,18 @@ var app = express();
|
||||
app.use(historyApiFallback({ verbose: false }));
|
||||
|
||||
app.use(
|
||||
require('webpack-dev-middleware')(compiler, {
|
||||
require("webpack-dev-middleware")(compiler, {
|
||||
noInfo: true,
|
||||
publicPath: config.output.publicPath
|
||||
})
|
||||
);
|
||||
|
||||
app.use(require('webpack-hot-middleware')(compiler));
|
||||
app.use(require("webpack-hot-middleware")(compiler));
|
||||
|
||||
app.use(favicon('./favicon.png'));
|
||||
app.use(favicon("./favicon.png"));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.resolve('index.html'));
|
||||
app.get("*", (req, res) => {
|
||||
res.sendFile(path.resolve("index.html"));
|
||||
});
|
||||
|
||||
app.listen(PORT, err => {
|
||||
@@ -51,6 +52,6 @@ app.listen(PORT, err => {
|
||||
}
|
||||
|
||||
utils.clearConsole();
|
||||
console.log(chalk.cyan('Starting the development server...'));
|
||||
console.log(chalk.cyan("Starting the development server..."));
|
||||
console.log();
|
||||
});
|
||||
|
||||
+12
-11
@@ -1,22 +1,23 @@
|
||||
/* eslint-disable */
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var chalk = require('chalk');
|
||||
var express = require('express');
|
||||
var favicon = require('serve-favicon');
|
||||
var utils = require('./utils');
|
||||
// jshint esversion: 6
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
var chalk = require("chalk");
|
||||
var express = require("express");
|
||||
var favicon = require("serve-favicon");
|
||||
var utils = require("./utils");
|
||||
|
||||
var PORT = process.env.PORT || 80;
|
||||
|
||||
// Launch server
|
||||
var app = express();
|
||||
|
||||
app.use(express.static('./build'));
|
||||
app.use(express.static("./build"));
|
||||
|
||||
app.use(favicon('./build/favicon.png'));
|
||||
app.use(favicon("./build/favicon.png"));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.resolve('./build/index.html'));
|
||||
app.get("*", (req, res) => {
|
||||
res.sendFile(path.resolve("./build/index.html"));
|
||||
});
|
||||
|
||||
app.listen(PORT, err => {
|
||||
@@ -26,6 +27,6 @@ app.listen(PORT, err => {
|
||||
}
|
||||
|
||||
utils.clearConsole();
|
||||
console.log(chalk.cyan('Production server started on port ' + PORT));
|
||||
console.log(chalk.cyan("Production server started on port " + PORT));
|
||||
console.log();
|
||||
});
|
||||
|
||||
+21
-20
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable */
|
||||
var chalk = require('chalk');
|
||||
// jshint esversion: 6
|
||||
var chalk = require("chalk");
|
||||
|
||||
var friendlySyntaxErrorLabel = 'Syntax error:';
|
||||
var friendlySyntaxErrorLabel = "Syntax error:";
|
||||
|
||||
function isLikelyASyntaxError(message) {
|
||||
return message.indexOf(friendlySyntaxErrorLabel) !== -1;
|
||||
@@ -9,16 +10,16 @@ function isLikelyASyntaxError(message) {
|
||||
|
||||
function formatMessage(message) {
|
||||
return message
|
||||
.replace('Module build failed: SyntaxError:', friendlySyntaxErrorLabel)
|
||||
.replace("Module build failed: SyntaxError:", friendlySyntaxErrorLabel)
|
||||
.replace(
|
||||
/Module not found: Error: Cannot resolve 'file' or 'directory'/,
|
||||
'Module not found:'
|
||||
"Module not found:"
|
||||
)
|
||||
.replace(/^\s*at\s.*:\d+:\d+[\s\)]*\n/gm, '')
|
||||
.replace('./~/css-loader!./~/postcss-loader!', '');
|
||||
.replace(/^\s*at\s.*:\d+:\d+[\s\)]*\n/gm, "")
|
||||
.replace("./~/css-loader!./~/postcss-loader!", "");
|
||||
}
|
||||
var clearConsole = () => {
|
||||
process.stdout.write('\x1bc');
|
||||
process.stdout.write("\x1bc");
|
||||
};
|
||||
|
||||
var formatStats = (stats, port) => {
|
||||
@@ -26,23 +27,23 @@ var formatStats = (stats, port) => {
|
||||
var hasErrors = stats.hasErrors();
|
||||
var hasWarnings = stats.hasWarnings();
|
||||
if (!hasErrors && !hasWarnings) {
|
||||
console.log(chalk.green('Compiled successfully!'));
|
||||
console.log(chalk.green("Compiled successfully!"));
|
||||
console.log();
|
||||
console.log('The app is running at http://localhost:' + port + '/');
|
||||
console.log("The app is running at http://localhost:" + port + "/");
|
||||
console.log();
|
||||
return;
|
||||
}
|
||||
|
||||
var json = stats.toJson();
|
||||
var formattedErrors = json.errors.map(
|
||||
message => 'Error in ' + formatMessage(message)
|
||||
message => "Error in " + formatMessage(message)
|
||||
);
|
||||
var formattedWarnings = json.warnings.map(
|
||||
message => 'Warning in ' + formatMessage(message)
|
||||
message => "Warning in " + formatMessage(message)
|
||||
);
|
||||
|
||||
if (hasErrors) {
|
||||
console.log(chalk.red('Failed to compile.'));
|
||||
console.log(chalk.red("Failed to compile."));
|
||||
console.log();
|
||||
if (formattedErrors.some(isLikelyASyntaxError)) {
|
||||
formattedErrors = formattedErrors.filter(isLikelyASyntaxError);
|
||||
@@ -55,23 +56,23 @@ var formatStats = (stats, port) => {
|
||||
}
|
||||
|
||||
if (hasWarnings) {
|
||||
console.log(chalk.yellow('Compiled with warnings.'));
|
||||
console.log(chalk.yellow("Compiled with warnings."));
|
||||
console.log();
|
||||
formattedWarnings.forEach(message => {
|
||||
console.log(message);
|
||||
console.log();
|
||||
});
|
||||
|
||||
console.log('You may use special comments to disable some warnings.');
|
||||
console.log("You may use special comments to disable some warnings.");
|
||||
console.log(
|
||||
'Use ' +
|
||||
chalk.yellow('// eslint-disable-next-line') +
|
||||
' to ignore the next line.'
|
||||
"Use " +
|
||||
chalk.yellow("// eslint-disable-next-line") +
|
||||
" to ignore the next line."
|
||||
);
|
||||
console.log(
|
||||
'Use ' +
|
||||
chalk.yellow('/* eslint-disable */') +
|
||||
' to ignore all warnings in a file.'
|
||||
"Use " +
|
||||
chalk.yellow("/* eslint-disable */") +
|
||||
" to ignore all warnings in a file."
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user