Skip to content

Commit

Permalink
feat: use always relative paths
Browse files Browse the repository at this point in the history
fixes #63

Should workaround absolute path handling of compodoc on windows.

compodoc/compodoc#1195
  • Loading branch information
twittwer committed Apr 3, 2022
1 parent 896a037 commit 38ecc72
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions packages/compodoc/src/executors/build/executor.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { BuildExecutorSchema, CompodocOptions } from './schema';
import { ChildProcess, spawn } from 'child_process';
import { join, relative, resolve, sep } from 'path';
import {
ExecutorContext,
getPackageManagerCommand,
joinPathFragments,
readJsonFile,
} from '@nrwl/devkit';
import { ChildProcess, spawn } from 'child_process';
import {
copyFileSync,
existsSync,
Expand All @@ -15,6 +13,8 @@ import {
writeFileSync,
} from 'fs';
import { tmpdir } from 'os';
import { join, relative, resolve } from 'path';
import { BuildExecutorSchema, CompodocOptions } from './schema';

export default async function runExecutor(
options: BuildExecutorSchema,
Expand All @@ -34,7 +34,7 @@ export default async function runExecutor(
cwd,
joinPathFragments(context.root, 'node_modules', '.bin', 'compodoc'),
);
const cmdArgs = toArguments(toCompodocOptions(options, context));
const cmdArgs = toArguments(args);
const cmdOpts = { cwd, shell: true };

if (options.watch && options.exportFormat === 'json') {
Expand Down Expand Up @@ -96,13 +96,12 @@ function toCompodocOptions(
const _: [BuildExecutorSchema, ExecutorContext] = [options, context];
const project = context.workspace.projects[context.projectName];

options.tsConfig ??= `${project.root}/tsconfig.json`;
options.outputPath ??= `dist/compodoc/${context.projectName}`;

return {
tsconfig: options.tsConfig
? resolve(context.root, options.tsConfig)
: resolve(project.root, 'tsconfig.json'),
output: options.outputPath
? resolve(context.root, options.outputPath)
: resolve('dist', 'compodoc', context.projectName),
tsconfig: toRelativePath(options.tsConfig, ..._),
output: toRelativePath(options.outputPath, ..._),

exportFormat: options.exportFormat,
minimal: options.exportFormat === 'json',
Expand Down

0 comments on commit 38ecc72

Please sign in to comment.