From b5f905de7043053a0233b29ff901529032d90e8c Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Wed, 6 Nov 2024 19:17:57 -0300 Subject: [PATCH] client: inject workspace instead of override --- generators/client/generator.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/generators/client/generator.ts b/generators/client/generator.ts index e2dbd74b4a44..93c74af511a4 100644 --- a/generators/client/generator.ts +++ b/generators/client/generator.ts @@ -244,13 +244,19 @@ export default class JHipsterClientGenerator extends BaseApplicationGenerator { if (application.clientRootDir) { // Add scripts to map to client package.json this.packageJson.merge({ - workspaces: [application.clientRootDir], scripts: { 'webapp:build': `npm run -w ${application.clientRootDir} webapp:build`, 'ci:frontend:test': `npm run -w ${application.clientRootDir} ci:frontend:test`, 'e2e:headless': `npm run -w ${application.clientRootDir} e2e:headless`, }, }); + + const clientWorkspace = application.clientRootDir.slice(0, -1); + const packageJson = this.packageJson.createProxy(); + const workspaces = packageJson.workspaces as string[] | undefined; + if (!workspaces?.includes(clientWorkspace)) { + packageJson.workspaces = [...(workspaces ?? []), clientWorkspace]; + } } },