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

feat: add skipFormat option #1333

Merged
merged 1 commit into from
Oct 10, 2024
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
4 changes: 3 additions & 1 deletion packages/nx-gradle/src/generators/application/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,5 +454,7 @@ async function applicationGenerator(

addFiles(tree, normalizedOptions);
addProjectToGradleSetting(tree, normalizedOptions);
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}
}
1 change: 1 addition & 0 deletions packages/nx-gradle/src/generators/application/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export interface NxGradleAppGeneratorSchema {
minimal?: boolean;
port?: string | number;
framework?: FrameworkType;
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-gradle/src/generators/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
],
"default": 8080,
"description": "Port to start the server at. Default is 8080."
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": ["name", "language", "groupId", "projectVersion", "configFormat"]
Expand Down
4 changes: 3 additions & 1 deletion packages/nx-gradle/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export async function initGenerator(
'755',
);
}
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}

return () => {
installPackagesTask(tree);
Expand Down
1 change: 1 addition & 0 deletions packages/nx-gradle/src/generators/init/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export interface NxGradleInitGeneratorSchema {
preset: PresetType;
skipWrapper?: boolean;
versionManagement: VersionManagementType;
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-gradle/src/generators/init/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@
}
]
}
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": [
Expand Down
4 changes: 3 additions & 1 deletion packages/nx-gradle/src/generators/library/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,5 +335,7 @@ async function libraryGenerator(
addFiles(tree, normalizedOptions);
addProjectToGradleSetting(tree, normalizedOptions);
addLibraryToProjects(tree, normalizedOptions);
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}
}
1 change: 1 addition & 0 deletions packages/nx-gradle/src/generators/library/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export interface NxGradleLibGeneratorSchema {
projects?: string;
skipStarterCode?: boolean;
framework?: FrameworkType;
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-gradle/src/generators/library/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
"description": "Skip starter code",
"type": "boolean",
"default": false
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": ["name", "language", "groupId", "projectVersion"]
Expand Down
4 changes: 3 additions & 1 deletion packages/nx-gradle/src/generators/wrapper/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export default async function (
joinPathFragments(normalizedOptions.gradleRootDirectory, 'gradlew.bat'),
'755',
);
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}
}

export function updateGitIgnore(tree: Tree) {
Expand Down
1 change: 1 addition & 0 deletions packages/nx-gradle/src/generators/wrapper/schema.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export interface NxGradleWrapperGeneratorSchema {
skipGitignore?: boolean;
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-gradle/src/generators/wrapper/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"description": "Don't add Gradle Wrapper to .gitignore",
"type": "boolean",
"default": false
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": []
Expand Down
4 changes: 3 additions & 1 deletion packages/nx-maven/src/generators/application/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,5 +489,7 @@ async function applicationGenerator(
aggregatorProject: normalizedOptions.aggregatorProject,
mavenRootDirectory: normalizedOptions.mavenRootDirectory,
});
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}
}
1 change: 1 addition & 0 deletions packages/nx-maven/src/generators/application/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export interface NxMavenAppGeneratorSchema {
minimal?: boolean;
port?: string | number;
framework?: FrameworkType;
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-maven/src/generators/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@
],
"default": 8080,
"description": "Port to start the server at. Default is 8080."
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": [
Expand Down
4 changes: 3 additions & 1 deletion packages/nx-maven/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export async function initGenerator(
'755',
);
}
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}

return () => {
installPackagesTask(tree);
Expand Down
1 change: 1 addition & 0 deletions packages/nx-maven/src/generators/init/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export interface NxMavenInitGeneratorSchema {
dependencyManagement: DependencyManagementType;
skipWrapper?: boolean;
localRepoRelativePath: string;
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-maven/src/generators/init/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
"type": "string",
"description": "Maven local repository relative path to {workspaceRoot}/{mavenRootDirectory}",
"default": ".m2/repository"
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": [
Expand Down
4 changes: 3 additions & 1 deletion packages/nx-maven/src/generators/library/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,5 +340,7 @@ async function libraryGenerator(
mavenRootDirectory: normalizedOptions.mavenRootDirectory,
});
addLibraryToProjects(tree, normalizedOptions);
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}
}
1 change: 1 addition & 0 deletions packages/nx-maven/src/generators/library/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export interface NxMavenLibGeneratorSchema {
projects?: string;
skipStarterCode?: boolean;
framework?: FrameworkType;
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-maven/src/generators/library/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@
"description": "Skip starter code",
"type": "boolean",
"default": false
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": ["name", "language", "groupId", "projectVersion", "parentProject"]
Expand Down
4 changes: 3 additions & 1 deletion packages/nx-maven/src/generators/parent-project/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,7 @@ async function parentProjectGenerator(
aggregatorProject: normalizedOptions.aggregatorProject,
mavenRootDirectory: normalizedOptions.mavenRootDirectory,
});
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export interface NxMavenParentProjectGeneratorSchema {
aggregatorProject?: string;
framework?: FrameworkType;
language: 'java' | 'kotlin' | 'java-kotlin';
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-maven/src/generators/parent-project/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
"aggregatorProject": {
"type": "string",
"description": "ArtifactId of the aggregator project (that manages a group of submodules) or leave it blank for the root project"
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": ["name", "projectType", "groupId", "projectVersion"]
Expand Down
4 changes: 3 additions & 1 deletion packages/nx-maven/src/generators/wrapper/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export default async function (
joinPathFragments(normalizedOptions.mavenRootDirectory, 'mvnw.cmd'),
'755',
);
await formatFiles(tree);
if (!options.skipFormat) {
await formatFiles(tree);
}
}

function updateGitIgnore(tree: Tree) {
Expand Down
1 change: 1 addition & 0 deletions packages/nx-maven/src/generators/wrapper/schema.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export interface NxMavenWrapperGeneratorSchema {
skipGitignore?: boolean;
skipFormat?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-maven/src/generators/wrapper/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"description": "Don't add Maven Wrapper to .gitignore",
"type": "boolean",
"default": false
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": []
Expand Down