@graphprotocol/graph-cli 0.40.0 → 0.40.1-alpha-20230216174117-760a195
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 +10 -0
- package/dist/bin.js +31 -3
- package/dist/command-helpers/network.js +16 -13
- package/dist/command-helpers/network.test.js +2 -2
- package/dist/command-helpers/spinner.js +4 -27
- package/dist/commands/add.js +48 -67
- package/dist/commands/auth.js +40 -102
- package/dist/commands/build.js +51 -68
- package/dist/commands/codegen.js +39 -61
- package/dist/commands/create.js +31 -55
- package/dist/commands/deploy.js +112 -174
- package/dist/commands/init.js +519 -512
- package/dist/commands/local.js +93 -103
- package/dist/commands/remove.js +32 -56
- package/dist/commands/test.js +81 -88
- package/dist/index.js +5 -0
- package/oclif.manifest.json +724 -0
- package/package.json +10 -3
- package/dist/cli.js +0 -26
- package/dist/command-helpers/gluegun.js +0 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphprotocol/graph-cli",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.1-alpha-20230216174117-760a195",
|
|
4
4
|
"description": "CLI for building for and deploying to The Graph",
|
|
5
5
|
"license": "(Apache-2.0 OR MIT)",
|
|
6
6
|
"engines": {
|
|
@@ -9,14 +9,16 @@
|
|
|
9
9
|
"bin": {
|
|
10
10
|
"graph": "dist/bin.js"
|
|
11
11
|
},
|
|
12
|
-
"main": "dist/
|
|
12
|
+
"main": "dist/index.js",
|
|
13
13
|
"files": [
|
|
14
14
|
"CHANGELOG.md",
|
|
15
15
|
"dist",
|
|
16
|
+
"oclif.manifest.json",
|
|
16
17
|
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"@float-capital/float-subgraph-uncrashable": "^0.0.0-alpha.4",
|
|
21
|
+
"@oclif/core": "2.0.7",
|
|
20
22
|
"assemblyscript": "0.19.23",
|
|
21
23
|
"binary-install-raw": "0.0.13",
|
|
22
24
|
"chalk": "3.0.0",
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
"@types/which": "^2.0.1",
|
|
53
55
|
"copyfiles": "^2.4.1",
|
|
54
56
|
"jest": "26.0.0",
|
|
57
|
+
"oclif": "3.6.1",
|
|
55
58
|
"spawn-command": "0.0.2-1",
|
|
56
59
|
"strip-ansi": "6.0.0",
|
|
57
60
|
"tern": "0.24.3",
|
|
@@ -60,8 +63,12 @@
|
|
|
60
63
|
"publishConfig": {
|
|
61
64
|
"access": "public"
|
|
62
65
|
},
|
|
66
|
+
"oclif": {
|
|
67
|
+
"bin": "graph",
|
|
68
|
+
"commands": "./dist/commands"
|
|
69
|
+
},
|
|
63
70
|
"scripts": {
|
|
64
|
-
"build": "tsc -b tsconfig.build.json && copyfiles -u 1 src/**/*.graphql dist/ && chmod +x ./dist/bin.js",
|
|
71
|
+
"build": "tsc -b tsconfig.build.json && oclif manifest && copyfiles -u 1 src/**/*.graphql dist/ && chmod +x ./dist/bin.js",
|
|
65
72
|
"test": "jest --verbose",
|
|
66
73
|
"test:init": "jest tests/cli/init.test.ts --verbose",
|
|
67
74
|
"test:validation": "jest tests/cli/validation.test.ts --verbose",
|
package/dist/cli.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.run = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const gluegun_1 = require("gluegun");
|
|
9
|
-
const run = async (argv) => {
|
|
10
|
-
let builder = (0, gluegun_1.build)().brand('graph').src(__dirname);
|
|
11
|
-
const pluginDirs = [];
|
|
12
|
-
await Promise.all(['npm root -g', 'npm root', 'yarn global dir'].map(async (cmd) => {
|
|
13
|
-
try {
|
|
14
|
-
const dir = await gluegun_1.system.run(cmd, { trim: true });
|
|
15
|
-
pluginDirs.push(dir);
|
|
16
|
-
}
|
|
17
|
-
catch (_) {
|
|
18
|
-
// noop
|
|
19
|
-
}
|
|
20
|
-
}));
|
|
21
|
-
// Inject potential plugin directories
|
|
22
|
-
builder = pluginDirs.reduce((cli, dir) => cli.plugin(path_1.default.join(dir, '@graphprotocol', 'indexer-cli', 'dist')), builder);
|
|
23
|
-
const cli = builder.help().version().defaultCommand().create();
|
|
24
|
-
return await cli.run(argv);
|
|
25
|
-
};
|
|
26
|
-
exports.run = run;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Workaround for https://github.com/infinitered/gluegun/pull/464.
|
|
3
|
-
//
|
|
4
|
-
// There is currently no way in Gluegun to define command-line options
|
|
5
|
-
// that take no arguments (like `--watch`). As a consequence, boolean
|
|
6
|
-
// options like `--watch` will consume the immediately following argument,
|
|
7
|
-
// leading to confusing behavior.
|
|
8
|
-
//
|
|
9
|
-
// E.g. `graph deploy --watch subgraph/name
|
|
10
|
-
//
|
|
11
|
-
// Will result in
|
|
12
|
-
// ```
|
|
13
|
-
// toolbox.parameters.options === { watch: 'subgraph/name' }
|
|
14
|
-
// toolbox.parameters.first === undefined
|
|
15
|
-
// toolbox.parameters.array === []
|
|
16
|
-
// ```
|
|
17
|
-
// where what we really want is
|
|
18
|
-
// ```
|
|
19
|
-
// toolbox.parameters.options === { watch: true }
|
|
20
|
-
// toolbox.parameters.first = 'subgraph/name'
|
|
21
|
-
// toolbox.parameters.array = ['subgraph/name']
|
|
22
|
-
// ```
|
|
23
|
-
//
|
|
24
|
-
// The `fixParameters` function checks if any of the provided boolean
|
|
25
|
-
// options has a string value; if so, it pushes it to the front of the
|
|
26
|
-
// parameters array and returns the result of that.
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.fixParameters = void 0;
|
|
29
|
-
const fixParameters = (parameters, booleanOptions) => {
|
|
30
|
-
const unexpectedStringOptions = Object.keys(booleanOptions)
|
|
31
|
-
.filter(key => typeof booleanOptions[key] === 'string')
|
|
32
|
-
.map(key => ({ key, value: booleanOptions[key] }));
|
|
33
|
-
const optionNames = unexpectedStringOptions
|
|
34
|
-
.map(({ key }) => `--` + key.replace(/([A-Z])/, '-$1').toLowerCase())
|
|
35
|
-
.join(', ');
|
|
36
|
-
if (unexpectedStringOptions.length > 1) {
|
|
37
|
-
throw new Error(`Unexpected value provided for one or more of ${optionNames}. See --help for more information.`);
|
|
38
|
-
}
|
|
39
|
-
else if (unexpectedStringOptions.length == 1) {
|
|
40
|
-
const params = parameters.array;
|
|
41
|
-
params.unshift(unexpectedStringOptions[0].value);
|
|
42
|
-
return params;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return parameters.array;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
exports.fixParameters = fixParameters;
|