Skip to content

Commit a05ad38

Browse files
authored
Merge pull request #107 from docsbydoxdox/feature/windows-support
[feat] Windows support
2 parents be6e7e0 + 77f70fd commit a05ad38

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

packages/doxdox-core/src/loader.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { join, resolve } from 'path';
22

3+
import { pathToFileURL } from 'url';
4+
35
import { getProjectPackage, isDirectory, isFile } from './utils.js';
46

57
/**
@@ -46,7 +48,7 @@ export const loadPluginFromFile = async <T>(
4648
path: string
4749
): Promise<T | null> => {
4850
try {
49-
return (await import(resolve(path))).default;
51+
return (await import(pathToFileURL(resolve(path)).href)).default;
5052
} catch (err: any) {
5153
if (process.env.DEBUG) {
5254
console.error(err);

packages/doxdox-core/src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { EOL } from 'os';
22

33
import { promises as fs } from 'fs';
44

5-
import { resolve, join, dirname } from 'path';
5+
import { resolve, dirname } from 'path';
66

77
import { fileURLToPath } from 'url';
88

@@ -30,7 +30,7 @@ export const findFileInPath = async (
3030
? dirname(input)
3131
: input;
3232

33-
const filePath = resolve(join(inputDirectory, fileName));
33+
const filePath = resolve(inputDirectory, fileName);
3434

3535
const fileStat = await fs.stat(filePath);
3636

@@ -61,13 +61,13 @@ export const findParentNodeModules = async (
6161
): Promise<string | null> => {
6262
if (maxDepth > 0) {
6363
try {
64-
const nodeModulesPath = resolve(currentDirectory, './node_modules');
64+
const nodeModulesPath = resolve(currentDirectory, 'node_modules');
6565

6666
if (await fs.stat(nodeModulesPath)) {
6767
return nodeModulesPath;
6868
}
6969
} catch (_) {
70-
const parentDirectory = resolve(currentDirectory, '../');
70+
const parentDirectory = resolve(currentDirectory, '..');
7171

7272
return await findParentNodeModules(parentDirectory, --maxDepth);
7373
}

packages/doxdox-renderer-github-wiki/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { join } from 'path';
2+
13
import admzip from 'adm-zip';
24

35
import { markdownTable } from 'markdown-table';
@@ -39,7 +41,7 @@ export default async (doc: Doc): Promise<string | Buffer> => {
3941
Promise.all(
4042
file.methods.map(async method =>
4143
zip.addFile(
42-
`${file.path}/${method.name}.md`,
44+
join(file.path, `${method.name}.md`),
4345
Buffer.from(renderMethod(method), 'utf-8')
4446
)
4547
)

0 commit comments

Comments
 (0)