@itsbjoern/roost 0.1.7 → 0.1.8
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 +5 -2
- package/bin/{roost → roost-bin} +0 -0
- package/install.js +14 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,15 +5,18 @@ This is the npm wrapper for the Roost CLI. It downloads a prebuilt `roost` binar
|
|
|
5
5
|
### Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
+
# Global install — use `roost` from anywhere:
|
|
8
9
|
npm install -g @itsbjoern/roost
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
# Local install — use via npx:
|
|
10
12
|
npm install @itsbjoern/roost
|
|
11
13
|
```
|
|
12
14
|
|
|
13
15
|
Then (CLI):
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
roost init
|
|
18
|
+
roost init # after global install
|
|
19
|
+
npx roost init # after local install
|
|
17
20
|
```
|
|
18
21
|
|
|
19
22
|
### JavaScript API
|
package/bin/{roost → roost-bin}
RENAMED
|
Binary file
|
package/install.js
CHANGED
|
@@ -112,16 +112,26 @@ async function main() {
|
|
|
112
112
|
cwd: binDir,
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
const
|
|
116
|
-
const
|
|
115
|
+
const extractedName = process.platform === "win32" ? "roost.exe" : "roost";
|
|
116
|
+
const extractedPath = path.join(binDir, extractedName);
|
|
117
117
|
|
|
118
|
-
const exists = fs.existsSync(
|
|
118
|
+
const exists = fs.existsSync(extractedPath);
|
|
119
119
|
if (!exists) {
|
|
120
120
|
throw new Error(
|
|
121
|
-
`Extracted archive did not contain expected binary at ${
|
|
121
|
+
`Extracted archive did not contain expected binary at ${extractedPath}`
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
// On Unix, archive contains "roost" which would overwrite the Node wrapper.
|
|
126
|
+
// Rename to roost-bin so bin/roost stays as the wrapper script.
|
|
127
|
+
let binPath;
|
|
128
|
+
if (process.platform === "win32") {
|
|
129
|
+
binPath = extractedPath; // already bin/roost.exe
|
|
130
|
+
} else {
|
|
131
|
+
binPath = path.join(binDir, "roost-bin");
|
|
132
|
+
await fs.promises.rename(extractedPath, binPath);
|
|
133
|
+
}
|
|
134
|
+
|
|
125
135
|
if (process.platform !== "win32") {
|
|
126
136
|
await fs.promises.chmod(binPath, 0o755);
|
|
127
137
|
}
|