Skip to content

Commit

Permalink
feat: add deprecation notices (#1533)
Browse files Browse the repository at this point in the history
* feat: add deprecation notices

* skip git in tests

* update log messages
  • Loading branch information
saihaj authored Dec 11, 2023
1 parent af637f1 commit 45f3197
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 14 deletions.
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 @@ 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/',
},
}),
};

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 @@ 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.',
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 @@ 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.',
Expand All @@ -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({
Expand Down Expand Up @@ -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',
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

0 comments on commit 45f3197

Please sign in to comment.