@graphprotocol/graph-cli 0.62.0-alpha-20231115171303-83b3511 → 0.62.0
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 +6 -1
- package/dist/commands/init.js +19 -3
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.62.0
|
|
3
|
+
## 0.62.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
[`cbbb0fc`](https://github.com/graphprotocol/graph-tooling/commit/cbbb0fc2050019c705f25f59a2bbb6a8ff9b7c32)
|
|
15
15
|
Thanks [@saihaj](https://github.com/saihaj)! - include user agent for CLI fetch calls
|
|
16
16
|
|
|
17
|
+
- [#1508](https://github.com/graphprotocol/graph-tooling/pull/1508)
|
|
18
|
+
[`f5ffcf1`](https://github.com/graphprotocol/graph-tooling/commit/f5ffcf12bf9241c948b8d0b0d023416f66b68d7f)
|
|
19
|
+
Thanks [@saihaj](https://github.com/saihaj)! - respect `--protocol` and `--network` provided from
|
|
20
|
+
flags of `graph init`
|
|
21
|
+
|
|
17
22
|
- [#1461](https://github.com/graphprotocol/graph-tooling/pull/1461)
|
|
18
23
|
[`cbbb0fc`](https://github.com/graphprotocol/graph-tooling/commit/cbbb0fc2050019c705f25f59a2bbb6a8ff9b7c32)
|
|
19
24
|
Thanks [@saihaj](https://github.com/saihaj)! - send graph cli version as user agent for all third
|
package/dist/commands/init.js
CHANGED
|
@@ -39,6 +39,7 @@ const scaffold_1 = require("../command-helpers/scaffold");
|
|
|
39
39
|
const spinner_1 = require("../command-helpers/spinner");
|
|
40
40
|
const studio_1 = require("../command-helpers/studio");
|
|
41
41
|
const subgraph_1 = require("../command-helpers/subgraph");
|
|
42
|
+
const debug_1 = __importDefault(require("../debug"));
|
|
42
43
|
const protocols_1 = __importDefault(require("../protocols"));
|
|
43
44
|
const schema_1 = require("../scaffold/schema");
|
|
44
45
|
const validation_1 = require("../validation");
|
|
@@ -46,9 +47,12 @@ const add_1 = __importDefault(require("./add"));
|
|
|
46
47
|
const protocolChoices = Array.from(protocols_1.default.availableProtocols().keys());
|
|
47
48
|
const availableNetworks = protocols_1.default.availableNetworks();
|
|
48
49
|
const DEFAULT_EXAMPLE_SUBGRAPH = 'ethereum-gravatar';
|
|
50
|
+
const initDebugger = (0, debug_1.default)('graph-cli:commands:init');
|
|
49
51
|
class InitCommand extends core_1.Command {
|
|
50
52
|
async run() {
|
|
51
|
-
const { args: { subgraphName, directory }, flags
|
|
53
|
+
const { args: { subgraphName, directory }, flags, } = await this.parse(InitCommand);
|
|
54
|
+
const { protocol, product, studio, node: nodeFlag, 'allow-simple-name': allowSimpleNameFlag, 'from-contract': fromContract, 'contract-name': contractName, 'from-example': fromExample, 'index-events': indexEvents, 'skip-install': skipInstall, network, abi: abiPath, 'start-block': startBlock, spkg: spkgPath, } = flags;
|
|
55
|
+
initDebugger('Flags: %O', flags);
|
|
52
56
|
let { node, allowSimpleName } = (0, node_1.chooseNodeUrl)({
|
|
53
57
|
product,
|
|
54
58
|
// if we are loading example, we want to ensure we are using studio
|
|
@@ -373,9 +377,18 @@ async function processInitForm({ protocol: initProtocol, product: initProduct, s
|
|
|
373
377
|
message: 'Protocol',
|
|
374
378
|
choices: protocolChoices,
|
|
375
379
|
skip: protocolChoices.includes(String(initProtocol)),
|
|
380
|
+
result: value => {
|
|
381
|
+
if (initProtocol) {
|
|
382
|
+
initDebugger.extend('processInitForm')('initProtocol: %O', initProtocol);
|
|
383
|
+
return initProtocol;
|
|
384
|
+
}
|
|
385
|
+
initDebugger.extend('processInitForm')('protocol: %O', value);
|
|
386
|
+
return value;
|
|
387
|
+
},
|
|
376
388
|
});
|
|
377
389
|
const protocolInstance = new protocols_1.default(protocol);
|
|
378
390
|
const isSubstreams = protocol === 'substreams';
|
|
391
|
+
initDebugger.extend('processInitForm')('isSubstreams: %O', isSubstreams);
|
|
379
392
|
const { product } = await gluegun_1.prompt.ask([
|
|
380
393
|
{
|
|
381
394
|
type: 'select',
|
|
@@ -448,10 +461,13 @@ async function processInitForm({ protocol: initProtocol, product: initProduct, s
|
|
|
448
461
|
choices: availableNetworks
|
|
449
462
|
.get(protocol) // Get networks related to the chosen protocol.
|
|
450
463
|
?.toArray() || ['mainnet'],
|
|
451
|
-
skip:
|
|
464
|
+
skip: initNetwork !== undefined,
|
|
452
465
|
result: value => {
|
|
453
|
-
if (initNetwork)
|
|
466
|
+
if (initNetwork) {
|
|
467
|
+
initDebugger.extend('processInitForm')('initNetwork: %O', initNetwork);
|
|
454
468
|
return initNetwork;
|
|
469
|
+
}
|
|
470
|
+
initDebugger.extend('processInitForm')('network: %O', value);
|
|
455
471
|
return value;
|
|
456
472
|
},
|
|
457
473
|
},
|
package/oclif.manifest.json
CHANGED