@apollo/rover 0.4.7 → 0.5.0-rc.1

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 +32 -13
  2. package/binary.js +48 -8
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -37,7 +37,7 @@ rover graph publish --schema ./path-to-valid-schema test@cats
37
37
  ## Command-line options
38
38
 
39
39
  ```console
40
- Rover 0.4.7
40
+ Rover 0.5.0-rc.1
41
41
 
42
42
  Rover - Your Graph Companion
43
43
  Read the getting started guide by running:
@@ -66,18 +66,37 @@ USAGE:
66
66
  rover [FLAGS] [OPTIONS] <SUBCOMMAND>
67
67
 
68
68
  FLAGS:
69
- --insecure-accept-invalid-certs Accept invalid certificates when performing HTTPS requests
70
- --insecure-accept-invalid-hostnames Accept invalid hostnames when performing HTTPS requests
71
- -h, --help Prints help information
72
- -V, --version Prints version information
69
+ --insecure-accept-invalid-certs
70
+ Accept invalid certificates when performing HTTPS requests.
71
+
72
+ You should think very carefully before using this flag.
73
+
74
+ If invalid certificates are trusted, any certificate for any site will be trusted for use. This includes
75
+ expired certificates. This introduces significant vulnerabilities, and should only be used as a last resort.
76
+ --insecure-accept-invalid-hostnames
77
+ Accept invalid hostnames when performing HTTPS requests.
78
+
79
+ You should think very carefully before using this flag.
80
+
81
+ If hostname verification is not used, any valid certificate for any site will be trusted for use from any
82
+ other. This introduces a significant vulnerability to man-in-the-middle attacks.
83
+ -h, --help
84
+ Prints help information
85
+
86
+ -V, --version
87
+ Prints version information
88
+
73
89
 
74
90
  OPTIONS:
75
- --client-timeout <client-timeout> Configure the timeout length (in seconds) when performing HTTP(S) requests
76
- [default: 30]
77
- -l, --log <log-level> Specify Rover's log level [possible values: error, warn,
78
- info, debug, trace]
79
- --output <output-type> Specify Rover's output type [default: plain] [possible values:
80
- json, plain]
91
+ --client-timeout <client-timeout>
92
+ Configure the timeout length (in seconds) when performing HTTP(S) requests [default: 30]
93
+
94
+ -l, --log <log-level>
95
+ Specify Rover's log level [possible values: error, warn, info, debug,
96
+ trace]
97
+ --output <output-type>
98
+ Specify Rover's output type [default: plain] [possible values: json, plain]
99
+
81
100
 
82
101
  SUBCOMMANDS:
83
102
  config Configuration profile commands
@@ -123,7 +142,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe
123
142
  > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise.
124
143
 
125
144
  ```bash
126
- curl -sSL https://rover.apollo.dev/nix/v0.4.7 | sh
145
+ curl -sSL https://rover.apollo.dev/nix/v0.5.0-rc.1 | sh
127
146
  ```
128
147
 
129
148
  You will need `curl` installed on your system to run the above installation commands. You can get the latest version from [the curl downloads page](https://curl.se/download.html).
@@ -141,7 +160,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe
141
160
  > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise.
142
161
 
143
162
  ```bash
144
- iwr 'https://rover.apollo.dev/win/v0.4.7' | iex
163
+ iwr 'https://rover.apollo.dev/win/v0.5.0-rc.1' | iex
145
164
  ```
146
165
 
147
166
  #### npm installer
package/binary.js CHANGED
@@ -2,6 +2,8 @@ const { Binary } = require("binary-install");
2
2
  const os = require("os");
3
3
  const cTable = require("console.table");
4
4
  const libc = require("detect-libc");
5
+ const { join } = require("path");
6
+ const { spawnSync } = require("child_process");
5
7
 
6
8
  const error = (msg) => {
7
9
  console.error(msg);
@@ -9,7 +11,6 @@ const error = (msg) => {
9
11
  };
10
12
 
11
13
  const { version } = require("./package.json");
12
- const repository = "https://github.com/apollographql/rover";
13
14
  const name = "rover";
14
15
 
15
16
  const supportedPlatforms = [
@@ -49,9 +50,12 @@ const getPlatform = () => {
49
50
  architecture === supportedPlatform.ARCHITECTURE
50
51
  ) {
51
52
  if (supportedPlatform.TYPE === "Linux") {
52
- let musl_warning = "Downloading musl binary that does not include `rover supergraph compose`.";
53
+ let musl_warning =
54
+ "Downloading musl binary that does not include `rover supergraph compose`.";
53
55
  if (libc.isNonGlibcLinuxSync()) {
54
- console.warn("This operating system does not support dynamic linking to glibc.");
56
+ console.warn(
57
+ "This operating system does not support dynamic linking to glibc."
58
+ );
55
59
  console.warn(musl_warning);
56
60
  supportedPlatform.RUST_TARGET = "x86_64-unknown-linux-musl";
57
61
  } else {
@@ -61,8 +65,13 @@ const getPlatform = () => {
61
65
  let libc_minor_version = split_libc_version[1];
62
66
  let min_major_version = 2;
63
67
  let min_minor_version = 17;
64
- if (libc_major_version < min_major_version || libc_minor_version < min_minor_version) {
65
- console.warn(`This operating system needs glibc >= ${min_major_version}.${min_minor_version}, but only has ${libc_version} installed.`);
68
+ if (
69
+ libc_major_version < min_major_version ||
70
+ libc_minor_version < min_minor_version
71
+ ) {
72
+ console.warn(
73
+ `This operating system needs glibc >= ${min_major_version}.${min_minor_version}, but only has ${libc_version} installed.`
74
+ );
66
75
  console.warn(musl_warning);
67
76
  supportedPlatform.RUST_TARGET = "x86_64-unknown-linux-musl";
68
77
  }
@@ -82,9 +91,17 @@ const getPlatform = () => {
82
91
  const getBinary = () => {
83
92
  const platform = getPlatform();
84
93
  // the url for this binary is constructed from values in `package.json`
85
- // https://github.com/apollographql/rover/releases/download/v1.0.0/binary-install-example-v1.0.0-x86_64-apple-darwin.tar.gz
86
- const url = `${repository}/releases/download/v${version}/${name}-v${version}-${platform.RUST_TARGET}.tar.gz`;
87
- return new Binary(platform.BINARY_NAME, url);
94
+ // https://rover.apollo.dev/tar/rover/x86_64-unknown-linux-gnu/v0.4.8
95
+ const url = `https://rover.apollo.dev/tar/${name}/${platform.RUST_TARGET}/v${version}`;
96
+ let binary = new Binary(platform.BINARY_NAME, url);
97
+
98
+ // binary-install doesn't put the binary in the right place, so just patch it.
99
+ binary.installDirectory = join(__dirname, "node_modules", ".bin");
100
+ binary.binaryPath = join(binary.installDirectory, binary.name);
101
+ // setting this allows us to extract supergraph plugins to the proper directory
102
+ // the variable itself is read in Rust code
103
+ process.env.APOLLO_NODE_MODULES_BIN_DIR = binary.installDirectory;
104
+ return binary;
88
105
  };
89
106
 
90
107
  const run = () => {
@@ -95,9 +112,32 @@ const run = () => {
95
112
  const install = () => {
96
113
  const binary = getBinary();
97
114
  binary.install();
115
+ let pluginInstallCommand = `${binary.binaryPath} install --plugin`;
116
+ let commands = [
117
+ `${pluginInstallCommand} supergraph@latest-0`,
118
+ `${pluginInstallCommand} supergraph@latest-2`,
119
+ ];
120
+ for (command of commands) {
121
+ try {
122
+ spawnSync(command, {
123
+ stdio: "inherit",
124
+ shell: true,
125
+ });
126
+ } catch (e) {
127
+ console.error(
128
+ `'${command.replace(
129
+ binary.binaryPath,
130
+ binary.name
131
+ )}' failed with message '${
132
+ e.message
133
+ }'. 'rover supergraph compose' might not work properly on your machine.`
134
+ );
135
+ }
136
+ }
98
137
  };
99
138
 
100
139
  module.exports = {
101
140
  install,
102
141
  run,
142
+ getBinary,
103
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/rover",
3
- "version": "0.4.7",
3
+ "version": "0.5.0-rc.1",
4
4
  "description": "The new Apollo CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "volta": {
35
35
  "node": "17.5.0",
36
- "npm": "8.5.0"
36
+ "npm": "8.5.4"
37
37
  },
38
38
  "homepage": "https://github.com/apollographql/rover#readme",
39
39
  "dependencies": {
@@ -42,6 +42,6 @@
42
42
  "detect-libc": "^2.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "prettier": "2.5.1"
45
+ "prettier": "2.6.0"
46
46
  }
47
47
  }