hdoc-tools 0.60.1 → 0.62.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.
Files changed (55) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +89 -75
  3. package/hdoc-build-db.js +275 -275
  4. package/hdoc-build-embeddings.js +202 -202
  5. package/hdoc-build-pdf.js +232 -232
  6. package/hdoc-build.js +14 -6
  7. package/hdoc-bump.js +4 -2
  8. package/hdoc-content-routes.js +143 -83
  9. package/hdoc-create.js +110 -108
  10. package/hdoc-db.js +114 -114
  11. package/hdoc-help.js +60 -60
  12. package/hdoc-init.js +103 -68
  13. package/hdoc-install-browser.js +145 -145
  14. package/hdoc-mermaid.js +204 -204
  15. package/hdoc-module.js +1102 -1079
  16. package/hdoc-serve.js +13 -7
  17. package/hdoc-stats.js +9 -9
  18. package/hdoc-validate-config.js +355 -329
  19. package/hdoc-validate-interbook.js +321 -0
  20. package/hdoc-validate.js +1231 -1158
  21. package/hdoc-ver.js +4 -2
  22. package/hdoc.js +12 -11
  23. package/npm-shrinkwrap.json +2 -2
  24. package/package.json +13 -2
  25. package/schemas/hdocbook-project.schema.json +20 -0
  26. package/schemas/hdocbook.schema.json +6 -2
  27. package/templates/doc-header-non-git.html +19 -19
  28. package/templates/doc-header.html +26 -26
  29. package/templates/init/.github/workflows/hdocbuild_onpull.yml +16 -16
  30. package/templates/init/.github/workflows/hdocbuild_onpush.yml +15 -15
  31. package/templates/init/LICENSE +21 -21
  32. package/templates/init/README.md +9 -9
  33. package/templates/init/_hdocbook/index.md +4 -4
  34. package/templates/init/gitignore +8 -8
  35. package/templates/init/resources/README.md +2 -2
  36. package/templates/pdf/css/custom-block.css +90 -90
  37. package/templates/pdf/css/fonts.css +221 -221
  38. package/templates/pdf/css/hdocs-pdf.css +495 -495
  39. package/templates/pdf/css/vars.css +404 -404
  40. package/templates/pdf/template-footer.html +19 -19
  41. package/templates/pdf/template-header.html +37 -37
  42. package/templates/pdf/template.html +20 -20
  43. package/templates/pdf-header-non-git.html +12 -12
  44. package/templates/pdf-header.html +16 -16
  45. package/ui/content/invalid-hdocbook-json.html +6 -6
  46. package/ui/content/invalid-hdocbook-json.md +7 -7
  47. package/ui/css/theme-default/styles/components/content.css +124 -124
  48. package/ui/css/theme-default/styles/components/sidebar.css +182 -182
  49. package/ui/css/theme-default/styles/htldoc.layouts.css +310 -310
  50. package/ui/index.html +419 -419
  51. package/ui/js/doc.hornbill.js +31 -44
  52. package/ui/js/mermaid-theme.json +27 -0
  53. package/hdoc-build-onyx.js +0 -134
  54. package/templates/mermaid-theme.yaml +0 -28
  55. package/templates/pdf/fonts/inter-cyrillic copy.woff2 +0 -0
package/hdoc-db.js CHANGED
@@ -1,114 +1,114 @@
1
- (() => {
2
- const cheerio = require("cheerio");
3
- const path = require("node:path");
4
- const hdoc = require(path.join(__dirname, "hdoc-module.js"));
5
-
6
- exports.create_table = (db, table_name, columns, virtual, fts5) => {
7
- const create_sql = ["CREATE"];
8
- if (virtual) create_sql.push("VIRTUAL");
9
- create_sql.push("TABLE");
10
- create_sql.push(table_name);
11
- if (fts5) create_sql.push("USING fts5(");
12
- else create_sql.push("(");
13
- for (let i = 0; i < columns.length; i++) {
14
- if (i !== 0) create_sql.push(`,${columns[i]}`);
15
- else create_sql.push(columns[i]);
16
- }
17
- create_sql.push(");");
18
- try {
19
- db.exec(create_sql.join("\n"));
20
- return null;
21
- } catch (e) {
22
- return e;
23
- }
24
- };
25
-
26
- exports.insert_record = (db, table, columns, values) => {
27
- const response = {
28
- success: false,
29
- row_id: 0,
30
- error: null,
31
- };
32
- const queryProps = [];
33
- queryProps.push(`INSERT INTO ${table}`);
34
- let cols = "(";
35
- let vals = "VALUES (";
36
- for (let i = 0; i < columns.length; i++) {
37
- if (i === 0) {
38
- cols += `${columns[i].replace("UNINDEXED", "").replace("INTEGER", "").trim()}`;
39
- vals += "?";
40
- } else {
41
- cols += `, ${columns[i].replace("UNINDEXED", "").replace("INTEGER", "").trim()}`;
42
- vals += ", ?";
43
- }
44
- }
45
- cols += ")";
46
- vals += ")";
47
- queryProps.push(cols);
48
- queryProps.push(vals);
49
-
50
- try {
51
- const stmt = db.prepare(queryProps.join(" "));
52
- const info = stmt.run(values);
53
- response.row_id = info.lastInsertRowid;
54
- response.success = true;
55
- } catch (e) {
56
- response.error = e;
57
- }
58
- return response;
59
- };
60
-
61
- exports.transform_html_for_index = (html_txt) => {
62
- const response = {
63
- fm_props: {},
64
- sections: [],
65
- };
66
-
67
- // Single parse covers frontmatter extraction, full-text, and preview —
68
- // previously three separate cheerio.load() calls.
69
- const $ = cheerio.load(html_txt, { decodeEntities: false });
70
-
71
- // Extract frontmatter properties from the leading HTML comment
72
- if ($._root?.children && Array.isArray($._root.children)) {
73
- for (const child of $._root.children) {
74
- if (child.type === "comment" && child.data?.startsWith("[[FRONTMATTER")) {
75
- for (const line of child.data.split(/\r?\n/)) {
76
- if (line.includes(":")) {
77
- const parts = line.split(/:(.*)/s);
78
- if (parts.length > 1) {
79
- const key = parts[0].trim().toLowerCase();
80
- let val = parts[1].trim();
81
- if (/^".*"$/.test(val)) val = val.slice(1, -1);
82
- if (key === "title") {
83
- val = val.replace(
84
- /&amp;|&lt;|&gt;|&quot;|&#39;|&apos;|&#(\d+);|&#x([0-9a-fA-F]+);/g,
85
- (m, dec, hex) => dec ? String.fromCharCode(+dec) : hex ? String.fromCharCode(parseInt(hex, 16)) : ({ "&amp;": "&", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'", "&apos;": "'" })[m],
86
- );
87
- }
88
- response.fm_props[key] = val;
89
- }
90
- }
91
- }
92
- break;
93
- }
94
- }
95
- }
96
-
97
- // Page chrome - the document-header block (breadcrumb bar, edit link,
98
- // title, "Article / date / N minutes to read / N contributors") is
99
- // rendered into every page and would otherwise pollute search index
100
- // term frequencies and embedding chunks. The title is indexed
101
- // separately from frontmatter, so nothing of value is lost.
102
- $(".document-header").remove();
103
-
104
- // Full-document plain text for search indexing
105
- const text = $("body").text();
106
-
107
- // Preview: first paragraph texts joined, then truncated
108
- let preview = $("p").map((_i, el) => $(el).text()).get().join("\n");
109
- preview = hdoc.truncate_string(preview, 200, true).replace(/(?:\r\n|\r|\n)/g, " ");
110
-
111
- response.sections.push({ text, preview });
112
- return response;
113
- };
114
- })();
1
+ (() => {
2
+ const cheerio = require("cheerio");
3
+ const path = require("node:path");
4
+ const hdoc = require(path.join(__dirname, "hdoc-module.js"));
5
+
6
+ exports.create_table = (db, table_name, columns, virtual, fts5) => {
7
+ const create_sql = ["CREATE"];
8
+ if (virtual) create_sql.push("VIRTUAL");
9
+ create_sql.push("TABLE");
10
+ create_sql.push(table_name);
11
+ if (fts5) create_sql.push("USING fts5(");
12
+ else create_sql.push("(");
13
+ for (let i = 0; i < columns.length; i++) {
14
+ if (i !== 0) create_sql.push(`,${columns[i]}`);
15
+ else create_sql.push(columns[i]);
16
+ }
17
+ create_sql.push(");");
18
+ try {
19
+ db.exec(create_sql.join("\n"));
20
+ return null;
21
+ } catch (e) {
22
+ return e;
23
+ }
24
+ };
25
+
26
+ exports.insert_record = (db, table, columns, values) => {
27
+ const response = {
28
+ success: false,
29
+ row_id: 0,
30
+ error: null,
31
+ };
32
+ const queryProps = [];
33
+ queryProps.push(`INSERT INTO ${table}`);
34
+ let cols = "(";
35
+ let vals = "VALUES (";
36
+ for (let i = 0; i < columns.length; i++) {
37
+ if (i === 0) {
38
+ cols += `${columns[i].replace("UNINDEXED", "").replace("INTEGER", "").trim()}`;
39
+ vals += "?";
40
+ } else {
41
+ cols += `, ${columns[i].replace("UNINDEXED", "").replace("INTEGER", "").trim()}`;
42
+ vals += ", ?";
43
+ }
44
+ }
45
+ cols += ")";
46
+ vals += ")";
47
+ queryProps.push(cols);
48
+ queryProps.push(vals);
49
+
50
+ try {
51
+ const stmt = db.prepare(queryProps.join(" "));
52
+ const info = stmt.run(values);
53
+ response.row_id = info.lastInsertRowid;
54
+ response.success = true;
55
+ } catch (e) {
56
+ response.error = e;
57
+ }
58
+ return response;
59
+ };
60
+
61
+ exports.transform_html_for_index = (html_txt) => {
62
+ const response = {
63
+ fm_props: {},
64
+ sections: [],
65
+ };
66
+
67
+ // Single parse covers frontmatter extraction, full-text, and preview —
68
+ // previously three separate cheerio.load() calls.
69
+ const $ = cheerio.load(html_txt, { decodeEntities: false });
70
+
71
+ // Extract frontmatter properties from the leading HTML comment
72
+ if ($._root?.children && Array.isArray($._root.children)) {
73
+ for (const child of $._root.children) {
74
+ if (child.type === "comment" && child.data?.startsWith("[[FRONTMATTER")) {
75
+ for (const line of child.data.split(/\r?\n/)) {
76
+ if (line.includes(":")) {
77
+ const parts = line.split(/:(.*)/s);
78
+ if (parts.length > 1) {
79
+ const key = parts[0].trim().toLowerCase();
80
+ let val = parts[1].trim();
81
+ if (/^".*"$/.test(val)) val = val.slice(1, -1);
82
+ if (key === "title") {
83
+ val = val.replace(
84
+ /&amp;|&lt;|&gt;|&quot;|&#39;|&apos;|&#(\d+);|&#x([0-9a-fA-F]+);/g,
85
+ (m, dec, hex) => dec ? String.fromCharCode(+dec) : hex ? String.fromCharCode(parseInt(hex, 16)) : ({ "&amp;": "&", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'", "&apos;": "'" })[m],
86
+ );
87
+ }
88
+ response.fm_props[key] = val;
89
+ }
90
+ }
91
+ }
92
+ break;
93
+ }
94
+ }
95
+ }
96
+
97
+ // Page chrome - the document-header block (breadcrumb bar, edit link,
98
+ // title, "Article / date / N minutes to read / N contributors") is
99
+ // rendered into every page and would otherwise pollute search index
100
+ // term frequencies and embedding chunks. The title is indexed
101
+ // separately from frontmatter, so nothing of value is lost.
102
+ $(".document-header").remove();
103
+
104
+ // Full-document plain text for search indexing
105
+ const text = $("body").text();
106
+
107
+ // Preview: first paragraph texts joined, then truncated
108
+ let preview = $("p").map((_i, el) => $(el).text()).get().join("\n");
109
+ preview = hdoc.truncate_string(preview, 200, true).replace(/(?:\r\n|\r|\n)/g, " ");
110
+
111
+ response.sections.push({ text, preview });
112
+ return response;
113
+ };
114
+ })();
package/hdoc-help.js CHANGED
@@ -1,60 +1,60 @@
1
- (() => {
2
- exports.run = () => {
3
- // STEVE: The purpose of this function is to output information about hdoc arguments
4
- const helpText = `
5
- Command Line Usage
6
-
7
- hdoc <command> [switches]
8
-
9
- Commands
10
-
11
- - build
12
- Performs a local build of the book, and outputs as a ZIP file.
13
- - Use the '--set-version 1.2.3' argument to set the version number of the built book.
14
- - Use the '--no-color' argument to remove any color control characters from the output.
15
- - Use the '--no-links' argument to skip link output to CLI during validation.
16
- - Use the '--no-embeddings' argument to skip semantic search embedding generation.
17
-
18
- - createDocs
19
- Creates folder structure and markdown documents as defined in the HDocBook navigation item links
20
-
21
- - edit
22
- Starts the local structure/content editor on port 3001 (bound to 127.0.0.1), serving the editor UI alongside a live preview of the content. Supports a -port N to use a different port.
23
- NOTE: This feature is experimental and not really for general use yet. GS
24
-
25
- - help
26
- Outputs available arguments and switches
27
-
28
- - init
29
- Initializes a new HDocBook project from a template, using runtime input variables
30
-
31
- - serve
32
- Starts a local web server on port 3000, serving the content. Supports a -port N to use a different port
33
-
34
- - stats
35
- Returns statistics regarding the book you are working on. Supports a -v switch for verbose output.
36
- The book statistics do not include counts for any externally hosted content injected into the book content using the [[INCLUDE]] tags.
37
-
38
- - validate
39
- Validates the book content.
40
- - Use the '--set-version 1.2.3' argument to set the version number of the built book.
41
- - Use the '--no-color' argument to remove any color control characters from the output.
42
- - Use the '--no-links' argument to skip link output to CLI during validation.
43
- - Use the '--quiet' argument to suppress most console output, and only output validation errors if they are found.
44
-
45
- - bump
46
- Updates the semantic version number of the current book. If no options are specified, then the default of patch is applied:
47
- - major - updates the major version of the book. i.e. - 1.4.5 would become 2.0.0
48
- - minor - updates the minor version of the book. i.e. - 1.4.5 would become 1.5.0
49
- - patch (default) - updates the patch version of the book. i.e. - 1.4.5 would become 1.4.6
50
-
51
- - ver
52
- Returns the version of the current book
53
-
54
- Example
55
-
56
- hdoc stats -v
57
- `;
58
- console.log(helpText);
59
- };
60
- })();
1
+ (() => {
2
+ exports.run = () => {
3
+ // STEVE: The purpose of this function is to output information about hdoc arguments
4
+ const helpText = `
5
+ Command Line Usage
6
+
7
+ hdoc <command> [switches]
8
+
9
+ Commands
10
+
11
+ - build
12
+ Performs a local build of the book, and outputs as a ZIP file.
13
+ - Use the '--set-version 1.2.3' argument to set the version number of the built book.
14
+ - Use the '--no-color' argument to remove any color control characters from the output.
15
+ - Use the '--no-links' argument to skip link output to CLI during validation.
16
+ - Use the '--no-embeddings' argument to skip semantic search embedding generation.
17
+
18
+ - createDocs
19
+ Creates folder structure and markdown documents as defined in the HDocBook navigation item links
20
+
21
+ - edit
22
+ Starts the local structure/content editor on port 3001 (bound to 127.0.0.1), serving the editor UI alongside a live preview of the content. Supports a -port N to use a different port.
23
+ NOTE: This feature is experimental and not really for general use yet. GS
24
+
25
+ - help
26
+ Outputs available arguments and switches
27
+
28
+ - init
29
+ Initializes a new HDocBook project from a template, using runtime input variables
30
+
31
+ - serve
32
+ Starts a local web server on port 3000, serving the content. Supports a -port N to use a different port
33
+
34
+ - stats
35
+ Returns statistics regarding the book you are working on. Supports a -v switch for verbose output.
36
+ The book statistics do not include counts for any externally hosted content injected into the book content using the [[INCLUDE]] tags.
37
+
38
+ - validate
39
+ Validates the book content.
40
+ - Use the '--set-version 1.2.3' argument to set the version number of the built book.
41
+ - Use the '--no-color' argument to remove any color control characters from the output.
42
+ - Use the '--no-links' argument to skip link output to CLI during validation.
43
+ - Use the '--quiet' argument to suppress most console output, and only output validation errors if they are found.
44
+
45
+ - bump
46
+ Updates the semantic version number of the current book. If no options are specified, then the default of patch is applied:
47
+ - major - updates the major version of the book. i.e. - 1.4.5 would become 2.0.0
48
+ - minor - updates the minor version of the book. i.e. - 1.4.5 would become 1.5.0
49
+ - patch (default) - updates the patch version of the book. i.e. - 1.4.5 would become 1.4.6
50
+
51
+ - ver
52
+ Returns the version of the current book
53
+
54
+ Example
55
+
56
+ hdoc stats -v
57
+ `;
58
+ console.log(helpText);
59
+ };
60
+ })();
package/hdoc-init.js CHANGED
@@ -4,6 +4,15 @@
4
4
  const fs = require("node:fs");
5
5
  const path = require("node:path");
6
6
 
7
+ // Valid values come from the same schema the build validator harvests, so
8
+ // init can never scaffold a book that validate would reject.
9
+ const hdocbook_schema = require(
10
+ path.join(__dirname, "schemas", "hdocbook.schema.json"),
11
+ );
12
+ const valid_product_families =
13
+ hdocbook_schema.properties.productFamily.enum;
14
+ const valid_audience = hdocbook_schema.properties.audience.items.enum;
15
+
7
16
  const promptProps = [
8
17
  {
9
18
  name: "id",
@@ -36,6 +45,29 @@
36
45
  description: "Package Author",
37
46
  required: true,
38
47
  },
48
+ {
49
+ name: "productFamily",
50
+ description: `Product Family [${valid_product_families.join(", ")}]`,
51
+ default: "hdocs",
52
+ options: valid_product_families,
53
+ required: true,
54
+ },
55
+ {
56
+ name: "audience",
57
+ description: `Audience [${valid_audience.join(", ")}]`,
58
+ default: "public",
59
+ options: valid_audience,
60
+ required: true,
61
+ },
62
+ {
63
+ name: "bookType",
64
+ description:
65
+ "Book Type (0=document, 1=api_ref, 2=db_ref, 3=etl_ref, 4=mcp_ref)",
66
+ default: "0",
67
+ validator: /^[0-4]$/,
68
+ warning: "Book Type must be a number between 0 and 4.",
69
+ required: true,
70
+ },
39
71
  ];
40
72
 
41
73
  // Asks a single question, re-prompting if the field is required and empty or if
@@ -55,6 +87,11 @@
55
87
  ask();
56
88
  return;
57
89
  }
90
+ if (value && field.options && !field.options.includes(value)) {
91
+ console.error(`Value must be one of: ${field.options.join(", ")}`);
92
+ ask();
93
+ return;
94
+ }
58
95
  resolve(value);
59
96
  });
60
97
  };
@@ -62,11 +99,38 @@
62
99
  });
63
100
 
64
101
  const createBook = (server_path, source_path, docProps) => {
102
+ // Refuse to scaffold over an existing book — re-running init in a
103
+ // populated folder used to silently overwrite template-named files.
104
+ const conflict_candidates = [
105
+ "hdocbook-project.json",
106
+ "package.json",
107
+ "gitignore",
108
+ ".gitignore",
109
+ "_hdocbook",
110
+ docProps.id,
111
+ ];
112
+ const conflicts = conflict_candidates.filter((f) =>
113
+ fs.existsSync(path.join(source_path, f)),
114
+ );
115
+ if (conflicts.length > 0) {
116
+ console.error(
117
+ "\r\nThe target folder already contains files that init would overwrite:\r\n",
118
+ );
119
+ for (const f of conflicts) console.error(` ${f}`);
120
+ console.error(
121
+ "\r\nRun hdoc init in an empty folder, or remove these first.\r\n",
122
+ );
123
+ process.exit(1);
124
+ }
125
+
65
126
  console.log("\r\nCreating book with the following properties:\r\n");
66
127
  console.log(" Doc ID:", docProps.id);
67
128
  console.log(" Title:", docProps.title);
68
129
  console.log(" Description:", docProps.description);
69
130
  console.log(" Author:", docProps.author);
131
+ console.log(" Product Family:", docProps.productFamily);
132
+ console.log(" Audience:", docProps.audience);
133
+ console.log(" Book Type:", docProps.bookType);
70
134
  console.log(" Initial Version:", docProps.version, "\r\n");
71
135
 
72
136
  // Now copy files over
@@ -92,79 +156,50 @@
92
156
  process.exit(1);
93
157
  }
94
158
 
159
+ // Synchronous read/modify/write of the three scaffolded JSON files —
160
+ // exits non-zero on failure instead of racing the process exit.
161
+ const update_json = (file_path, mutate) => {
162
+ try {
163
+ const obj = JSON.parse(fs.readFileSync(file_path, "utf8"));
164
+ mutate(obj);
165
+ fs.writeFileSync(file_path, JSON.stringify(obj, null, 2));
166
+ console.log("Updated:", file_path);
167
+ } catch (err) {
168
+ console.error("Error updating:", file_path, "\r\n", err);
169
+ process.exit(1);
170
+ }
171
+ };
172
+
95
173
  // Update hdocbook-project.json
96
- const hdocBookProjectFilePath = path.join(
97
- source_path,
98
- "hdocbook-project.json",
99
- );
100
- const hdocBookProjectFile = require(hdocBookProjectFilePath);
101
- hdocBookProjectFile.docId = docProps.id;
102
- fs.writeFile(
103
- hdocBookProjectFilePath,
104
- JSON.stringify(hdocBookProjectFile, null, 2),
105
- function writeJSON(err) {
106
- if (err)
107
- return console.error(
108
- "Error updating:",
109
- hdocBookProjectFilePath,
110
- "\r\n",
111
- err,
112
- );
113
- console.log("Updated:", hdocBookProjectFilePath);
114
- },
115
- );
174
+ update_json(path.join(source_path, "hdocbook-project.json"), (obj) => {
175
+ obj.docId = docProps.id;
176
+ });
116
177
 
117
178
  // Update root/hdocbook.json
118
- const hdocBookFilePath = path.join(bookContentRoot, "hdocbook.json");
119
- const hdocbookFile = require(hdocBookFilePath);
120
- hdocbookFile.docId = docProps.id;
121
- hdocbookFile.title = docProps.title;
122
- hdocbookFile.description = docProps.description;
123
- hdocbookFile.version = docProps.version;
124
- hdocbookFile.publicSource = `https://github.com/Hornbill-Docs/${docProps.id}`;
125
- hdocbookFile.navigation.items[0].items = [
126
- {
127
- text: "Welcome",
128
- link: `${docProps.id}/index`,
129
- },
130
- ];
131
- fs.writeFile(
132
- hdocBookFilePath,
133
- JSON.stringify(hdocbookFile, null, 2),
134
- function writeJSON(err) {
135
- if (err)
136
- return console.error(
137
- "Error updating:",
138
- hdocBookFilePath,
139
- "\r\n",
140
- err,
141
- );
142
- console.log("Updated:", hdocBookFilePath);
143
- },
144
- );
179
+ update_json(path.join(bookContentRoot, "hdocbook.json"), (obj) => {
180
+ obj.docId = docProps.id;
181
+ obj.title = docProps.title;
182
+ obj.description = docProps.description;
183
+ obj.version = docProps.version;
184
+ obj.publicSource = `https://github.com/Hornbill-Docs/${docProps.id}`;
185
+ obj.productFamily = docProps.productFamily;
186
+ obj.audience = [docProps.audience];
187
+ obj.bookType = Number(docProps.bookType);
188
+ obj.navigation.items[0].items = [
189
+ {
190
+ text: "Welcome",
191
+ link: `${docProps.id}/index`,
192
+ },
193
+ ];
194
+ });
145
195
 
146
196
  // Update package.json
147
- const packageFilePath = path.join(source_path, "package.json");
148
- const packageFile = require(packageFilePath);
149
- packageFile.name = docProps.id;
150
- packageFile.version = docProps.version;
151
- hdocbookFile.description = docProps.description;
152
- hdocbookFile.version = docProps.version;
153
- hdocbookFile.author = docProps.author;
154
- fs.writeFile(
155
- packageFilePath,
156
- JSON.stringify(packageFile, null, 2),
157
- function writeJSON(err) {
158
- if (err)
159
- return console.error(
160
- "Error updating:",
161
- packageFilePath,
162
- "\r\n",
163
- err,
164
- );
165
- console.log("Updated:", packageFilePath);
166
- },
167
- );
197
+ update_json(path.join(source_path, "package.json"), (obj) => {
198
+ obj.name = docProps.id;
199
+ obj.version = docProps.version;
200
+ obj.description = docProps.description;
201
+ obj.author = docProps.author;
202
+ });
168
203
 
169
204
  // Rename gitignore to .gitignore
170
205
  const gitignorePath = path.join(source_path, "gitignore");