@apollo/rover 0.23.0 → 0.25.0-rc.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.
Files changed (3) hide show
  1. package/README.md +9 -8
  2. package/binary.js +19 -11
  3. package/package.json +10 -6
package/README.md CHANGED
@@ -21,13 +21,13 @@ A few useful Rover commands to interact with your graphs:
21
21
  rover graph fetch test@cats
22
22
  ```
23
23
 
24
- 1. Validate recent changes made to your local graph with `rover graph check`.
24
+ 2. Validate recent changes made to your local graph with `rover graph check`.
25
25
 
26
26
  ```bash
27
27
  rover graph check --schema=./path-to-valid-sdl test@cats
28
28
  ```
29
29
 
30
- 1. Publish your local graph to Apollo Studio.
30
+ 3. Publish your local graph to Apollo Studio.
31
31
 
32
32
  ```bash
33
33
  rover graph publish --schema ./path-to-valid-schema test@cats
@@ -76,7 +76,8 @@ Options:
76
76
 
77
77
  --format <FORMAT_KIND>
78
78
  Specify Rover's format type
79
-
79
+
80
+ [default: plain]
80
81
  [possible values: plain, json]
81
82
 
82
83
  -o, --output <OUTPUT_FILE>
@@ -84,21 +85,21 @@ Options:
84
85
 
85
86
  --insecure-accept-invalid-certs
86
87
  Accept invalid certificates when performing HTTPS requests.
87
-
88
+
88
89
  You should think very carefully before using this flag.
89
-
90
+
90
91
  If invalid certificates are trusted, any certificate for any site will be trusted for use. This includes expired certificates. This introduces significant vulnerabilities, and should only be used as a last resort.
91
92
 
92
93
  --insecure-accept-invalid-hostnames
93
94
  Accept invalid hostnames when performing HTTPS requests.
94
-
95
+
95
96
  You should think very carefully before using this flag.
96
-
97
+
97
98
  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.
98
99
 
99
100
  --client-timeout <CLIENT_TIMEOUT>
100
101
  Configure the timeout length (in seconds) when performing HTTP(S) requests
101
-
102
+
102
103
  [default: 30]
103
104
 
104
105
  --skip-update-check
package/binary.js CHANGED
@@ -16,38 +16,39 @@ const error = (msg) => {
16
16
  };
17
17
 
18
18
  const { version } = require("./package.json");
19
- const name = "rover";
19
+ const fs = require("fs");
20
+ const name = `rover`;
20
21
 
21
22
  const supportedPlatforms = [
22
23
  {
23
24
  TYPE: "Windows_NT",
24
25
  ARCHITECTURE: "x64",
25
26
  RUST_TARGET: "x86_64-pc-windows-msvc",
26
- BINARY_NAME: `${name}.exe`,
27
+ BINARY_NAME: `${name}-${version}.exe`,
27
28
  },
28
29
  {
29
30
  TYPE: "Linux",
30
31
  ARCHITECTURE: "x64",
31
32
  RUST_TARGET: "x86_64-unknown-linux-gnu",
32
- BINARY_NAME: name,
33
+ BINARY_NAME: `${name}-${version}`,
33
34
  },
34
35
  {
35
36
  TYPE: "Linux",
36
37
  ARCHITECTURE: "arm64",
37
38
  RUST_TARGET: "aarch64-unknown-linux-gnu",
38
- BINARY_NAME: name,
39
+ BINARY_NAME: `${name}-${version}`,
39
40
  },
40
41
  {
41
42
  TYPE: "Darwin",
42
43
  ARCHITECTURE: "x64",
43
44
  RUST_TARGET: "x86_64-apple-darwin",
44
- BINARY_NAME: name,
45
+ BINARY_NAME: `${name}-${version}`,
45
46
  },
46
47
  {
47
48
  TYPE: "Darwin",
48
49
  ARCHITECTURE: "arm64",
49
50
  RUST_TARGET: "aarch64-apple-darwin",
50
- BINARY_NAME: name,
51
+ BINARY_NAME: `${name}-${version}`,
51
52
  },
52
53
  ];
53
54
 
@@ -101,7 +102,7 @@ const getPlatform = () => {
101
102
 
102
103
  /*! Copyright (c) 2019 Avery Harnish - MIT License */
103
104
  class Binary {
104
- constructor(name, url, config) {
105
+ constructor(name, url, installDirectory) {
105
106
  let errors = [];
106
107
  if (typeof url !== "string") {
107
108
  errors.push("url must be a string");
@@ -131,8 +132,7 @@ class Binary {
131
132
  }
132
133
  this.url = url;
133
134
  this.name = name;
134
- this.installDirectory =
135
- config?.installDirectory || join(__dirname, "node_modules", ".bin");
135
+ this.installDirectory = installDirectory;
136
136
 
137
137
  if (!existsSync(this.installDirectory)) {
138
138
  mkdirSync(this.installDirectory, { recursive: true });
@@ -176,6 +176,7 @@ class Binary {
176
176
  });
177
177
  })
178
178
  .then(() => {
179
+ fs.renameSync(join(this.installDirectory, name), this.binaryPath);
179
180
  if (!suppressLogs) {
180
181
  console.error(`${this.name} has been installed!`);
181
182
  }
@@ -211,13 +212,19 @@ class Binary {
211
212
  }
212
213
  }
213
214
 
214
- const getBinary = () => {
215
+ const getBinary = (overrideInstallDirectory) => {
215
216
  const platform = getPlatform();
216
217
  const download_host = process.env.npm_config_apollo_rover_download_host || process.env.APOLLO_ROVER_DOWNLOAD_HOST || 'https://rover.apollo.dev'
217
218
  // the url for this binary is constructed from values in `package.json`
218
219
  // https://rover.apollo.dev/tar/rover/x86_64-unknown-linux-gnu/v0.4.8
219
220
  const url = `${download_host}/tar/${name}/${platform.RUST_TARGET}/v${version}`;
220
- let binary = new Binary(platform.BINARY_NAME, url);
221
+ const { dirname } = require('path');
222
+ const appDir = dirname(require.main.filename);
223
+ let installDirectory = join(appDir, "binary");
224
+ if (overrideInstallDirectory != null && overrideInstallDirectory !== "") {
225
+ installDirectory = overrideInstallDirectory
226
+ }
227
+ let binary = new Binary(platform.BINARY_NAME, url, installDirectory);
221
228
 
222
229
  // setting this allows us to extract supergraph plugins to the proper directory
223
230
  // the variable itself is read in Rust code
@@ -251,4 +258,5 @@ module.exports = {
251
258
  install,
252
259
  run,
253
260
  getBinary,
261
+ getPlatform,
254
262
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/rover",
3
- "version": "0.23.0",
3
+ "version": "0.25.0-rc.0",
4
4
  "description": "The new Apollo CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -10,7 +10,8 @@
10
10
  "prepack": "cp ../../README.md . && cp ../../LICENSE .",
11
11
  "postinstall": "node ./install.js",
12
12
  "fmt": "prettier --write **/*.js",
13
- "fmt:check": "prettier --check **/*.js"
13
+ "fmt:check": "prettier --check **/*.js",
14
+ "test": "jest"
14
15
  },
15
16
  "repository": "https://github.com/apollographql/rover",
16
17
  "keywords": [
@@ -32,8 +33,8 @@
32
33
  "npm": ">=6"
33
34
  },
34
35
  "volta": {
35
- "node": "18.19.0",
36
- "npm": "10.3.0"
36
+ "node": "20.15.1",
37
+ "npm": "10.8.2"
37
38
  },
38
39
  "homepage": "https://github.com/apollographql/rover#readme",
39
40
  "dependencies": {
@@ -41,9 +42,12 @@
41
42
  "axios-proxy-builder": "^0.1.1",
42
43
  "console.table": "^0.10.0",
43
44
  "detect-libc": "^2.0.0",
44
- "tar": "^6.2.0"
45
+ "tar": "^7.0.0"
45
46
  },
46
47
  "devDependencies": {
47
- "prettier": "3.2.4"
48
+ "prettier": "3.3.3",
49
+ "jest": "29.7.0",
50
+ "axios-mock-adapter": "1.22.0",
51
+ "jest-junit": "16.0.0"
48
52
  }
49
53
  }