@graphprotocol/graph-cli 0.53.0 → 0.54.0-alpha-20230724164724-a1104fb

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,13 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.54.0-alpha-20230724164724-a1104fb
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1407](https://github.com/graphprotocol/graph-tooling/pull/1407)
8
+ [`a1104fb`](https://github.com/graphprotocol/graph-tooling/commit/a1104fb030f54fa9544332127fafc745135a32e4)
9
+ Thanks [@saihaj](https://github.com/saihaj)! - add skipInstall flag for init
10
+
3
11
  ## 0.53.0
4
12
 
5
13
  ### Minor Changes
@@ -16,6 +16,7 @@ export default class InitCommand extends Command {
16
16
  'from-example': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
17
17
  'contract-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
18
18
  'index-events': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
+ 'skip-install': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
20
  'start-block': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
20
21
  abi: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
21
22
  spkg: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
@@ -24,7 +24,7 @@ const availableNetworks = protocols_1.default.availableNetworks();
24
24
  const DEFAULT_EXAMPLE_SUBGRAPH = 'ethereum-gravatar';
25
25
  class InitCommand extends core_1.Command {
26
26
  async run() {
27
- const { args: { subgraphName, directory }, flags: { protocol, product, studio, node: nodeFlag, 'allow-simple-name': allowSimpleNameFlag, 'from-contract': fromContract, 'contract-name': contractName, 'from-example': fromExample, 'index-events': indexEvents, network, abi: abiPath, 'start-block': startBlock, spkg: spkgPath, }, } = await this.parse(InitCommand);
27
+ const { args: { subgraphName, directory }, flags: { 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, }, } = await this.parse(InitCommand);
28
28
  let { node, allowSimpleName } = (0, node_1.chooseNodeUrl)({
29
29
  product,
30
30
  // if we are loading example, we want to ensure we are using studio
@@ -66,6 +66,7 @@ class InitCommand extends core_1.Command {
66
66
  allowSimpleName,
67
67
  directory,
68
68
  subgraphName,
69
+ skipInstall,
69
70
  }, { commands });
70
71
  // Exit with success
71
72
  return this.exit(0);
@@ -119,6 +120,7 @@ class InitCommand extends core_1.Command {
119
120
  product,
120
121
  startBlock,
121
122
  spkgPath,
123
+ skipInstall,
122
124
  }, { commands, addContract: false });
123
125
  // Exit with success
124
126
  return this.exit(0);
@@ -138,6 +140,7 @@ class InitCommand extends core_1.Command {
138
140
  fromExample,
139
141
  subgraphName: answers.subgraphName,
140
142
  directory: answers.directory,
143
+ skipInstall,
141
144
  }, { commands });
142
145
  }
143
146
  else {
@@ -185,6 +188,7 @@ class InitCommand extends core_1.Command {
185
188
  product: answers.product,
186
189
  startBlock: answers.startBlock,
187
190
  spkgPath: answers.spkgPath,
191
+ skipInstall,
188
192
  }, { commands, addContract: true });
189
193
  }
190
194
  // Exit with success
@@ -239,6 +243,10 @@ InitCommand.flags = {
239
243
  description: 'Index contract events as entities.',
240
244
  dependsOn: ['from-contract'],
241
245
  }),
246
+ 'skip-install': core_1.Flags.boolean({
247
+ summary: 'Skip installing dependencies.',
248
+ default: false,
249
+ }),
242
250
  'start-block': core_1.Flags.string({
243
251
  helpGroup: 'Scaffold from contract',
244
252
  description: 'Block number to start indexing from.',
@@ -652,7 +660,7 @@ Subgraph ${subgraphName} created in ${relativeDir}
652
660
 
653
661
  Make sure to visit the documentation on https://thegraph.com/docs/ for further information.`);
654
662
  }
655
- async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphName, directory, }, { commands, }) {
663
+ async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphName, directory, skipInstall, }, { commands, }) {
656
664
  // Fail if the subgraph name is invalid
657
665
  if (!revalidateSubgraphName.bind(this)(subgraphName, { allowSimpleName })) {
658
666
  process.exitCode = 1;
@@ -733,10 +741,12 @@ async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphN
733
741
  return;
734
742
  }
735
743
  // Install dependencies
736
- const installed = await installDependencies(directory, commands);
737
- if (installed !== true) {
738
- this.exit(1);
739
- return;
744
+ if (!skipInstall) {
745
+ const installed = await installDependencies(directory, commands);
746
+ if (installed !== true) {
747
+ this.exit(1);
748
+ return;
749
+ }
740
750
  }
741
751
  // Run code-generation
742
752
  const codegen = await runCodegen(directory, commands.codegen);
@@ -746,7 +756,7 @@ async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphN
746
756
  }
747
757
  printNextSteps.bind(this)({ subgraphName, directory }, { commands });
748
758
  }
749
- async function initSubgraphFromContract({ protocolInstance, allowSimpleName, subgraphName, directory, abi, network, contract, indexEvents, contractName, node, studio, product, startBlock, spkgPath, }, { commands, addContract, }) {
759
+ async function initSubgraphFromContract({ protocolInstance, allowSimpleName, subgraphName, directory, abi, network, contract, indexEvents, contractName, node, studio, product, startBlock, spkgPath, skipInstall, }, { commands, addContract, }) {
750
760
  const isSubstreams = protocolInstance.name === 'substreams';
751
761
  // Fail if the subgraph name is invalid
752
762
  if (!revalidateSubgraphName.bind(this)(subgraphName, { allowSimpleName })) {
@@ -808,11 +818,13 @@ async function initSubgraphFromContract({ protocolInstance, allowSimpleName, sub
808
818
  this.exit(1);
809
819
  return;
810
820
  }
811
- // Install dependencies
812
- const installed = await installDependencies(directory, commands);
813
- if (installed !== true) {
814
- this.exit(1);
815
- return;
821
+ if (!skipInstall) {
822
+ // Install dependencies
823
+ const installed = await installDependencies(directory, commands);
824
+ if (installed !== true) {
825
+ this.exit(1);
826
+ return;
827
+ }
816
828
  }
817
829
  // Substreams we have nothing to install or generate
818
830
  if (!isSubstreams) {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.53.0",
2
+ "version": "0.54.0-alpha-20230724164724-a1104fb",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
@@ -561,6 +561,12 @@
561
561
  "from-contract"
562
562
  ]
563
563
  },
564
+ "skip-install": {
565
+ "name": "skip-install",
566
+ "type": "boolean",
567
+ "summary": "Skip installing dependencies.",
568
+ "allowNo": false
569
+ },
564
570
  "start-block": {
565
571
  "name": "start-block",
566
572
  "type": "option",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.53.0",
3
+ "version": "0.54.0-alpha-20230724164724-a1104fb",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {