Skip to content

Commit b759ebd

Browse files
alan-agius4hansl
authored andcommitted
fix(@angular/cli): command runner is not working on windows
`fs` is unable to read the normalized paths from `@angular-devkit/core` on `windows` as the disk drive is replaced from `c:/` to `/c/` Closes #11928
1 parent f9ad0e2 commit b759ebd

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/angular/cli/models/command-runner.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,16 @@
99
// tslint:disable:no-global-tslint-disable no-any
1010
import {
1111
JsonObject,
12-
Path,
1312
deepCopy,
14-
dirname,
15-
join,
1613
logging,
17-
normalize,
1814
parseJson,
1915
schema,
2016
strings as coreStrings,
2117
tags,
2218
} from '@angular-devkit/core';
2319
import { ExportStringRef } from '@angular-devkit/schematics/tools';
2420
import { readFileSync } from 'fs';
21+
import { dirname, join } from 'path';
2522
import { of, throwError } from 'rxjs';
2623
import { concatMap } from 'rxjs/operators';
2724
import * as yargsParser from 'yargs-parser';
@@ -37,8 +34,8 @@ import { insideProject } from '../utilities/project';
3734
import { convertSchemaToOptions, parseSchema } from './json-schema';
3835

3936

40-
export interface CommandMap {
41-
[key: string]: Path;
37+
interface CommandMap {
38+
[key: string]: string;
4239
}
4340

4441
interface CommandMetadata {
@@ -111,7 +108,7 @@ export async function runCommand(
111108

112109
return 1;
113110
}
114-
const cliDir = dirname(normalize(commandMapPath));
111+
const cliDir = dirname(commandMapPath);
115112
const commandsText = readFileSync(commandMapPath).toString('utf-8');
116113
const commandJson = JSON.parse(commandsText) as { [name: string]: string };
117114

@@ -410,7 +407,7 @@ async function createCommand(metadata: CommandLocation,
410407
throw new Error('Implementation path is incorrect');
411408
}
412409

413-
const implRef = new ExportStringRef(implPath, dirname(normalize(metadata.path)));
410+
const implRef = new ExportStringRef(implPath, dirname(metadata.path));
414411

415412
const ctor = implRef.ref as CommandConstructor;
416413

0 commit comments

Comments
 (0)