hdoc-tools 0.55.2 → 0.56.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/hdoc.js +32 -1
- package/package.json +1 -1
package/hdoc.js
CHANGED
|
@@ -128,7 +128,19 @@
|
|
|
128
128
|
let source_path = process.cwd();
|
|
129
129
|
let ui_path = path.join(__dirname, "ui");
|
|
130
130
|
let editor_path = path.join(__dirname, "editor", "dist");
|
|
131
|
-
|
|
131
|
+
// Default the GitHub token from the environment so nobody has to hand-pass a
|
|
132
|
+
// secret on the command line (and it never lands in shell history). GITHUB_TOKEN
|
|
133
|
+
// is the GitHub Actions / CI standard; GH_TOKEN is the gh-CLI convention. An
|
|
134
|
+
// explicit --git-token flag (parsed below) overrides either.
|
|
135
|
+
let git_token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN || "";
|
|
136
|
+
// Track where the token came from purely so we can log it (masked) later — helps
|
|
137
|
+
// contributors confirm auth is active rather than silently falling back to the
|
|
138
|
+
// unauthenticated 60/hr limit because of a typo'd env var or wrong scope.
|
|
139
|
+
let git_token_source = process.env.GITHUB_TOKEN
|
|
140
|
+
? "GITHUB_TOKEN env"
|
|
141
|
+
: process.env.GH_TOKEN
|
|
142
|
+
? "GH_TOKEN env"
|
|
143
|
+
: "";
|
|
132
144
|
let command = ""; // Our command to run
|
|
133
145
|
let build_version = "";
|
|
134
146
|
let verbose = false;
|
|
@@ -170,6 +182,7 @@
|
|
|
170
182
|
x++;
|
|
171
183
|
if (x < process.argv.length) {
|
|
172
184
|
git_token = process.argv[x];
|
|
185
|
+
git_token_source = "--git-token flag";
|
|
173
186
|
}
|
|
174
187
|
} else if (process.argv[x].toLowerCase() === "--set-version") {
|
|
175
188
|
x++;
|
|
@@ -197,6 +210,24 @@
|
|
|
197
210
|
console.log(" Server Path:", __dirname);
|
|
198
211
|
console.log(" Document Path:", source_path, "\r\n");
|
|
199
212
|
|
|
213
|
+
// Confirm GitHub auth status for commands that pull contributor data, so a
|
|
214
|
+
// contributor can see at a glance whether the rate-limit-lifting token is
|
|
215
|
+
// actually in effect. Show only a short masked preview — never the full token.
|
|
216
|
+
if (command.toLowerCase() === "build" || command.toLowerCase() === "validate") {
|
|
217
|
+
if (git_token) {
|
|
218
|
+
const masked =
|
|
219
|
+
git_token.length > 8
|
|
220
|
+
? `${git_token.slice(0, 4)}…${git_token.slice(-2)}`
|
|
221
|
+
: "…";
|
|
222
|
+
console.log(` GitHub Token: using ${git_token_source} [${masked}]`, "\r\n");
|
|
223
|
+
} else {
|
|
224
|
+
console.log(
|
|
225
|
+
" GitHub Token: none — using unauthenticated GitHub API (60 requests/hour). Set GITHUB_TOKEN to raise the limit.",
|
|
226
|
+
"\r\n",
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
200
231
|
|
|
201
232
|
// Add validated-links.txt to .gitignore if it doesn't exist
|
|
202
233
|
const gitignorePath = path.join(source_path, ".gitignore");
|