Skip to content

Commit 33656f7

Browse files
clydindgp1130
authored andcommitted
fix(@angular-devkit/schematics): allow custom registry for node package task
1 parent 0d6dae1 commit 33656f7

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

etc/api/angular_devkit/schematics/tools/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export declare class NodeWorkflow extends workflow.BaseWorkflow {
135135
dryRun?: boolean;
136136
root?: Path;
137137
packageManager?: string;
138+
packageRegistry?: string;
138139
registry?: schema.CoreSchemaRegistry;
139140
resolvePaths?: string[];
140141
});

packages/angular_devkit/schematics/tasks/node-package/executor.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import { Observable } from 'rxjs';
1313
import { TaskExecutor, UnsuccessfulWorkflowExecution } from '../../src';
1414
import { NodePackageTaskFactoryOptions, NodePackageTaskOptions } from './options';
1515

16-
type PackageManagerProfile = {
16+
interface PackageManagerProfile {
1717
quietArgument?: string;
1818
commands: {
1919
installAll?: string;
2020
installPackage: string;
21-
},
22-
};
21+
};
22+
}
2323

2424
const packageManagers: { [name: string]: PackageManagerProfile } = {
2525
'npm': {
@@ -99,6 +99,10 @@ export default function(
9999
args.push(taskPackageManagerProfile.quietArgument);
100100
}
101101

102+
if (factoryOptions.registry) {
103+
args.push(`--registry="${factoryOptions.registry}"`);
104+
}
105+
102106
return new Observable(obs => {
103107
const spinner = ora({
104108
text: 'Installing packages...',

packages/angular_devkit/schematics/tasks/node-package/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface NodePackageTaskFactoryOptions {
1111
rootDirectory?: string;
1212
packageManager?: string;
1313
allowPackageManagerOverride?: boolean;
14+
registry?: string;
1415
}
1516

1617
export interface NodePackageTaskOptions {

packages/angular_devkit/schematics/tools/workflow/node-workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class NodeWorkflow extends workflow.BaseWorkflow {
2424
dryRun?: boolean;
2525
root?: Path;
2626
packageManager?: string;
27+
packageRegistry?: string;
2728
registry?: schema.CoreSchemaRegistry;
2829
resolvePaths?: string[],
2930
},
@@ -44,6 +45,7 @@ export class NodeWorkflow extends workflow.BaseWorkflow {
4445
allowPackageManagerOverride: true,
4546
packageManager: options.packageManager,
4647
rootDirectory: options.root && getSystemPath(options.root),
48+
registry: options.packageRegistry,
4749
},
4850
);
4951
engineHost.registerTaskExecutor(

0 commit comments

Comments
 (0)