renaming backend, cellxgene to server, client respectively

This commit is contained in:
Charlotte Weaver
2018-06-26 11:41:32 -07:00
parent 59dcfe2bc4
commit dd5fa57259
97 changed files with 4 additions and 7 deletions
+57
View File
@@ -0,0 +1,57 @@
/* eslint-disable */
// 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";
var PORT = process.env.PORT || 3000;
// Set up compiler
var compiler = webpack(config);
compiler.plugin("invalid", () => {
utils.clearConsole();
console.log("Compiling...");
});
compiler.plugin("done", stats => {
utils.formatStats(stats, PORT);
});
// Launch server
var app = express();
app.use(historyApiFallback({ verbose: false }));
app.use(
require("webpack-dev-middleware")(compiler, {
noInfo: true,
publicPath: config.output.publicPath
})
);
app.use(require("webpack-hot-middleware")(compiler));
app.use(favicon("./favicon.png"));
app.get("*", (req, res) => {
res.sendFile(path.resolve("index.html"));
});
app.listen(PORT, err => {
if (err) {
console.log(err);
return;
}
utils.clearConsole();
console.log(chalk.cyan("Starting the development server..."));
console.log();
});
+32
View File
@@ -0,0 +1,32 @@
/* eslint-disable */
// 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(favicon("./build/favicon.png"));
app.get("*", (req, res) => {
res.sendFile(path.resolve("./build/index.html"));
});
app.listen(PORT, err => {
if (err) {
console.log(err);
return;
}
utils.clearConsole();
console.log(chalk.cyan("Production server started on port " + PORT));
console.log();
});
+80
View File
@@ -0,0 +1,80 @@
/* eslint-disable */
// jshint esversion: 6
var chalk = require("chalk");
var friendlySyntaxErrorLabel = "Syntax error:";
function isLikelyASyntaxError(message) {
return message.indexOf(friendlySyntaxErrorLabel) !== -1;
}
function formatMessage(message) {
return message
.replace("Module build failed: SyntaxError:", friendlySyntaxErrorLabel)
.replace(
/Module not found: Error: Cannot resolve 'file' or 'directory'/,
"Module not found:"
)
.replace(/^\s*at\s.*:\d+:\d+[\s\)]*\n/gm, "")
.replace("./~/css-loader!./~/postcss-loader!", "");
}
var clearConsole = () => {
process.stdout.write("\x1bc");
};
var formatStats = (stats, port) => {
clearConsole();
var hasErrors = stats.hasErrors();
var hasWarnings = stats.hasWarnings();
if (!hasErrors && !hasWarnings) {
console.log(chalk.green("Compiled successfully!"));
console.log();
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)
);
var formattedWarnings = json.warnings.map(
message => "Warning in " + formatMessage(message)
);
if (hasErrors) {
console.log(chalk.red("Failed to compile."));
console.log();
if (formattedErrors.some(isLikelyASyntaxError)) {
formattedErrors = formattedErrors.filter(isLikelyASyntaxError);
}
formattedErrors.forEach(message => {
console.log(message);
console.log();
});
return;
}
if (hasWarnings) {
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(
"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."
);
}
};
module.exports = { formatStats: formatStats, clearConsole: clearConsole };