facult 1.0.1 → 1.0.3
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 +0 -8
- package/bin/facult.cjs +6 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,12 +43,6 @@ Direct binary install from GitHub Releases (macOS/Linux):
|
|
|
43
43
|
curl -fsSL https://github.com/hack-dance/facult/releases/latest/download/facult-install.sh | bash
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
If release assets are private, set a token first:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
export FACULT_GITHUB_TOKEN="<github-token>"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
46
|
Windows and manual installs can download the correct binary from each release page:
|
|
53
47
|
`facult-<version>-<platform>-<arch>`.
|
|
54
48
|
|
|
@@ -252,8 +246,6 @@ facult <command> --help
|
|
|
252
246
|
### Runtime env vars
|
|
253
247
|
|
|
254
248
|
- `FACULT_ROOT_DIR`: override canonical store location
|
|
255
|
-
- `FACULT_GITHUB_TOKEN`: auth token for private GitHub release asset downloads
|
|
256
|
-
- `GITHUB_TOKEN` / `GH_TOKEN`: fallback tokens for release asset downloads
|
|
257
249
|
- `FACULT_VERSION`: version selector for `scripts/install.sh` (`latest` by default)
|
|
258
250
|
- `FACULT_INSTALL_DIR`: install target dir for `scripts/install.sh` (`~/.facult/bin` by default)
|
|
259
251
|
- `FACULT_INSTALL_PM`: force package manager detection for npm bootstrap launcher (`npm` or `bun`)
|
package/bin/facult.cjs
CHANGED
|
@@ -37,7 +37,6 @@ async function main() {
|
|
|
37
37
|
);
|
|
38
38
|
const binaryName = resolved.platform === "windows" ? "facult.exe" : "facult";
|
|
39
39
|
const binaryPath = path.join(installDir, binaryName);
|
|
40
|
-
const githubToken = resolveGitHubToken();
|
|
41
40
|
|
|
42
41
|
if (!(await fileExists(binaryPath))) {
|
|
43
42
|
const tag = `v${version}`;
|
|
@@ -50,7 +49,6 @@ async function main() {
|
|
|
50
49
|
await downloadWithRetry(url, tmpPath, {
|
|
51
50
|
attempts: DOWNLOAD_RETRIES,
|
|
52
51
|
delayMs: DOWNLOAD_RETRY_DELAY_MS,
|
|
53
|
-
token: githubToken,
|
|
54
52
|
});
|
|
55
53
|
if (resolved.platform !== "windows") {
|
|
56
54
|
await fsp.chmod(tmpPath, 0o755);
|
|
@@ -149,48 +147,19 @@ function detectPackageManager() {
|
|
|
149
147
|
return "npm";
|
|
150
148
|
}
|
|
151
149
|
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
process.env.FACULT_GITHUB_TOKEN,
|
|
155
|
-
process.env.GITHUB_TOKEN,
|
|
156
|
-
process.env.GH_TOKEN,
|
|
157
|
-
];
|
|
158
|
-
for (const candidate of tokenCandidates) {
|
|
159
|
-
const token = String(candidate || "").trim();
|
|
160
|
-
if (token) {
|
|
161
|
-
return token;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return "";
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function buildRequestHeaders(url, token) {
|
|
168
|
-
const headers = {
|
|
150
|
+
function buildRequestHeaders() {
|
|
151
|
+
return {
|
|
169
152
|
"user-agent": "facult-installer",
|
|
170
153
|
accept: "application/octet-stream",
|
|
171
154
|
};
|
|
172
|
-
if (!token) {
|
|
173
|
-
return headers;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
try {
|
|
177
|
-
const hostname = new URL(url).hostname.toLowerCase();
|
|
178
|
-
if (hostname === "github.com" || hostname === "api.github.com") {
|
|
179
|
-
headers.authorization = `Bearer ${token}`;
|
|
180
|
-
}
|
|
181
|
-
} catch {
|
|
182
|
-
// Keep default headers if URL parsing fails.
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return headers;
|
|
186
155
|
}
|
|
187
156
|
|
|
188
|
-
async function download(url, destinationPath
|
|
157
|
+
async function download(url, destinationPath) {
|
|
189
158
|
await new Promise((resolve, reject) => {
|
|
190
159
|
const request = https.get(
|
|
191
160
|
url,
|
|
192
161
|
{
|
|
193
|
-
headers: buildRequestHeaders(
|
|
162
|
+
headers: buildRequestHeaders(),
|
|
194
163
|
},
|
|
195
164
|
(response) => {
|
|
196
165
|
if (
|
|
@@ -200,7 +169,7 @@ async function download(url, destinationPath, options = {}) {
|
|
|
200
169
|
response.headers.location
|
|
201
170
|
) {
|
|
202
171
|
response.resume();
|
|
203
|
-
download(response.headers.location, destinationPath
|
|
172
|
+
download(response.headers.location, destinationPath)
|
|
204
173
|
.then(resolve)
|
|
205
174
|
.catch(reject);
|
|
206
175
|
return;
|
|
@@ -240,7 +209,7 @@ async function downloadWithRetry(url, destinationPath, options) {
|
|
|
240
209
|
for (let attempt = 1; attempt <= options.attempts; attempt += 1) {
|
|
241
210
|
try {
|
|
242
211
|
await safeUnlink(destinationPath);
|
|
243
|
-
await download(url, destinationPath
|
|
212
|
+
await download(url, destinationPath);
|
|
244
213
|
return;
|
|
245
214
|
} catch (error) {
|
|
246
215
|
lastError = error;
|