hdoc-tools 0.6.1 → 0.6.2

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.
Files changed (3) hide show
  1. package/hdoc-stats.js +20 -12
  2. package/hdoc.js +7 -5
  3. package/package.json +1 -1
package/hdoc-stats.js CHANGED
@@ -114,24 +114,32 @@
114
114
  // Output information about all markdown files in the book
115
115
  console.log('--------------');
116
116
  console.log(' Markdown ');
117
- console.log('--------------');
118
- for (const key in stats.mdFiles) {
119
- if (stats.mdFiles.hasOwnProperty(key)) {
120
- console.log('Relative Path: ', key);
121
- console.log(' Word Count: ', stats.mdFiles[key].wordCount);
122
- console.log('File Size (B): ', stats.mdFiles[key].sizeInBytes, '\r\n');
117
+ console.log('--------------\r\n');
118
+ if (stats.totalMDFiles === 0) {
119
+ console.log('\r\nNo markdown files found\r\n');
120
+ } else {
121
+ for (const key in stats.mdFiles) {
122
+ if (stats.mdFiles.hasOwnProperty(key)) {
123
+ console.log('Relative Path: ', key);
124
+ console.log(' Word Count: ', stats.mdFiles[key].wordCount);
125
+ console.log('File Size (B): ', stats.mdFiles[key].sizeInBytes, '\r\n');
126
+ }
123
127
  }
124
128
  }
125
129
 
126
130
  // Output information about all static HTML in the book
127
131
  console.log('---------------');
128
132
  console.log(' Static HTML ');
129
- console.log('---------------');
130
- for (const key in stats.staticHTMLFiles) {
131
- if (stats.staticHTMLFiles.hasOwnProperty(key)) {
132
- console.log('Relative Path: ', key);
133
- console.log(' Word Count: ', stats.staticHTMLFiles[key].wordCount);
134
- console.log('File Size (B): ', stats.staticHTMLFiles[key].sizeInBytes, '\r\n');
133
+ console.log('---------------\r\n');
134
+ if (stats.totalStaticHTMLFiles === 0) {
135
+ console.log('No static HTML files found\r\n');
136
+ } else {
137
+ for (const key in stats.staticHTMLFiles) {
138
+ if (stats.staticHTMLFiles.hasOwnProperty(key)) {
139
+ console.log('Relative Path: ', key);
140
+ console.log(' Word Count: ', stats.staticHTMLFiles[key].wordCount);
141
+ console.log('File Size (B): ', stats.staticHTMLFiles[key].sizeInBytes, '\r\n');
142
+ }
135
143
  }
136
144
  }
137
145
  }
package/hdoc.js CHANGED
@@ -38,7 +38,8 @@
38
38
  let source_path = process.cwd();
39
39
  let ui_path = path.join(__dirname, "ui");
40
40
 
41
- var command = ""; // Our command to run
41
+ let command = ""; // Our command to run
42
+ let verbose = false;
42
43
 
43
44
  // Get options from command args
44
45
  for (let x = 0; x < process.argv.length; x++) {
@@ -62,6 +63,10 @@
62
63
  ui_path = process.argv[x];
63
64
  }
64
65
  }
66
+
67
+ if (process.argv[x] === "-v") {
68
+ verbose = true;
69
+ }
65
70
  }
66
71
 
67
72
  console.log("Hornbill HDocBook Tools v0.1", "\r\n");
@@ -76,10 +81,7 @@
76
81
  builder.run(ui_path, source_path, md);
77
82
  } else if (command == "stats") {
78
83
  const stats = require(path.join(__dirname, "hdoc-stats.js"));
79
- stats.run(ui_path, source_path, md);
80
- } else if (command == "statsv") {
81
- const stats = require(path.join(__dirname, "hdoc-stats.js"));
82
- stats.run(ui_path, source_path, md, true);
84
+ stats.run(ui_path, source_path, md, verbose);
83
85
  } else if (command == "init") {
84
86
  const init = require(path.join(__dirname, "hdoc-init.js"));
85
87
  init.run(ui_path, source_path, md);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {