saucectl 0.202.0 → 0.205.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 +58 -5
- package/index.js +39 -2
- package/install.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,30 +16,83 @@ The command should be globally available:
|
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
18
|
$ saucectl -v
|
|
19
|
-
saucectl version 0.
|
|
20
|
-
(build
|
|
19
|
+
saucectl version 0.197.2
|
|
20
|
+
(build a301436d5b178bcfda8db106c50bfb78ac5be679)
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
__Note:__ When you run the command for the first time, it will initially download the binary. This only happens once.
|
|
24
24
|
|
|
25
|
-
__Note:__ `saucectl` installation is disabled on Sauce Labs Cloud. If you wish to force the installation, set
|
|
25
|
+
__Note:__ `saucectl` installation is disabled on Sauce Labs Cloud. If you wish to force the installation, set
|
|
26
|
+
the `SAUCECTL_FORCE_INSTALL` environment variable to `true`.
|
|
26
27
|
|
|
27
28
|
### Install Binary from a Specified Source
|
|
28
29
|
|
|
29
30
|
If you want the installer to download `saucectl` from a specific source, set the following environment variable:
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
**macOS/Linux:**
|
|
33
|
+
```bash
|
|
32
34
|
export SAUCECTL_INSTALL_BINARY=http://localhost:9000/saucectl_0.32.2_mac_64-bit.tar.gz
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
**Windows (PowerShell):**
|
|
38
|
+
```powershell
|
|
39
|
+
$env:SAUCECTL_INSTALL_BINARY = "http://localhost:9000/saucectl_0.32.2_win_64-bit.zip"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Windows (Command Prompt):**
|
|
43
|
+
```cmd
|
|
44
|
+
set SAUCECTL_INSTALL_BINARY=http://localhost:9000/saucectl_0.32.2_win_64-bit.zip
|
|
45
|
+
```
|
|
46
|
+
|
|
35
47
|
### Install Binary from a Mirror Site
|
|
36
48
|
|
|
37
|
-
Override the default download site by setting the `SAUCECTL_INSTALL_BINARY_MIRROR` environment variable to a
|
|
49
|
+
Override the default download site by setting the `SAUCECTL_INSTALL_BINARY_MIRROR` environment variable to a
|
|
50
|
+
custom URL. The default site is [Sauce Labs saucectl releases](https://github.com/saucelabs/saucectl/releases/download).
|
|
38
51
|
|
|
52
|
+
**macOS/Linux:**
|
|
39
53
|
```bash
|
|
40
54
|
SAUCECTL_INSTALL_BINARY_MIRROR=https://your-mirror-download-site.com/foo/bar npm i -g saucectl
|
|
41
55
|
```
|
|
42
56
|
|
|
57
|
+
**Windows (PowerShell):**
|
|
58
|
+
```powershell
|
|
59
|
+
$env:SAUCECTL_INSTALL_BINARY_MIRROR = "https://your-mirror-download-site.com/foo/bar"
|
|
60
|
+
npm i -g saucectl
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Windows (Command Prompt):**
|
|
64
|
+
```cmd
|
|
65
|
+
set SAUCECTL_INSTALL_BINARY_MIRROR=https://your-mirror-download-site.com/foo/bar
|
|
66
|
+
npm i -g saucectl
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Use a Local Binary
|
|
70
|
+
|
|
71
|
+
If you already have a `saucectl` binary on your machine, you can point the installer directly to it by setting
|
|
72
|
+
the `SAUCECTL_INSTALL_BINARY_LOCAL` environment variable to the absolute (or relative) path of the binary.
|
|
73
|
+
No download will occur. The binary will be copied into the package's `bin` directory.
|
|
74
|
+
|
|
75
|
+
**macOS/Linux:**
|
|
76
|
+
```bash
|
|
77
|
+
export SAUCECTL_INSTALL_BINARY_LOCAL=/usr/local/bin/saucectl
|
|
78
|
+
npm i -g saucectl
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Windows (PowerShell):**
|
|
82
|
+
```powershell
|
|
83
|
+
$env:SAUCECTL_INSTALL_BINARY_LOCAL = "C:\tools\saucectl.exe"
|
|
84
|
+
npm i -g saucectl
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Windows (Command Prompt):**
|
|
88
|
+
```cmd
|
|
89
|
+
set SAUCECTL_INSTALL_BINARY_LOCAL=C:\tools\saucectl.exe
|
|
90
|
+
npm i -g saucectl
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
> **Note:** `SAUCECTL_INSTALL_BINARY_LOCAL` takes precedence over `SAUCECTL_INSTALL_BINARY` and
|
|
94
|
+
> `SAUCECTL_INSTALL_BINARY_MIRROR` if multiple variables are set simultaneously.
|
|
95
|
+
|
|
43
96
|
---
|
|
44
97
|
|
|
45
98
|
For more information about `saucectl`, visit its main repository: [saucelabs/saucectl](https://github.com/saucelabs/saucectl).
|
package/index.js
CHANGED
|
@@ -1,15 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { spawn } = require('child_process');
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
4
5
|
const { BinWrapper } = require('@saucelabs/bin-wrapper');
|
|
5
6
|
const { Writable } = require('stream');
|
|
6
7
|
|
|
7
|
-
const version = '0.
|
|
8
|
+
const version = '0.205.0';
|
|
8
9
|
const defaultBinInstallBase =
|
|
9
10
|
'https://github.com/saucelabs/saucectl/releases/download';
|
|
10
|
-
const binWrapper = (
|
|
11
|
+
const binWrapper = (
|
|
12
|
+
binInstallURL = null,
|
|
13
|
+
binInstallBase = null,
|
|
14
|
+
binLocalPath = null,
|
|
15
|
+
) => {
|
|
11
16
|
const bw = new BinWrapper();
|
|
12
17
|
|
|
18
|
+
if (binLocalPath) {
|
|
19
|
+
const resolvedPath = path.resolve(binLocalPath);
|
|
20
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
21
|
+
console.error(
|
|
22
|
+
`Please ensure the path provided by SAUCECTL_INSTALL_BINARY_LOCAL exists: ${resolvedPath}`,
|
|
23
|
+
);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!fs.statSync(resolvedPath).isFile()) {
|
|
27
|
+
console.error(
|
|
28
|
+
`Please ensure the path provided by SAUCECTL_INSTALL_BINARY_LOCAL points to a file, not a directory: ${resolvedPath}`,
|
|
29
|
+
);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (binInstallURL || binInstallBase) {
|
|
33
|
+
console.warn(
|
|
34
|
+
'SAUCECTL_INSTALL_BINARY_LOCAL is set alongside other binary source environment variables. The local path takes precedence.',
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const binName = process.platform.startsWith('win')
|
|
38
|
+
? 'saucectl.exe'
|
|
39
|
+
: 'saucectl';
|
|
40
|
+
const binDir = path.join(__dirname, 'bin');
|
|
41
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
42
|
+
fs.copyFileSync(resolvedPath, path.join(binDir, binName));
|
|
43
|
+
fs.chmodSync(path.join(binDir, binName), 0o755);
|
|
44
|
+
bw.dest(binDir);
|
|
45
|
+
bw.use(binName);
|
|
46
|
+
return bw;
|
|
47
|
+
}
|
|
48
|
+
|
|
13
49
|
if (binInstallURL) {
|
|
14
50
|
try {
|
|
15
51
|
new URL(binInstallURL);
|
|
@@ -134,6 +170,7 @@ if (require.main === module) {
|
|
|
134
170
|
const bw = binWrapper(
|
|
135
171
|
process.env.SAUCECTL_INSTALL_BINARY,
|
|
136
172
|
process.env.SAUCECTL_INSTALL_BINARY_MIRROR,
|
|
173
|
+
process.env.SAUCECTL_INSTALL_BINARY_LOCAL,
|
|
137
174
|
);
|
|
138
175
|
main(bw, process.argv.slice(2));
|
|
139
176
|
}
|
package/install.js
CHANGED
|
@@ -23,10 +23,15 @@ async function install() {
|
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
console.info(
|
|
26
|
+
console.info(
|
|
27
|
+
process.env.SAUCECTL_INSTALL_BINARY_LOCAL
|
|
28
|
+
? 'Locating local saucectl binary'
|
|
29
|
+
: 'Fetching saucectl binary',
|
|
30
|
+
);
|
|
27
31
|
const bw = binWrapper(
|
|
28
32
|
process.env.SAUCECTL_INSTALL_BINARY,
|
|
29
33
|
process.env.SAUCECTL_INSTALL_BINARY_MIRROR,
|
|
34
|
+
process.env.SAUCECTL_INSTALL_BINARY_LOCAL,
|
|
30
35
|
);
|
|
31
36
|
if (!bw) {
|
|
32
37
|
return;
|