Last active
January 18, 2020 06:15
-
-
Save kaychaks/9f7a83b0e982cf4c76b69de165c5da1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"relay": "node scripts/relayCompiler.js" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//scripts/relayCompiler.js | |
const spawn = require("child_process").spawn; | |
const path = require("path"); | |
const args = [ | |
"--extensions", | |
"js", | |
"jsx", | |
"--schema", | |
path.resolve(__dirname, "../schema/schema.graphql"), | |
"--src", | |
path.resolve(__dirname, ".."), // since we are currently in <rootDir>/scripts | |
"--include", // these will be based off of the `--src` flag ☝️ | |
"src/**", | |
"node_modules/@foundation/logger/src/**", | |
"--exclude", | |
"**/__mocks__/**", | |
"**/__tests__/**", | |
"**/__generated__/**", | |
"--artifactDirectory", | |
"src/__generated__/relay" | |
]; | |
if (process.argv.includes("--watch")) { | |
args.push("--watch"); | |
} | |
if (process.argv.includes("--no-watchman")) { | |
args.push("--no-watchman"); | |
} | |
const proc = spawn( | |
path.resolve(__dirname, "../node_modules/.bin/relay-compiler"), | |
args, | |
{ stdio: "inherit" } | |
); | |
proc.on("close", code => { | |
process.exit(code); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment