Skip to content

Commit 4e76f5a

Browse files
clydinfilipesilva
authored andcommitted
fix(@angular-devkit/schematics): ensure task option values are defined
1 parent 165abc8 commit 4e76f5a

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function(
6767

6868
const rootDirectory = factoryOptions.rootDirectory || process.cwd();
6969

70-
return (options: NodePackageTaskOptions) => {
70+
return (options: NodePackageTaskOptions = { command: 'install' }) => {
7171
let taskPackageManagerProfile = packageManagerProfile;
7272
let taskPackageManagerName = packageManagerName;
7373
if (factoryOptions.allowPackageManagerOverride && options.packageManager) {

packages/angular_devkit/schematics/tasks/repo-init/executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function(
2020
): TaskExecutor<RepositoryInitializerTaskOptions> {
2121
const rootDirectory = factoryOptions.rootDirectory || process.cwd();
2222

23-
return async (options: RepositoryInitializerTaskOptions, context: SchematicContext) => {
23+
return async (options: RepositoryInitializerTaskOptions = {}, context: SchematicContext) => {
2424
const authorName = options.authorName;
2525
const authorEmail = options.authorEmail;
2626

packages/angular_devkit/schematics/tasks/run-schematic/executor.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ import { RunSchematicTaskOptions } from './options';
1010

1111

1212
export default function(): TaskExecutor<RunSchematicTaskOptions<{}>> {
13-
return (options: RunSchematicTaskOptions<{}>, context: SchematicContext) => {
13+
return (options: RunSchematicTaskOptions<{}> | undefined, context: SchematicContext) => {
14+
if (!options?.name) {
15+
throw new Error(
16+
'RunSchematicTask requires an options object with a non-empty name property.',
17+
);
18+
}
19+
1420
const maybeWorkflow = context.engine.workflow;
1521
const collection = options.collection || context.schematic.collection.description.name;
1622

packages/angular_devkit/schematics/tasks/tslint-fix/executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function _listAllFiles(root: string): string[] {
8181

8282

8383
export default function (): TaskExecutor<TslintFixTaskOptions> {
84-
return async (options: TslintFixTaskOptions, context: SchematicContext) => {
84+
return async (options: TslintFixTaskOptions = {}, context: SchematicContext) => {
8585
const root = process.cwd();
8686
const tslint = await import('tslint'); // tslint:disable-line:no-implicit-dependencies
8787

0 commit comments

Comments
 (0)