Skip to content

Commit

Permalink
build: update .prettierignore
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilou88 committed Dec 31, 2023
1 parent f103f9a commit f23566e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/nx-maven/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export async function initGenerator(
updateGitIgnore(tree, normalizedOptions);
addPrettierToPackageJson(tree);
addOrUpdatePrettierRc(tree);
addOrUpdatePrettierIgnore(tree);
addOrUpdatePrettierIgnore(tree, normalizedOptions);
addOrUpdateGitattributes(tree);
if (!options.skipWrapper) {
tree.changePermissions(
Expand Down Expand Up @@ -232,9 +232,20 @@ function addOrUpdatePrettierRc(tree: Tree) {
}
}

function addOrUpdatePrettierIgnore(tree: Tree) {
function addOrUpdatePrettierIgnore(tree: Tree, options: NormalizedSchema) {
const prettierIgnorePath = '.prettierignore';
const mavenPrettierIgnores = ['# Maven target', '\ntarget/'];

if (options.localRepoRelativePath) {
if (options.mavenRootDirectory) {
mavenPrettierIgnores.push(
`\n${options.mavenRootDirectory}/${options.localRepoRelativePath}`,
);
} else {
mavenPrettierIgnores.push(`\n${options.localRepoRelativePath}`);
}
}

if (tree.exists(prettierIgnorePath)) {
const prettierIgnoreOldContent =
tree.read(prettierIgnorePath, 'utf-8') || '';
Expand Down

0 comments on commit f23566e

Please sign in to comment.