@graphprotocol/graph-cli 0.41.0-alpha-20230220204254-d199c93 → 0.41.0-alpha-20230221140937-bb75c97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -14
- package/dist/command-helpers/studio.js +0 -1
- package/dist/commands/deploy.js +8 -5
- package/dist/compiler/asc.js +1 -1
- package/dist/compiler/index.js +25 -28
- package/dist/protocols/index.js +0 -1
- package/oclif.manifest.json +1 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.41.0-alpha-
|
|
3
|
+
## 0.41.0-alpha-20230221140937-bb75c97
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
- [#1076](https://github.com/graphprotocol/graph-tooling/pull/1076)
|
|
8
|
-
[`d199c93`](https://github.com/graphprotocol/graph-tooling/commit/d199c9332b169db95cbf36b1fc05517a4c98ec97)
|
|
9
|
-
Thanks [@saihaj](https://github.com/saihaj)! - add `base-testnet` to studio
|
|
10
|
-
|
|
11
7
|
- [#1055](https://github.com/graphprotocol/graph-tooling/pull/1055)
|
|
12
8
|
[`044cd92`](https://github.com/graphprotocol/graph-tooling/commit/044cd92d0ceb9628c7f7fbe3627a09b867710247)
|
|
13
9
|
Thanks [@enisdenjo](https://github.com/enisdenjo)! - Migrate to Oclif
|
|
@@ -17,18 +13,9 @@
|
|
|
17
13
|
- [#1055](https://github.com/graphprotocol/graph-tooling/pull/1055)
|
|
18
14
|
[`044cd92`](https://github.com/graphprotocol/graph-tooling/commit/044cd92d0ceb9628c7f7fbe3627a09b867710247)
|
|
19
15
|
Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates:
|
|
20
|
-
|
|
21
16
|
- Added dependency [`@oclif/core@2.0.7` ↗︎](https://www.npmjs.com/package/@oclif/core/v/2.0.7) (to
|
|
22
17
|
`dependencies`)
|
|
23
18
|
|
|
24
|
-
- [#1074](https://github.com/graphprotocol/graph-tooling/pull/1074)
|
|
25
|
-
[`e84d1e8`](https://github.com/graphprotocol/graph-tooling/commit/e84d1e873d9b2a8967c5fe2a85fce48b2caeb75f)
|
|
26
|
-
Thanks [@saihaj](https://github.com/saihaj)! - update GH issues link for error message
|
|
27
|
-
|
|
28
|
-
- [#1071](https://github.com/graphprotocol/graph-tooling/pull/1071)
|
|
29
|
-
[`17d0888`](https://github.com/graphprotocol/graph-tooling/commit/17d08884fbc30a78089403e13139622b4145e9ff)
|
|
30
|
-
Thanks [@saihaj](https://github.com/saihaj)! - global files are not needed when using substreams
|
|
31
|
-
|
|
32
19
|
## 0.40.0
|
|
33
20
|
|
|
34
21
|
### Minor Changes
|
package/dist/commands/deploy.js
CHANGED
|
@@ -48,7 +48,13 @@ const headersFlag = core_1.Flags.custom({
|
|
|
48
48
|
});
|
|
49
49
|
class DeployCommand extends core_1.Command {
|
|
50
50
|
async run() {
|
|
51
|
-
const { args: { 'subgraph-name': subgraphName, 'subgraph-manifest': manifest }, flags: { product, studio, 'deploy-key': deployKeyFlag, 'access-token': accessToken, 'version-label': versionLabelFlag, ipfs, headers, node: nodeFlag, 'output-dir': outputDir, 'skip-migrations': skipMigrations, watch, 'debug-fork': debugFork, network, 'network-file': networkFile, }, } = await this.parse(DeployCommand);
|
|
51
|
+
const { args: { 'subgraph-name': subgraphName, 'subgraph-manifest': manifest }, flags: { product: productFlag, studio, 'deploy-key': deployKeyFlag, 'access-token': accessToken, 'version-label': versionLabelFlag, ipfs, headers, node: nodeFlag, 'output-dir': outputDir, 'skip-migrations': skipMigrations, watch, 'debug-fork': debugFork, network, 'network-file': networkFile, }, } = await this.parse(DeployCommand);
|
|
52
|
+
const product = studio
|
|
53
|
+
? 'subgraph-studio'
|
|
54
|
+
: productFlag ||
|
|
55
|
+
(await core_1.ux.prompt('Which product to deploy for?', {
|
|
56
|
+
required: true,
|
|
57
|
+
}));
|
|
52
58
|
try {
|
|
53
59
|
const dataSourcesAndTemplates = await DataSourcesExtractor.fromFilePath(manifest);
|
|
54
60
|
for (const { network } of dataSourcesAndTemplates) {
|
|
@@ -61,10 +67,7 @@ class DeployCommand extends core_1.Command {
|
|
|
61
67
|
const { node } = (0, node_1.chooseNodeUrl)({
|
|
62
68
|
product,
|
|
63
69
|
studio,
|
|
64
|
-
node: nodeFlag
|
|
65
|
-
(await core_1.ux.prompt('Which product to deploy for?', {
|
|
66
|
-
required: true,
|
|
67
|
-
})),
|
|
70
|
+
node: nodeFlag,
|
|
68
71
|
});
|
|
69
72
|
if (!node) {
|
|
70
73
|
// shouldn't happen, but we do the check to satisfy TS
|
package/dist/compiler/asc.js
CHANGED
|
@@ -30,7 +30,7 @@ const createExitHandler = (inputFile) => () => {
|
|
|
30
30
|
Suggestion: try to comment the whole file and uncomment it little by little while re-running the graph-cli until you isolate the line where the problem happens.
|
|
31
31
|
Also, please contact us so we can make the CLI better by handling errors like this. You can reach out in any of these links:
|
|
32
32
|
- Discord channel: https://discord.gg/eM8CA6WA9r
|
|
33
|
-
- Github issues: https://github.com/graphprotocol/graph-
|
|
33
|
+
- Github issues: https://github.com/graphprotocol/graph-cli/issues`);
|
|
34
34
|
};
|
|
35
35
|
const setupExitHandler = (exitHandler) => process.addListener('exit', exitHandler);
|
|
36
36
|
const removeExitHandler = (exitHandler) => process.removeListener('exit', exitHandler);
|
package/dist/compiler/index.js
CHANGED
|
@@ -48,31 +48,34 @@ class Compiler {
|
|
|
48
48
|
this.sourceDir = path_1.default.dirname(options.subgraphManifest);
|
|
49
49
|
this.blockIpfsMethods = options.blockIpfsMethods;
|
|
50
50
|
this.libsDirs = [];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
dir = path_1.default.dirname(dir) === dir ? undefined : path_1.default.dirname(dir)) {
|
|
61
|
-
if (fs_extra_1.default.existsSync(path_1.default.join(dir, 'node_modules'))) {
|
|
62
|
-
this.libsDirs.push(path_1.default.join(dir, 'node_modules'));
|
|
51
|
+
if (options.protocol.name !== 'substreams') {
|
|
52
|
+
for (let dir = path_1.default.resolve(this.sourceDir);
|
|
53
|
+
// Terminate after the root dir or when we have found node_modules
|
|
54
|
+
dir !== undefined;
|
|
55
|
+
// Continue with the parent directory, terminate after the root dir
|
|
56
|
+
dir = path_1.default.dirname(dir) === dir ? undefined : path_1.default.dirname(dir)) {
|
|
57
|
+
if (fs_extra_1.default.existsSync(path_1.default.join(dir, 'node_modules'))) {
|
|
58
|
+
this.libsDirs.push(path_1.default.join(dir, 'node_modules'));
|
|
59
|
+
}
|
|
63
60
|
}
|
|
61
|
+
if (this.libsDirs.length === 0) {
|
|
62
|
+
throw Error(`could not locate \`node_modules\` in parent directories of subgraph manifest`);
|
|
63
|
+
}
|
|
64
|
+
const globalsFile = path_1.default.join('@graphprotocol', 'graph-ts', 'global', 'global.ts');
|
|
65
|
+
const globalsLib = this.libsDirs.find(item => {
|
|
66
|
+
return fs_extra_1.default.existsSync(path_1.default.join(item, globalsFile));
|
|
67
|
+
});
|
|
68
|
+
if (!globalsLib) {
|
|
69
|
+
throw Error('Could not locate `@graphprotocol/graph-ts` package in parent directories of subgraph manifest.');
|
|
70
|
+
}
|
|
71
|
+
this.globalsFile = path_1.default.join(globalsLib, globalsFile);
|
|
64
72
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const globalsFile = path_1.default.join('@graphprotocol', 'graph-ts', 'global', 'global.ts');
|
|
69
|
-
const globalsLib = this.libsDirs.find(item => {
|
|
70
|
-
return fs_extra_1.default.existsSync(path_1.default.join(item, globalsFile));
|
|
71
|
-
});
|
|
72
|
-
if (!globalsLib) {
|
|
73
|
-
throw Error('Could not locate `@graphprotocol/graph-ts` package in parent directories of subgraph manifest.');
|
|
73
|
+
// @ts-expect-error assigned or not, we dont care
|
|
74
|
+
if (!this.globalsFile) {
|
|
75
|
+
throw new Error('Globals file is missing.');
|
|
74
76
|
}
|
|
75
|
-
this.
|
|
77
|
+
this.protocol = this.options.protocol;
|
|
78
|
+
this.ABI = this.protocol.getABI();
|
|
76
79
|
process.on('uncaughtException', e => {
|
|
77
80
|
toolbox.print.error(`UNCAUGHT EXCEPTION: ${e}`);
|
|
78
81
|
});
|
|
@@ -230,9 +233,6 @@ class Compiler {
|
|
|
230
233
|
// Create output directory
|
|
231
234
|
fs_extra_1.default.mkdirsSync(path_1.default.dirname(outFile));
|
|
232
235
|
const libs = this.libsDirs.join(',');
|
|
233
|
-
if (!this.globalsFile) {
|
|
234
|
-
throw Error('Could not locate `@graphprotocol/graph-ts` package in parent directories of subgraph manifest.');
|
|
235
|
-
}
|
|
236
236
|
const global = path_1.default.relative(baseDir, this.globalsFile);
|
|
237
237
|
asc.compile({
|
|
238
238
|
inputFile,
|
|
@@ -271,9 +271,6 @@ class Compiler {
|
|
|
271
271
|
// Create output directory
|
|
272
272
|
fs_extra_1.default.mkdirsSync(path_1.default.dirname(outFile));
|
|
273
273
|
const libs = this.libsDirs.join(',');
|
|
274
|
-
if (!this.globalsFile) {
|
|
275
|
-
throw Error('Could not locate `@graphprotocol/graph-ts` package in parent directories of subgraph manifest.');
|
|
276
|
-
}
|
|
277
274
|
const global = path_1.default.relative(baseDir, this.globalsFile);
|
|
278
275
|
asc.compile({
|
|
279
276
|
inputFile,
|
package/dist/protocols/index.js
CHANGED
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.41.0-alpha-
|
|
2
|
+
"version": "0.41.0-alpha-20230221140937-bb75c97",
|
|
3
3
|
"commands": {
|
|
4
4
|
"add": {
|
|
5
5
|
"id": "add",
|
|
@@ -569,7 +569,6 @@
|
|
|
569
569
|
"optimism-kovan",
|
|
570
570
|
"aurora",
|
|
571
571
|
"aurora-testnet",
|
|
572
|
-
"base-testnet",
|
|
573
572
|
"near-mainnet",
|
|
574
573
|
"near-testnet",
|
|
575
574
|
"cosmoshub-4",
|
package/package.json
CHANGED