hdoc-tools 0.9.46 → 0.9.47
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/LICENSE +21 -0
- package/hdoc-build.js +2 -2
- package/hdoc-module.js +22 -15
- package/package.json +3 -1
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Hornbill Docs
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/hdoc-build.js
CHANGED
@@ -637,7 +637,7 @@
|
|
637
637
|
console.log(`Loading product families...`);
|
638
638
|
const prods = await hdoc.load_product_families();
|
639
639
|
if (!prods.success) {
|
640
|
-
console.log(
|
640
|
+
console.log(`${prods.errors}\n`);
|
641
641
|
process.exit(1);
|
642
642
|
} else {
|
643
643
|
prod_families = prods.prod_families;
|
@@ -655,7 +655,7 @@
|
|
655
655
|
try {
|
656
656
|
css_templates.push(fs.readFileSync(css_files[i], 'utf8'));
|
657
657
|
} catch (e) {
|
658
|
-
console.log(`Error reading file
|
658
|
+
console.log(`Error reading file[${css_files[i]}]: ${e}`);
|
659
659
|
}
|
660
660
|
}
|
661
661
|
}
|
package/hdoc-module.js
CHANGED
@@ -358,23 +358,30 @@
|
|
358
358
|
prods_supported: [],
|
359
359
|
errors: ''
|
360
360
|
};
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
response.prods_supported
|
361
|
+
const prod_families_url = 'https://docs.hornbill.com/_books/products.json';
|
362
|
+
for (let i = 1; i < 4; i++) {
|
363
|
+
try {
|
364
|
+
const prods = await axios.get(prod_families_url, {
|
365
|
+
httpsAgent: agent,
|
366
|
+
timeout: 5000
|
367
|
+
});
|
368
|
+
if (prods.status === 200) {
|
369
|
+
response.prod_families = prods.data;
|
370
|
+
response.prods_supported = [];
|
371
|
+
for (let i = 0; i < response.prod_families.products.length; i++) {
|
372
|
+
response.prods_supported.push(response.prod_families.products[i].id);
|
373
|
+
}
|
374
|
+
response.success = true;
|
375
|
+
break;
|
376
|
+
} else {
|
377
|
+
throw `Unexpected status - ${prods.status} ${prods.statusText}`;
|
371
378
|
}
|
372
|
-
|
373
|
-
|
374
|
-
|
379
|
+
} catch (e) {
|
380
|
+
if (response.errors === '') response.errors = `Request to ${prod_families_url} failed:`;
|
381
|
+
response.errors += `\nAttempt ${i} - Error returning product families: ${e}`;
|
382
|
+
// Wait 2 seconds and try again
|
383
|
+
await new Promise(r => setTimeout(r, 2000));
|
375
384
|
}
|
376
|
-
} catch (e) {
|
377
|
-
response.errors = (`Error returning product families: ${e}`);
|
378
385
|
}
|
379
386
|
return response;
|
380
387
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hdoc-tools",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.47",
|
4
4
|
"description": "Hornbill HDocBook Development Support Tool",
|
5
5
|
"main": "hdoc.js",
|
6
6
|
"bin": {
|
@@ -34,6 +34,7 @@
|
|
34
34
|
"dependencies": {
|
35
35
|
"american-british-english-translator": "^0.2.1",
|
36
36
|
"axios": "^1.3.2",
|
37
|
+
"axios-retry": "^3.5.0",
|
37
38
|
"better-sqlite3": "^8.0.1",
|
38
39
|
"body-parser": "^1.20.1",
|
39
40
|
"cheerio": "^1.0.0-rc.12",
|
@@ -50,6 +51,7 @@
|
|
50
51
|
"multer": "^1.4.5-lts.1",
|
51
52
|
"prompt": "^1.3.0",
|
52
53
|
"puppeteer": "^19.8.0",
|
54
|
+
"retry": "^0.13.1",
|
53
55
|
"stream": "0.0.2",
|
54
56
|
"true-case-path": "^2.2.1",
|
55
57
|
"words-count": "^2.0.2",
|