From 45f319773276ba14efb0623f7b22232ef76b685a Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 11 Dec 2023 17:14:02 -0500 Subject: [PATCH] feat: add deprecation notices (#1533) * feat: add deprecation notices * skip git in tests * update log messages --- .changeset/red-walls-hug.md | 6 ++++++ packages/cli/src/commands/auth.ts | 8 ++++++++ packages/cli/src/commands/create.ts | 6 ++++++ packages/cli/src/commands/deploy.ts | 6 ++++-- packages/cli/src/commands/init.ts | 16 ++++++++++++++++ packages/cli/src/commands/remove.ts | 6 ++++++ packages/cli/tests/cli/init.test.ts | 8 ++++++++ .../from-contract-with-abi-and-structs.stderr | 12 ++++++++++-- .../init/ethereum/from-contract-with-abi.stderr | 12 ++++++++++-- ...from-contract-with-overloaded-elements.stderr | 12 ++++++++++-- .../tests/cli/init/ethereum/from-contract.stderr | 12 ++++++++++-- .../tests/cli/init/ethereum/from-example.stderr | 12 ++++++++++-- .../cli/tests/cli/init/near/from-contract.stderr | 12 ++++++++++-- 13 files changed, 114 insertions(+), 14 deletions(-) create mode 100644 .changeset/red-walls-hug.md diff --git a/.changeset/red-walls-hug.md b/.changeset/red-walls-hug.md new file mode 100644 index 000000000..565342561 --- /dev/null +++ b/.changeset/red-walls-hug.md @@ -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 diff --git a/packages/cli/src/commands/auth.ts b/packages/cli/src/commands/auth.ts index 6a264d895..c677f8517 100644 --- a/packages/cli/src/commands/auth.ts +++ b/packages/cli/src/commands/auth.ts @@ -19,10 +19,18 @@ export default class AuthCommand extends Command { 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/', + }, }), }; diff --git a/packages/cli/src/commands/create.ts b/packages/cli/src/commands/create.ts index 989d861f5..811addef9 100644 --- a/packages/cli/src/commands/create.ts +++ b/packages/cli/src/commands/create.ts @@ -1,6 +1,7 @@ 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'; @@ -8,6 +9,11 @@ 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({ diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index 819b758ff..5122750a5 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -55,9 +55,11 @@ export default class DeployCommand extends Command { 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.', diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index 488a65046..35da3cf51 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -47,10 +47,18 @@ export default class InitCommand extends Command { 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.', @@ -59,6 +67,10 @@ export default class InitCommand extends Command { '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({ @@ -89,6 +101,10 @@ export default class InitCommand extends Command { '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', diff --git a/packages/cli/src/commands/remove.ts b/packages/cli/src/commands/remove.ts index 5728bd6a8..149550b03 100644 --- a/packages/cli/src/commands/remove.ts +++ b/packages/cli/src/commands/remove.ts @@ -1,6 +1,7 @@ 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'; @@ -8,6 +9,11 @@ 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({ diff --git a/packages/cli/tests/cli/init.test.ts b/packages/cli/tests/cli/init.test.ts index 9dac0d021..ab9b5ae4e 100644 --- a/packages/cli/tests/cli/init.test.ts +++ b/packages/cli/tests/cli/init.test.ts @@ -11,6 +11,7 @@ describe('Init', () => { 'From example', [ 'init', + '--skip-git', '--protocol', 'ethereum', '--studio', @@ -32,6 +33,7 @@ describe('Init', () => { 'From contract', [ 'init', + '--skip-git', '--protocol', 'ethereum', '--studio', @@ -55,6 +57,7 @@ describe('Init', () => { 'From contract with abi', [ 'init', + '--skip-git', '--protocol', 'ethereum', '--studio', @@ -80,6 +83,7 @@ describe('Init', () => { 'From contract with abi and structs', [ 'init', + '--skip-git', '--protocol', 'ethereum', '--studio', @@ -105,6 +109,7 @@ describe('Init', () => { 'From contract with list items in abi', [ 'init', + '--skip-git', '--protocol', 'ethereum', '--studio', @@ -130,6 +135,7 @@ describe('Init', () => { 'From contract with overloaded elements', [ 'init', + '--skip-git', '--protocol', 'ethereum', '--studio', @@ -155,6 +161,7 @@ describe('Init', () => { 'From contract with index events and abi with ID in events', [ 'init', + '--skip-git', '--protocol', 'ethereum', '--studio', @@ -186,6 +193,7 @@ describe('Init', () => { 'From contract', [ 'init', + '--skip-git', '--protocol', 'near', '--product', diff --git a/packages/cli/tests/cli/init/ethereum/from-contract-with-abi-and-structs.stderr b/packages/cli/tests/cli/init/ethereum/from-contract-with-abi-and-structs.stderr index fea421192..47c98b1f2 100644 --- a/packages/cli/tests/cli/init/ethereum/from-contract-with-abi-and-structs.stderr +++ b/packages/cli/tests/cli/init/ethereum/from-contract-with-abi-and-structs.stderr @@ -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 @@ -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 diff --git a/packages/cli/tests/cli/init/ethereum/from-contract-with-abi.stderr b/packages/cli/tests/cli/init/ethereum/from-contract-with-abi.stderr index fea421192..47c98b1f2 100644 --- a/packages/cli/tests/cli/init/ethereum/from-contract-with-abi.stderr +++ b/packages/cli/tests/cli/init/ethereum/from-contract-with-abi.stderr @@ -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 @@ -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 diff --git a/packages/cli/tests/cli/init/ethereum/from-contract-with-overloaded-elements.stderr b/packages/cli/tests/cli/init/ethereum/from-contract-with-overloaded-elements.stderr index fea421192..47c98b1f2 100644 --- a/packages/cli/tests/cli/init/ethereum/from-contract-with-overloaded-elements.stderr +++ b/packages/cli/tests/cli/init/ethereum/from-contract-with-overloaded-elements.stderr @@ -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 @@ -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 diff --git a/packages/cli/tests/cli/init/ethereum/from-contract.stderr b/packages/cli/tests/cli/init/ethereum/from-contract.stderr index 1527780e4..d450b4242 100644 --- a/packages/cli/tests/cli/init/ethereum/from-contract.stderr +++ b/packages/cli/tests/cli/init/ethereum/from-contract.stderr @@ -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 @@ -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 diff --git a/packages/cli/tests/cli/init/ethereum/from-example.stderr b/packages/cli/tests/cli/init/ethereum/from-example.stderr index ffcf41194..97b07c2d9 100644 --- a/packages/cli/tests/cli/init/ethereum/from-example.stderr +++ b/packages/cli/tests/cli/init/ethereum/from-example.stderr @@ -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 diff --git a/packages/cli/tests/cli/init/near/from-contract.stderr b/packages/cli/tests/cli/init/near/from-contract.stderr index fea421192..47c98b1f2 100644 --- a/packages/cli/tests/cli/init/near/from-contract.stderr +++ b/packages/cli/tests/cli/init/near/from-contract.stderr @@ -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 @@ -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