Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if(options.exclude) {
excludeGraphql = [
'**/node_modules/**',
'**/__mocks__/**',
'**/__tests__/**',
'**/__generated__/**',
...options.exclude,
];
}
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: [
if (options.webpackConfig) {
customWebpackConfig = path.resolve(process.cwd(), options.webpackConfig);
} else {
schemaPath = path.resolve(process.cwd(), options.schema);
}
if ((schemaPath && path.extname(schemaPath) === '.js') || customWebpackConfig) {
console.log(`schemaPath: ${schemaPath}, customWebpackConfig: ${customWebpackConfig}`);
schemaPath = await graphqlJSCompiler(schemaPath, srcDir, customWebpackConfig);
}
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,
}
const srcDir = path.resolve(process.cwd(), options.src);
if (!fs.existsSync(srcDir)) {
throw new Error(`--source path does not exist: ${srcDir}.`);
}
if (!hasWatchmanRootFile(srcDir)) {
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) =>