diff --git a/app/angular/src/builders/utils/run-compodoc.ts b/app/angular/src/builders/utils/run-compodoc.ts index 3ad8daa12ecb..0df330892048 100644 --- a/app/angular/src/builders/utils/run-compodoc.ts +++ b/app/angular/src/builders/utils/run-compodoc.ts @@ -1,18 +1,26 @@ import { BuilderContext } from '@angular-devkit/architect'; import { spawn } from 'child_process'; import { Observable } from 'rxjs'; +import * as path from 'path'; const hasTsConfigArg = (args: string[]) => args.indexOf('-p') !== -1; +// path.relative is necessary to workaround a compodoc issue with +// absolute paths on windows machines +const toRelativePath = (pathToTsConfig: string) => { + return path.isAbsolute(pathToTsConfig) ? path.relative('.', pathToTsConfig) : pathToTsConfig; +}; + export const runCompodoc = ( { compodocArgs, tsconfig }: { compodocArgs: string[]; tsconfig: string }, context: BuilderContext ): Observable => { return new Observable((observer) => { + const tsConfigPath = toRelativePath(tsconfig); const finalCompodocArgs = [ 'compodoc', // Default options - ...(hasTsConfigArg(compodocArgs) ? [] : ['-p', tsconfig]), + ...(hasTsConfigArg(compodocArgs) ? [] : ['-p', tsConfigPath]), '-d', `${context.workspaceRoot}`, ...compodocArgs,