Turn on flow for scripts/start.js (#242)

Summary:
  - The value of `process.stdout.isTTY` is either `true` or `undefined`.
    Flow (reasonably) dislikes this, so we add an explicit check.
  - More `package.json` burnination.

Test Plan:
Note that `require("./package.json").proxy === undefined` in the Node
console, and that `yarn start` works.

wchargin-branch: flow--scripts-start
This commit is contained in:
William Chargin 2018-05-08 14:51:55 -07:00 committed by GitHub
parent 824df7e916
commit 2e8653a3ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
// @no-flow
// @flow
"use strict";
// Do this as the first thing so that any code reading it knows the right env.
@ -33,7 +33,8 @@ const config = require("../config/webpack.config.dev");
const createDevServerConfig = require("../config/webpackDevServer.config");
const useYarn = fs.existsSync(paths.yarnLockFile);
const isInteractive = process.stdout.isTTY;
const isInteractive =
typeof process.stdout.isTTY !== "undefined" && process.stdout.isTTY;
// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
@ -68,12 +69,12 @@ choosePort(HOST, DEFAULT_PORT)
return;
}
const protocol = process.env.HTTPS === "true" ? "https" : "http";
const appName = require(paths.appPackageJson).name;
const appName = "sourcecred";
const urls = prepareUrls(protocol, HOST, port);
// Create a webpack compiler that is configured with custom messages.
const compiler = createCompiler(webpack, config, appName, urls, useYarn);
// Load proxy config
const proxySetting = require(paths.appPackageJson).proxy;
const proxySetting = undefined;
const proxyConfig = prepareProxy(proxySetting, paths.appPublic);
// Serve webpack assets generated by the compiler over a web sever.
const serverConfig = createDevServerConfig(