docgen-tool 5.0.0-beta.1 → 5.0.0-beta.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 (2) hide show
  1. package/dist/cli.js +14 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { program } from 'commander';
3
3
  import pico from 'picocolors';
4
- import path from 'path';
4
+ import path, { dirname, join } from 'path';
5
5
  import { promises } from 'fs';
6
6
  import fs from 'fs-extra';
7
7
  import schemaValidator from 'z-schema';
@@ -13,6 +13,7 @@ import Html from 'react-pdf-html';
13
13
  import pkg from 'lodash';
14
14
  import ReactDOMServer from 'react-dom/server';
15
15
 
16
+ const entrypointDirectory = dirname(process.argv[1]);
16
17
  const readFile = async (filePath) => {
17
18
  const normalized = path.normalize(filePath);
18
19
  try {
@@ -272,8 +273,12 @@ const loadTemplates = async ({
272
273
  console.log(pico.green("Loading templates"));
273
274
  try {
274
275
  let files = {
275
- main: await readFile("./src/include/templates/main.html"),
276
- redirect: await readFile("./src/include/templates/redirect.html")
276
+ main: await readFile(
277
+ join(entrypointDirectory, "include/templates/main.html")
278
+ ),
279
+ redirect: await readFile(
280
+ join(entrypointDirectory, "include/templates/redirect.html")
281
+ )
277
282
  };
278
283
  for (let key in files) {
279
284
  if (files.hasOwnProperty(key)) {
@@ -730,7 +735,11 @@ const generatePdf = ({
730
735
 
731
736
  const scaffold$1 = async ({ outputDirectory, verbose }) => {
732
737
  console.log(pico.green("Creating scaffold template directory"));
733
- await copyDirectory("./src/include/example", outputDirectory, verbose);
738
+ await copyDirectory(
739
+ join(entrypointDirectory, "include/example"),
740
+ outputDirectory,
741
+ verbose
742
+ );
734
743
  };
735
744
 
736
745
  const sortPages = ({ contents }) => {
@@ -1023,7 +1032,7 @@ const writePages = async ({
1023
1032
  await Promise.all(promises);
1024
1033
  await writeFile(options.output + "ownership.html", hydratedPages.webCover);
1025
1034
  await copyDirectory(
1026
- "./src/include/require",
1035
+ join(entrypointDirectory, "include/require"),
1027
1036
  options.output + "require",
1028
1037
  options.verbose
1029
1038
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docgen-tool",
3
3
  "type": "module",
4
- "version": "5.0.0-beta.1",
4
+ "version": "5.0.0-beta.2",
5
5
  "description": "A tool for creating HTML and PDF documentation",
6
6
  "bin": "./dist/cli.js",
7
7
  "files": [