@trackunit/graphql-build-tools
v0.0.14
Published
`@trackunit/graphql-build-tools` provides a CLI and reusable transformer helpers for producing Manager-compatible GraphQL SDL in service build pipelines.
Keywords
Readme
Trackunit GraphQL Build Tools
@trackunit/graphql-build-tools provides a CLI and reusable transformer helpers for producing Manager-compatible GraphQL SDL in service build pipelines.
CLI Usage
Run the CLI in two steps when publishing a service schema:
bundlecollects all raw.graphqlsfiles into one SDL file.buildrenders that bundled SDL into the Manager-compatible schema for a gateway.
graphql-build-tools bundle "src/**/*.graphqls" target/schema.graphqls
graphql-build-tools build --server=public target/schema.graphqls target/schema.public.graphqlsbundle
graphql-build-tools bundle "src/**/*.graphqls" target/schema.graphqlsThe bundle command:
- Finds matching
.graphqlsfiles - Sorts them for stable output
- Concatenates them with newlines
- Writes one raw combined SDL file
build
graphql-build-tools build --server=public target/schema.graphqls target/schema.public.graphqlsThe build command:
- Reads the bundled raw SDL
- Applies Manager's GraphQL directive transformer chain
- Renders the SDL for one gateway:
internal,public,report, orv3-mobile - Writes the final schema to upload or publish
Use - as the build output path to write the transformed SDL to stdout:
graphql-build-tools build --server=public target/schema.graphqls - > target/schema.public.graphqlsCI Example
- run:
name: Build public GraphQL schema
command: |
npx --yes @trackunit/graphql-build-tools bundle "src/**/*.graphqls" target/schema.graphqls
npx --yes @trackunit/graphql-build-tools build --server=public target/schema.graphqls target/schema.public.graphqlsMaven Example
Use npm exec from frontend-maven-plugin when rendering schemas from a Maven build:
<execution>
<id>bundle-graphql-schema</id>
<phase>generate-resources</phase>
<goals><goal>npm</goal></goals>
<configuration>
<arguments>exec --yes -- @trackunit/graphql-build-tools bundle src/main/graphql/**/*.graphqls target/graphql/schema.graphqls</arguments>
</configuration>
</execution>
<execution>
<id>render-public-graphql-schema</id>
<phase>generate-resources</phase>
<goals><goal>npm</goal></goals>
<configuration>
<arguments>exec --yes -- @trackunit/graphql-build-tools build --server=public target/graphql/schema.graphqls target/graphql/schema.public.graphqls</arguments>
</configuration>
</execution>Publish target/schema.public.graphqls or target/graphql/schema.public.graphqls to the schema registry from the next CI step.
The package also exports the SDL directive transformer chain used by buildGraphqlSchema.
Programmatic API
const { buildGraphqlSchema, bundleSchemas } = require("@trackunit/graphql-build-tools");The package root resolves to the library API. The CLI stays available through the graphql-build-tools bin command.
Trackunit
For more info and a full guide on Iris App SDK Development, please visit our Developer Hub.
This package was developed by Trackunit ApS. Trackunit is the leading SaaS-based IoT solution for the construction industry, offering an ecosystem of hardware, fleet management software & telematics.
