@graphprotocol/graph-cli 0.76.0 → 0.77.0-alpha-20240625185414-ea1be5b

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.77.0-alpha-20240625185414-ea1be5b
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1690](https://github.com/graphprotocol/graph-tooling/pull/1690)
8
+ [`4b14ddd`](https://github.com/graphprotocol/graph-tooling/commit/4b14ddd8b50f7aa8ae4776dfab9594782a3cef68)
9
+ Thanks [@saihaj](https://github.com/saihaj)! - allow publishing new subgraph version
10
+
3
11
  ## 0.76.0
4
12
 
5
13
  ### Minor Changes
@@ -6,6 +6,7 @@ export default class PublishCommand extends Command {
6
6
  };
7
7
  static flags: {
8
8
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
9
+ 'subgraph-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
10
  ipfs: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
11
  'ipfs-hash': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
12
  'webapp-url': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
@@ -13,9 +14,10 @@ export default class PublishCommand extends Command {
13
14
  /**
14
15
  * Prompt the user to open up the browser to continue publishing the subgraph
15
16
  */
16
- publishWithBrowser({ ipfsHash, webapp }: {
17
+ publishWithBrowser({ ipfsHash, webapp, subgraphId, }: {
17
18
  ipfsHash: string;
18
19
  webapp: string;
20
+ subgraphId: string | undefined;
19
21
  }): Promise<void>;
20
22
  run(): Promise<void>;
21
23
  }
@@ -30,6 +30,8 @@ const chalk_1 = __importDefault(require("chalk"));
30
30
  const gluegun_1 = require("gluegun");
31
31
  const open_1 = __importDefault(require("open"));
32
32
  const core_1 = require("@oclif/core");
33
+ // eslint-disable-next-line no-restricted-imports
34
+ const fetch_1 = require("@whatwg-node/fetch");
33
35
  const compiler_1 = require("../command-helpers/compiler");
34
36
  const DataSourcesExtractor = __importStar(require("../command-helpers/data-sources"));
35
37
  const ipfs_1 = require("../command-helpers/ipfs");
@@ -38,20 +40,26 @@ class PublishCommand extends core_1.Command {
38
40
  /**
39
41
  * Prompt the user to open up the browser to continue publishing the subgraph
40
42
  */
41
- async publishWithBrowser({ ipfsHash, webapp }) {
43
+ async publishWithBrowser({ ipfsHash, webapp, subgraphId, }) {
42
44
  const answer = await core_1.ux.prompt(`Press ${chalk_1.default.green('y')} (or any key) to open up the browser to continue publishing or ${chalk_1.default.yellow('q')} to exit`);
43
45
  if (answer.toLowerCase() === 'q') {
44
46
  this.exit(0);
45
47
  }
46
- const URL = `${webapp}?id=${ipfsHash}`;
47
- gluegun_1.print.success(`Finalize the publish of the subgraph from the Graph CLI publish page. Opening up the browser to continue publishing at ${URL}`);
48
- await (0, open_1.default)(URL);
48
+ const url = new fetch_1.URL(webapp);
49
+ const searchParams = new fetch_1.URLSearchParams(url.search);
50
+ searchParams.set('id', ipfsHash);
51
+ if (subgraphId) {
52
+ searchParams.set('subgraphId', subgraphId);
53
+ }
54
+ const openUrl = url.toString();
55
+ gluegun_1.print.success(`Finalize the publish of the subgraph from the Graph CLI publish page. Opening up the browser to continue publishing at ${fetch_1.URL}`);
56
+ await (0, open_1.default)(openUrl);
49
57
  return;
50
58
  }
51
59
  async run() {
52
- const { args: { 'subgraph-manifest': manifest }, flags: { 'ipfs-hash': ipfsHash, 'webapp-url': webUiUrl, ipfs }, } = await this.parse(PublishCommand);
60
+ const { args: { 'subgraph-manifest': manifest }, flags: { 'ipfs-hash': ipfsHash, 'webapp-url': webUiUrl, ipfs, 'subgraph-id': subgraphId }, } = await this.parse(PublishCommand);
53
61
  if (ipfsHash) {
54
- await this.publishWithBrowser({ ipfsHash, webapp: webUiUrl });
62
+ await this.publishWithBrowser({ ipfsHash, webapp: webUiUrl, subgraphId });
55
63
  return;
56
64
  }
57
65
  let protocol;
@@ -80,7 +88,7 @@ class PublishCommand extends core_1.Command {
80
88
  process.exitCode = 1;
81
89
  return;
82
90
  }
83
- await this.publishWithBrowser({ ipfsHash: result, webapp: webUiUrl });
91
+ await this.publishWithBrowser({ ipfsHash: result, webapp: webUiUrl, subgraphId });
84
92
  return;
85
93
  }
86
94
  }
@@ -94,6 +102,9 @@ PublishCommand.flags = {
94
102
  help: core_1.Flags.help({
95
103
  char: 'h',
96
104
  }),
105
+ 'subgraph-id': core_1.Flags.string({
106
+ summary: 'Subgraph ID to publish to.',
107
+ }),
97
108
  ipfs: core_1.Flags.string({
98
109
  summary: 'Upload build results to an IPFS node.',
99
110
  char: 'i',
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.76.0",
2
+ "version": "0.77.0-alpha-20240625185414-ea1be5b",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
@@ -762,6 +762,12 @@
762
762
  "description": "Show CLI help.",
763
763
  "allowNo": false
764
764
  },
765
+ "subgraph-id": {
766
+ "name": "subgraph-id",
767
+ "type": "option",
768
+ "summary": "Subgraph ID to publish to.",
769
+ "multiple": false
770
+ },
765
771
  "ipfs": {
766
772
  "name": "ipfs",
767
773
  "type": "option",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.76.0",
3
+ "version": "0.77.0-alpha-20240625185414-ea1be5b",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {