@gqfn/cli
v0.7.1
Published
The CLI of GQFn
Downloads
15
Readme
@gqfn/cli
The CLI tool for GQFn - provides commands to initialize, manage, and sync GraphQL schemas for @gqfn/core.
Installation
Install the CLI package globally or locally in your project:
# ✨ Auto-detect
npx nypm i @gqfn/cli
# npm
npm install @gqfn/cli
# yarn
yarn add @gqfn/cli
# pnpm
pnpm install @gqfn/cli
# bun
bun install @gqfn/cliFor global installation:
npm install -g @gqfn/cliUsage
Initialize GQFn in your project
gqfn initThis command creates the necessary configuration files and sets up your project for GQFn usage.
Add a GraphQL schema
gqfn add https://your-graphql-endpoint.com/graphqlYou can add multiple endpoints at once:
gqfn add https://api.example.com/graphql https://graphql.example.com/v1Sync schemas
gqfn syncThis command fetches the latest schema definitions from all configured endpoints and updates the generated types.
Command Options
All commands support the following options:
-s, --silent: Disable all output--ignore-error(sync only): Ignore errors when syncing the schema
Configuration
The CLI uses a gqfn.config.ts file for configuration. Here's an example:
import { defineConfig } from '@gqfn/cli'
export default defineConfig({
clients: [
{
name: 'api',
url: 'https://your-graphql-endpoint.com/graphql',
headers: {
Authorization: `Bearer ${process.env.API_TOKEN}`
}
}
],
outputDir: './src/gqfn'
})Development
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable - Install dependencies using
pnpm install - Run interactive tests using
pnpm dev
License
Published under MIT License.
