hdoc-tools 0.6.6 → 0.6.8

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-init.js CHANGED
@@ -97,12 +97,18 @@
97
97
  hdocbookFile.title = docProps.title;
98
98
  hdocbookFile.description = docProps.description;
99
99
  hdocbookFile.version = docProps.version;
100
+ hdocbookFile.navigation.items[0].items = [
101
+ {
102
+ "text": "Welcome",
103
+ "link": path.join(docProps.id, 'index')
104
+ }
105
+ ];
100
106
  fs.writeFile(hdocBookFilePath, JSON.stringify(hdocbookFile, null, 2), function writeJSON(err) {
101
107
  if (err) return console.log('Error updating:',hdocBookFilePath, '\r\n', err);
102
108
  console.log('Updated:', hdocBookFilePath);
103
109
  });
104
110
 
105
- // Update hdocbook-project.json
111
+ // Update package.json
106
112
  const packageFilePath = path.join(bookPath, 'package.json');
107
113
  const packageFile = require(packageFilePath);
108
114
  packageFile.name = docProps.id;
package/hdoc.js CHANGED
@@ -1,16 +1,17 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const { createCipheriv } = require('crypto');
4
4
 
5
5
  (function () {
6
6
  'use strict';
7
7
 
8
+ const preRun = require('./validateNodeVer.js');
8
9
  const fs = require('fs');
9
- var path = require('path');
10
+ const path = require('path');
10
11
  const stream = require('stream');
11
12
  const yaml = require('js-yaml');
12
13
  const mdfm = require('markdown-it-front-matter');
13
- var hljs = require('highlight.js'); // https://highlightjs.org/
14
+ const hljs = require('highlight.js'); // https://highlightjs.org/
14
15
  const md = require('markdown-it')({
15
16
  // enable everything
16
17
  html: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {
@@ -13,11 +13,13 @@
13
13
  "hdoc-init.js",
14
14
  "hdoc-serve.js",
15
15
  "hdoc-stats.js",
16
+ "validateNodeVer.js",
16
17
  "ui",
17
18
  "custom_modules",
18
19
  "templates"
19
20
  ],
20
21
  "scripts": {
22
+ "preinstall": "node validateNodeVer",
21
23
  "test": "echo \"Error: no test specified\" && exit 1"
22
24
  },
23
25
  "author": "Hornbill Technologies Ltd",
@@ -28,7 +30,6 @@
28
30
  "dree": "^3.4.2",
29
31
  "express": "^4.18.2",
30
32
  "fs-extra": "^11.1.0",
31
- "hdoc-tools": "^0.1.0",
32
33
  "highlight.js": "^11.6.0",
33
34
  "html-to-text": "^8.2.1",
34
35
  "js-yaml": "^4.1.0",
@@ -7,7 +7,7 @@
7
7
  "navigation": {
8
8
  "items": [
9
9
  {
10
- "text": "Welcome",
10
+ "text": "Introduction",
11
11
  "expand": true
12
12
  }
13
13
  ]
@@ -0,0 +1,13 @@
1
+ (function() {
2
+ 'use strict';
3
+ const vers = process.versions;
4
+ if (vers && vers.node) {
5
+ if (parseInt(vers.node, 10) < 18) {
6
+ console.log('\r\nHornbill HDocBook Tools\r\n');
7
+ console.error('\x1b[31mThis tool requires Node.js version >= 18.x.\x1b[0m\r\n');
8
+ process.exit(1);
9
+ }
10
+ } else {
11
+ console.log('\x1b[33mCould not read version of Node.js, continuing...\x1b[0m');
12
+ }
13
+ })();