Skip to content

Commit 0a16b41

Browse files
authoredJun 12, 2024··
feat: throw errors when trying to select hosted service (#1681)
* feat: throw errors when trying to select hosted service * remove ipfs checks * fix test:
1 parent 801cac7 commit 0a16b41

File tree

7 files changed

+33
-3
lines changed

7 files changed

+33
-3
lines changed
 

‎.changeset/ninety-balloons-stare.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/graph-cli': patch
3+
---
4+
5+
remove ipfs check for studio deploys

‎.changeset/real-eggs-teach.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/graph-cli': minor
3+
---
4+
5+
Part of the Hosted Service migration throw an error when users are trying to use `hosted-service` product in `graph [auth|deploy|init]` commands.

‎packages/cli/src/command-helpers/compiler.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface CreateCompilerOptions {
1111
outputDir: string;
1212
outputFormat: string;
1313
skipMigrations: boolean;
14+
// TODO: Remove this is unused
1415
blockIpfsMethods?: RegExpMatchArray;
1516
protocol: Protocol;
1617
}

‎packages/cli/src/commands/auth.ts

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ export default class AuthCommand extends Command {
5757
required: true,
5858
}));
5959

60+
// Poor var naming will cleanup later
61+
({ node } = chooseNodeUrl({ product: node, studio: false }));
62+
6063
// eslint-disable-next-line -- prettier has problems with ||=
6164
deployKey =
6265
deployKey ||
@@ -68,6 +71,10 @@ export default class AuthCommand extends Command {
6871
this.error('✖ Deploy key must not exceed 200 characters', { exit: 1 });
6972
}
7073

74+
if (product === 'hosted-service' || node?.match(/api.thegraph.com/)) {
75+
this.error('✖ The hosted service is deprecated', { exit: 1 });
76+
}
77+
7178
try {
7279
await saveDeployKey(node!, deployKey);
7380
print.success(`Deploy key set for ${node}`);

‎packages/cli/src/commands/deploy.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ export default class DeployCommand extends Command {
281281
])
282282
.then(({ product }) => product as string));
283283

284+
if (product === 'hosted-service') {
285+
this.error('✖ The hosted service is deprecated', { exit: 1 });
286+
}
287+
284288
const { node } = chooseNodeUrl({
285289
product,
286290
studio,
@@ -455,7 +459,7 @@ export default class DeployCommand extends Command {
455459
outputDir,
456460
outputFormat: 'wasm',
457461
skipMigrations,
458-
blockIpfsMethods: isStudio || undefined, // Network does not support publishing subgraphs with IPFS methods
462+
blockIpfsMethods: undefined,
459463
protocol,
460464
});
461465

‎packages/cli/src/commands/init.ts

+9
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ export default class InitCommand extends Command {
201201
} = flags;
202202

203203
initDebugger('Flags: %O', flags);
204+
205+
if (product === 'hosted-service') {
206+
this.error('✖ The hosted service is deprecated', { exit: 1 });
207+
}
208+
204209
let { node, allowSimpleName } = chooseNodeUrl({
205210
product,
206211
// if we are loading example, we want to ensure we are using studio
@@ -595,6 +600,10 @@ async function processInitForm(
595600
},
596601
]);
597602

603+
if (product == 'hosted-service') {
604+
this.error('✖ The hosted service is deprecated', { exit: 1 });
605+
}
606+
598607
const { subgraphName } = await prompt.ask<{ subgraphName: string }>([
599608
{
600609
type: 'input',

‎packages/cli/tests/cli/init.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ describe.sequential(
201201
'--skip-git',
202202
'--protocol',
203203
'near',
204-
'--product',
205-
'hosted-service',
204+
'--studio',
206205
'--from-contract',
207206
'app.good-morning.near',
208207
'--network',

0 commit comments

Comments
 (0)
Please sign in to comment.