From 41e416c505c3174856b622417c9bd591e357eb5b Mon Sep 17 00:00:00 2001 From: khalilou88 Date: Fri, 20 Oct 2023 01:35:36 +0200 Subject: [PATCH] build: work in progress --- .../init/files/nx/project.json__template__ | 12 -------- .../nx-maven/src/generators/init/generator.ts | 28 ++++++++++++++----- 2 files changed, 21 insertions(+), 19 deletions(-) delete mode 100644 packages/nx-maven/src/generators/init/files/nx/project.json__template__ diff --git a/packages/nx-maven/src/generators/init/files/nx/project.json__template__ b/packages/nx-maven/src/generators/init/files/nx/project.json__template__ deleted file mode 100644 index d3c9ddc11..000000000 --- a/packages/nx-maven/src/generators/init/files/nx/project.json__template__ +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "<%= parentProjectName %>", - "$schema": "../node_modules/nx/schemas/project-schema.json", - "targets": { - "build": { - "executor": "@jnxplus/nx-maven:run-task", - "options": { - "task": "install -N" - } - } - } - } \ No newline at end of file diff --git a/packages/nx-maven/src/generators/init/generator.ts b/packages/nx-maven/src/generators/init/generator.ts index 3aeee9072..a302f1f37 100644 --- a/packages/nx-maven/src/generators/init/generator.ts +++ b/packages/nx-maven/src/generators/init/generator.ts @@ -11,7 +11,9 @@ import { updateGitIgnore, } from '../../utils/generators'; import { + ProjectConfiguration, Tree, + addProjectConfiguration, formatFiles, generateFiles, joinPathFragments, @@ -65,19 +67,31 @@ function addFiles(tree: Tree, options: NormalizedSchema) { options.mavenRootDirectory, templateOptions, ); +} + +export default async function (tree: Tree, options: NxMavenGeneratorSchema) { + const normalizedOptions = normalizeOptions(tree, options); if (options.mavenRootDirectory) { - generateFiles( + const projectConfiguration: ProjectConfiguration = { + root: normalizedOptions.mavenRootDirectory, + targets: { + build: { + executor: '@jnxplus/nx-maven:run-task', + options: { + task: 'install -N', + }, + }, + }, + }; + + addProjectConfiguration( tree, - path.join(__dirname, 'files', 'nx'), - options.mavenRootDirectory, - templateOptions, + normalizedOptions.parentProjectName, + projectConfiguration, ); } -} -export default async function (tree: Tree, options: NxMavenGeneratorSchema) { - const normalizedOptions = normalizeOptions(tree, options); addFiles(tree, normalizedOptions); updateNxJson(tree, normalizedOptions); updateGitIgnore(tree, options.skipWrapper);