2017-07-07 13:28:29 -04:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Copyright (c) 2017-present, Facebook, Inc.
|
|
|
|
|
*
|
2017-10-05 14:14:49 -04:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-07-07 13:28:29 -04:00
|
|
|
*/
|
|
|
|
|
|
2017-07-10 19:38:35 -04:00
|
|
|
require("babel-register")({
|
2017-09-28 17:46:29 -04:00
|
|
|
babelrc: false,
|
|
|
|
|
only: [__dirname, process.cwd() + "/core"],
|
|
|
|
|
plugins: [require("./server/translate-plugin.js")],
|
|
|
|
|
presets: ["react", "env"]
|
2017-07-07 13:28:29 -04:00
|
|
|
});
|
|
|
|
|
|
2017-08-09 18:43:30 -04:00
|
|
|
// initial check that required files are present
|
|
|
|
|
const chalk = require("chalk");
|
|
|
|
|
const fs = require("fs");
|
|
|
|
|
const CWD = process.cwd();
|
|
|
|
|
|
|
|
|
|
if (!fs.existsSync(CWD + "/siteConfig.js")) {
|
2017-09-28 17:46:29 -04:00
|
|
|
console.error(
|
|
|
|
|
chalk.red("Error: No siteConfig.js file found in website folder!")
|
|
|
|
|
);
|
|
|
|
|
process.exit(1);
|
2017-08-09 18:43:30 -04:00
|
|
|
}
|
|
|
|
|
|
2017-07-13 16:40:24 -04:00
|
|
|
const program = require("commander");
|
|
|
|
|
|
|
|
|
|
program.option("--port <number>", "Specify port number").parse(process.argv);
|
|
|
|
|
|
|
|
|
|
const port = program.port || 3000;
|
2017-07-11 17:48:57 -04:00
|
|
|
|
2017-08-15 19:55:38 -04:00
|
|
|
// start local server on specified port
|
2017-07-10 19:38:35 -04:00
|
|
|
const server = require("./server/server.js");
|
2017-07-11 17:48:57 -04:00
|
|
|
server(port);
|