How to use the graphql-transformer-core.buildAPIProject function in graphql-transformer-core

To help you get started, we’ve selected a few graphql-transformer-core 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 aws-amplify / amplify-cli / packages / amplify-provider-awscloudformation / lib / transform-graphql-schema.js View on Github external
let searchableTransformerFlag = false;

  if (directiveMap.directives.includes('searchable')) {
    searchableTransformerFlag = true;
  }

  const buildConfig = {
    buildParameters,
    projectDirectory: options.dryrun ? false : resourceDir,
    transformersFactory: transformerListFactory,
    transformersFactoryArgs: [searchableTransformerFlag, storageConfig],
    rootStackFileName: 'cloudformation-template.json',
    currentCloudBackendDirectory: previouslyDeployedBackendDir,
    disableResolverOverrides: options.disableResolverOverrides,
  };
  const transformerOutput = await TransformPackage.buildAPIProject(buildConfig);

  context.print.success(`\nGraphQL schema compiled successfully.\n\nEdit your schema at ${schemaFilePath} or \
place .graphql files in a directory at ${schemaDirPath}`);

  const jsonString = JSON.stringify(parameters, null, 4);

  if (!options.dryRun) {
    fs.writeFileSync(parametersFilePath, jsonString, 'utf8');
  }
  return transformerOutput;
}