hdoc-tools 0.17.31 → 0.17.32
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-serve.js +5 -5
- package/hdoc.js +11 -2
- package/package.json +1 -1
package/hdoc-serve.js
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
console.log(' Server Port:', port);
|
40
40
|
|
41
41
|
if (fs.existsSync(path.join(source_path, 'hdocbook-project.json')) == false) {
|
42
|
-
console.
|
42
|
+
console.error("No hdocbook-project.json file found in working folder. Unable to continue.");
|
43
43
|
return -1;
|
44
44
|
}
|
45
45
|
|
@@ -51,7 +51,7 @@
|
|
51
51
|
try {
|
52
52
|
hdocbook_project = require(hdocbook_project_config_path);
|
53
53
|
} catch (e) {
|
54
|
-
console.
|
54
|
+
console.error(`\nFailed to load hdocbook-project.json:\n${e}\n`);
|
55
55
|
process.exit(1);
|
56
56
|
}
|
57
57
|
|
@@ -86,7 +86,7 @@
|
|
86
86
|
try {
|
87
87
|
hdocbook_config = require(hdocbook_path);
|
88
88
|
} catch (e) {
|
89
|
-
console.
|
89
|
+
console.error(`\nFailed to load hdocbook.json:${e}\n`);
|
90
90
|
process.exit(1);
|
91
91
|
}
|
92
92
|
|
@@ -195,7 +195,7 @@
|
|
195
195
|
ps,
|
196
196
|
(err) => {
|
197
197
|
if (err) {
|
198
|
-
console.
|
198
|
+
console.error(err); // No such file or any other kind of error
|
199
199
|
return res.sendStatus(400).send('Unexpected error');
|
200
200
|
}
|
201
201
|
});
|
@@ -305,7 +305,7 @@
|
|
305
305
|
// Read & parse file
|
306
306
|
JSON.parse(fs.readFileSync(file_path));
|
307
307
|
} catch (e) {
|
308
|
-
console.
|
308
|
+
console.error(`Error parsing hdocbook.json: ${e}`);
|
309
309
|
|
310
310
|
}
|
311
311
|
}
|
package/hdoc.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env node
|
1
|
+
#!/usr/bin/env node
|
2
2
|
(async function () {
|
3
3
|
'use strict';
|
4
4
|
|
@@ -9,6 +9,15 @@
|
|
9
9
|
|
10
10
|
const packageFile = path.join(__dirname, 'package.json');
|
11
11
|
|
12
|
+
const { info, error } = console;
|
13
|
+
console.info = (arg) => {
|
14
|
+
info.call(console, `\x1b[33m${arg}\x1b[0m`);
|
15
|
+
};
|
16
|
+
console.error = (arg) => {
|
17
|
+
error.call(console, `\x1b[31m${arg}\x1b[0m`);
|
18
|
+
};
|
19
|
+
|
20
|
+
|
12
21
|
const getHdocPackageVersion = function (packagePath) {
|
13
22
|
if (fs.existsSync(packagePath)) {
|
14
23
|
try {
|
@@ -110,7 +119,7 @@
|
|
110
119
|
const ver = require(path.join(__dirname, 'hdoc-ver.js'));
|
111
120
|
ver.run(source_path);
|
112
121
|
} else {
|
113
|
-
console.
|
122
|
+
console.error('Unknown command:', command, '\r\n');
|
114
123
|
console.log('Run hdoc help for information regarding this tool.\r\n');
|
115
124
|
}
|
116
125
|
})();
|