Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust child process I/O for compodoc command #22441

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ describe('runCompodoc', () => {
expect(mockRunScript).toHaveBeenCalledWith(
'compodoc',
['-p', 'path/to/tsconfig.json', '-d', 'path/to/project'],
'path/to/project'
'path/to/project',
'inherit'
);
});

Expand All @@ -66,7 +67,8 @@ describe('runCompodoc', () => {
expect(mockRunScript).toHaveBeenCalledWith(
'compodoc',
['-d', 'path/to/project', '-p', 'path/to/tsconfig.stories.json'],
'path/to/project'
'path/to/project',
'inherit'
);
});

Expand All @@ -87,7 +89,8 @@ describe('runCompodoc', () => {
expect(mockRunScript).toHaveBeenCalledWith(
'compodoc',
['-p', 'path/to/tsconfig.json', '-d', 'path/to/project'],
'path/to/project'
'path/to/project',
'inherit'
);
});

Expand All @@ -108,7 +111,8 @@ describe('runCompodoc', () => {
expect(mockRunScript).toHaveBeenCalledWith(
'compodoc',
['-p', 'path/to/tsconfig.json', '--output', 'path/to/customFolder'],
'path/to/project'
'path/to/project',
'inherit'
);
});

Expand All @@ -129,7 +133,8 @@ describe('runCompodoc', () => {
expect(mockRunScript).toHaveBeenCalledWith(
'compodoc',
['-p', 'path/to/tsconfig.json', '-d', 'path/to/customFolder'],
'path/to/project'
'path/to/project',
'inherit'
);
});
});
3 changes: 2 additions & 1 deletion code/frameworks/angular/src/builders/utils/run-compodoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export const runCompodoc = (
const stdout = packageManager.runPackageCommandSync(
'compodoc',
finalCompodocArgs,
context.workspaceRoot
context.workspaceRoot,
'inherit'
);

context.logger.info(stdout);
Expand Down
14 changes: 12 additions & 2 deletions code/lib/cli/src/js-package-manager/JsPackageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,18 @@ export abstract class JsPackageManager {
): // Use generic and conditional type to force `string[]` if fetchAllVersions is true and `string` if false
Promise<T extends true ? string[] : string>;

public abstract runPackageCommand(command: string, args: string[], cwd?: string): Promise<string>;
public abstract runPackageCommandSync(command: string, args: string[], cwd?: string): string;
public abstract runPackageCommand(
command: string,
args: string[],
cwd?: string,
stdio?: string
): Promise<string>;
public abstract runPackageCommandSync(
command: string,
args: string[],
cwd?: string,
stdio?: 'inherit' | 'pipe'
): string;
public abstract findInstallations(pattern?: string[]): Promise<InstallationMetadata | undefined>;

public executeCommandSync({
Expand Down
8 changes: 7 additions & 1 deletion code/lib/cli/src/js-package-manager/NPMProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ export class NPMProxy extends JsPackageManager {
return this.installArgs;
}

public runPackageCommandSync(command: string, args: string[], cwd?: string): string {
public runPackageCommandSync(
command: string,
args: string[],
cwd?: string,
stdio?: 'pipe' | 'inherit'
): string {
return this.executeCommandSync({
command: 'npm',
args: ['exec', '--', command, ...args],
cwd,
stdio,
});
}

Expand Down
8 changes: 7 additions & 1 deletion code/lib/cli/src/js-package-manager/PNPMProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,17 @@ export class PNPMProxy extends JsPackageManager {
return this.installArgs;
}

public runPackageCommandSync(command: string, args: string[], cwd?: string): string {
public runPackageCommandSync(
command: string,
args: string[],
cwd?: string,
stdio?: 'pipe' | 'inherit'
): string {
return this.executeCommandSync({
command: 'pnpm',
args: ['exec', command, ...args],
cwd,
stdio,
});
}

Expand Down
9 changes: 7 additions & 2 deletions code/lib/cli/src/js-package-manager/Yarn1Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ export class Yarn1Proxy extends JsPackageManager {
return `yarn ${command}`;
}

public runPackageCommandSync(command: string, args: string[], cwd?: string): string {
return this.executeCommandSync({ command: `yarn`, args: [command, ...args], cwd });
public runPackageCommandSync(
command: string,
args: string[],
cwd?: string,
stdio?: 'pipe' | 'inherit'
): string {
return this.executeCommandSync({ command: `yarn`, args: [command, ...args], cwd, stdio });
}

async runPackageCommand(command: string, args: string[], cwd?: string): Promise<string> {
Expand Down
9 changes: 7 additions & 2 deletions code/lib/cli/src/js-package-manager/Yarn2Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ export class Yarn2Proxy extends JsPackageManager {
return `yarn ${command}`;
}

public runPackageCommandSync(command: string, args: string[], cwd?: string) {
return this.executeCommandSync({ command: 'yarn', args: [command, ...args], cwd });
public runPackageCommandSync(
command: string,
args: string[],
cwd?: string,
stdio?: 'pipe' | 'inherit'
) {
return this.executeCommandSync({ command: 'yarn', args: [command, ...args], cwd, stdio });
}

async runPackageCommand(command: string, args: string[], cwd?: string) {
Expand Down