Skip to content

Commit

Permalink
fix(angular): allow skiping formatFiles in component generator when c…
Browse files Browse the repository at this point in the history
…alled from another generator (#15953)
  • Loading branch information
leosvelperez committed Mar 29, 2023
1 parent 65f7fca commit 75f6b98
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/generated/packages/angular/generators/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@
"description": "Specifies if the component should be exported in the declaring `NgModule`. Additionally, if the project is a library, the component will be exported from the project's entry point (normally `index.ts`) if the module it belongs to is also exported or if the component is standalone.",
"default": false,
"x-priority": "important"
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false,
"x-priority": "internal"
}
},
"required": ["name", "project"],
Expand Down
4 changes: 3 additions & 1 deletion packages/angular/src/generators/component/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ export async function componentGenerator(tree: Tree, rawOptions: Schema) {

exportComponentInEntryPoint(tree, options);

await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}
}

function buildSelector(tree: Tree, name: string, prefix: string) {
Expand Down
1 change: 1 addition & 0 deletions packages/angular/src/generators/component/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface Schema {
skipSelector?: boolean;
export?: boolean;
prefix?: string;
skipFormat?: boolean;
}

export interface NormalizedSchema extends Schema {
Expand Down
6 changes: 6 additions & 0 deletions packages/angular/src/generators/component/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
"description": "Specifies if the component should be exported in the declaring `NgModule`. Additionally, if the project is a library, the component will be exported from the project's entry point (normally `index.ts`) if the module it belongs to is also exported or if the component is standalone.",
"default": false,
"x-priority": "important"
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false,
"x-priority": "internal"
}
},
"required": ["name", "project"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export async function addStandaloneComponent(
export: true,
project: libraryOptions.name,
flat: componentOptions.flat,
skipFormat: true,
});

if (libraryOptions.routing) {
Expand Down

1 comment on commit 75f6b98

@vercel
Copy link

@vercel vercel bot commented on 75f6b98 Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.