@apollo/rover 0.40.0 → 0.41.0
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/README.md +8 -4
- package/bin/rover.js +49 -0
- package/package.json +20 -30
- package/binary.js +0 -383
- package/install.js +0 -4
- package/run.js +0 -4
package/README.md
CHANGED
|
@@ -83,6 +83,8 @@ Commands:
|
|
|
83
83
|
Commands for fetching offline licenses
|
|
84
84
|
client
|
|
85
85
|
Client workflow commands
|
|
86
|
+
graph-artifact
|
|
87
|
+
Graph artifact commands
|
|
86
88
|
help
|
|
87
89
|
Print this message or the help of the given subcommand(s)
|
|
88
90
|
|
|
@@ -97,7 +99,7 @@ Options:
|
|
|
97
99
|
[possible values: plain, json]
|
|
98
100
|
|
|
99
101
|
-o, --output <OUTPUT_FILE>
|
|
100
|
-
Specify a file to write Rover's output to
|
|
102
|
+
Specify a file to write Rover's console output to instead of stdout
|
|
101
103
|
|
|
102
104
|
--insecure-accept-invalid-certs
|
|
103
105
|
Accept invalid certificates when performing HTTPS requests.
|
|
@@ -114,12 +116,14 @@ Options:
|
|
|
114
116
|
If hostname verification is not used, any valid certificate for any site will be trusted for use from any other. This introduces a significant vulnerability to man-in-the-middle attacks.
|
|
115
117
|
|
|
116
118
|
--client-timeout <CLIENT_TIMEOUT>
|
|
117
|
-
Configure the timeout length (in seconds) when performing HTTP(S) requests
|
|
119
|
+
Configure the timeout length (in seconds) when performing HTTP(S) requests.
|
|
118
120
|
|
|
119
|
-
|
|
121
|
+
Defaults to 30s for standard operations and 300s for plugin downloads.
|
|
120
122
|
|
|
121
123
|
--skip-update-check
|
|
122
|
-
Skip checking for newer versions of rover
|
|
124
|
+
Skip checking for newer versions of rover.
|
|
125
|
+
|
|
126
|
+
Set the `APOLLO_ROVER_SKIP_UPDATE` environment variable (to `1` or `true`) to disable all of Rover's auto-updating at once — both this self-update check and the `supergraph`/`router` plugin auto-updates (`--skip-update`).
|
|
123
127
|
|
|
124
128
|
-h, --help
|
|
125
129
|
Print help (see a summary with '-h')
|
package/bin/rover.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict'
|
|
3
|
+
|
|
4
|
+
function isMusl() {
|
|
5
|
+
try {
|
|
6
|
+
return require('fs').readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
|
7
|
+
} catch {}
|
|
8
|
+
try {
|
|
9
|
+
const orig = process.report.excludeNetwork
|
|
10
|
+
process.report.excludeNetwork = true
|
|
11
|
+
const report = process.report.getReport()
|
|
12
|
+
process.report.excludeNetwork = orig
|
|
13
|
+
if (report.header?.glibcVersionRuntime) return false
|
|
14
|
+
return report.sharedObjects.some((f) => f.includes('libc.musl-') || f.includes('ld-musl-'))
|
|
15
|
+
} catch {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const PLATFORMS = {
|
|
19
|
+
darwin: {
|
|
20
|
+
arm64: '@apollo/rover-darwin-arm64/rover',
|
|
21
|
+
x64: '@apollo/rover-darwin-x64/rover',
|
|
22
|
+
},
|
|
23
|
+
linux: {
|
|
24
|
+
arm64: '@apollo/rover-linux-arm64/rover',
|
|
25
|
+
x64: '@apollo/rover-linux-x64/rover',
|
|
26
|
+
},
|
|
27
|
+
'linux-musl': {
|
|
28
|
+
x64: '@apollo/rover-linux-x64-musl/rover',
|
|
29
|
+
},
|
|
30
|
+
win32: {
|
|
31
|
+
x64: '@apollo/rover-win32-x64/rover.exe',
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const key = process.platform === 'linux' && isMusl() ? 'linux-musl' : process.platform
|
|
36
|
+
const binPath = PLATFORMS[key]?.[process.arch]
|
|
37
|
+
|
|
38
|
+
if (!binPath) {
|
|
39
|
+
console.error(`Unsupported platform: ${process.platform} ${process.arch}`)
|
|
40
|
+
process.exit(1)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const bin = require.resolve(binPath)
|
|
44
|
+
process.env.APOLLO_NODE_MODULES_BIN_DIR = require('path').dirname(bin)
|
|
45
|
+
const result = require('child_process').spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' })
|
|
46
|
+
if (result.error) {
|
|
47
|
+
throw result.error
|
|
48
|
+
}
|
|
49
|
+
process.exitCode = result.status ?? 1
|
package/package.json
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo/rover",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"rover": "run.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"prepack": "cp ../../README.md . && cp ../../LICENSE .",
|
|
11
|
-
"postinstall": "node ./install.js",
|
|
12
|
-
"fmt": "prettier --write **/*.js",
|
|
13
|
-
"fmt:check": "prettier --check **/*.js",
|
|
14
|
-
"test": "jest"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/apollographql/rover.git"
|
|
19
|
-
},
|
|
3
|
+
"version": "0.41.0",
|
|
4
|
+
"description": "Rover is a tool for working with the Apollo GraphQL Registry.",
|
|
20
5
|
"keywords": [
|
|
21
6
|
"rover",
|
|
22
7
|
"graphql",
|
|
@@ -26,23 +11,28 @@
|
|
|
26
11
|
"tooling",
|
|
27
12
|
"tools"
|
|
28
13
|
],
|
|
29
|
-
"
|
|
14
|
+
"homepage": "https://github.com/apollographql/rover#readme",
|
|
30
15
|
"license": "MIT",
|
|
31
|
-
"
|
|
32
|
-
|
|
16
|
+
"author": "Apollo Developers <opensource@apollographql.com>",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/apollographql/rover.git"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"rover": "bin/rover.js"
|
|
33
23
|
},
|
|
34
24
|
"engines": {
|
|
35
25
|
"node": ">=22.14.0"
|
|
36
26
|
},
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
27
|
+
"optionalDependencies": {
|
|
28
|
+
"@apollo/rover-darwin-arm64": "0.41.0",
|
|
29
|
+
"@apollo/rover-darwin-x64": "0.41.0",
|
|
30
|
+
"@apollo/rover-linux-arm64": "0.41.0",
|
|
31
|
+
"@apollo/rover-linux-x64": "0.41.0",
|
|
32
|
+
"@apollo/rover-linux-x64-musl": "0.41.0",
|
|
33
|
+
"@apollo/rover-win32-x64": "0.41.0"
|
|
42
34
|
},
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"jest-junit": "17.0.0",
|
|
46
|
-
"prettier": "3.8.3"
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/apollographql/rover/issues"
|
|
47
37
|
}
|
|
48
|
-
}
|
|
38
|
+
}
|
package/binary.js
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const libc = require("detect-libc");
|
|
4
|
-
const os = require("os");
|
|
5
|
-
const tar = require("tar");
|
|
6
|
-
const { Console } = require("node:console");
|
|
7
|
-
const { existsSync, mkdirSync, rmSync } = require("fs");
|
|
8
|
-
const { join } = require("path");
|
|
9
|
-
const { spawnSync } = require("child_process");
|
|
10
|
-
const { Readable } = require("stream");
|
|
11
|
-
const { ProxyAgent, fetch } = require("undici");
|
|
12
|
-
|
|
13
|
-
const error = (msg) => {
|
|
14
|
-
console.error(msg);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const { version } = require("./package.json");
|
|
19
|
-
const fs = require("fs");
|
|
20
|
-
const name = `rover`;
|
|
21
|
-
|
|
22
|
-
const supportedPlatforms = [
|
|
23
|
-
{
|
|
24
|
-
TYPE: "Windows_NT",
|
|
25
|
-
ARCHITECTURE: "x64",
|
|
26
|
-
RUST_TARGET: "x86_64-pc-windows-msvc",
|
|
27
|
-
BINARY_NAME: `${name}-${version}.exe`,
|
|
28
|
-
RAW_NAME: `${name}.exe`,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
TYPE: "Linux",
|
|
32
|
-
ARCHITECTURE: "x64",
|
|
33
|
-
RUST_TARGET: "x86_64-unknown-linux-gnu",
|
|
34
|
-
BINARY_NAME: `${name}-${version}`,
|
|
35
|
-
RAW_NAME: `${name}`,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
TYPE: "Linux",
|
|
39
|
-
ARCHITECTURE: "arm64",
|
|
40
|
-
RUST_TARGET: "aarch64-unknown-linux-gnu",
|
|
41
|
-
BINARY_NAME: `${name}-${version}`,
|
|
42
|
-
RAW_NAME: `${name}`,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
TYPE: "Darwin",
|
|
46
|
-
ARCHITECTURE: "x64",
|
|
47
|
-
RUST_TARGET: "x86_64-apple-darwin",
|
|
48
|
-
BINARY_NAME: `${name}-${version}`,
|
|
49
|
-
RAW_NAME: `${name}`,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
TYPE: "Darwin",
|
|
53
|
-
ARCHITECTURE: "arm64",
|
|
54
|
-
RUST_TARGET: "aarch64-apple-darwin",
|
|
55
|
-
BINARY_NAME: `${name}-${version}`,
|
|
56
|
-
RAW_NAME: `${name}`,
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
const getPlatform = (type = os.type(), architecture = os.arch()) => {
|
|
61
|
-
for (let supportedPlatform of supportedPlatforms) {
|
|
62
|
-
if (
|
|
63
|
-
type === supportedPlatform.TYPE &&
|
|
64
|
-
architecture === supportedPlatform.ARCHITECTURE
|
|
65
|
-
) {
|
|
66
|
-
if (supportedPlatform.TYPE === "Linux") {
|
|
67
|
-
let musl_warning =
|
|
68
|
-
"Downloading musl binary that does not include `rover supergraph compose`.";
|
|
69
|
-
if (libc.isNonGlibcLinuxSync()) {
|
|
70
|
-
console.warn(
|
|
71
|
-
"This operating system does not support dynamic linking to glibc.",
|
|
72
|
-
);
|
|
73
|
-
console.warn(musl_warning);
|
|
74
|
-
supportedPlatform.RUST_TARGET = "x86_64-unknown-linux-musl";
|
|
75
|
-
} else {
|
|
76
|
-
let libc_version = libc.versionSync();
|
|
77
|
-
let split_libc_version = libc_version.split(".");
|
|
78
|
-
let libc_major_version = split_libc_version[0];
|
|
79
|
-
let libc_minor_version = split_libc_version[1];
|
|
80
|
-
let min_major_version = 2;
|
|
81
|
-
let min_minor_version = 17;
|
|
82
|
-
if (
|
|
83
|
-
libc_major_version < min_major_version ||
|
|
84
|
-
libc_minor_version < min_minor_version
|
|
85
|
-
) {
|
|
86
|
-
console.warn(
|
|
87
|
-
`This operating system needs glibc >= ${min_major_version}.${min_minor_version}, but only has ${libc_version} installed.`,
|
|
88
|
-
);
|
|
89
|
-
console.warn(musl_warning);
|
|
90
|
-
supportedPlatform.RUST_TARGET = "x86_64-unknown-linux-musl";
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return supportedPlatform;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const stderr = new Console(process.stderr);
|
|
99
|
-
stderr.log(
|
|
100
|
-
`Platform with type "${type}" and architecture "${architecture}" is not supported by ${name}.`,
|
|
101
|
-
);
|
|
102
|
-
stderr.table(supportedPlatforms);
|
|
103
|
-
process.exit(1);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const DEFAULT_PORTS = { "http:": 80, "https:": 443 };
|
|
107
|
-
|
|
108
|
-
/*! Copyright (c) 2014-present Matt Zabriskie & Collaborators - MIT License */
|
|
109
|
-
const parseNoProxyEntry = (entry) => {
|
|
110
|
-
let entryHost = entry;
|
|
111
|
-
let entryPort = 0;
|
|
112
|
-
|
|
113
|
-
if (entryHost.charAt(0) === "[") {
|
|
114
|
-
const bracketIndex = entryHost.indexOf("]");
|
|
115
|
-
if (bracketIndex !== -1) {
|
|
116
|
-
const host = entryHost.slice(1, bracketIndex);
|
|
117
|
-
const rest = entryHost.slice(bracketIndex + 1);
|
|
118
|
-
if (rest.charAt(0) === ":" && /^\d+$/.test(rest.slice(1))) {
|
|
119
|
-
entryPort = Number.parseInt(rest.slice(1), 10);
|
|
120
|
-
}
|
|
121
|
-
return [host, entryPort];
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const firstColon = entryHost.indexOf(":");
|
|
126
|
-
const lastColon = entryHost.lastIndexOf(":");
|
|
127
|
-
if (
|
|
128
|
-
firstColon !== -1 &&
|
|
129
|
-
firstColon === lastColon &&
|
|
130
|
-
/^\d+$/.test(entryHost.slice(lastColon + 1))
|
|
131
|
-
) {
|
|
132
|
-
entryPort = Number.parseInt(entryHost.slice(lastColon + 1), 10);
|
|
133
|
-
entryHost = entryHost.slice(0, lastColon);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return [entryHost, entryPort];
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/*! Copyright (c) 2014-present Matt Zabriskie & Collaborators - MIT License */
|
|
140
|
-
const normalizeNoProxyHost = (hostname) => {
|
|
141
|
-
if (!hostname) return hostname;
|
|
142
|
-
if (
|
|
143
|
-
hostname.charAt(0) === "[" &&
|
|
144
|
-
hostname.charAt(hostname.length - 1) === "]"
|
|
145
|
-
) {
|
|
146
|
-
hostname = hostname.slice(1, -1);
|
|
147
|
-
}
|
|
148
|
-
return hostname.replace(/\.+$/, "");
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
/*! Copyright (c) 2014-present Matt Zabriskie & Collaborators - MIT License */
|
|
152
|
-
const shouldBypassProxy = (requestURL) => {
|
|
153
|
-
const noProxy = (
|
|
154
|
-
process.env.no_proxy ||
|
|
155
|
-
process.env.NO_PROXY ||
|
|
156
|
-
""
|
|
157
|
-
).toLowerCase();
|
|
158
|
-
|
|
159
|
-
if (!noProxy) return false;
|
|
160
|
-
if (noProxy === "*") return true;
|
|
161
|
-
|
|
162
|
-
const port =
|
|
163
|
-
Number.parseInt(requestURL.port, 10) ||
|
|
164
|
-
DEFAULT_PORTS[requestURL.protocol] ||
|
|
165
|
-
0;
|
|
166
|
-
const hostname = normalizeNoProxyHost(requestURL.hostname.toLowerCase());
|
|
167
|
-
|
|
168
|
-
return noProxy.split(/[\s,]+/).some((entry) => {
|
|
169
|
-
if (!entry) return false;
|
|
170
|
-
|
|
171
|
-
let [entryHost, entryPort] = parseNoProxyEntry(entry);
|
|
172
|
-
entryHost = normalizeNoProxyHost(entryHost);
|
|
173
|
-
if (!entryHost) return false;
|
|
174
|
-
|
|
175
|
-
if (entryPort && entryPort !== port) return false;
|
|
176
|
-
|
|
177
|
-
if (entryHost.charAt(0) === "*") {
|
|
178
|
-
entryHost = entryHost.slice(1);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (entryHost.charAt(0) === ".") {
|
|
182
|
-
return hostname.endsWith(entryHost);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return hostname === entryHost;
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const getProxyEnv = (requestURL) => {
|
|
190
|
-
if (shouldBypassProxy(requestURL)) return null;
|
|
191
|
-
|
|
192
|
-
if (requestURL.protocol === "http:") {
|
|
193
|
-
return process.env.HTTP_PROXY || process.env.http_proxy || null;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (requestURL.protocol === "https:") {
|
|
197
|
-
return process.env.HTTPS_PROXY || process.env.https_proxy || null;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return null;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
/*! Copyright (c) 2019 Avery Harnish - MIT License */
|
|
204
|
-
class Binary {
|
|
205
|
-
constructor(name, raw_name, url, installDirectory) {
|
|
206
|
-
let errors = [];
|
|
207
|
-
if (typeof url !== "string") {
|
|
208
|
-
errors.push("url must be a string");
|
|
209
|
-
} else {
|
|
210
|
-
try {
|
|
211
|
-
new URL(url);
|
|
212
|
-
} catch (e) {
|
|
213
|
-
errors.push(e);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (name && typeof name !== "string") {
|
|
217
|
-
errors.push("name must be a string");
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (!name) {
|
|
221
|
-
errors.push("You must specify the name of your binary");
|
|
222
|
-
}
|
|
223
|
-
if (errors.length > 0) {
|
|
224
|
-
let errorMsg =
|
|
225
|
-
"One or more of the parameters you passed to the Binary constructor are invalid:\n";
|
|
226
|
-
errors.forEach((error) => {
|
|
227
|
-
errorMsg += error;
|
|
228
|
-
});
|
|
229
|
-
errorMsg +=
|
|
230
|
-
'\n\nCorrect usage: new Binary("my-binary", "https://example.com/binary/download.tar.gz")';
|
|
231
|
-
error(errorMsg);
|
|
232
|
-
}
|
|
233
|
-
this.url = url;
|
|
234
|
-
this.name = name;
|
|
235
|
-
this.raw_name = raw_name;
|
|
236
|
-
this.installDirectory = installDirectory;
|
|
237
|
-
|
|
238
|
-
if (!existsSync(this.installDirectory)) {
|
|
239
|
-
mkdirSync(this.installDirectory, { recursive: true });
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
this.binaryPath = join(this.installDirectory, this.name);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
exists() {
|
|
246
|
-
return existsSync(this.binaryPath);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
install(suppressLogs = false) {
|
|
250
|
-
if (this.exists()) {
|
|
251
|
-
if (!suppressLogs) {
|
|
252
|
-
console.error(
|
|
253
|
-
`${this.name} is already installed, skipping installation.`,
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
return Promise.resolve();
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (existsSync(this.installDirectory)) {
|
|
260
|
-
rmSync(this.installDirectory, { recursive: true });
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
mkdirSync(this.installDirectory, { recursive: true });
|
|
264
|
-
|
|
265
|
-
if (!suppressLogs) {
|
|
266
|
-
console.error(`Downloading release from ${this.url}`);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const proxyUrl = getProxyEnv(new URL(this.url));
|
|
270
|
-
|
|
271
|
-
const agent = proxyUrl ? new ProxyAgent(proxyUrl) : null;
|
|
272
|
-
const fetchPromise = fetch(this.url, agent ? { dispatcher: agent } : {});
|
|
273
|
-
|
|
274
|
-
return fetchPromise
|
|
275
|
-
.then((res) => {
|
|
276
|
-
if (!res.ok) {
|
|
277
|
-
throw new Error(
|
|
278
|
-
`Failed to download binary: HTTP ${res.status} ${res.statusText}`,
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
return new Promise((resolve, reject) => {
|
|
282
|
-
const sink = Readable.fromWeb(res.body).pipe(
|
|
283
|
-
tar.x({ strip: 1, C: this.installDirectory }),
|
|
284
|
-
);
|
|
285
|
-
sink.on("finish", () => resolve());
|
|
286
|
-
sink.on("error", (err) => reject(err));
|
|
287
|
-
});
|
|
288
|
-
})
|
|
289
|
-
.then(() => {
|
|
290
|
-
fs.renameSync(
|
|
291
|
-
join(this.installDirectory, this.raw_name),
|
|
292
|
-
this.binaryPath,
|
|
293
|
-
);
|
|
294
|
-
if (!suppressLogs) {
|
|
295
|
-
console.error(`${this.name} has been installed!`);
|
|
296
|
-
}
|
|
297
|
-
})
|
|
298
|
-
.finally(() => agent && agent.close())
|
|
299
|
-
.catch((e) => {
|
|
300
|
-
error(`Error fetching release: ${e.message}`);
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
run() {
|
|
305
|
-
const promise = !this.exists() ? this.install(true) : Promise.resolve();
|
|
306
|
-
|
|
307
|
-
promise
|
|
308
|
-
.then(() => {
|
|
309
|
-
const [, , ...args] = process.argv;
|
|
310
|
-
|
|
311
|
-
const options = { cwd: process.cwd(), stdio: "inherit" };
|
|
312
|
-
|
|
313
|
-
const result = spawnSync(this.binaryPath, args, options);
|
|
314
|
-
|
|
315
|
-
if (result.error) {
|
|
316
|
-
error(result.error);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
process.exit(result.status);
|
|
320
|
-
})
|
|
321
|
-
.catch((e) => {
|
|
322
|
-
error(e.message);
|
|
323
|
-
process.exit(1);
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const getBinary = (overrideInstallDirectory, platform = getPlatform()) => {
|
|
329
|
-
const download_host =
|
|
330
|
-
process.env.npm_config_apollo_rover_download_host ||
|
|
331
|
-
process.env.APOLLO_ROVER_DOWNLOAD_HOST ||
|
|
332
|
-
"https://rover.apollo.dev";
|
|
333
|
-
// the url for this binary is constructed from values in `package.json`
|
|
334
|
-
// https://rover.apollo.dev/tar/rover/x86_64-unknown-linux-gnu/vx.x.x
|
|
335
|
-
const url = `${download_host}/tar/${name}/${platform.RUST_TARGET}/v${version}`;
|
|
336
|
-
const { dirname } = require("path");
|
|
337
|
-
const appDir = dirname(require.main.filename);
|
|
338
|
-
let installDirectory = join(appDir, "binary");
|
|
339
|
-
if (overrideInstallDirectory != null && overrideInstallDirectory !== "") {
|
|
340
|
-
installDirectory = overrideInstallDirectory;
|
|
341
|
-
}
|
|
342
|
-
let binary = new Binary(
|
|
343
|
-
platform.BINARY_NAME,
|
|
344
|
-
platform.RAW_NAME,
|
|
345
|
-
url,
|
|
346
|
-
installDirectory,
|
|
347
|
-
);
|
|
348
|
-
|
|
349
|
-
// setting this allows us to extract supergraph plugins to the proper directory
|
|
350
|
-
// the variable itself is read in Rust code
|
|
351
|
-
process.env.APOLLO_NODE_MODULES_BIN_DIR = binary.installDirectory;
|
|
352
|
-
return binary;
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
const install = (suppressLogs = false) => {
|
|
356
|
-
const binary = getBinary();
|
|
357
|
-
// these messages are duplicated in `src/command/install/mod.rs`
|
|
358
|
-
// for the curl installer.
|
|
359
|
-
if (!suppressLogs) {
|
|
360
|
-
console.error(
|
|
361
|
-
"If you would like to disable Rover's anonymized usage collection, you can set APOLLO_TELEMETRY_DISABLED=true",
|
|
362
|
-
);
|
|
363
|
-
console.error(
|
|
364
|
-
"You can check out our documentation at https://go.apollo.dev/r/docs.",
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return binary.install(suppressLogs);
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
const run = () => {
|
|
372
|
-
const binary = getBinary();
|
|
373
|
-
binary.run();
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
module.exports = {
|
|
377
|
-
install,
|
|
378
|
-
run,
|
|
379
|
-
getBinary,
|
|
380
|
-
getPlatform,
|
|
381
|
-
getProxyEnv,
|
|
382
|
-
shouldBypassProxy,
|
|
383
|
-
};
|
package/install.js
DELETED
package/run.js
DELETED