UNPKG

@graphprotocol/graph-cli

Version:

CLI for building for and deploying to The Graph

19 lines (18 loc) 596 B
import { URL } from 'node:url'; import { print } from 'gluegun'; export const SUBGRAPH_STUDIO_URL = 'https://api.studio.thegraph.com/deploy/'; export const validateNodeUrl = (node) => new URL(node); export const normalizeNodeUrl = (node) => new URL(node).toString(); export function chooseNodeUrl({ node }) { if (node) { try { validateNodeUrl(node); return { node }; } catch (e) { print.error(`Graph node "${node}" is invalid: ${e.message}`); process.exit(1); } } return { node: SUBGRAPH_STUDIO_URL }; }