You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
leebenson__reactql/index.ts

35 lines
771 B

4 years ago
import * as path from "path";
import * as fs from "fs";
5 years ago
// Load env vars, for the `GRAPHQL` endpoint and anything else we need
require("dotenv").config();
5 years ago
// Catch CTRL/CMD+C interrupts cleanly
const signals: NodeJS.Signals[] = [
"SIGHUP",
"SIGINT",
"SIGQUIT",
"SIGABRT",
"SIGTERM"
];
signals.forEach(s => process.on(s, () => process.exit(0)));
5 years ago
4 years ago
// Check that we have a specified Webpack runner
if (!process.env.RUNNER) {
console.error("No Webpack runner specified");
process.exit(1);
}
// Path to runner
const script = path.resolve("./src/runner", `${process.env.RUNNER!}.ts`);
// Check that the runner exists
if (!fs.existsSync(script)) {
console.error(`Runner doesn't exist: ${script}`);
process.exit(1);
}
5 years ago
// Start the script
4 years ago
require(script);