Skip to content

Commit

Permalink
feat: add skipFormat option (#1333)
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilou88 authored Oct 10, 2024
1 parent bf1bdd2 commit 3b497fb
Show file tree
Hide file tree
Showing 27 changed files with 81 additions and 9 deletions.
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

0 comments on commit 3b497fb

Please sign in to comment.