@graphprotocol/graph-cli 0.38.0 → 0.38.1-alpha-20230208030436-e93ce80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.38.1-alpha-20230208030436-e93ce80
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1055](https://github.com/graphprotocol/graph-tooling/pull/1055)
8
+ [`9932c57`](https://github.com/graphprotocol/graph-tooling/commit/9932c579a0a3f569fc61712ed2e3f2e1538f25ed)
9
+ Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates:
10
+ - Added dependency [`@oclif/core@2.0.7` ↗︎](https://www.npmjs.com/package/@oclif/core/v/2.0.7) (to
11
+ `dependencies`)
12
+
3
13
  ## 0.38.0
4
14
 
5
15
  ### Minor Changes
package/dist/bin.js CHANGED
@@ -1,6 +1,34 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var __importDefault = (this && this.__importDefault) || function (mod) {
27
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
+ };
3
29
  Object.defineProperty(exports, "__esModule", { value: true });
4
- // run the CLI with the current process arguments
5
- const cli_1 = require("./cli");
6
- (0, cli_1.run)(process.argv);
30
+ const oclif = __importStar(require("@oclif/core"));
31
+ const flush_1 = __importDefault(require("@oclif/core/flush"));
32
+ // @ts-expect-error Handle is a pure JS file
33
+ const handle_1 = __importDefault(require("@oclif/core/handle"));
34
+ oclif.run().then(flush_1.default).catch(handle_1.default);
@@ -5,17 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.updateNetworksFile = exports.initNetworksConfig = exports.updateSubgraphNetwork = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
+ const gluegun_1 = require("gluegun");
8
9
  const yaml_1 = __importDefault(require("yaml"));
9
10
  const spinner_1 = require("./spinner");
10
- const updateSubgraphNetwork = async (toolbox, manifest, network, networksFile, identifierName) => await (0, spinner_1.withSpinner)(`Update sources network`, `Failed to update sources network`, `Warnings while updating sources network`, async (spinner) => {
11
+ const updateSubgraphNetwork = async (manifest, network, networksFile, identifierName) =>
12
+ // TODO: use useSpinner
13
+ await (0, spinner_1.withSpinner)(`Update sources network`, `Failed to update sources network`, `Warnings while updating sources network`, async (spinner) => {
11
14
  (0, spinner_1.step)(spinner, `Reading networks config`);
12
- const allNetworks = await toolbox.filesystem.read(networksFile, 'json');
15
+ const allNetworks = await gluegun_1.filesystem.read(networksFile, 'json');
13
16
  const networkConfig = allNetworks[network];
14
17
  // Exit if the network passed with --network does not exits in networks.json
15
18
  if (!networkConfig) {
16
19
  throw new Error(`Network '${network}' was not found in '${networksFile}'`);
17
20
  }
18
- await toolbox.patching.update(manifest, content => {
21
+ await gluegun_1.patching.update(manifest, content => {
19
22
  const subgraph = yaml_1.default.parse(content);
20
23
  const networkSources = Object.keys(networkConfig);
21
24
  const subgraphSources = subgraph.dataSources.map((value) => value.name);
@@ -37,10 +40,12 @@ const updateSubgraphNetwork = async (toolbox, manifest, network, networksFile, i
37
40
  });
38
41
  // All data sources shoud be on the same network,
39
42
  // so we have to update the network of all templates too.
40
- subgraph.templates && (subgraph.templates = subgraph.templates.map((template) => ({
41
- ...template,
42
- network,
43
- })));
43
+ // eslint-disable-next-line -- prettier has problems with &&=
44
+ subgraph.templates &&
45
+ (subgraph.templates = subgraph.templates.map((template) => ({
46
+ ...template,
47
+ network,
48
+ })));
44
49
  const unsusedSources = networkSources.filter(x => !subgraphSources.includes(x));
45
50
  unsusedSources.forEach(source => {
46
51
  (0, spinner_1.step)(spinner, `dataSource '${source}' from '${networksFile}' not found in ${manifest}`);
@@ -51,8 +56,10 @@ const updateSubgraphNetwork = async (toolbox, manifest, network, networksFile, i
51
56
  });
52
57
  });
53
58
  exports.updateSubgraphNetwork = updateSubgraphNetwork;
54
- const initNetworksConfig = async (toolbox, directory, identifierName) => await (0, spinner_1.withSpinner)(`Initialize networks config`, `Failed to initialize networks config`, `Warnings while initializing networks config`, async () => {
55
- const subgraphStr = toolbox.filesystem.read(path_1.default.join(directory, 'subgraph.yaml'));
59
+ const initNetworksConfig = async (directory, identifierName) =>
60
+ // TODO: use useSpinner
61
+ await (0, spinner_1.withSpinner)(`Initialize networks config`, `Failed to initialize networks config`, `Warnings while initializing networks config`, async () => {
62
+ const subgraphStr = gluegun_1.filesystem.read(path_1.default.join(directory, 'subgraph.yaml'));
56
63
  const subgraph = yaml_1.default.parse(subgraphStr);
57
64
  const networks = subgraph.dataSources.reduce((acc, source) => Object.assign(acc, {
58
65
  [source.network]: {
@@ -62,7 +69,7 @@ const initNetworksConfig = async (toolbox, directory, identifierName) => await (
62
69
  },
63
70
  },
64
71
  }), {});
65
- toolbox.filesystem.write(`${directory}/networks.json`, networks);
72
+ gluegun_1.filesystem.write(`${directory}/networks.json`, networks);
66
73
  return true;
67
74
  });
68
75
  exports.initNetworksConfig = initNetworksConfig;
@@ -76,8 +83,8 @@ function hasChanges(identifierName, network, networkConfig, dataSource) {
76
83
  const startBlockChanged = networkConfig.startBlock !== dataSource.source.startBlock;
77
84
  return networkChanged || addressChanged || startBlockChanged;
78
85
  }
79
- const updateNetworksFile = async (toolbox, network, dataSource, address, networksFile) => {
80
- await toolbox.patching.update(networksFile, config => {
86
+ async function updateNetworksFile(network, dataSource, address, networksFile) {
87
+ await gluegun_1.patching.update(networksFile, config => {
81
88
  if (Object.keys(config).includes(network)) {
82
89
  Object.assign(config[network], { [dataSource]: { address } });
83
90
  }
@@ -86,5 +93,5 @@ const updateNetworksFile = async (toolbox, network, dataSource, address, network
86
93
  }
87
94
  return config;
88
95
  });
89
- };
96
+ }
90
97
  exports.updateNetworksFile = updateNetworksFile;
@@ -33,7 +33,7 @@ const network_1 = require("./network");
33
33
  const SUBGRAPH_PATH_BASE = path_1.default.join(__dirname, '..', '..', '..', '..', 'examples', 'example-subgraph');
34
34
  describe('initNetworksConfig', () => {
35
35
  beforeAll(async () => {
36
- await (0, network_1.initNetworksConfig)(toolbox, SUBGRAPH_PATH_BASE, 'address');
36
+ await (0, network_1.initNetworksConfig)(SUBGRAPH_PATH_BASE, 'address');
37
37
  });
38
38
  afterAll(async () => {
39
39
  toolbox.filesystem.remove(`${SUBGRAPH_PATH_BASE}/networks.json`);
@@ -75,7 +75,7 @@ describe('updateSubgraphNetwork', () => {
75
75
  let address = subgraphObj.dataSources[0].source.address;
76
76
  expect(network).toBe('mainnet');
77
77
  expect(address).toBe('0x22843e74c59580b3eaf6c233fa67d8b7c561a835');
78
- await (0, network_1.updateSubgraphNetwork)(toolbox, manifest, 'optimism', networksFie, 'address');
78
+ await (0, network_1.updateSubgraphNetwork)(manifest, 'optimism', networksFie, 'address');
79
79
  subgraph = toolbox.filesystem.read(manifest);
80
80
  subgraphObj = yaml_1.default.parse(subgraph);
81
81
  network = subgraphObj.dataSources[0].network;
@@ -23,8 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.withSpinner = exports.step = void 0;
26
+ exports.useSpinner = exports.withSpinner = exports.step = void 0;
27
27
  const toolbox = __importStar(require("gluegun"));
28
+ const core_1 = require("@oclif/core");
28
29
  const step = (spinner, subject, text) => {
29
30
  if (text) {
30
31
  spinner.stopAndPersist({
@@ -47,6 +48,8 @@ exports.step = step;
47
48
  // spinner stops with the warning message and returns the `result` value.
48
49
  // Otherwise the spinner prints the in-progress message with a check mark
49
50
  // and simply returns the value returned by `f`.
51
+ //
52
+ // @deprecated
50
53
  const withSpinner = async (text, errorText, warningText, f) => {
51
54
  const spinner = toolbox.print.spin(text);
52
55
  try {
@@ -78,3 +81,36 @@ const withSpinner = async (text, errorText, warningText, f) => {
78
81
  }
79
82
  };
80
83
  exports.withSpinner = withSpinner;
84
+ // Executes the function `f` while displaying a command-line spinner.
85
+ async function useSpinner(text, errorText, warningText, f) {
86
+ const { action } = core_1.ux;
87
+ action.start(text);
88
+ try {
89
+ const result = await f(action);
90
+ if (result && typeof result === 'object') {
91
+ const hasError = 'error' in result;
92
+ const hasWarning = 'warning' in result;
93
+ const hasResult = 'result' in result;
94
+ if (hasError) {
95
+ action.stop(`✖ ${errorText}: ${result.error}`);
96
+ return (hasResult ? result.result : result);
97
+ }
98
+ if (hasWarning && hasResult) {
99
+ if (result.warning !== null) {
100
+ action.stop(`⚠️ ${warningText}: ${result.warning}`);
101
+ }
102
+ action.stop('✔');
103
+ return result.result;
104
+ }
105
+ action.stop('✔');
106
+ return result;
107
+ }
108
+ action.stop('✔');
109
+ return result;
110
+ }
111
+ catch (e) {
112
+ action.stop(`✖ ${errorText}: ${e.message}`);
113
+ throw e;
114
+ }
115
+ }
116
+ exports.useSpinner = useSpinner;
@@ -26,61 +26,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const chalk_1 = __importDefault(require("chalk"));
29
+ const core_1 = require("@oclif/core");
30
+ const errors_1 = require("@oclif/core/lib/errors");
31
+ const gluegun_1 = require("gluegun");
30
32
  const immutable_1 = __importDefault(require("immutable"));
31
33
  const abi_1 = require("../command-helpers/abi");
32
34
  const DataSourcesExtractor = __importStar(require("../command-helpers/data-sources"));
33
- const gluegun_1 = require("../command-helpers/gluegun");
34
35
  const network_1 = require("../command-helpers/network");
35
36
  const scaffold_1 = require("../command-helpers/scaffold");
36
37
  const spinner_1 = require("../command-helpers/spinner");
37
38
  const protocols_1 = __importDefault(require("../protocols"));
38
39
  const abi_2 = __importDefault(require("../protocols/ethereum/abi"));
39
40
  const subgraph_1 = __importDefault(require("../subgraph"));
40
- const HELP = `
41
- ${chalk_1.default.bold('graph add')} <address> [<subgraph-manifest default: "./subgraph.yaml">]
42
-
43
- ${chalk_1.default.dim('Options:')}
44
-
45
- --abi <path> Path to the contract ABI (default: download from Etherscan)
46
- --contract-name Name of the contract (default: Contract)
47
- --merge-entities Whether to merge entities with the same name (default: false)
48
- --network-file <path> Networks config file path (default: "./networks.json")
49
- -h, --help Show usage information
50
- `;
51
- exports.default = {
52
- description: 'Adds a new datasource to a subgraph',
53
- run: async (toolbox) => {
54
- // Obtain tools
55
- const { print, system } = toolbox;
56
- // Read CLI parameters
57
- let { abi, contractName, h, help, mergeEntities, networkFile } = toolbox.parameters.options;
58
- contractName || (contractName = 'Contract');
59
- try {
60
- (0, gluegun_1.fixParameters)(toolbox.parameters, {
61
- h,
62
- help,
63
- mergeEntities,
64
- });
65
- }
66
- catch (e) {
67
- print.error(e.message);
68
- process.exitCode = 1;
69
- return;
70
- }
71
- const address = toolbox.parameters.first || toolbox.parameters.array?.[0];
72
- const manifestPath = toolbox.parameters.second || toolbox.parameters.array?.[1] || './subgraph.yaml';
73
- // Show help text if requested
74
- if (help || h) {
75
- print.info(HELP);
76
- return;
77
- }
78
- // Validate the address
79
- if (!address) {
80
- print.error('No contract address provided');
81
- process.exitCode = 1;
82
- return;
83
- }
41
+ class AddCommand extends core_1.Command {
42
+ async run() {
43
+ const { args: { address, subgraphManifest: manifestPath }, flags: { abi, contractName, mergeEntities, networkFile: networksFile }, } = await this.parse(AddCommand);
84
44
  const dataSourcesAndTemplates = await DataSourcesExtractor.fromFilePath(manifestPath);
85
45
  const protocol = protocols_1.default.fromDataSources(dataSourcesAndTemplates);
86
46
  const manifest = await subgraph_1.default.load(manifestPath, { protocol });
@@ -89,9 +49,7 @@ exports.default = {
89
49
  const entities = getEntities(manifest);
90
50
  const contractNames = getContractNames(manifest);
91
51
  if (contractNames.includes(contractName)) {
92
- print.error(`Datasource or template with name ${contractName} already exists, please choose a different name`);
93
- process.exitCode = 1;
94
- return;
52
+ this.error(`Datasource or template with name ${contractName} already exists, please choose a different name.`, { exit: 1 });
95
53
  }
96
54
  let ethabi = null;
97
55
  if (abi) {
@@ -103,7 +61,7 @@ exports.default = {
103
61
  else {
104
62
  ethabi = await (0, abi_1.loadAbiFromEtherscan)(abi_2.default, network, address);
105
63
  }
106
- const { collisionEntities, onlyCollisions, abiData } = updateEventNamesOnCollision(toolbox, ethabi, entities, contractName, mergeEntities);
64
+ const { collisionEntities, onlyCollisions, abiData } = updateEventNamesOnCollision(ethabi, entities, contractName, mergeEntities);
107
65
  ethabi.data = abiData;
108
66
  await (0, scaffold_1.writeABI)(ethabi, contractName);
109
67
  await (0, scaffold_1.writeSchema)(ethabi, protocol, result.getIn(['schema', 'file']), collisionEntities);
@@ -124,20 +82,47 @@ exports.default = {
124
82
  result.set('dataSources', dataSources.push(dataSource));
125
83
  await subgraph_1.default.write(result, manifestPath);
126
84
  // Update networks.json
127
- const networksFile = networkFile || './networks.json';
128
- await (0, network_1.updateNetworksFile)(toolbox, network, contractName, address, networksFile);
85
+ await (0, network_1.updateNetworksFile)(network, contractName, address, networksFile);
129
86
  // Detect Yarn and/or NPM
130
- const yarn = system.which('yarn');
131
- const npm = system.which('npm');
87
+ const yarn = gluegun_1.system.which('yarn');
88
+ const npm = gluegun_1.system.which('npm');
132
89
  if (!yarn && !npm) {
133
- print.error(`Neither Yarn nor NPM were found on your system. Please install one of them.`);
134
- process.exitCode = 1;
135
- return;
90
+ this.error('Neither Yarn nor NPM were found on your system. Please install one of them.', {
91
+ exit: 1,
92
+ });
136
93
  }
137
- await (0, spinner_1.withSpinner)('Running codegen', 'Failed to run codegen', 'Warning during codegen', async () => {
138
- await system.run(yarn ? 'yarn codegen' : 'npm run codegen');
139
- });
140
- },
94
+ await (0, spinner_1.useSpinner)('Running codegen', 'Failed to run codegen', 'Warning during codegen', () => gluegun_1.system.run(yarn ? 'yarn codegen' : 'npm run codegen'));
95
+ }
96
+ }
97
+ exports.default = AddCommand;
98
+ AddCommand.description = 'Adds a new datasource to a subgraph.';
99
+ AddCommand.args = {
100
+ address: core_1.Args.string({
101
+ description: 'The contract address',
102
+ required: true,
103
+ }),
104
+ subgraphManifest: core_1.Args.string({
105
+ default: 'subgraph.yaml',
106
+ }),
107
+ };
108
+ AddCommand.flags = {
109
+ abi: core_1.Flags.string({
110
+ summary: 'Path to the contract ABI.',
111
+ default: '*Download from Etherscan*',
112
+ }),
113
+ contractName: core_1.Flags.string({
114
+ summary: 'Name of the contract.',
115
+ default: 'Contract',
116
+ }),
117
+ mergeEntities: core_1.Flags.boolean({
118
+ summary: 'Whether to merge entities with the same name.',
119
+ default: false,
120
+ }),
121
+ // TODO: should be networksFile (with an "s"), or?
122
+ networkFile: core_1.Flags.string({
123
+ summary: 'Networks config file path.',
124
+ default: 'networks.json',
125
+ }),
141
126
  };
142
127
  const getEntities = (manifest) => {
143
128
  const dataSources = manifest.result.get('dataSources', immutable_1.default.List());
@@ -152,9 +137,8 @@ const getContractNames = (manifest) => {
152
137
  const templates = manifest.result.get('templates', immutable_1.default.List());
153
138
  return dataSources.concat(templates).map((dataSource) => dataSource.get('name'));
154
139
  };
155
- const updateEventNamesOnCollision = (toolbox, ethabi, entities, contractName, mergeEntities) => {
140
+ const updateEventNamesOnCollision = (ethabi, entities, contractName, mergeEntities) => {
156
141
  let abiData = ethabi.data;
157
- const { print } = toolbox;
158
142
  const collisionEntities = [];
159
143
  let onlyCollisions = true;
160
144
  for (let i = 0; i < abiData.size; i++) {
@@ -162,10 +146,7 @@ const updateEventNamesOnCollision = (toolbox, ethabi, entities, contractName, me
162
146
  if (dataRow.get('type') === 'event') {
163
147
  if (entities.includes(dataRow.get('name'))) {
164
148
  if (entities.includes(`${contractName}${dataRow.get('name')}`)) {
165
- print.error(`Contract name ('${contractName}')
166
- + event name ('${dataRow.get('name')}') entity already exists.`);
167
- process.exitCode = 1;
168
- break;
149
+ throw new errors_1.CLIError(`Contract name ('${contractName}') + event name ('${dataRow.get('name')}') entity already exists.`, { exit: 1 });
169
150
  }
170
151
  if (mergeEntities) {
171
152
  collisionEntities.push(dataRow.get('name'));
@@ -26,88 +26,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const chalk_1 = __importDefault(require("chalk"));
29
+ const core_1 = require("@oclif/core");
30
+ const gluegun_1 = require("gluegun");
30
31
  const compiler_1 = require("../command-helpers/compiler");
31
32
  const DataSourcesExtractor = __importStar(require("../command-helpers/data-sources"));
32
- const gluegun_1 = require("../command-helpers/gluegun");
33
33
  const network_1 = require("../command-helpers/network");
34
34
  const debug_1 = __importDefault(require("../debug"));
35
35
  const protocols_1 = __importDefault(require("../protocols"));
36
36
  const buildDebug = (0, debug_1.default)('graph-cli:build');
37
- const HELP = `
38
- ${chalk_1.default.bold('graph build')} [options] ${chalk_1.default.bold('[<subgraph-manifest>]')}
39
-
40
- Options:
41
-
42
- -h, --help Show usage information
43
- -i, --ipfs <node> Upload build results to an IPFS node
44
- -o, --output-dir <path> Output directory for build results (default: build/)
45
- -t, --output-format <format> Output format for mappings (wasm, wast) (default: wasm)
46
- --skip-migrations Skip subgraph migrations (default: false)
47
- -w, --watch Regenerate types when subgraph files change (default: false)
48
- --network <name> Network configuration to use from the networks config file
49
- --network-file <path> Networks config file path (default: "./networks.json")
50
- `;
51
- exports.default = {
52
- description: 'Builds a subgraph and (optionally) uploads it to IPFS',
53
- run: async (toolbox) => {
54
- // Obtain tools
55
- const { filesystem, print } = toolbox;
56
- // Parse CLI parameters
57
- let { i, h, help, ipfs, o, outputDir, outputFormat, skipMigrations, t, w, watch, network, networkFile, } = toolbox.parameters.options;
58
- // Support both short and long option variants
59
- help || (help = h);
60
- ipfs || (ipfs = i);
61
- outputDir || (outputDir = o);
62
- outputFormat || (outputFormat = t);
63
- watch || (watch = w);
64
- let manifest;
65
- try {
66
- [manifest] = (0, gluegun_1.fixParameters)(toolbox.parameters, {
67
- h,
68
- help,
69
- w,
70
- watch,
71
- });
72
- }
73
- catch (e) {
74
- print.error(e.message);
75
- process.exitCode = 1;
76
- return;
77
- }
78
- // Fall back to default values for options / parameters
79
- outputFormat = outputFormat && ['wasm', 'wast'].includes(outputFormat) ? outputFormat : 'wasm';
80
- outputDir = outputDir && outputDir !== '' ? outputDir : filesystem.path('build');
81
- manifest =
82
- manifest !== undefined && manifest !== '' ? manifest : filesystem.resolve('subgraph.yaml');
83
- networkFile =
84
- networkFile !== undefined && networkFile !== ''
85
- ? networkFile
86
- : filesystem.resolve('networks.json');
87
- // Show help text if requested
88
- if (help) {
89
- print.info(HELP);
90
- return;
91
- }
37
+ class BuildCommand extends core_1.Command {
38
+ async run() {
39
+ const { args: { 'subgraph-manifest': manifest }, flags: { ipfs, 'output-dir': outputDir, 'output-format': outputFormat, 'skip-migrations': skipMigrations, watch, network, 'network-file': networkFile, }, } = await this.parse(BuildCommand);
92
40
  let protocol;
93
41
  try {
94
42
  const dataSourcesAndTemplates = await DataSourcesExtractor.fromFilePath(manifest);
95
43
  protocol = protocols_1.default.fromDataSources(dataSourcesAndTemplates);
96
44
  }
97
45
  catch (e) {
98
- print.error(e.message);
99
- process.exitCode = 1;
100
- return;
46
+ this.error(e, { exit: 1 });
101
47
  }
102
48
  buildDebug('Detected protocol "%s" (%o)', protocol.name, protocol);
103
- if (network && filesystem.exists(networkFile) !== 'file') {
104
- print.error(`Network file '${networkFile}' does not exists or is not a file!`);
105
- process.exitCode = 1;
106
- return;
49
+ if (network && gluegun_1.filesystem.exists(networkFile) !== 'file') {
50
+ this.error(`Network file '${networkFile}' does not exists or is not a file!`, { exit: 1 });
107
51
  }
108
52
  if (network) {
109
53
  const identifierName = protocol.getContract().identifierName();
110
- await (0, network_1.updateSubgraphNetwork)(toolbox, manifest, network, networkFile, identifierName);
54
+ await (0, network_1.updateSubgraphNetwork)(manifest, network, networkFile, identifierName);
111
55
  }
112
56
  const compiler = (0, compiler_1.createCompiler)(manifest, {
113
57
  ipfs,
@@ -118,7 +62,7 @@ exports.default = {
118
62
  });
119
63
  // Exit with an error code if the compiler couldn't be created
120
64
  if (!compiler) {
121
- process.exitCode = 1;
65
+ this.exit(1);
122
66
  return;
123
67
  }
124
68
  // Watch subgraph files for changes or additions, trigger
@@ -129,8 +73,47 @@ exports.default = {
129
73
  else {
130
74
  const result = await compiler.compile();
131
75
  if (result === false) {
132
- process.exitCode = 1;
76
+ this.exit(1);
133
77
  }
134
78
  }
135
- },
79
+ }
80
+ }
81
+ exports.default = BuildCommand;
82
+ BuildCommand.description = 'Builds a subgraph and (optionally) uploads it to IPFS.';
83
+ BuildCommand.args = {
84
+ 'subgraph-manifest': core_1.Args.string({
85
+ default: 'subgraph.yaml',
86
+ }),
87
+ };
88
+ BuildCommand.flags = {
89
+ ipfs: core_1.Flags.string({
90
+ summary: 'Upload build results to an IPFS node.',
91
+ char: 'i',
92
+ }),
93
+ 'output-dir': core_1.Flags.string({
94
+ summary: 'Output directory for build results.',
95
+ char: 'o',
96
+ default: 'build/',
97
+ }),
98
+ 'output-format': core_1.Flags.string({
99
+ summary: 'Output format for mappings.',
100
+ char: 't',
101
+ options: ['wasm', 'wast'],
102
+ default: 'wasm',
103
+ }),
104
+ 'skip-migrations': core_1.Flags.boolean({
105
+ summary: 'Skip subgraph migrations.',
106
+ }),
107
+ watch: core_1.Flags.boolean({
108
+ summary: 'Regenerate types when subgraph files change.',
109
+ char: 'w',
110
+ }),
111
+ network: core_1.Flags.string({
112
+ summary: 'Network configuration to use from the networks config file.',
113
+ }),
114
+ // TODO: should be networksFile (with an "s"), or?
115
+ 'network-file': core_1.Flags.string({
116
+ summary: 'Networks config file path.',
117
+ default: 'networks.json',
118
+ }),
136
119
  };
@@ -209,7 +209,7 @@ exports.default = {
209
209
  }
210
210
  if (network) {
211
211
  const identifierName = protocol.getContract().identifierName();
212
- await (0, network_1.updateSubgraphNetwork)(toolbox, manifest, network, networkFile, identifierName);
212
+ await (0, network_1.updateSubgraphNetwork)(manifest, network, networkFile, identifierName);
213
213
  }
214
214
  const isStudio = node.match(/studio/);
215
215
  const isHostedService = node.match(/thegraph.com/) && !isStudio;
@@ -26,11 +26,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.comm = void 0;
29
30
  const fs_1 = __importDefault(require("fs"));
30
31
  const os_1 = __importDefault(require("os"));
31
32
  const path_1 = __importDefault(require("path"));
33
+ const core_1 = require("@oclif/core");
32
34
  const chalk_1 = __importDefault(require("chalk"));
33
- const graphCli = __importStar(require("../cli"));
34
35
  const abi_1 = require("../command-helpers/abi");
35
36
  const DataSourcesExtractor = __importStar(require("../command-helpers/data-sources"));
36
37
  const gluegun_1 = require("../command-helpers/gluegun");
@@ -44,10 +45,85 @@ const debug_1 = __importDefault(require("../debug"));
44
45
  const protocols_1 = __importDefault(require("../protocols"));
45
46
  const schema_1 = require("../scaffold/schema");
46
47
  const validation_1 = require("../validation");
48
+ const add_1 = __importDefault(require("./add"));
47
49
  const protocolChoices = Array.from(protocols_1.default.availableProtocols().keys());
48
50
  const availableNetworks = protocols_1.default.availableNetworks();
49
51
  const DEFAULT_EXAMPLE_SUBGRAPH = 'ethereum/gravatar';
50
52
  const initDebug = (0, debug_1.default)('graph-cli:init');
53
+ class InitCommand extends core_1.Command {
54
+ async run() {
55
+ const { flags } = await this.parse(InitCommand);
56
+ console.log(flags);
57
+ }
58
+ }
59
+ exports.default = InitCommand;
60
+ InitCommand.args = {
61
+ subgraphName: core_1.Args.string({
62
+ required: true,
63
+ }),
64
+ directory: core_1.Args.string({
65
+ required: true,
66
+ }),
67
+ };
68
+ InitCommand.flags = {
69
+ protocol: core_1.Flags.string({
70
+ required: true,
71
+ options: protocolChoices,
72
+ }),
73
+ product: core_1.Flags.string({
74
+ summary: 'Selects the product for which to initialize.',
75
+ required: true,
76
+ options: ['subgraph-studio', 'hosted-service'],
77
+ }),
78
+ studio: core_1.Flags.boolean({
79
+ summary: 'Shortcut for "--product subgraph-studio".',
80
+ exclusive: ['product'],
81
+ }),
82
+ node: core_1.Flags.string({
83
+ summary: 'Graph node for which to initialize.',
84
+ char: 'g',
85
+ required: true,
86
+ }),
87
+ 'allow-simple-name': core_1.Flags.boolean({
88
+ description: 'Use a subgraph name without a prefix.',
89
+ default: false,
90
+ }),
91
+ 'from-contract': core_1.Flags.string({
92
+ helpGroup: 'Scaffold',
93
+ description: 'Creates a scaffold based on an existing contract.',
94
+ required: true,
95
+ exclusive: ['from-example'],
96
+ }),
97
+ 'from-example': core_1.Flags.string({
98
+ helpGroup: 'Scaffold',
99
+ description: 'Creates a scaffold based on an example subgraph.',
100
+ default: 'Contract',
101
+ exclusive: ['from-contract'],
102
+ }),
103
+ 'contract-name': core_1.Flags.string({
104
+ helpGroup: 'Scaffold from contract',
105
+ description: 'Name of the contract.',
106
+ required: true,
107
+ dependsOn: ['from-contract'],
108
+ }),
109
+ 'index-events': core_1.Flags.boolean({
110
+ helpGroup: 'Scaffold from contract',
111
+ description: 'Index contract events as entities.',
112
+ dependsOn: ['from-contract'],
113
+ }),
114
+ 'start-block': core_1.Flags.integer({
115
+ helpGroup: 'Scaffold from contract',
116
+ description: 'Block number to start indexing from.',
117
+ default: 0,
118
+ dependsOn: ['from-contract'],
119
+ }),
120
+ abi: core_1.Flags.string({
121
+ helpGroup: 'Ethereum',
122
+ }),
123
+ network: core_1.Flags.string({
124
+ helpGroup: 'Ethereum',
125
+ }),
126
+ };
51
127
  const HELP = `
52
128
  ${chalk_1.default.bold('graph init')} [options] [subgraph-name] [directory]
53
129
 
@@ -102,7 +178,8 @@ const processInitForm = async (toolbox, { protocol, product, studio, node, abi,
102
178
  choices: protocolChoices,
103
179
  skip: protocolChoices.includes(protocol),
104
180
  result: (value) => {
105
- protocol || (protocol = value);
181
+ // eslint-disable-next-line -- prettier has problems with ||=
182
+ protocol = protocol || value;
106
183
  protocolInstance = new protocols_1.default(protocol);
107
184
  return protocol;
108
185
  },
@@ -315,14 +392,15 @@ const loadAbiFromFile = (toolbox, ABI, filename) => {
315
392
  return ABI.load('Contract', filename);
316
393
  }
317
394
  };
318
- exports.default = {
395
+ exports.comm = {
319
396
  description: 'Creates a new subgraph with basic scaffolding',
320
397
  run: async (toolbox) => {
321
398
  // Obtain tools
322
399
  const { print, system } = toolbox;
323
400
  // Read CLI parameters
324
401
  let { protocol, product, studio, node, g, abi, allowSimpleName, fromContract, contractName, fromExample, h, help, indexEvents, network, startBlock, } = toolbox.parameters.options;
325
- node || (node = g);
402
+ // eslint-disable-next-line -- prettier has problems with ||=
403
+ node = node || g;
326
404
  ({ node, allowSimpleName } = (0, node_1.chooseNodeUrl)({
327
405
  product,
328
406
  studio,
@@ -606,7 +684,7 @@ const initSubgraphFromExample = async (toolbox, { fromExample, allowSimpleName,
606
684
  process.exitCode = 1;
607
685
  return;
608
686
  }
609
- const networkConf = await (0, network_1.initNetworksConfig)(toolbox, directory, 'address');
687
+ const networkConf = await (0, network_1.initNetworksConfig)(directory, 'address');
610
688
  if (networkConf !== true) {
611
689
  process.exitCode = 1;
612
690
  return;
@@ -716,7 +794,7 @@ const initSubgraphFromContract = async (toolbox, { protocolInstance, allowSimple
716
794
  }
717
795
  if (protocolInstance.hasContract()) {
718
796
  const identifierName = protocolInstance.getContract().identifierName();
719
- const networkConf = await (0, network_1.initNetworksConfig)(toolbox, directory, identifierName);
797
+ const networkConf = await (0, network_1.initNetworksConfig)(directory, identifierName);
720
798
  if (networkConf !== true) {
721
799
  process.exitCode = 1;
722
800
  return;
@@ -803,7 +881,7 @@ const addAnotherContract = async (toolbox, { protocolInstance, directory }) => {
803
881
  commandLine.push('--abi', abi);
804
882
  }
805
883
  }
806
- await graphCli.run(commandLine);
884
+ await add_1.default.run(commandLine);
807
885
  }
808
886
  catch (e) {
809
887
  toolbox.print.error(e);
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = void 0;
4
+ var core_1 = require("@oclif/core");
5
+ Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
@@ -0,0 +1,327 @@
1
+ {
2
+ "version": "0.38.1-alpha-20230208030436-e93ce80",
3
+ "commands": {
4
+ "add": {
5
+ "id": "add",
6
+ "description": "Adds a new datasource to a subgraph.",
7
+ "strict": true,
8
+ "pluginName": "@graphprotocol/graph-cli",
9
+ "pluginAlias": "@graphprotocol/graph-cli",
10
+ "pluginType": "core",
11
+ "aliases": [],
12
+ "flags": {
13
+ "abi": {
14
+ "name": "abi",
15
+ "type": "option",
16
+ "summary": "Path to the contract ABI.",
17
+ "multiple": false,
18
+ "default": "*Download from Etherscan*"
19
+ },
20
+ "contractName": {
21
+ "name": "contractName",
22
+ "type": "option",
23
+ "summary": "Name of the contract.",
24
+ "multiple": false,
25
+ "default": "Contract"
26
+ },
27
+ "mergeEntities": {
28
+ "name": "mergeEntities",
29
+ "type": "boolean",
30
+ "summary": "Whether to merge entities with the same name.",
31
+ "allowNo": false
32
+ },
33
+ "networkFile": {
34
+ "name": "networkFile",
35
+ "type": "option",
36
+ "summary": "Networks config file path.",
37
+ "multiple": false,
38
+ "default": "networks.json"
39
+ }
40
+ },
41
+ "args": {
42
+ "address": {
43
+ "name": "address",
44
+ "description": "The contract address",
45
+ "required": true
46
+ },
47
+ "subgraphManifest": {
48
+ "name": "subgraphManifest",
49
+ "default": "subgraph.yaml"
50
+ }
51
+ }
52
+ },
53
+ "auth": {
54
+ "id": "auth",
55
+ "description": "Sets the deploy key to use when deploying to a Graph node",
56
+ "pluginName": "@graphprotocol/graph-cli",
57
+ "pluginAlias": "@graphprotocol/graph-cli",
58
+ "pluginType": "core",
59
+ "aliases": [],
60
+ "flags": {},
61
+ "args": {}
62
+ },
63
+ "build": {
64
+ "id": "build",
65
+ "description": "Builds a subgraph and (optionally) uploads it to IPFS.",
66
+ "strict": true,
67
+ "pluginName": "@graphprotocol/graph-cli",
68
+ "pluginAlias": "@graphprotocol/graph-cli",
69
+ "pluginType": "core",
70
+ "aliases": [],
71
+ "flags": {
72
+ "ipfs": {
73
+ "name": "ipfs",
74
+ "type": "option",
75
+ "char": "i",
76
+ "summary": "Upload build results to an IPFS node.",
77
+ "multiple": false
78
+ },
79
+ "output-dir": {
80
+ "name": "output-dir",
81
+ "type": "option",
82
+ "char": "o",
83
+ "summary": "Output directory for build results.",
84
+ "multiple": false,
85
+ "default": "build/"
86
+ },
87
+ "output-format": {
88
+ "name": "output-format",
89
+ "type": "option",
90
+ "char": "t",
91
+ "summary": "Output format for mappings.",
92
+ "multiple": false,
93
+ "options": [
94
+ "wasm",
95
+ "wast"
96
+ ],
97
+ "default": "wasm"
98
+ },
99
+ "skip-migrations": {
100
+ "name": "skip-migrations",
101
+ "type": "boolean",
102
+ "summary": "Skip subgraph migrations.",
103
+ "allowNo": false
104
+ },
105
+ "watch": {
106
+ "name": "watch",
107
+ "type": "boolean",
108
+ "char": "w",
109
+ "summary": "Regenerate types when subgraph files change.",
110
+ "allowNo": false
111
+ },
112
+ "network": {
113
+ "name": "network",
114
+ "type": "option",
115
+ "summary": "Network configuration to use from the networks config file.",
116
+ "multiple": false
117
+ },
118
+ "network-file": {
119
+ "name": "network-file",
120
+ "type": "option",
121
+ "summary": "Networks config file path.",
122
+ "multiple": false,
123
+ "default": "networks.json"
124
+ }
125
+ },
126
+ "args": {
127
+ "subgraph-manifest": {
128
+ "name": "subgraph-manifest",
129
+ "default": "subgraph.yaml"
130
+ }
131
+ }
132
+ },
133
+ "codegen": {
134
+ "id": "codegen",
135
+ "description": "Generates AssemblyScript types for a subgraph",
136
+ "pluginName": "@graphprotocol/graph-cli",
137
+ "pluginAlias": "@graphprotocol/graph-cli",
138
+ "pluginType": "core",
139
+ "aliases": [],
140
+ "flags": {},
141
+ "args": {}
142
+ },
143
+ "create": {
144
+ "id": "create",
145
+ "description": "Registers a subgraph name",
146
+ "pluginName": "@graphprotocol/graph-cli",
147
+ "pluginAlias": "@graphprotocol/graph-cli",
148
+ "pluginType": "core",
149
+ "aliases": [],
150
+ "flags": {},
151
+ "args": {}
152
+ },
153
+ "deploy": {
154
+ "id": "deploy",
155
+ "description": "Deploys the subgraph to a Graph node",
156
+ "pluginName": "@graphprotocol/graph-cli",
157
+ "pluginAlias": "@graphprotocol/graph-cli",
158
+ "pluginType": "core",
159
+ "aliases": [],
160
+ "flags": {},
161
+ "args": {}
162
+ },
163
+ "init": {
164
+ "id": "init",
165
+ "strict": true,
166
+ "pluginName": "@graphprotocol/graph-cli",
167
+ "pluginAlias": "@graphprotocol/graph-cli",
168
+ "pluginType": "core",
169
+ "aliases": [],
170
+ "flags": {
171
+ "protocol": {
172
+ "name": "protocol",
173
+ "type": "option",
174
+ "required": true,
175
+ "multiple": false,
176
+ "options": [
177
+ "arweave",
178
+ "ethereum",
179
+ "near",
180
+ "cosmos",
181
+ "substreams"
182
+ ]
183
+ },
184
+ "product": {
185
+ "name": "product",
186
+ "type": "option",
187
+ "summary": "Selects the product for which to initialize.",
188
+ "required": true,
189
+ "multiple": false,
190
+ "options": [
191
+ "subgraph-studio",
192
+ "hosted-service"
193
+ ]
194
+ },
195
+ "studio": {
196
+ "name": "studio",
197
+ "type": "boolean",
198
+ "summary": "Shortcut for \"--product subgraph-studio\".",
199
+ "allowNo": false,
200
+ "exclusive": [
201
+ "product"
202
+ ]
203
+ },
204
+ "node": {
205
+ "name": "node",
206
+ "type": "option",
207
+ "char": "g",
208
+ "summary": "Graph node for which to initialize.",
209
+ "required": true,
210
+ "multiple": false
211
+ },
212
+ "allow-simple-name": {
213
+ "name": "allow-simple-name",
214
+ "type": "boolean",
215
+ "description": "Use a subgraph name without a prefix.",
216
+ "allowNo": false
217
+ },
218
+ "from-contract": {
219
+ "name": "from-contract",
220
+ "type": "option",
221
+ "description": "Creates a scaffold based on an existing contract.",
222
+ "required": true,
223
+ "helpGroup": "Scaffold",
224
+ "multiple": false,
225
+ "exclusive": [
226
+ "from-example"
227
+ ]
228
+ },
229
+ "from-example": {
230
+ "name": "from-example",
231
+ "type": "option",
232
+ "description": "Creates a scaffold based on an example subgraph.",
233
+ "helpGroup": "Scaffold",
234
+ "multiple": false,
235
+ "exclusive": [
236
+ "from-contract"
237
+ ],
238
+ "default": "Contract"
239
+ },
240
+ "contract-name": {
241
+ "name": "contract-name",
242
+ "type": "option",
243
+ "description": "Name of the contract.",
244
+ "required": true,
245
+ "helpGroup": "Scaffold from contract",
246
+ "multiple": false,
247
+ "dependsOn": [
248
+ "from-contract"
249
+ ]
250
+ },
251
+ "index-events": {
252
+ "name": "index-events",
253
+ "type": "boolean",
254
+ "description": "Index contract events as entities.",
255
+ "helpGroup": "Scaffold from contract",
256
+ "allowNo": false,
257
+ "dependsOn": [
258
+ "from-contract"
259
+ ]
260
+ },
261
+ "start-block": {
262
+ "name": "start-block",
263
+ "type": "option",
264
+ "description": "Block number to start indexing from.",
265
+ "helpGroup": "Scaffold from contract",
266
+ "multiple": false,
267
+ "dependsOn": [
268
+ "from-contract"
269
+ ],
270
+ "default": 0
271
+ },
272
+ "abi": {
273
+ "name": "abi",
274
+ "type": "option",
275
+ "helpGroup": "Ethereum",
276
+ "multiple": false
277
+ },
278
+ "network": {
279
+ "name": "network",
280
+ "type": "option",
281
+ "helpGroup": "Ethereum",
282
+ "multiple": false
283
+ }
284
+ },
285
+ "args": {
286
+ "subgraphName": {
287
+ "name": "subgraphName",
288
+ "required": true
289
+ },
290
+ "directory": {
291
+ "name": "directory",
292
+ "required": true
293
+ }
294
+ }
295
+ },
296
+ "local": {
297
+ "id": "local",
298
+ "description": "Runs local tests against a Graph Node environment (using Ganache by default)",
299
+ "pluginName": "@graphprotocol/graph-cli",
300
+ "pluginAlias": "@graphprotocol/graph-cli",
301
+ "pluginType": "core",
302
+ "aliases": [],
303
+ "flags": {},
304
+ "args": {}
305
+ },
306
+ "remove": {
307
+ "id": "remove",
308
+ "description": "Unregisters a subgraph name",
309
+ "pluginName": "@graphprotocol/graph-cli",
310
+ "pluginAlias": "@graphprotocol/graph-cli",
311
+ "pluginType": "core",
312
+ "aliases": [],
313
+ "flags": {},
314
+ "args": {}
315
+ },
316
+ "test": {
317
+ "id": "test",
318
+ "description": "Runs rust binary for subgraph testing",
319
+ "pluginName": "@graphprotocol/graph-cli",
320
+ "pluginAlias": "@graphprotocol/graph-cli",
321
+ "pluginType": "core",
322
+ "aliases": [],
323
+ "flags": {},
324
+ "args": {}
325
+ }
326
+ }
327
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.38.0",
3
+ "version": "0.38.1-alpha-20230208030436-e93ce80",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {
@@ -9,14 +9,16 @@
9
9
  "bin": {
10
10
  "graph": "dist/bin.js"
11
11
  },
12
- "main": "dist/cli.js",
12
+ "main": "dist/index.js",
13
13
  "files": [
14
14
  "CHANGELOG.md",
15
15
  "dist",
16
+ "oclif.manifest.json",
16
17
  "README.md"
17
18
  ],
18
19
  "dependencies": {
19
20
  "@float-capital/float-subgraph-uncrashable": "^0.0.0-alpha.4",
21
+ "@oclif/core": "2.0.7",
20
22
  "assemblyscript": "0.19.23",
21
23
  "binary-install-raw": "0.0.13",
22
24
  "chalk": "3.0.0",
@@ -52,6 +54,7 @@
52
54
  "@types/which": "^2.0.1",
53
55
  "copyfiles": "^2.4.1",
54
56
  "jest": "26.0.0",
57
+ "oclif": "3.6.1",
55
58
  "spawn-command": "0.0.2-1",
56
59
  "strip-ansi": "6.0.0",
57
60
  "tern": "0.24.3",
@@ -60,8 +63,12 @@
60
63
  "publishConfig": {
61
64
  "access": "public"
62
65
  },
66
+ "oclif": {
67
+ "bin": "graph",
68
+ "commands": "./dist/commands"
69
+ },
63
70
  "scripts": {
64
- "build": "tsc -b tsconfig.build.json && copyfiles -u 1 src/**/*.graphql dist/ && chmod +x ./dist/bin.js",
71
+ "build": "tsc -b tsconfig.build.json && oclif manifest && copyfiles -u 1 src/**/*.graphql dist/ && chmod +x ./dist/bin.js",
65
72
  "test": "jest --verbose",
66
73
  "test:init": "jest tests/cli/init.test.ts --verbose",
67
74
  "test:validation": "jest tests/cli/validation.test.ts --verbose",
package/dist/cli.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.run = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const gluegun_1 = require("gluegun");
9
- const run = async (argv) => {
10
- let builder = (0, gluegun_1.build)().brand('graph').src(__dirname);
11
- const pluginDirs = [];
12
- await Promise.all(['npm root -g', 'npm root', 'yarn global dir'].map(async (cmd) => {
13
- try {
14
- const dir = await gluegun_1.system.run(cmd, { trim: true });
15
- pluginDirs.push(dir);
16
- }
17
- catch (_) {
18
- // noop
19
- }
20
- }));
21
- // Inject potential plugin directories
22
- builder = pluginDirs.reduce((cli, dir) => cli.plugin(path_1.default.join(dir, '@graphprotocol', 'indexer-cli', 'dist')), builder);
23
- const cli = builder.help().version().defaultCommand().create();
24
- return await cli.run(argv);
25
- };
26
- exports.run = run;