Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add deprecation notices #1533

Merged
merged 5 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/red-walls-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphprotocol/graph-cli': minor
---

adding deprecation notices for commands we plan to change in the next major. See
https://github.com/graphprotocol/graph-tooling/issues/1487
8 changes: 8 additions & 0 deletions packages/cli/src/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@
product: Flags.string({
summary: 'Select a product for which to authenticate.',
options: ['subgraph-studio', 'hosted-service'],
deprecated: {
message:
'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
},
}),
studio: Flags.boolean({
summary: 'Shortcut for "--product subgraph-studio".',
exclusive: ['product'],
deprecated: {
message:
'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
},
}),
};

Expand Down Expand Up @@ -61,7 +69,7 @@
}

try {
await saveDeployKey(node!, deployKey);

Check warning on line 72 in packages/cli/src/commands/auth.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
print.success(`Deploy key set for ${node}`);
} catch (e) {
this.error(e, { exit: 1 });
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/commands/create.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { URL } from 'url';
import { print } from 'gluegun';
import { Args, Command, Flags } from '@oclif/core';
import { Deprecation } from '@oclif/core/lib/interfaces';
import { identifyDeployKey as identifyAccessToken } from '../command-helpers/auth';
import { createJsonRpcClient } from '../command-helpers/jsonrpc';
import { validateNodeUrl } from '../command-helpers/node';
import { GRAPH_CLI_SHARED_HEADERS } from '../constants';

export default class CreateCommand extends Command {
static description = 'Registers a subgraph name';
static state = 'deprecated';
static deprecationOptions: Deprecation = {
message:
'In next major version, this command will be merged as a subcommand for `graph local`.',
};

static args = {
'subgraph-name': Args.string({
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@
exclusive: ['access-token'],
}),
'access-token': Flags.string({
deprecated: true,
summary: 'Graph access key. DEPRECATED: Use "--deploy-key" instead.',
exclusive: ['deploy-key'],
deprecated: {
to: 'deploy-key',
message: "In next version, we are removing this flag in favor of '--deploy-key'",
},
}),
'version-label': Flags.string({
summary: 'Version label used for the deployment.',
Expand Down Expand Up @@ -432,7 +434,7 @@
}

if (network) {
const identifierName = protocol.getContract()!.identifierName();

Check warning on line 437 in packages/cli/src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
await updateSubgraphNetwork(manifest, network, networkFile, identifierName);
}

Expand Down
16 changes: 16 additions & 0 deletions packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@
product: Flags.string({
summary: 'Selects the product for which to initialize.',
options: ['subgraph-studio', 'hosted-service'],
deprecated: {
message:
'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
},
}),
studio: Flags.boolean({
summary: 'Shortcut for "--product subgraph-studio".',
exclusive: ['product'],
deprecated: {
message:
'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
},
}),
node: Flags.string({
summary: 'Graph node for which to initialize.',
Expand All @@ -59,6 +67,10 @@
'allow-simple-name': Flags.boolean({
description: 'Use a subgraph name without a prefix.',
default: false,
deprecated: {
message:
'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
},
}),

'from-contract': Flags.string({
Expand Down Expand Up @@ -89,6 +101,10 @@
'skip-git': Flags.boolean({
summary: 'Skip initializing a Git repository.',
default: false,
deprecated: {
message:
'In next major version, this flag will be removed. By default we will stop initializing a Git repository.',
},
}),
'start-block': Flags.string({
helpGroup: 'Scaffold from contract',
Expand All @@ -111,8 +127,8 @@
summary: 'Network the contract is deployed to.',
dependsOn: ['from-contract'],
options: [
...availableNetworks.get('ethereum')!,

Check warning on line 130 in packages/cli/src/commands/init.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
...availableNetworks.get('near')!,

Check warning on line 131 in packages/cli/src/commands/init.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
...availableNetworks.get('cosmos')!,
],
}),
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/commands/remove.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { URL } from 'url';
import { print } from 'gluegun';
import { Args, Command, Flags } from '@oclif/core';
import { Deprecation } from '@oclif/core/lib/interfaces';
import { identifyDeployKey as identifyAccessToken } from '../command-helpers/auth';
import { createJsonRpcClient } from '../command-helpers/jsonrpc';
import { validateNodeUrl } from '../command-helpers/node';
import { GRAPH_CLI_SHARED_HEADERS } from '../constants';

export default class RemoveCommand extends Command {
static description = 'Unregisters a subgraph name';
static state = 'deprecated';
static deprecationOptions: Deprecation = {
message:
'In next major version, this command will be merged as a subcommand for `graph local`.',
};

static args = {
'subgraph-name': Args.string({
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/tests/cli/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('Init', () => {
'From example',
[
'init',
'--skip-git',
'--protocol',
'ethereum',
'--studio',
Expand All @@ -32,6 +33,7 @@ describe('Init', () => {
'From contract',
[
'init',
'--skip-git',
'--protocol',
'ethereum',
'--studio',
Expand All @@ -55,6 +57,7 @@ describe('Init', () => {
'From contract with abi',
[
'init',
'--skip-git',
'--protocol',
'ethereum',
'--studio',
Expand All @@ -80,6 +83,7 @@ describe('Init', () => {
'From contract with abi and structs',
[
'init',
'--skip-git',
'--protocol',
'ethereum',
'--studio',
Expand All @@ -105,6 +109,7 @@ describe('Init', () => {
'From contract with list items in abi',
[
'init',
'--skip-git',
'--protocol',
'ethereum',
'--studio',
Expand All @@ -130,6 +135,7 @@ describe('Init', () => {
'From contract with overloaded elements',
[
'init',
'--skip-git',
'--protocol',
'ethereum',
'--studio',
Expand All @@ -155,6 +161,7 @@ describe('Init', () => {
'From contract with index events and abi with ID in events',
[
'init',
'--skip-git',
'--protocol',
'ethereum',
'--studio',
Expand Down Expand Up @@ -186,6 +193,7 @@ describe('Init', () => {
'From contract',
[
'init',
'--skip-git',
'--protocol',
'near',
'--product',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
› Warning: In next major version, this flag will be removed. By default we
› will stop initializing a Git repository.
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
- Create subgraph scaffold
Generate subgraph
- Create subgraph scaffold
Expand All @@ -6,8 +16,6 @@
✔ Create subgraph scaffold
- Initialize networks config
✔ Initialize networks config
- Initialize subgraph repository
✔ Initialize subgraph repository
- Install dependencies with yarn
✔ Install dependencies with yarn
- Generate ABI and schema types with yarn codegen
Expand Down
12 changes: 10 additions & 2 deletions packages/cli/tests/cli/init/ethereum/from-contract-with-abi.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
› Warning: In next major version, this flag will be removed. By default we
› will stop initializing a Git repository.
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
- Create subgraph scaffold
Generate subgraph
- Create subgraph scaffold
Expand All @@ -6,8 +16,6 @@
✔ Create subgraph scaffold
- Initialize networks config
✔ Initialize networks config
- Initialize subgraph repository
✔ Initialize subgraph repository
- Install dependencies with yarn
✔ Install dependencies with yarn
- Generate ABI and schema types with yarn codegen
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
› Warning: In next major version, this flag will be removed. By default we
› will stop initializing a Git repository.
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
- Create subgraph scaffold
Generate subgraph
- Create subgraph scaffold
Expand All @@ -6,8 +16,6 @@
✔ Create subgraph scaffold
- Initialize networks config
✔ Initialize networks config
- Initialize subgraph repository
✔ Initialize subgraph repository
- Install dependencies with yarn
✔ Install dependencies with yarn
- Generate ABI and schema types with yarn codegen
Expand Down
12 changes: 10 additions & 2 deletions packages/cli/tests/cli/init/ethereum/from-contract.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
› Warning: In next major version, this flag will be removed. By default we
› will stop initializing a Git repository.
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
- Fetching ABI from Etherscan
✔ Fetching ABI from Etherscan
- Create subgraph scaffold
Expand All @@ -8,8 +18,6 @@
✔ Create subgraph scaffold
- Initialize networks config
✔ Initialize networks config
- Initialize subgraph repository
✔ Initialize subgraph repository
- Install dependencies with yarn
✔ Install dependencies with yarn
- Generate ABI and schema types with yarn codegen
Expand Down
12 changes: 10 additions & 2 deletions packages/cli/tests/cli/init/ethereum/from-example.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
› Warning: In next major version, this flag will be removed. By default we
› will stop initializing a Git repository.
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
- Cloning example subgraph
✔ Cloning example subgraph
- Initialize networks config
✔ Initialize networks config
- Update subgraph name and commands in package.json
✔ Update subgraph name and commands in package.json
- Initialize subgraph repository
✔ Initialize subgraph repository
- Install dependencies with yarn
✔ Install dependencies with yarn
- Generate ABI and schema types with yarn codegen
Expand Down
12 changes: 10 additions & 2 deletions packages/cli/tests/cli/init/near/from-contract.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
› Warning: In next major version, this flag will be removed. By default we
› will stop initializing a Git repository.
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
› Warning: In next major version, this flag will be removed. By default we
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
› Data
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
- Create subgraph scaffold
Generate subgraph
- Create subgraph scaffold
Expand All @@ -6,8 +16,6 @@
✔ Create subgraph scaffold
- Initialize networks config
✔ Initialize networks config
- Initialize subgraph repository
✔ Initialize subgraph repository
- Install dependencies with yarn
✔ Install dependencies with yarn
- Generate ABI and schema types with yarn codegen
Expand Down
Loading