Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cli/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
COSMO_API_KEY=cosmo_669b576aaadc10ee1ae81d9193425705
COSMO_API_URL=http://localhost:3001
CDN_URL=http://localhost:11000
29 changes: 18 additions & 11 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
# Cosmo CLI aka "wgc"
# WunderGraph Cosmo CLI aka "wgc"

[![npm version](https://badge.fury.io/js/wgc.svg)](https://badge.fury.io/js/wgc)

## Getting started

Official documentation: [https://cosmo-docs.wundergraph.com/cli](https://cosmo-docs.wundergraph.com/cli)

### Prerequisites

- [Node.js 16 LTS or higher](https://nodejs.dev/en/about/releases/)
- [Node.js 20 LTS or higher](https://nodejs.dev/en/about/releases/)

The cosmo CLI tool `wgc`. Used to manage the cosmo platform e.g. pushing schema, check schemas, creating new projects, managing users, etc. It interacts with the control plane.

### Installation

```bash
npx wgc schema push --service reviews --endpoint https://my-service.com/graphql <schema>.graphql
npx wgc --help
# or install it globally
npm install -g wgc --help
```

### Development

Run the following script to test your changes locally:
Ensure that at least Node.js 20.6.0 is installed because rely on the native .env file support.

Replace `env.example` with `.env` and fill in the required values. By default, we point to the services of your local development environment.

Run any command with `pnpm wgc` to test your changes locally directly.

```bash
pnpm build && pnpm wgc schema push
pnpm wgc ...
```

_Everything behind `wgc` is passed to the `wgc` cli._
_Everything behind `wgc` is passed to the `wgc` cli. This allows you to test your changes locally._

## Authentication
#### Run tests:

The CLI uses the following environment variables to authenticate with the control plane:

- `COSMO_API_KEY` - API key for the control plane
- `COSMO_API_URL` - URL of the control plane
```bash
pnpm test
```
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"scripts": {
"build": "del dist && tsc",
"wgc": "tsx src/index.ts",
"wgc": "tsx --env-file .env src/index.ts",
"test": "pnpm lint && vitest run",
"coverage": "vitest run --coverage",
"lint": "eslint --cache --ext .ts,.mjs,.cjs . && prettier -c src",
Expand Down