Skip to content

Commit ff07ffc

Browse files
committed
Removed cacheDir from parseString method.
Added jsdoc config file.
1 parent a74a059 commit ff07ffc

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

package-lock.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
node_modules/
22

3-
cache/
4-
53
coverage/
64

75
dist/

packages/doxdox-parser-jsdoc/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@types/temp": "0.9.1",
2828
"@typescript-eslint/eslint-plugin": "5.13.0",
2929
"@typescript-eslint/parser": "5.13.0",
30+
"copyfiles": "2.4.1",
3031
"eslint": "8.10.0",
3132
"jest": "27.5.1",
3233
"rimraf": "3.0.2",
@@ -35,7 +36,7 @@
3536
},
3637
"scripts": {
3738
"test": "NODE_OPTIONS=--experimental-vm-modules jest --runInBand --passWithNoTests",
38-
"build": "rimraf dist/ && tsc",
39+
"build": "rimraf dist/ && tsc && copyfiles -u 1 src/config.json dist/",
3940
"lint": "eslint 'src/**/*.ts'"
4041
},
4142
"jest": {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"source": {
3+
"excludePattern": ""
4+
}
5+
}

packages/doxdox-parser-jsdoc/src/index.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import { Jsdoc } from './types';
1616

1717
const parser = async (cwd: string, path: string): Promise<File> => {
1818
try {
19-
const nodeModulesDir = await findParentNodeModules(
20-
dirname(sanitizePath(import.meta.url))
21-
);
19+
const parserDir = dirname(sanitizePath(import.meta.url));
20+
21+
const nodeModulesDir = await findParentNodeModules(parserDir);
2222

2323
if (!nodeModulesDir) {
2424
throw new Error('node_modules directory was not found');
@@ -29,7 +29,12 @@ const parser = async (cwd: string, path: string): Promise<File> => {
2929
nodeModulesDir,
3030
`.bin/${platform() === 'win32' ? 'jsdoc.cmd' : 'jsdoc'}`
3131
),
32-
['--explain', join(cwd, path)]
32+
[
33+
'--explain',
34+
join(cwd, path),
35+
'--configure',
36+
join(parserDir, 'config.json')
37+
]
3338
);
3439

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

101106
export const parseString = async (
102107
path: string,
103-
content: string,
104-
cacheDir = './cache'
108+
content: string
105109
): Promise<File> => {
106110
temp.track();
107111

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

110114
const tempPath = join(tempDir, path);
111115

0 commit comments

Comments
 (0)