How to use the relay-compiler.ConsoleReporter function in relay-compiler

To help you get started, weโ€™ve selected a few relay-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yusinto / relay-compiler-plus / src / compiler / main.js View on Github external
}

  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: [
github yusinto / relay-compiler-plus / src / compiler / main.js View on Github external
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,
github kiwicom / mobile / app / relay / scripts / RelayCompiler.js View on Github external
}
  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) =>