hdoc-tools 0.55.1 → 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/.puppeteerrc.cjs +9 -0
- package/hdoc-install-browser.js +6 -5
- package/hdoc.js +32 -1
- package/package.json +1 -1
- package/schemas/hdocbook.schema.json +2 -3
package/.puppeteerrc.cjs
CHANGED
|
@@ -7,6 +7,15 @@
|
|
|
7
7
|
// Discovered by Puppeteer (cosmiconfig) walking up from node_modules/.../puppeteer
|
|
8
8
|
// to this package root during install. skipDownload only affects provisioning,
|
|
9
9
|
// not where the browser is launched from at runtime.
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
|
|
10
12
|
module.exports = {
|
|
11
13
|
skipDownload: true,
|
|
14
|
+
// Pin a fixed, user-independent cache dir inside the package root. Under a
|
|
15
|
+
// global install, postinstall runs as root (sudo) while `hdoc` later runs as
|
|
16
|
+
// a normal user; os.homedir() resolves to different homes for each, so the
|
|
17
|
+
// old ~/.cache/puppeteer default left the browser in root's home and the
|
|
18
|
+
// runtime launch (a normal user) never found it. Anchoring to __dirname makes
|
|
19
|
+
// install-time provisioning and runtime launch agree on one absolute path.
|
|
20
|
+
cacheDir: path.join(__dirname, ".cache", "puppeteer"),
|
|
12
21
|
};
|
package/hdoc-install-browser.js
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
(async () => {
|
|
22
22
|
const fs = require("node:fs");
|
|
23
23
|
const path = require("node:path");
|
|
24
|
-
const os = require("node:os");
|
|
25
24
|
const {
|
|
26
25
|
install,
|
|
27
26
|
computeExecutablePath,
|
|
@@ -42,12 +41,14 @@
|
|
|
42
41
|
const log = (msg) => console.log(`[hdoc-tools] ${msg}`);
|
|
43
42
|
|
|
44
43
|
// Resolve the cache directory the same way Puppeteer does at runtime:
|
|
45
|
-
// PUPPETEER_CACHE_DIR wins, otherwise the
|
|
46
|
-
//
|
|
47
|
-
//
|
|
44
|
+
// PUPPETEER_CACHE_DIR wins, otherwise the fixed cacheDir declared in
|
|
45
|
+
// .puppeteerrc.cjs. Reading the shared config (rather than recomputing from
|
|
46
|
+
// os.homedir()) guarantees we install to exactly the path the browser is
|
|
47
|
+
// later launched from — critical for `sudo npm i -g`, where postinstall runs
|
|
48
|
+
// as root but `hdoc` runs as a normal user with a different home directory.
|
|
48
49
|
const cacheDir =
|
|
49
50
|
process.env.PUPPETEER_CACHE_DIR ||
|
|
50
|
-
path.join(
|
|
51
|
+
require(path.join(__dirname, ".puppeteerrc.cjs")).cacheDir;
|
|
51
52
|
|
|
52
53
|
let platform;
|
|
53
54
|
try {
|
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");
|
package/package.json
CHANGED
|
@@ -35,18 +35,17 @@
|
|
|
35
35
|
"description": "The ID of the product family this book belongs to.",
|
|
36
36
|
"enum": [
|
|
37
37
|
"esp",
|
|
38
|
+
"com.hornbill.docmanager",
|
|
38
39
|
"com.hornbill.boardmanager",
|
|
39
40
|
"com.hornbill.customermanager",
|
|
40
|
-
"com.hornbill.collaboration",
|
|
41
|
-
"com.hornbill.docmanager",
|
|
42
41
|
"com.hornbill.grc",
|
|
43
42
|
"com.hornbill.itom",
|
|
44
43
|
"com.hornbill.livechat",
|
|
45
|
-
"com.hornbill.pricingcalculator",
|
|
46
44
|
"com.hornbill.projectmanager",
|
|
47
45
|
"com.hornbill.servicemanager",
|
|
48
46
|
"com.hornbill.suppliermanager",
|
|
49
47
|
"com.hornbill.timesheetmanager",
|
|
48
|
+
"com.hornbill.collaboration",
|
|
50
49
|
"appdev",
|
|
51
50
|
"hdocs"
|
|
52
51
|
]
|