Skip to content

Commit

Permalink
Merge pull request #156 from docsbydoxdox/hotfix/temp-files
Browse files Browse the repository at this point in the history
[hotfix] Removed cacheDir from parseString method.
  • Loading branch information
neogeek authored Mar 3, 2022
2 parents a74a059 + ff07ffc commit 2ac206f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions packages/doxdox-parser-jsdoc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
node_modules/

cache/

coverage/

dist/
3 changes: 2 additions & 1 deletion packages/doxdox-parser-jsdoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@types/temp": "0.9.1",
"@typescript-eslint/eslint-plugin": "5.13.0",
"@typescript-eslint/parser": "5.13.0",
"copyfiles": "2.4.1",
"eslint": "8.10.0",
"jest": "27.5.1",
"rimraf": "3.0.2",
Expand All @@ -35,7 +36,7 @@
},
"scripts": {
"test": "NODE_OPTIONS=--experimental-vm-modules jest --runInBand --passWithNoTests",
"build": "rimraf dist/ && tsc",
"build": "rimraf dist/ && tsc && copyfiles -u 1 src/config.json dist/",
"lint": "eslint 'src/**/*.ts'"
},
"jest": {
Expand Down
5 changes: 5 additions & 0 deletions packages/doxdox-parser-jsdoc/src/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"source": {
"excludePattern": ""
}
}
18 changes: 11 additions & 7 deletions packages/doxdox-parser-jsdoc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { Jsdoc } from './types';

const parser = async (cwd: string, path: string): Promise<File> => {
try {
const nodeModulesDir = await findParentNodeModules(
dirname(sanitizePath(import.meta.url))
);
const parserDir = dirname(sanitizePath(import.meta.url));

const nodeModulesDir = await findParentNodeModules(parserDir);

if (!nodeModulesDir) {
throw new Error('node_modules directory was not found');
Expand All @@ -29,7 +29,12 @@ const parser = async (cwd: string, path: string): Promise<File> => {
nodeModulesDir,
`.bin/${platform() === 'win32' ? 'jsdoc.cmd' : 'jsdoc'}`
),
['--explain', join(cwd, path)]
[
'--explain',
join(cwd, path),
'--configure',
join(parserDir, 'config.json')
]
);

const docs = JSON.parse(output) as Jsdoc[];
Expand Down Expand Up @@ -100,12 +105,11 @@ const parser = async (cwd: string, path: string): Promise<File> => {

export const parseString = async (
path: string,
content: string,
cacheDir = './cache'
content: string
): Promise<File> => {
temp.track();

const tempDir = await temp.mkdir({ prefix: 'doxdox-', dir: cacheDir });
const tempDir = await temp.mkdir({ prefix: 'doxdox-' });

const tempPath = join(tempDir, path);

Expand Down

0 comments on commit 2ac206f

Please sign in to comment.