@graphprotocol/graph-cli 0.52.0 → 0.52.1-alpha-20230718212224-9d21810

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,19 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.52.1-alpha-20230718212224-9d21810
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1400](https://github.com/graphprotocol/graph-tooling/pull/1400)
8
+ [`d7a5634`](https://github.com/graphprotocol/graph-tooling/commit/d7a5634e5ba40873e62ff580db51b83f995e9e83)
9
+ Thanks [@saihaj](https://github.com/saihaj)! - only update `network.json` file during `graph add`
10
+ if it exists
11
+
12
+ - [#1400](https://github.com/graphprotocol/graph-tooling/pull/1400)
13
+ [`d7a5634`](https://github.com/graphprotocol/graph-tooling/commit/d7a5634e5ba40873e62ff580db51b83f995e9e83)
14
+ Thanks [@saihaj](https://github.com/saihaj)! - ask for start block in `graph add` if we cannot
15
+ fetch the start block from etherscan
16
+
3
17
  ## 0.52.0
4
18
 
5
19
  ### Minor Changes
@@ -66,8 +66,23 @@ class AddCommand extends core_1.Command {
66
66
  startBlock || (startBlock = Number(await (0, abi_1.loadStartBlockForContract)(network, address)).toString());
67
67
  }
68
68
  catch (error) {
69
- // If we can't get the start block, we'll just leave it out of the manifest
70
- // TODO: Ask the user for the start block
69
+ // we cannot ask user to do prompt in test environment
70
+ if (process.env.NODE_ENV !== 'test') {
71
+ // If we can't get the start block, we'll just leave it out of the manifest
72
+ const { startBlock: userInputStartBlock } = await gluegun_1.prompt.ask([
73
+ {
74
+ type: 'input',
75
+ name: 'startBlock',
76
+ message: 'Start Block',
77
+ initial: '0',
78
+ validate: value => parseInt(value) >= 0,
79
+ result(value) {
80
+ return value;
81
+ },
82
+ },
83
+ ]);
84
+ startBlock = userInputStartBlock;
85
+ }
71
86
  }
72
87
  await (0, scaffold_1.writeABI)(ethabi, contractName);
73
88
  const { collisionEntities, onlyCollisions, abiData } = updateEventNamesOnCollision(ethabi, entities, contractName, mergeEntities);
@@ -90,7 +105,9 @@ class AddCommand extends core_1.Command {
90
105
  result.set('dataSources', dataSources.push(dataSource));
91
106
  await subgraph_1.default.write(result, manifestPath);
92
107
  // Update networks.json
93
- await (0, network_1.updateNetworksFile)(network, contractName, address, networksFile);
108
+ if (gluegun_1.filesystem.exists(networksFile)) {
109
+ await (0, network_1.updateNetworksFile)(network, contractName, address, networksFile);
110
+ }
94
111
  // Detect Yarn and/or NPM
95
112
  const yarn = gluegun_1.system.which('yarn');
96
113
  const npm = gluegun_1.system.which('npm');
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.52.0",
2
+ "version": "0.52.1-alpha-20230718212224-9d21810",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.52.0",
3
+ "version": "0.52.1-alpha-20230718212224-9d21810",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {