Skip to content

Commit

Permalink
feat: throw errors when trying to select hosted service (graphprotoco…
Browse files Browse the repository at this point in the history
…l#1681)

* feat: throw errors when trying to select hosted service

* remove ipfs checks

* fix test:
  • Loading branch information
saihaj authored Jun 12, 2024
1 parent 801cac7 commit 0a16b41
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/ninety-balloons-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-cli': patch
---

remove ipfs check for studio deploys
5 changes: 5 additions & 0 deletions .changeset/real-eggs-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-cli': minor
---

Part of the Hosted Service migration throw an error when users are trying to use `hosted-service` product in `graph [auth|deploy|init]` commands.
1 change: 1 addition & 0 deletions packages/cli/src/command-helpers/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface CreateCompilerOptions {
outputDir: string;
outputFormat: string;
skipMigrations: boolean;
// TODO: Remove this is unused
blockIpfsMethods?: RegExpMatchArray;
protocol: Protocol;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/src/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export default class AuthCommand extends Command {
required: true,
}));

// Poor var naming will cleanup later
({ node } = chooseNodeUrl({ product: node, studio: false }));

// eslint-disable-next-line -- prettier has problems with ||=
deployKey =
deployKey ||
Expand All @@ -68,6 +71,10 @@ export default class AuthCommand extends Command {
this.error('✖ Deploy key must not exceed 200 characters', { exit: 1 });
}

if (product === 'hosted-service' || node?.match(/api.thegraph.com/)) {
this.error('✖ The hosted service is deprecated', { exit: 1 });
}

try {
await saveDeployKey(node!, deployKey);
print.success(`Deploy key set for ${node}`);
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ export default class DeployCommand extends Command {
])
.then(({ product }) => product as string));

if (product === 'hosted-service') {
this.error('✖ The hosted service is deprecated', { exit: 1 });
}

const { node } = chooseNodeUrl({
product,
studio,
Expand Down Expand Up @@ -455,7 +459,7 @@ export default class DeployCommand extends Command {
outputDir,
outputFormat: 'wasm',
skipMigrations,
blockIpfsMethods: isStudio || undefined, // Network does not support publishing subgraphs with IPFS methods
blockIpfsMethods: undefined,
protocol,
});

Expand Down
9 changes: 9 additions & 0 deletions packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ export default class InitCommand extends Command {
} = flags;

initDebugger('Flags: %O', flags);

if (product === 'hosted-service') {
this.error('✖ The hosted service is deprecated', { exit: 1 });
}

let { node, allowSimpleName } = chooseNodeUrl({
product,
// if we are loading example, we want to ensure we are using studio
Expand Down Expand Up @@ -595,6 +600,10 @@ async function processInitForm(
},
]);

if (product == 'hosted-service') {
this.error('✖ The hosted service is deprecated', { exit: 1 });
}

const { subgraphName } = await prompt.ask<{ subgraphName: string }>([
{
type: 'input',
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/tests/cli/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ describe.sequential(
'--skip-git',
'--protocol',
'near',
'--product',
'hosted-service',
'--studio',
'--from-contract',
'app.good-morning.near',
'--network',
Expand Down

0 comments on commit 0a16b41

Please sign in to comment.