Files
talk/scripts/schemaPath.ts
T
Kiwi 044e1c2863 Watcher infrastructure (#1724)
* wip

* Adding chokidar and types

* specifiying build tasks

* new structure, new types, executor and watchers

* Adding log

* Fully implemented watchers

* adapt vscode launc

* Add .babelrc.js to toplevel tsconfig project

* Typo

* Get schema path from .graphqlconfig

* Use watcher binary

* Add joi validation to watcher

* Remove fb-watchman for now

* Use correct ignore path

* Fix dist folder

* Allow setting watcher

* Per default only spawn one process at a time

* Support runOnInit

* Rename RestartingExecutor to LongRunningExecutor

* Use debounce instead of throttle

* Remove console log

* Debounce command execution

* Simplify debounce

* Watcher name change

* Typos

* Rename "watcher" root level config to "backend"
2018-07-03 12:21:58 -06:00

40 lines
1.1 KiB
TypeScript

#!/usr/bin/env ts-node
import program from "commander";
import fs from "fs";
import path from "path";
const config = JSON.parse(
fs.readFileSync(path.resolve(__dirname, "../.graphqlconfig"), "utf8")
);
program
.version("0.1.0")
.usage("<project>")
.arguments("<project>")
.description(
"Returns the schema graph in `.graphqlconfig` based on <project>"
)
.action(project => {
if (!config.projects) {
// tslint:disable-next-line:no-console
console.error("Missing projects key in .graphqconfig");
process.exit(1);
}
if (!config.projects[project]) {
// tslint:disable-next-line:no-console
console.error(`Project ${project} not found in .graphqconfig`);
process.exit(1);
}
if (!config.projects[project].schemaPath) {
// tslint:disable-next-line:no-console
console.error(
`SchemaPath for project ${project} not found in .graphqconfig`
);
process.exit(1);
}
// tslint:disable-next-line:no-console
console.log(config.projects[project].schemaPath);
})
.parse(process.argv);