Skip to content

refactor(structure): restructure repo to role-based layout (JDWLABS-20)#7

Open
jdwillmsen wants to merge 8 commits into
mainfrom
feat/JDWLABS-20-role-based-layout
Open

refactor(structure): restructure repo to role-based layout (JDWLABS-20)#7
jdwillmsen wants to merge 8 commits into
mainfrom
feat/JDWLABS-20-role-based-layout

Conversation

@jdwillmsen
Copy link
Copy Markdown
Member

@jdwillmsen jdwillmsen commented May 27, 2026

Summary

Restructures the monorepo from framework-based to role-based directory grouping.

Directory Changes

Before After
apps/angular/ apps/frontend/
apps/go/ apps/backend/
apps/springboot/ apps/backend/
apps/angular/platform-e2e apps/e2e/
libs/angular/ libs/frontend/
libs/go/ libs/backend/

Path / Alias Updates

  • @jdw/angular-*@jdw/frontend-* (130 import sites in 73 TS files)
  • tsconfig.base.json path aliases updated
  • Jest preset/coverage paths corrected for new directory depth
  • ESLint config relative import depth fixed (4→3 levels for apps)
  • Angular app tsconfig relative paths corrected
  • MFE module-federation.config.ts remote entry paths updated
  • go.work workspace paths updated
  • nx.json include patterns updated

Project Name Changes

  • angular-*frontend-* in all project.json name fields and jest displayName
  • go-*backend-*

Verification

  • ✅ 21/21 projects lint clean
  • ✅ 19/19 projects tests pass
  • nx format:check passes
  • go.work resolves correctly

Closes JDWLABS-20

🤖 Generated with Claude Code

Move from framework-based to role-based directory grouping:
- apps/angular/ -> apps/frontend/
- apps/go/ + apps/springboot/ -> apps/backend/
- apps/angular/platform-e2e -> apps/e2e/
- libs/angular/ -> libs/frontend/
- libs/go/ -> libs/backend/

Update all relative paths (tsconfig, jest, eslint, module-federation),
import aliases (@jdw/angular-* -> @jdw/frontend-*), project names
(angular-* -> frontend-*, go-* -> backend-*), go.work workspace paths,
and nx.json include patterns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 27, 2026

View your CI Pipeline Execution ↗ for commit c9fcf32

Command Status Duration Result
nx affected -t lint test ✅ Succeeded 3s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-07 05:48:09 UTC

jdwillmsen and others added 3 commits May 27, 2026 22:18
Cypress dirs were deleted during Playwright migration (JDWLABS-18) but
tsconfig.json project references were not updated, causing ng-packagr to
crash with 'Cannot destructure property pos' on frontend-shared-ui build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
actions/checkout@v4, nrwl/nx-set-shas@v4, and pnpm/action-setup@v4
will be forced to Node 24 on June 2 2026. Set env var to opt in now
and avoid breakage at the cutover.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pnpm hard links fail across NTFS volumes. Worktrees must be on same
drive as repo (F:) or node_modules will be empty and git hooks fail.
Documents the workaround and correct WT_BASE config.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jdwillmsen
Copy link
Copy Markdown
Member Author

Code review

Found 4 issues:

  1. Dockerfiles still reference stale apps/angular/ and dist/apps/angular/ paths — Docker builds will fail since these paths no longer exist after the role-based restructure. Same issue exists in all four frontend Dockerfiles (authui, rolesui, usersui, container).

ENV JSFOLDER=/usr/share/nginx/html/*.js
COPY apps/angular/authui/authui/start-nginx.sh /usr/bin/start-nginx.sh
RUN chmod +x /usr/bin/start-nginx.sh
COPY apps/angular/authui/authui/default.conf /etc/nginx/conf.d
COPY dist/apps/angular/authui/authui/ /usr/share/nginx/html/

  1. libs/frontend/shared/ui/package.json and libs/frontend/shared/util/package.json still declare @jdw/angular-shared-ui / @jdw/angular-shared-util as their package names, and the ui package still has a peer dependency on @jdw/angular-shared-util. These are inconsistent with the renamed @jdw/frontend-* aliases in tsconfig.base.json.

{
"name": "@jdw/angular-shared-ui",
"version": "0.0.1",

  1. Go module names were not updated. apps/backend/servicediscovery/go.mod still declares module apps/go/servicediscovery and libs/backend/shared/util/go.mod still declares module libs/go/shared/util. The import in main.go line 9 still uses "libs/go/shared/util". The go.work file masks this inside the workspace, but the module names are wrong and will break any out-of-workspace build or external consumer.

module apps/go/servicediscovery

module libs/go/shared/util

  1. README.md still documents the old framework-based directory structure (apps/angular/, apps/go/, apps/springboot/, libs/angular/, libs/go/) and references old library names like angular-usersui-data-access. This directly contradicts the new role-based layout introduced by this PR.

apps/README.md

Lines 27 to 41 in 0ad3cf7

├── apps/ # Complete applications
│ ├── angular/ # Grouped by framework / language
│ │ ├── container/ # Specific application
│ │ ├── authui/
│ │ ├── usersui/
│ │ ├── rolesui/
│ │ └── platform-e2e/
│ ├── go/
│ │ └── servicediscovery/
│ └── springboot/
│ └── usersrole/
├── libs/ # Reusable libraries
│ ├── angular/ # Grouped by framework
│ │ ├── container/ # App-specific libraries

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

jdwillmsen and others added 3 commits June 1, 2026 23:31
- Dockerfiles (authui, rolesui, usersui, container): update COPY paths
  from apps/angular/<app>/<app>/ to apps/frontend/<app>/ and dist paths
- servicediscovery Dockerfiles: update dist path from apps/go/ to
  apps/backend/
- go.mod module declarations: apps/go/servicediscovery ->
  apps/backend/servicediscovery, libs/go/shared/util ->
  libs/backend/shared/util
- main.go: update import to libs/backend/shared/util
- package.json: rename @jdw/angular-shared-ui/util to
  @jdw/frontend-shared-ui/util
- README: update directory structure and lib examples to role-based names

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolve conflicts from main diverging while this branch renamed the repo
to a role-based layout (apps/angular -> apps/frontend, libs/angular ->
libs/frontend):

- CLAUDE.md: take main's newer version
- project.json (authui/container/rolesui/usersui): keep frontend paths,
  adopt main's tools/ -> scripts/ directory rename
- roles.component{,.spec}.ts: import date comparators from
  @jdw/frontend-shared-util (main moved them from usersui-util into the
  shared-util lib); date.util.ts relocated into libs/frontend/shared/util
- nx format:write for main's updated prettier (scss)

Verified locally: format:check, build (9 projects), lint+test (21) pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The merge left .github/pull_request_template.md at this branch's older
"## Summary" template; restore main's newer "## What" version (added in
JDWLABS-21) so merging PR #7 does not revert it.

Note: repo tracks both PULL_REQUEST_TEMPLATE.md and pull_request_template.md
(case collision predating this PR) - flagged for separate cleanup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud is proposing a fix for your failed CI:

We updated the @use import paths in all four Angular app styles.scss files from the old libs/angular/shared/ui/... to the new libs/frontend/shared/ui/..., resolving the "Can't find stylesheet to import" build errors. These stale relative paths were missed during the role-based directory restructuring and caused all four production builds to fail.

Tip

We verified this fix by re-running authui:build:production.

Suggested Fix changes
diff --git a/apps/frontend/authui/src/styles.scss b/apps/frontend/authui/src/styles.scss
index c8cf39f..752439c 100644
--- a/apps/frontend/authui/src/styles.scss
+++ b/apps/frontend/authui/src/styles.scss
@@ -1,5 +1,5 @@
 @use '@angular/material' as mat;
-@use '../../../../../libs/angular/shared/ui/src/lib/styles/themes/black-white';
+@use '../../../../libs/frontend/shared/ui/src/lib/styles/themes/black-white';
 
 @include mat.elevation-classes();
 @include mat.app-background();
diff --git a/apps/frontend/container/src/styles.scss b/apps/frontend/container/src/styles.scss
index e37b572..8cf1485 100644
--- a/apps/frontend/container/src/styles.scss
+++ b/apps/frontend/container/src/styles.scss
@@ -1,5 +1,5 @@
 @use '@angular/material' as mat;
-@use '../../../../../libs/angular/shared/ui/src/lib/styles/themes/red-teal';
+@use '../../../../libs/frontend/shared/ui/src/lib/styles/themes/red-teal';
 
 @include mat.elevation-classes();
 @include mat.app-background();
diff --git a/apps/frontend/rolesui/src/styles.scss b/apps/frontend/rolesui/src/styles.scss
index c8cf39f..752439c 100644
--- a/apps/frontend/rolesui/src/styles.scss
+++ b/apps/frontend/rolesui/src/styles.scss
@@ -1,5 +1,5 @@
 @use '@angular/material' as mat;
-@use '../../../../../libs/angular/shared/ui/src/lib/styles/themes/black-white';
+@use '../../../../libs/frontend/shared/ui/src/lib/styles/themes/black-white';
 
 @include mat.elevation-classes();
 @include mat.app-background();
diff --git a/apps/frontend/usersui/src/styles.scss b/apps/frontend/usersui/src/styles.scss
index c8cf39f..752439c 100644
--- a/apps/frontend/usersui/src/styles.scss
+++ b/apps/frontend/usersui/src/styles.scss
@@ -1,5 +1,5 @@
 @use '@angular/material' as mat;
-@use '../../../../../libs/angular/shared/ui/src/lib/styles/themes/black-white';
+@use '../../../../libs/frontend/shared/ui/src/lib/styles/themes/black-white';
 
 @include mat.elevation-classes();
 @include mat.app-background();

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally bm6V-9Wcb

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

…BS-20)

The 4 frontend apps' styles.scss still imported the shared theme via a
deep relative path into the old libs/angular/shared layout, which no
longer exists after the role-based restructure, breaking build:production.

Add stylePreprocessorOptions.includePaths pointing at the shared styles
root and switch the imports to shallow '@use "themes/<name>"'. This both
fixes the broken path and removes the brittle ../../../../../ traversal so
future app moves won't re-break these imports.

Verified: nx run-many -t build -p authui container rolesui usersui -c
production --skip-nx-cache passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant