This repository has been archived by the owner on Jun 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,033 additions
and
71 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/graphql-typescript-definitions/bin/graphql-typescript-definitions
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
|
||
require('../lib/cli'); |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import * as yargs from 'yargs'; | ||
import * as chalk from 'chalk'; | ||
|
||
import {Builder} from '.'; | ||
|
||
const argv = yargs | ||
.usage('Usage: $0 <graphql-files> [options]') | ||
.option('schema-path', { | ||
required: true, | ||
normalize: true, | ||
type: 'string', | ||
describe: 'The path to the JSON file containing a schema instrospection query result', | ||
}) | ||
.option('watch', { | ||
required: false, | ||
default: false, | ||
type: 'boolean', | ||
describe: 'Watch the GraphQL files for changes and re-run the generation', | ||
}) | ||
.help() | ||
.argv; | ||
|
||
const builder = new Builder({ | ||
graphQLFiles: argv._[0], | ||
schemaPath: argv.schemaPath, | ||
}); | ||
|
||
const BUILT = chalk.inverse.bold.green(' BUILT '); | ||
const ERROR = chalk.inverse.bold.red(' ERROR '); | ||
|
||
builder.on('start', () => { | ||
console.log(); | ||
}); | ||
|
||
builder.on('build', ({documentPath, definitionPath}) => { | ||
console.log(`${BUILT} ${chalk.dim(documentPath)} → ${definitionPath}`); | ||
}); | ||
|
||
builder.on('end', () => { | ||
console.log(); | ||
}); | ||
|
||
builder.on('error', (error) => { | ||
console.log(`${ERROR} ${error.message}`); | ||
if (error.stack) { | ||
console.log(chalk.dim(error.stack)); | ||
} | ||
console.log(); | ||
}); | ||
|
||
builder.run({watch: argv.watch}) | ||
.catch((error) => console.log(error)); |
This file contains 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
11 changes: 11 additions & 0 deletions
11
packages/graphql-typescript-definitions/test/tsconfig.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compileOnSave": false, | ||
"compilerOptions": { | ||
"moduleResolution": "node", | ||
"strict": true, | ||
"experimentalDecorators": true, | ||
"allowSyntheticDefaultImports": true, | ||
"noUnusedParameters": true, | ||
"noUnusedLocals": true | ||
} | ||
} |
This file contains 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
Oops, something went wrong.