fix(@angular-devkit/schematics): allow custom registry for node package task

This commit is contained in:
Charles Lyding 2020-02-07 13:57:52 -05:00 committed by Douglas Parker
parent 0d6dae107d
commit 33656f7aa8
4 changed files with 11 additions and 3 deletions

View File

@ -135,6 +135,7 @@ export declare class NodeWorkflow extends workflow.BaseWorkflow {
dryRun?: boolean;
root?: Path;
packageManager?: string;
packageRegistry?: string;
registry?: schema.CoreSchemaRegistry;
resolvePaths?: string[];
});

View File

@ -13,13 +13,13 @@ import { Observable } from 'rxjs';
import { TaskExecutor, UnsuccessfulWorkflowExecution } from '../../src';
import { NodePackageTaskFactoryOptions, NodePackageTaskOptions } from './options';
type PackageManagerProfile = {
interface PackageManagerProfile {
quietArgument?: string;
commands: {
installAll?: string;
installPackage: string;
},
};
};
}
const packageManagers: { [name: string]: PackageManagerProfile } = {
'npm': {
@ -99,6 +99,10 @@ export default function(
args.push(taskPackageManagerProfile.quietArgument);
}
if (factoryOptions.registry) {
args.push(`--registry="${factoryOptions.registry}"`);
}
return new Observable(obs => {
const spinner = ora({
text: 'Installing packages...',

View File

@ -11,6 +11,7 @@ export interface NodePackageTaskFactoryOptions {
rootDirectory?: string;
packageManager?: string;
allowPackageManagerOverride?: boolean;
registry?: string;
}
export interface NodePackageTaskOptions {

View File

@ -24,6 +24,7 @@ export class NodeWorkflow extends workflow.BaseWorkflow {
dryRun?: boolean;
root?: Path;
packageManager?: string;
packageRegistry?: string;
registry?: schema.CoreSchemaRegistry;
resolvePaths?: string[],
},
@ -44,6 +45,7 @@ export class NodeWorkflow extends workflow.BaseWorkflow {
allowPackageManagerOverride: true,
packageManager: options.packageManager,
rootDirectory: options.root && getSystemPath(options.root),
registry: options.packageRegistry,
},
);
engineHost.registerTaskExecutor(