Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
console.log(`schemaPath: ${schemaPath}`);
clean(srcDir);
const reporter = new ConsoleReporter({
verbose: options.verbose,
quiet: options.quiet,
});
const schema = getSchema(schemaPath);
const parserConfigs = {
js: {
baseDir: srcDir,
getFileFilter: JSModuleParser.getFileFilter,
getParser: JSModuleParser.getParser,
getSchema: () => schema,
filepaths: getFilepathsFromGlob(srcDir, {
extensions: options.extensions,
include: ['**'],
exclude: [
'**/node_modules/**',
'**/__mocks__/**',
'**/__tests__/**',
'**/__generated__/**',
],
}),
},
graphql: {
baseDir: srcDir,
getParser: DotGraphQLParser.getParser,
}
console.log(`schemaPath: ${schemaPath}`);
clean(srcDir);
const reporter = new ConsoleReporter({
verbose: options.verbose,
quiet: options.quiet,
});
const schema = getSchema(schemaPath);
const parserConfigs = {
js: {
baseDir: srcDir,
getFileFilter: JSModuleParser.getFileFilter,
getParser: JSModuleParser.getParser,
getSchema: () => schema,
filepaths: getFilepathsFromGlob(srcDir, {
extensions: options.extensions,
include: options.include,
exclude: options.exclude,
}),
},
graphql: {
baseDir: srcDir,
getParser: DotGraphQLParser.getParser,
getSchema: () => schema,
filepaths: getFilepathsFromGlob(srcDir, {
extensions: ['graphql'],
include: options.include,
exclude: options.exclude,
throw new Error(
`
--watch requires that the src directory have a valid watchman "root" (.git/ folder).
Ensure that it exists in ${srcDir} or its parents.
`.trim(),
);
}
const reporter = new ConsoleReporter({ verbose: true });
const useWatchman = await WatchmanClient.isAvailable();
const parserConfigs = {
default: {
baseDir: srcDir,
getFileFilter: RelayJSModuleParser.getFileFilter,
getParser: RelayJSModuleParser.getParser,
getSchema: () => getSchema(schemaPath),
watchmanExpression: useWatchman ? buildWatchExpression(options) : null,
filepaths: useWatchman ? null : getFilepathsFromGlob(srcDir, options),
},
};
const writerConfigs = {
default: {
getWriter: getRelayFileWriter(srcDir),
isGeneratedFile: (filePath: string) =>
filePath.endsWith('.js') && filePath.includes('__generated__'),
parser: 'default',
},
};
const codegenRunner = new CodegenRunner({
reporter,