Skip to content

Commit 45f3197

Browse files
authored
feat: add deprecation notices (#1533)
* feat: add deprecation notices * skip git in tests * update log messages
1 parent af637f1 commit 45f3197

13 files changed

+114
-14
lines changed

.changeset/red-walls-hug.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@graphprotocol/graph-cli': minor
3+
---
4+
5+
adding deprecation notices for commands we plan to change in the next major. See
6+
https://github.com/graphprotocol/graph-tooling/issues/1487

packages/cli/src/commands/auth.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@ export default class AuthCommand extends Command {
1919
product: Flags.string({
2020
summary: 'Select a product for which to authenticate.',
2121
options: ['subgraph-studio', 'hosted-service'],
22+
deprecated: {
23+
message:
24+
'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/',
25+
},
2226
}),
2327
studio: Flags.boolean({
2428
summary: 'Shortcut for "--product subgraph-studio".',
2529
exclusive: ['product'],
30+
deprecated: {
31+
message:
32+
'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/',
33+
},
2634
}),
2735
};
2836

packages/cli/src/commands/create.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import { URL } from 'url';
22
import { print } from 'gluegun';
33
import { Args, Command, Flags } from '@oclif/core';
4+
import { Deprecation } from '@oclif/core/lib/interfaces';
45
import { identifyDeployKey as identifyAccessToken } from '../command-helpers/auth';
56
import { createJsonRpcClient } from '../command-helpers/jsonrpc';
67
import { validateNodeUrl } from '../command-helpers/node';
78
import { GRAPH_CLI_SHARED_HEADERS } from '../constants';
89

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

1218
static args = {
1319
'subgraph-name': Args.string({

packages/cli/src/commands/deploy.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ export default class DeployCommand extends Command {
5555
exclusive: ['access-token'],
5656
}),
5757
'access-token': Flags.string({
58-
deprecated: true,
59-
summary: 'Graph access key. DEPRECATED: Use "--deploy-key" instead.',
6058
exclusive: ['deploy-key'],
59+
deprecated: {
60+
to: 'deploy-key',
61+
message: "In next version, we are removing this flag in favor of '--deploy-key'",
62+
},
6163
}),
6264
'version-label': Flags.string({
6365
summary: 'Version label used for the deployment.',

packages/cli/src/commands/init.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,18 @@ export default class InitCommand extends Command {
4747
product: Flags.string({
4848
summary: 'Selects the product for which to initialize.',
4949
options: ['subgraph-studio', 'hosted-service'],
50+
deprecated: {
51+
message:
52+
'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/',
53+
},
5054
}),
5155
studio: Flags.boolean({
5256
summary: 'Shortcut for "--product subgraph-studio".',
5357
exclusive: ['product'],
58+
deprecated: {
59+
message:
60+
'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/',
61+
},
5462
}),
5563
node: Flags.string({
5664
summary: 'Graph node for which to initialize.',
@@ -59,6 +67,10 @@ export default class InitCommand extends Command {
5967
'allow-simple-name': Flags.boolean({
6068
description: 'Use a subgraph name without a prefix.',
6169
default: false,
70+
deprecated: {
71+
message:
72+
'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/',
73+
},
6274
}),
6375

6476
'from-contract': Flags.string({
@@ -89,6 +101,10 @@ export default class InitCommand extends Command {
89101
'skip-git': Flags.boolean({
90102
summary: 'Skip initializing a Git repository.',
91103
default: false,
104+
deprecated: {
105+
message:
106+
'In next major version, this flag will be removed. By default we will stop initializing a Git repository.',
107+
},
92108
}),
93109
'start-block': Flags.string({
94110
helpGroup: 'Scaffold from contract',

packages/cli/src/commands/remove.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import { URL } from 'url';
22
import { print } from 'gluegun';
33
import { Args, Command, Flags } from '@oclif/core';
4+
import { Deprecation } from '@oclif/core/lib/interfaces';
45
import { identifyDeployKey as identifyAccessToken } from '../command-helpers/auth';
56
import { createJsonRpcClient } from '../command-helpers/jsonrpc';
67
import { validateNodeUrl } from '../command-helpers/node';
78
import { GRAPH_CLI_SHARED_HEADERS } from '../constants';
89

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

1218
static args = {
1319
'subgraph-name': Args.string({

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe('Init', () => {
1111
'From example',
1212
[
1313
'init',
14+
'--skip-git',
1415
'--protocol',
1516
'ethereum',
1617
'--studio',
@@ -32,6 +33,7 @@ describe('Init', () => {
3233
'From contract',
3334
[
3435
'init',
36+
'--skip-git',
3537
'--protocol',
3638
'ethereum',
3739
'--studio',
@@ -55,6 +57,7 @@ describe('Init', () => {
5557
'From contract with abi',
5658
[
5759
'init',
60+
'--skip-git',
5861
'--protocol',
5962
'ethereum',
6063
'--studio',
@@ -80,6 +83,7 @@ describe('Init', () => {
8083
'From contract with abi and structs',
8184
[
8285
'init',
86+
'--skip-git',
8387
'--protocol',
8488
'ethereum',
8589
'--studio',
@@ -105,6 +109,7 @@ describe('Init', () => {
105109
'From contract with list items in abi',
106110
[
107111
'init',
112+
'--skip-git',
108113
'--protocol',
109114
'ethereum',
110115
'--studio',
@@ -130,6 +135,7 @@ describe('Init', () => {
130135
'From contract with overloaded elements',
131136
[
132137
'init',
138+
'--skip-git',
133139
'--protocol',
134140
'ethereum',
135141
'--studio',
@@ -155,6 +161,7 @@ describe('Init', () => {
155161
'From contract with index events and abi with ID in events',
156162
[
157163
'init',
164+
'--skip-git',
158165
'--protocol',
159166
'ethereum',
160167
'--studio',
@@ -186,6 +193,7 @@ describe('Init', () => {
186193
'From contract',
187194
[
188195
'init',
196+
'--skip-git',
189197
'--protocol',
190198
'near',
191199
'--product',

packages/cli/tests/cli/init/ethereum/from-contract-with-abi-and-structs.stderr

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
› Warning: In next major version, this flag will be removed. By default we
2+
› will stop initializing a Git repository.
3+
› Warning: In next major version, this flag will be removed. By default we
4+
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
5+
› Data
6+
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
7+
› Warning: In next major version, this flag will be removed. By default we
8+
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
9+
› Data
10+
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
111
- Create subgraph scaffold
212
Generate subgraph
313
- Create subgraph scaffold
@@ -6,8 +16,6 @@
616
✔ Create subgraph scaffold
717
- Initialize networks config
818
✔ Initialize networks config
9-
- Initialize subgraph repository
10-
✔ Initialize subgraph repository
1119
- Install dependencies with yarn
1220
✔ Install dependencies with yarn
1321
- Generate ABI and schema types with yarn codegen

packages/cli/tests/cli/init/ethereum/from-contract-with-abi.stderr

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
› Warning: In next major version, this flag will be removed. By default we
2+
› will stop initializing a Git repository.
3+
› Warning: In next major version, this flag will be removed. By default we
4+
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
5+
› Data
6+
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
7+
› Warning: In next major version, this flag will be removed. By default we
8+
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
9+
› Data
10+
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
111
- Create subgraph scaffold
212
Generate subgraph
313
- Create subgraph scaffold
@@ -6,8 +16,6 @@
616
✔ Create subgraph scaffold
717
- Initialize networks config
818
✔ Initialize networks config
9-
- Initialize subgraph repository
10-
✔ Initialize subgraph repository
1119
- Install dependencies with yarn
1220
✔ Install dependencies with yarn
1321
- Generate ABI and schema types with yarn codegen

packages/cli/tests/cli/init/ethereum/from-contract-with-overloaded-elements.stderr

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
› Warning: In next major version, this flag will be removed. By default we
2+
› will stop initializing a Git repository.
3+
› Warning: In next major version, this flag will be removed. By default we
4+
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
5+
› Data
6+
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
7+
› Warning: In next major version, this flag will be removed. By default we
8+
› will deploy to the Graph Studio. Learn more about Sunrise of Decentralized
9+
› Data
10+
› https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/
111
- Create subgraph scaffold
212
Generate subgraph
313
- Create subgraph scaffold
@@ -6,8 +16,6 @@
616
✔ Create subgraph scaffold
717
- Initialize networks config
818
✔ Initialize networks config
9-
- Initialize subgraph repository
10-
✔ Initialize subgraph repository
1119
- Install dependencies with yarn
1220
✔ Install dependencies with yarn
1321
- Generate ABI and schema types with yarn codegen

0 commit comments

Comments
 (0)