@ng-builder/graphql
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Apollo GraphQl builder

This angular builder is using the graphql-code-generator to generate apollo services for your angular application.

installation

First of all you need to install the builder package.

npm install -D @ng-builder/graphql

Then you have to configure it in the angular.json

...
{
  "version": 1,
  "projects": {
    "your-app": {
      "projectType": "application",
      "root": "apps/your-app",
      "sourceRoot": "apps/your-app/src",
      "prefix": "ya",
      "architect": {
        ...
        "build": {...},
        "graphql": {
          "builder": "@ng-builder/graphql:build",
          "options": {
            "schema": "https://swapi-graphql.netlify.com/.netlify/functions/index",
            "documents": "apps/your-app/src/**/*.graphql",
            "outputPath": "apps/your-app/src/graphql-models",
            "declarationFile": "types.d.ts"
          },
          "configurations": {
            "watch": {
              "watch": true
            }
          }
        }
      }
    }
  }
}

after you have configured the angular.json you can go ahead with ng run your-app:graphql --configuration="watch" This is generating under the specified directory a barrel file that exports all generated apollo services.

Readme

Keywords

none

Package Sidebar

Install

npm i @ng-builder/graphql

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

74.3 kB

Total Files

34

Last publish

Collaborators

  • lukasholzer