@sfdc-webapps/cli 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1414 -0
- package/dist/commands/apply-patches.d.ts +23 -0
- package/dist/commands/apply-patches.d.ts.map +1 -0
- package/dist/commands/apply-patches.js +524 -0
- package/dist/commands/apply-patches.js.map +1 -0
- package/dist/commands/new-app-feature.d.ts +7 -0
- package/dist/commands/new-app-feature.d.ts.map +1 -0
- package/dist/commands/new-app-feature.js +166 -0
- package/dist/commands/new-app-feature.js.map +1 -0
- package/dist/commands/new-app.d.ts +1 -0
- package/dist/commands/new-app.d.ts.map +1 -0
- package/dist/commands/new-app.js +2 -0
- package/dist/commands/new-app.js.map +1 -0
- package/dist/commands/watch-patches.d.ts +6 -0
- package/dist/commands/watch-patches.d.ts.map +1 -0
- package/dist/commands/watch-patches.js +152 -0
- package/dist/commands/watch-patches.js.map +1 -0
- package/dist/core/dependency-resolver.d.ts +40 -0
- package/dist/core/dependency-resolver.d.ts.map +1 -0
- package/dist/core/dependency-resolver.js +122 -0
- package/dist/core/dependency-resolver.js.map +1 -0
- package/dist/core/file-operations.d.ts +37 -0
- package/dist/core/file-operations.d.ts.map +1 -0
- package/dist/core/file-operations.js +201 -0
- package/dist/core/file-operations.js.map +1 -0
- package/dist/core/package-json-merger.d.ts +30 -0
- package/dist/core/package-json-merger.d.ts.map +1 -0
- package/dist/core/package-json-merger.js +104 -0
- package/dist/core/package-json-merger.js.map +1 -0
- package/dist/core/patch-loader.d.ts +17 -0
- package/dist/core/patch-loader.d.ts.map +1 -0
- package/dist/core/patch-loader.js +100 -0
- package/dist/core/patch-loader.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/debounce.d.ts +6 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/debounce.js +19 -0
- package/dist/utils/debounce.js.map +1 -0
- package/dist/utils/import-merger.d.ts +12 -0
- package/dist/utils/import-merger.d.ts.map +1 -0
- package/dist/utils/import-merger.js +240 -0
- package/dist/utils/import-merger.js.map +1 -0
- package/dist/utils/logger.d.ts +6 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +17 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path-mappings.d.ts +88 -0
- package/dist/utils/path-mappings.d.ts.map +1 -0
- package/dist/utils/path-mappings.js +138 -0
- package/dist/utils/path-mappings.js.map +1 -0
- package/dist/utils/paths.d.ts +43 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +107 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/route-merger.d.ts +107 -0
- package/dist/utils/route-merger.d.ts.map +1 -0
- package/dist/utils/route-merger.js +303 -0
- package/dist/utils/route-merger.js.map +1 -0
- package/dist/utils/validation.d.ts +29 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +109 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +39 -0
- package/src/commands/apply-patches.ts +594 -0
- package/src/commands/new-app-feature.ts +203 -0
- package/src/commands/new-app.ts +0 -0
- package/src/commands/watch-patches.ts +173 -0
- package/src/core/dependency-resolver.ts +175 -0
- package/src/core/file-operations.ts +265 -0
- package/src/core/package-json-merger.ts +129 -0
- package/src/core/patch-loader.ts +128 -0
- package/src/index.ts +95 -0
- package/src/types.ts +23 -0
- package/src/utils/debounce.ts +23 -0
- package/src/utils/import-merger.ts +293 -0
- package/src/utils/logger.ts +21 -0
- package/src/utils/path-mappings.ts +154 -0
- package/src/utils/paths.ts +121 -0
- package/src/utils/route-merger.ts +357 -0
- package/src/utils/validation.ts +150 -0
- package/test/e2e/E2E_TEST_FIXTURES.md +509 -0
- package/test/e2e/apply-patches.spec.ts +861 -0
- package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/package.json +10 -0
- package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/appLayout.tsx +27 -0
- package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/home.tsx +8 -0
- package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/index.tsx +10 -0
- package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/old-page.tsx +8 -0
- package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/routes.tsx +23 -0
- package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/styles/global.css +14 -0
- package/test/e2e/fixtures/basic-operations/dep-chain-linear/feature.ts +11 -0
- package/test/e2e/fixtures/basic-operations/dep-chain-linear/template/digitalExperiences/webApplications/dep-chain-linear/src/__inherit__appLayout.tsx +27 -0
- package/test/e2e/fixtures/basic-operations/dep-chain-linear/template/digitalExperiences/webApplications/dep-chain-linear/src/contact.tsx +8 -0
- package/test/e2e/fixtures/basic-operations/dep-chain-linear/template/digitalExperiences/webApplications/dep-chain-linear/src/routes.tsx +17 -0
- package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/feature.ts +10 -0
- package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/template/digitalExperiences/webApplications/feature-file-inherit-route-add/src/__inherit__appLayout.tsx +27 -0
- package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/template/digitalExperiences/webApplications/feature-file-inherit-route-add/src/__inherit__home.tsx +0 -0
- package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/template/digitalExperiences/webApplications/feature-file-inherit-route-add/src/about.tsx +8 -0
- package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/template/digitalExperiences/webApplications/feature-file-inherit-route-add/src/routes.tsx +17 -0
- package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/feature.ts +10 -0
- package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/__inherit__appLayout.tsx +27 -0
- package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/__prepend__index.tsx +2 -0
- package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/routes.tsx +17 -0
- package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/settings.tsx +9 -0
- package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/styles/__append__global.css +10 -0
- package/test/e2e/fixtures/basic-operations/feature-file-route-delete/feature.ts +10 -0
- package/test/e2e/fixtures/basic-operations/feature-file-route-delete/template/digitalExperiences/webApplications/feature-file-route-delete/src/__delete__old-page.tsx +2 -0
- package/test/e2e/fixtures/basic-operations/feature-file-route-delete/template/digitalExperiences/webApplications/feature-file-route-delete/src/__inherit__appLayout.tsx +27 -0
- package/test/e2e/fixtures/basic-operations/feature-file-route-delete/template/digitalExperiences/webApplications/feature-file-route-delete/src/routes.tsx +16 -0
- package/test/e2e/fixtures/composition-5-features/5-features-about/feature.ts +3 -0
- package/test/e2e/fixtures/composition-5-features/5-features-about/template/digitalExperiences/webApplications/5-features-about/src/about.tsx +8 -0
- package/test/e2e/fixtures/composition-5-features/5-features-about/template/digitalExperiences/webApplications/5-features-about/src/routes.tsx +17 -0
- package/test/e2e/fixtures/composition-5-features/5-features-analytics/feature.ts +3 -0
- package/test/e2e/fixtures/composition-5-features/5-features-analytics/template/digitalExperiences/webApplications/5-features-analytics/src/__prepend__index.tsx +2 -0
- package/test/e2e/fixtures/composition-5-features/5-features-footer/feature.ts +3 -0
- package/test/e2e/fixtures/composition-5-features/5-features-footer/template/digitalExperiences/webApplications/5-features-footer/src/footer.tsx +7 -0
- package/test/e2e/fixtures/composition-5-features/5-features-footer/template/digitalExperiences/webApplications/5-features-footer/src/routes.tsx +17 -0
- package/test/e2e/fixtures/composition-5-features/5-features-navigation/feature.ts +3 -0
- package/test/e2e/fixtures/composition-5-features/5-features-navigation/template/digitalExperiences/webApplications/5-features-navigation/src/navigation.tsx +7 -0
- package/test/e2e/fixtures/composition-5-features/5-features-navigation/template/digitalExperiences/webApplications/5-features-navigation/src/routes.tsx +17 -0
- package/test/e2e/fixtures/composition-5-features/5-features-theme/feature.ts +3 -0
- package/test/e2e/fixtures/composition-5-features/5-features-theme/template/digitalExperiences/webApplications/5-features-theme/src/styles/__append__global.css +5 -0
- package/test/e2e/fixtures/composition-append/composition-append-1/feature.ts +10 -0
- package/test/e2e/fixtures/composition-append/composition-append-1/template/digitalExperiences/webApplications/composition-append-1/src/styles/__append__global.css +4 -0
- package/test/e2e/fixtures/composition-append/composition-append-2/feature.ts +10 -0
- package/test/e2e/fixtures/composition-append/composition-append-2/template/digitalExperiences/webApplications/composition-append-2/src/styles/__append__global.css +4 -0
- package/test/e2e/fixtures/composition-append/composition-append-3/feature.ts +10 -0
- package/test/e2e/fixtures/composition-append/composition-append-3/template/digitalExperiences/webApplications/composition-append-3/src/styles/__append__global.css +4 -0
- package/test/e2e/fixtures/composition-inherit-modify/composition-inherit-layout/feature.ts +3 -0
- package/test/e2e/fixtures/composition-inherit-modify/composition-inherit-layout/template/digitalExperiences/webApplications/composition-inherit-layout/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/composition-inherit-modify/composition-modify-layout/feature.ts +3 -0
- package/test/e2e/fixtures/composition-inherit-modify/composition-modify-layout/template/digitalExperiences/webApplications/composition-modify-layout/src/__append__appLayout.tsx +2 -0
- package/test/e2e/fixtures/composition-prepend/composition-prepend-1/feature.ts +10 -0
- package/test/e2e/fixtures/composition-prepend/composition-prepend-1/template/digitalExperiences/webApplications/composition-prepend-1/src/__prepend__index.tsx +2 -0
- package/test/e2e/fixtures/composition-prepend/composition-prepend-2/feature.ts +10 -0
- package/test/e2e/fixtures/composition-prepend/composition-prepend-2/template/digitalExperiences/webApplications/composition-prepend-2/src/__prepend__index.tsx +2 -0
- package/test/e2e/fixtures/composition-prepend/composition-prepend-3/feature.ts +10 -0
- package/test/e2e/fixtures/composition-prepend/composition-prepend-3/template/digitalExperiences/webApplications/composition-prepend-3/src/__prepend__index.tsx +2 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-a/feature.ts +11 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-a/template/digitalExperiences/webApplications/dep-chain-a/src/page-a.tsx +8 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-a/template/digitalExperiences/webApplications/dep-chain-a/src/routes.tsx +17 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-b/feature.ts +11 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-b/template/digitalExperiences/webApplications/dep-chain-b/src/page-b.tsx +8 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-b/template/digitalExperiences/webApplications/dep-chain-b/src/routes.tsx +17 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-c/feature.ts +11 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-c/template/digitalExperiences/webApplications/dep-chain-c/src/page-c.tsx +8 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-c/template/digitalExperiences/webApplications/dep-chain-c/src/routes.tsx +17 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-d/feature.ts +10 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-d/template/digitalExperiences/webApplications/dep-chain-d/src/page-d.tsx +8 -0
- package/test/e2e/fixtures/dep-chain-long/dep-chain-d/template/digitalExperiences/webApplications/dep-chain-d/src/routes.tsx +17 -0
- package/test/e2e/fixtures/dep-circular/dep-circular-a/feature.ts +11 -0
- package/test/e2e/fixtures/dep-circular/dep-circular-a/template/digitalExperiences/webApplications/dep-circular-a/src/page-a.tsx +8 -0
- package/test/e2e/fixtures/dep-circular/dep-circular-b/feature.ts +11 -0
- package/test/e2e/fixtures/dep-circular/dep-circular-b/template/digitalExperiences/webApplications/dep-circular-b/src/page-b.tsx +8 -0
- package/test/e2e/fixtures/dep-complex-graph/README.md +119 -0
- package/test/e2e/fixtures/dep-complex-graph/create-placeholders.sh +25 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/feature.ts +14 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/__delete__old-page.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/login.tsx +8 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/routes.tsx +29 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/signup.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/feature.ts +14 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/analytics.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/dashboard.tsx +8 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/reports.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/routes.tsx +32 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/feature.ts +14 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/template/digitalExperiences/webApplications/dep-complex-graph-profile/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/template/digitalExperiences/webApplications/dep-complex-graph-profile/src/profile-edit.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/template/digitalExperiences/webApplications/dep-complex-graph-profile/src/profile.tsx +8 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/template/digitalExperiences/webApplications/dep-complex-graph-profile/src/routes.tsx +26 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-components/feature.ts +14 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-components/template/digitalExperiences/webApplications/dep-complex-graph-shared-components/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-components/template/digitalExperiences/webApplications/dep-complex-graph-shared-components/src/components.tsx +8 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-components/template/digitalExperiences/webApplications/dep-complex-graph-shared-components/src/routes.tsx +18 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-types/feature.ts +10 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-types/template/digitalExperiences/webApplications/dep-complex-graph-shared-types/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-types/template/digitalExperiences/webApplications/dep-complex-graph-shared-types/src/routes.tsx +17 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-types/template/digitalExperiences/webApplications/dep-complex-graph-shared-types/src/types.tsx +8 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-utils/feature.ts +10 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-utils/template/digitalExperiences/webApplications/dep-complex-graph-shared-utils/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-utils/template/digitalExperiences/webApplications/dep-complex-graph-shared-utils/src/routes.tsx +18 -0
- package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-utils/template/digitalExperiences/webApplications/dep-complex-graph-shared-utils/src/tools.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/feature.ts +15 -0
- package/test/e2e/fixtures/dep-complex-graph/template/digitalExperiences/webApplications/dep-complex-graph/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/template/digitalExperiences/webApplications/dep-complex-graph/src/admin-dashboard.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/template/digitalExperiences/webApplications/dep-complex-graph/src/admin-layout.tsx +1 -0
- package/test/e2e/fixtures/dep-complex-graph/template/digitalExperiences/webApplications/dep-complex-graph/src/routes.tsx +24 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-left/feature.ts +11 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-left/template/digitalExperiences/webApplications/dep-diamond-left/src/left-page.tsx +8 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-left/template/digitalExperiences/webApplications/dep-diamond-left/src/routes.tsx +17 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-right/feature.ts +11 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-right/template/digitalExperiences/webApplications/dep-diamond-right/src/right-page.tsx +8 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-right/template/digitalExperiences/webApplications/dep-diamond-right/src/routes.tsx +17 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-shared/feature.ts +10 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-shared/template/digitalExperiences/webApplications/dep-diamond-shared/src/routes.tsx +17 -0
- package/test/e2e/fixtures/dep-diamond/dep-diamond-shared/template/digitalExperiences/webApplications/dep-diamond-shared/src/shared-utils.tsx +8 -0
- package/test/e2e/fixtures/edges/edge-binary-files/feature.ts +13 -0
- package/test/e2e/fixtures/edges/edge-binary-files/template/digitalExperiences/webApplications/edge-binary-files/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/edges/edge-binary-files/template/digitalExperiences/webApplications/edge-binary-files/src/assets/test-image.png +0 -0
- package/test/e2e/fixtures/edges/edge-binary-files/template/digitalExperiences/webApplications/edge-binary-files/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/edges/edge-conflicting-prefixes/feature.ts +13 -0
- package/test/e2e/fixtures/edges/edge-conflicting-prefixes/template/digitalExperiences/webApplications/edge-conflicting-prefixes/src/__inherit____delete__conflicting.tsx +5 -0
- package/test/e2e/fixtures/edges/edge-conflicting-prefixes/template/digitalExperiences/webApplications/edge-conflicting-prefixes/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/edges/edge-empty-feature/feature.ts +16 -0
- package/test/e2e/fixtures/edges/edge-empty-feature/template/digitalExperiences/webApplications/edge-empty-feature/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/edges/edge-invalid-routes/feature.ts +12 -0
- package/test/e2e/fixtures/edges/edge-invalid-routes/template/digitalExperiences/webApplications/edge-invalid-routes/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/edges/edge-invalid-routes/template/digitalExperiences/webApplications/edge-invalid-routes/src/routes.tsx +8 -0
- package/test/e2e/fixtures/edges/edge-line-endings/feature.ts +13 -0
- package/test/e2e/fixtures/edges/edge-line-endings/template/digitalExperiences/webApplications/edge-line-endings/src/__prepend__index.tsx +2 -0
- package/test/e2e/fixtures/edges/edge-line-endings/template/digitalExperiences/webApplications/edge-line-endings/src/crlf.tsx +4 -0
- package/test/e2e/fixtures/edges/edge-line-endings/template/digitalExperiences/webApplications/edge-line-endings/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/edges/edge-line-endings/template/digitalExperiences/webApplications/edge-line-endings/src/styles/__append__global.css +4 -0
- package/test/e2e/fixtures/edges/edge-missing-base-files/feature.ts +13 -0
- package/test/e2e/fixtures/edges/edge-missing-base-files/template/digitalExperiences/webApplications/edge-missing-base-files/src/__inherit__missing.tsx +1 -0
- package/test/e2e/fixtures/edges/edge-missing-base-files/template/digitalExperiences/webApplications/edge-missing-base-files/src/__prepend__nonexistent.tsx +2 -0
- package/test/e2e/fixtures/edges/edge-missing-base-files/template/digitalExperiences/webApplications/edge-missing-base-files/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/edges/edge-package-json-conflicts-a/feature.ts +14 -0
- package/test/e2e/fixtures/edges/edge-package-json-conflicts-a/template/digitalExperiences/webApplications/edge-package-json-conflicts-a/src/placeholder.tsx +1 -0
- package/test/e2e/fixtures/edges/edge-package-json-conflicts-b/feature.ts +14 -0
- package/test/e2e/fixtures/edges/edge-package-json-conflicts-b/template/digitalExperiences/webApplications/edge-package-json-conflicts-b/src/placeholder.tsx +1 -0
- package/test/e2e/fixtures/edges/edge-performance-many/feature.ts +26 -0
- package/test/e2e/fixtures/edges/edge-performance-many/template/digitalExperiences/webApplications/edge-performance-many/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/path-mappings/feature-custom-mapping/feature.ts +16 -0
- package/test/e2e/fixtures/path-mappings/feature-custom-mapping/template/web/src/custom-component.tsx +3 -0
- package/test/e2e/fixtures/path-mappings/feature-custom-mapping/template/web/src/routes.tsx +8 -0
- package/test/e2e/fixtures/path-mappings/feature-mixed-paths/feature.ts +7 -0
- package/test/e2e/fixtures/path-mappings/feature-mixed-paths/template/digitalExperiences/webApplications/feature-mixed-paths/assets/icon.svg +3 -0
- package/test/e2e/fixtures/path-mappings/feature-mixed-paths/template/webApp/src/mapped-component.tsx +3 -0
- package/test/e2e/fixtures/path-mappings/feature-mixed-paths/template/webApp/src/routes.tsx +8 -0
- package/test/e2e/fixtures/path-mappings/feature-with-webapp-mapping/feature.ts +7 -0
- package/test/e2e/fixtures/path-mappings/feature-with-webapp-mapping/template/webApp/src/app.tsx +3 -0
- package/test/e2e/fixtures/path-mappings/feature-with-webapp-mapping/template/webApp/src/routes.tsx +8 -0
- package/test/e2e/fixtures/path-mappings/feature-without-mapping/feature.ts +11 -0
- package/test/e2e/fixtures/path-mappings/feature-without-mapping/template/digitalExperiences/webApplications/feature-without-mapping/src/legacy-component.tsx +3 -0
- package/test/e2e/fixtures/path-mappings/feature-without-mapping/template/digitalExperiences/webApplications/feature-without-mapping/src/routes.tsx +8 -0
- package/test/e2e/fixtures/scenarios/scenario-authentication/feature.ts +10 -0
- package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/components/LoginForm.tsx +25 -0
- package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/context/AuthContext.tsx +28 -0
- package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/login.tsx +10 -0
- package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/routes.tsx +17 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/feature.ts +11 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/components/ContactDetail.tsx +54 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/components/ContactForm.tsx +146 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/components/ContactList.tsx +77 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/routes.tsx +36 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/styles/__append__global.css +176 -0
- package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/utils/contactsApi.ts +42 -0
- package/test/e2e/fixtures/scenarios/scenario-navigation-menu/feature.ts +10 -0
- package/test/e2e/fixtures/scenarios/scenario-navigation-menu/template/digitalExperiences/webApplications/scenario-navigation-menu/src/__append__appLayout.tsx +4 -0
- package/test/e2e/fixtures/scenarios/scenario-navigation-menu/template/digitalExperiences/webApplications/scenario-navigation-menu/src/components/NavigationMenu.tsx +17 -0
- package/test/e2e/fixtures/scenarios/scenario-navigation-menu/template/digitalExperiences/webApplications/scenario-navigation-menu/src/placeholder.tsx +0 -0
- package/test/e2e/fixtures/single-operations/feature-file-append/feature.ts +10 -0
- package/test/e2e/fixtures/single-operations/feature-file-append/template/digitalExperiences/webApplications/feature-file-append/src/styles/__append__global.css +10 -0
- package/test/e2e/fixtures/single-operations/feature-file-inherit/feature.ts +10 -0
- package/test/e2e/fixtures/single-operations/feature-file-inherit/template/digitalExperiences/webApplications/feature-file-inherit/src/__inherit__appLayout.tsx +1 -0
- package/test/e2e/fixtures/single-operations/feature-file-inherit/template/digitalExperiences/webApplications/feature-file-inherit/src/__inherit__home.tsx +1 -0
- package/test/e2e/fixtures/single-operations/feature-file-prepend/feature.ts +10 -0
- package/test/e2e/fixtures/single-operations/feature-file-prepend/template/digitalExperiences/webApplications/feature-file-prepend/src/__prepend__index.tsx +2 -0
- package/test/e2e/fixtures/single-operations/feature-import-merge/feature.ts +10 -0
- package/test/e2e/fixtures/single-operations/feature-import-merge/template/digitalExperiences/webApplications/feature-import-merge/src/routes.tsx +18 -0
- package/test/e2e/fixtures/single-operations/feature-import-merge/template/digitalExperiences/webApplications/feature-import-merge/src/settings.tsx +8 -0
- package/test/e2e/fixtures/single-operations/feature-route-add/feature.ts +10 -0
- package/test/e2e/fixtures/single-operations/feature-route-add/template/digitalExperiences/webApplications/feature-route-add/src/about.tsx +8 -0
- package/test/e2e/fixtures/single-operations/feature-route-add/template/digitalExperiences/webApplications/feature-route-add/src/routes.tsx +23 -0
- package/test/e2e/fixtures/single-operations/feature-route-add/template/digitalExperiences/webApplications/feature-route-add/src/services.tsx +8 -0
- package/test/e2e/fixtures/watch/watch-add-delete-files/feature.ts +13 -0
- package/test/e2e/fixtures/watch/watch-add-delete-files/template/digitalExperiences/webApplications/watch-add-delete-files/src/initial.tsx +4 -0
- package/test/e2e/fixtures/watch/watch-add-delete-files/template/digitalExperiences/webApplications/watch-add-delete-files/src/placeholder.tsx +4 -0
- package/test/e2e/fixtures/watch/watch-basic/feature.ts +13 -0
- package/test/e2e/fixtures/watch/watch-basic/template/digitalExperiences/webApplications/watch-basic/src/placeholder.tsx +4 -0
- package/test/e2e/fixtures/watch/watch-basic/template/digitalExperiences/webApplications/watch-basic/src/watchTest.tsx +3 -0
- package/test/e2e/fixtures/watch/watch-debounce/feature.ts +13 -0
- package/test/e2e/fixtures/watch/watch-debounce/template/digitalExperiences/webApplications/watch-debounce/src/placeholder.tsx +4 -0
- package/test/e2e/fixtures/watch/watch-multiple-files/feature.ts +13 -0
- package/test/e2e/fixtures/watch/watch-multiple-files/template/digitalExperiences/webApplications/watch-multiple-files/src/components/WatchComponent.tsx +3 -0
- package/test/e2e/fixtures/watch/watch-multiple-files/template/digitalExperiences/webApplications/watch-multiple-files/src/placeholder.tsx +4 -0
- package/test/e2e/fixtures/watch/watch-multiple-files/template/digitalExperiences/webApplications/watch-multiple-files/src/styles/theme.css +4 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/package.json +10 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/about.tsx +8 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/appLayout.tsx +27 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/contact.tsx +8 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/home.tsx +8 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/index.tsx +10 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/old-page.tsx +8 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/routes.tsx +35 -0
- package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/styles/global.css +14 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/package.json +10 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/appLayout.tsx +27 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/home.tsx +8 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/index.tsx +10 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/old-page.tsx +8 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/page-a.tsx +8 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/page-b.tsx +8 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/page-c.tsx +8 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/page-d.tsx +8 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/routes.tsx +47 -0
- package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/styles/global.css +14 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/package.json +10 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/admin-dashboard.tsx +1 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/admin-layout.tsx +1 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/analytics.tsx +1 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/appLayout.tsx +27 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/components.tsx +8 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/dashboard.tsx +8 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/home.tsx +8 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/index.tsx +10 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/login.tsx +8 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/profile-edit.tsx +1 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/profile.tsx +8 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/reports.tsx +1 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/routes.tsx +94 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/signup.tsx +1 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/styles/global.css +14 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/tools.tsx +1 -0
- package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/types.tsx +8 -0
- package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/package.json +10 -0
- package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/appLayout.tsx +27 -0
- package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/custom-component.tsx +3 -0
- package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/home.tsx +8 -0
- package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/index.tsx +10 -0
- package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/old-page.tsx +8 -0
- package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/routes.tsx +28 -0
- package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/styles/global.css +14 -0
- package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/package.json +10 -0
- package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/about.tsx +8 -0
- package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/appLayout.tsx +27 -0
- package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/home.tsx +8 -0
- package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/index.tsx +10 -0
- package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/old-page.tsx +8 -0
- package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/routes.tsx +29 -0
- package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/styles/global.css +14 -0
- package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/package.json +10 -0
- package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/appLayout.tsx +27 -0
- package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/home.tsx +8 -0
- package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/index.tsx +13 -0
- package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/old-page.tsx +8 -0
- package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/routes.tsx +29 -0
- package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/settings.tsx +9 -0
- package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/styles/global.css +25 -0
- package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/package.json +10 -0
- package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/appLayout.tsx +27 -0
- package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/home.tsx +8 -0
- package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/index.tsx +10 -0
- package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/routes.tsx +17 -0
- package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/styles/global.css +14 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/assets/icon.svg +3 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/package.json +10 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/appLayout.tsx +27 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/home.tsx +8 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/index.tsx +10 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/mapped-component.tsx +3 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/old-page.tsx +8 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/routes.tsx +28 -0
- package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/styles/global.css +14 -0
- package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/package.json +10 -0
- package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/app.tsx +3 -0
- package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/appLayout.tsx +27 -0
- package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/home.tsx +8 -0
- package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/index.tsx +10 -0
- package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/old-page.tsx +8 -0
- package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/routes.tsx +28 -0
- package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/styles/global.css +14 -0
- package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/package.json +10 -0
- package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/appLayout.tsx +27 -0
- package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/home.tsx +8 -0
- package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/index.tsx +10 -0
- package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/legacy-component.tsx +3 -0
- package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/old-page.tsx +8 -0
- package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/routes.tsx +28 -0
- package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/styles/global.css +14 -0
- package/test/e2e/path-mappings.spec.ts +232 -0
- package/test/e2e/watch-patches.spec.ts +237 -0
- package/test/helpers/cli-runner.ts +100 -0
- package/test/helpers/compare-directories.ts +197 -0
- package/test/helpers/create-temp-dir.ts +34 -0
- package/test/helpers/fixtures.ts +67 -0
- package/test/setup.ts +6 -0
- package/test/unit/debounce.spec.ts +159 -0
- package/test/unit/dependency-resolver.spec.ts +260 -0
- package/test/unit/file-operations.spec.ts +264 -0
- package/test/unit/import-merger.spec.ts +395 -0
- package/test/unit/index.spec.ts +158 -0
- package/test/unit/new-app.spec.ts +178 -0
- package/test/unit/new-feature.spec.ts +178 -0
- package/test/unit/package-json-merger.spec.ts +275 -0
- package/test/unit/patch-loader.spec.ts +238 -0
- package/test/unit/path-mappings.spec.ts +241 -0
- package/test/unit/paths.spec.ts +247 -0
- package/test/unit/route-merger.spec.ts +265 -0
- package/test/unit/validation.spec.ts +311 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +18 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { join, dirname, basename } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
/**
|
|
5
|
+
* Find the monorepo root by searching upward for package.json with workspaces
|
|
6
|
+
*/
|
|
7
|
+
export function getMonorepoRoot() {
|
|
8
|
+
let currentDir = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
while (currentDir !== '/') {
|
|
10
|
+
const packageJsonPath = join(currentDir, 'package.json');
|
|
11
|
+
if (existsSync(packageJsonPath)) {
|
|
12
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
13
|
+
if (packageJson.workspaces) {
|
|
14
|
+
return currentDir;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
currentDir = dirname(currentDir);
|
|
18
|
+
}
|
|
19
|
+
throw new Error('Could not find monorepo root (package.json with workspaces)');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the features directory path
|
|
23
|
+
*/
|
|
24
|
+
export function getFeaturesDir() {
|
|
25
|
+
return join(getMonorepoRoot(), 'packages', 'features');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the directory path for a specific feature
|
|
29
|
+
*/
|
|
30
|
+
export function getFeatureDir(featureName) {
|
|
31
|
+
return join(getFeaturesDir(), featureName);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a file path within a feature
|
|
35
|
+
*/
|
|
36
|
+
export function resolveFeatureFile(featureName, filePath) {
|
|
37
|
+
return join(getFeatureDir(featureName), filePath);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Translate a feature file path to the corresponding base app path
|
|
41
|
+
* Replaces feature name with base app name in the nested structure
|
|
42
|
+
*
|
|
43
|
+
* Handles three formats:
|
|
44
|
+
* 1. Full path: "digitalExperiences/webApplications/feature-simple/src/routes.tsx"
|
|
45
|
+
* → "digitalExperiences/webApplications/base-app/src/routes.tsx"
|
|
46
|
+
* 2. WebApp path: "webApp/src/routes.tsx"
|
|
47
|
+
* → "digitalExperiences/webApplications/base-app/src/routes.tsx"
|
|
48
|
+
* 3. Other SFDX paths: "classes/NavMenu.cls"
|
|
49
|
+
* → "classes/NavMenu.cls" (unchanged, stays at root)
|
|
50
|
+
*/
|
|
51
|
+
export function translatePathToBaseApp(featurePath, featureName, baseAppPath) {
|
|
52
|
+
// Extract base app name from base app path (last directory component)
|
|
53
|
+
const baseAppName = basename(baseAppPath);
|
|
54
|
+
// Pattern: digitalExperiences/webApplications/<feature-name>/...
|
|
55
|
+
const prefix = 'digitalExperiences/webApplications/';
|
|
56
|
+
if (featurePath.startsWith(prefix)) {
|
|
57
|
+
// Full path format - remove prefix to get: <feature-name>/...
|
|
58
|
+
const remainder = featurePath.substring(prefix.length);
|
|
59
|
+
// Check if it starts with the feature name
|
|
60
|
+
if (remainder.startsWith(featureName + '/')) {
|
|
61
|
+
// Replace feature name with base app name
|
|
62
|
+
const pathAfterFeatureName = remainder.substring(featureName.length + 1);
|
|
63
|
+
return `${prefix}${baseAppName}/${pathAfterFeatureName}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else if (featurePath.startsWith('webApp/')) {
|
|
67
|
+
// WebApp path - strip webApp/ prefix and add full digitalExperiences path
|
|
68
|
+
const pathAfterWebApp = featurePath.substring('webApp/'.length);
|
|
69
|
+
return `${prefix}${baseAppName}/${pathAfterWebApp}`;
|
|
70
|
+
}
|
|
71
|
+
// All other paths (SFDX metadata, etc.) - return as is (stays at root level)
|
|
72
|
+
return featurePath;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Translate a feature file path to use a target app name
|
|
76
|
+
* Replaces feature name with target app name in the nested structure
|
|
77
|
+
*
|
|
78
|
+
* Handles three formats:
|
|
79
|
+
* 1. Full path: "digitalExperiences/webApplications/feature-simple/src/routes.tsx"
|
|
80
|
+
* → "digitalExperiences/webApplications/target-app/src/routes.tsx"
|
|
81
|
+
* 2. WebApp path: "webApp/src/routes.tsx"
|
|
82
|
+
* → "digitalExperiences/webApplications/target-app/src/routes.tsx"
|
|
83
|
+
* 3. Other SFDX paths: "classes/NavMenu.cls"
|
|
84
|
+
* → "classes/NavMenu.cls" (unchanged, stays at root)
|
|
85
|
+
*/
|
|
86
|
+
export function translatePathToTargetApp(featurePath, featureName, targetAppName) {
|
|
87
|
+
// Pattern: digitalExperiences/webApplications/<feature-name>/...
|
|
88
|
+
const prefix = 'digitalExperiences/webApplications/';
|
|
89
|
+
if (featurePath.startsWith(prefix)) {
|
|
90
|
+
// Full path format - remove prefix to get: <feature-name>/...
|
|
91
|
+
const remainder = featurePath.substring(prefix.length);
|
|
92
|
+
// Check if it starts with the feature name
|
|
93
|
+
if (remainder.startsWith(featureName + '/')) {
|
|
94
|
+
// Replace feature name with target app name
|
|
95
|
+
const pathAfterFeatureName = remainder.substring(featureName.length + 1);
|
|
96
|
+
return `${prefix}${targetAppName}/${pathAfterFeatureName}`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else if (featurePath.startsWith('webApp/')) {
|
|
100
|
+
// WebApp path - strip webApp/ prefix and add full digitalExperiences path
|
|
101
|
+
const pathAfterWebApp = featurePath.substring('webApp/'.length);
|
|
102
|
+
return `${prefix}${targetAppName}/${pathAfterWebApp}`;
|
|
103
|
+
}
|
|
104
|
+
// All other paths (SFDX metadata, etc.) - return as is (stays at root level)
|
|
105
|
+
return featurePath;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,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,oBAAoB,EAAE,CAAC;QAC7D,CAAC;IACH,CAAC;SAAM,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7C,0EAA0E;QAC1E,MAAM,eAAe,GAAG,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChE,OAAO,GAAG,MAAM,GAAG,aAAa,IAAI,eAAe,EAAE,CAAC;IACxD,CAAC;IAED,6EAA6E;IAC7E,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Project } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Route Merging Strategy: Replace-Matching with Deep Children Merge
|
|
4
|
+
*
|
|
5
|
+
* This function merges React Router routes from a feature into a base app using
|
|
6
|
+
* a "replace-matching" strategy with intelligent children array merging.
|
|
7
|
+
*
|
|
8
|
+
* ## How It Works:
|
|
9
|
+
*
|
|
10
|
+
* 1. **Top-Level Routes:**
|
|
11
|
+
* - Routes with the SAME path → Merge their children arrays
|
|
12
|
+
* - Routes with DIFFERENT paths → Add feature route to result
|
|
13
|
+
*
|
|
14
|
+
* 2. **Children Array Merging (when parent paths match):**
|
|
15
|
+
* - Index routes (`index: true`) → Feature replaces base if both exist
|
|
16
|
+
* - Named routes (`path: 'about'`) → Feature replaces base if paths match
|
|
17
|
+
* - New routes → Added to children array
|
|
18
|
+
* - Preserves base routes not in feature
|
|
19
|
+
*
|
|
20
|
+
* 3. **Route Deletion:**
|
|
21
|
+
* - Routes with path starting with `__delete__` are deletion markers
|
|
22
|
+
* - The route with matching path (without prefix) is removed from result
|
|
23
|
+
* - Example: `{ path: '__delete__new' }` removes the route with `path: 'new'`
|
|
24
|
+
*
|
|
25
|
+
* 4. **Recursion:**
|
|
26
|
+
* - Applies same logic to nested children arrays
|
|
27
|
+
*
|
|
28
|
+
* ## Example:
|
|
29
|
+
*
|
|
30
|
+
* **Base App Routes:**
|
|
31
|
+
* ```typescript
|
|
32
|
+
* [{
|
|
33
|
+
* path: '/',
|
|
34
|
+
* element: <AppLayout />,
|
|
35
|
+
* children: [
|
|
36
|
+
* { index: true, element: <Home /> }
|
|
37
|
+
* ]
|
|
38
|
+
* }]
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* **Feature Routes:**
|
|
42
|
+
* ```typescript
|
|
43
|
+
* [{
|
|
44
|
+
* path: '/',
|
|
45
|
+
* element: <AppLayout />,
|
|
46
|
+
* children: [
|
|
47
|
+
* { path: 'about', element: <About /> },
|
|
48
|
+
* { path: 'contact', element: <Contact /> }
|
|
49
|
+
* ]
|
|
50
|
+
* }]
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* **Merged Result:**
|
|
54
|
+
* ```typescript
|
|
55
|
+
* [{
|
|
56
|
+
* path: '/',
|
|
57
|
+
* element: <AppLayout />, // Uses feature's element
|
|
58
|
+
* children: [
|
|
59
|
+
* { index: true, element: <Home /> }, // Preserved from base
|
|
60
|
+
* { path: 'about', element: <About /> }, // Added from feature
|
|
61
|
+
* { path: 'contact', element: <Contact /> } // Added from feature
|
|
62
|
+
* ]
|
|
63
|
+
* }]
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* ## Deletion Example:
|
|
67
|
+
*
|
|
68
|
+
* **Base/Previous Routes:**
|
|
69
|
+
* ```typescript
|
|
70
|
+
* [{
|
|
71
|
+
* path: '/',
|
|
72
|
+
* children: [
|
|
73
|
+
* { path: 'home', element: <Home /> },
|
|
74
|
+
* { path: 'about', element: <About /> },
|
|
75
|
+
* { path: 'new', element: <New /> }
|
|
76
|
+
* ]
|
|
77
|
+
* }]
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* **Feature Routes (deleting 'new'):**
|
|
81
|
+
* ```typescript
|
|
82
|
+
* [{
|
|
83
|
+
* path: '/',
|
|
84
|
+
* children: [
|
|
85
|
+
* { path: '__delete__new', element: <></> }
|
|
86
|
+
* ]
|
|
87
|
+
* }]
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* **Merged Result:**
|
|
91
|
+
* ```typescript
|
|
92
|
+
* [{
|
|
93
|
+
* path: '/',
|
|
94
|
+
* children: [
|
|
95
|
+
* { path: 'home', element: <Home /> }, // Preserved
|
|
96
|
+
* { path: 'about', element: <About /> } // Preserved
|
|
97
|
+
* // 'new' route removed
|
|
98
|
+
* ]
|
|
99
|
+
* }]
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @param featurePath - Path to the feature's routes.tsx file
|
|
103
|
+
* @param targetPath - Path to the base app's routes.tsx file
|
|
104
|
+
* @returns The merged routes source code
|
|
105
|
+
*/
|
|
106
|
+
export declare function mergeRoutes(featurePath: string, targetPath: string, project?: Project): string;
|
|
107
|
+
//# sourceMappingURL=route-merger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-merger.d.ts","sourceRoot":"","sources":["../../src/utils/route-merger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA4C,MAAM,UAAU,CAAC;AAiB7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuGG;AACH,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,GAChB,MAAM,CAuDR"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import * as logger from './logger.js';
|
|
2
|
+
import { Project, ArrayLiteralExpression, Node } from 'ts-morph';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { mergeImports } from './import-merger.js';
|
|
5
|
+
/**
|
|
6
|
+
* Route Merging Strategy: Replace-Matching with Deep Children Merge
|
|
7
|
+
*
|
|
8
|
+
* This function merges React Router routes from a feature into a base app using
|
|
9
|
+
* a "replace-matching" strategy with intelligent children array merging.
|
|
10
|
+
*
|
|
11
|
+
* ## How It Works:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Top-Level Routes:**
|
|
14
|
+
* - Routes with the SAME path → Merge their children arrays
|
|
15
|
+
* - Routes with DIFFERENT paths → Add feature route to result
|
|
16
|
+
*
|
|
17
|
+
* 2. **Children Array Merging (when parent paths match):**
|
|
18
|
+
* - Index routes (`index: true`) → Feature replaces base if both exist
|
|
19
|
+
* - Named routes (`path: 'about'`) → Feature replaces base if paths match
|
|
20
|
+
* - New routes → Added to children array
|
|
21
|
+
* - Preserves base routes not in feature
|
|
22
|
+
*
|
|
23
|
+
* 3. **Route Deletion:**
|
|
24
|
+
* - Routes with path starting with `__delete__` are deletion markers
|
|
25
|
+
* - The route with matching path (without prefix) is removed from result
|
|
26
|
+
* - Example: `{ path: '__delete__new' }` removes the route with `path: 'new'`
|
|
27
|
+
*
|
|
28
|
+
* 4. **Recursion:**
|
|
29
|
+
* - Applies same logic to nested children arrays
|
|
30
|
+
*
|
|
31
|
+
* ## Example:
|
|
32
|
+
*
|
|
33
|
+
* **Base App Routes:**
|
|
34
|
+
* ```typescript
|
|
35
|
+
* [{
|
|
36
|
+
* path: '/',
|
|
37
|
+
* element: <AppLayout />,
|
|
38
|
+
* children: [
|
|
39
|
+
* { index: true, element: <Home /> }
|
|
40
|
+
* ]
|
|
41
|
+
* }]
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* **Feature Routes:**
|
|
45
|
+
* ```typescript
|
|
46
|
+
* [{
|
|
47
|
+
* path: '/',
|
|
48
|
+
* element: <AppLayout />,
|
|
49
|
+
* children: [
|
|
50
|
+
* { path: 'about', element: <About /> },
|
|
51
|
+
* { path: 'contact', element: <Contact /> }
|
|
52
|
+
* ]
|
|
53
|
+
* }]
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* **Merged Result:**
|
|
57
|
+
* ```typescript
|
|
58
|
+
* [{
|
|
59
|
+
* path: '/',
|
|
60
|
+
* element: <AppLayout />, // Uses feature's element
|
|
61
|
+
* children: [
|
|
62
|
+
* { index: true, element: <Home /> }, // Preserved from base
|
|
63
|
+
* { path: 'about', element: <About /> }, // Added from feature
|
|
64
|
+
* { path: 'contact', element: <Contact /> } // Added from feature
|
|
65
|
+
* ]
|
|
66
|
+
* }]
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* ## Deletion Example:
|
|
70
|
+
*
|
|
71
|
+
* **Base/Previous Routes:**
|
|
72
|
+
* ```typescript
|
|
73
|
+
* [{
|
|
74
|
+
* path: '/',
|
|
75
|
+
* children: [
|
|
76
|
+
* { path: 'home', element: <Home /> },
|
|
77
|
+
* { path: 'about', element: <About /> },
|
|
78
|
+
* { path: 'new', element: <New /> }
|
|
79
|
+
* ]
|
|
80
|
+
* }]
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* **Feature Routes (deleting 'new'):**
|
|
84
|
+
* ```typescript
|
|
85
|
+
* [{
|
|
86
|
+
* path: '/',
|
|
87
|
+
* children: [
|
|
88
|
+
* { path: '__delete__new', element: <></> }
|
|
89
|
+
* ]
|
|
90
|
+
* }]
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* **Merged Result:**
|
|
94
|
+
* ```typescript
|
|
95
|
+
* [{
|
|
96
|
+
* path: '/',
|
|
97
|
+
* children: [
|
|
98
|
+
* { path: 'home', element: <Home /> }, // Preserved
|
|
99
|
+
* { path: 'about', element: <About /> } // Preserved
|
|
100
|
+
* // 'new' route removed
|
|
101
|
+
* ]
|
|
102
|
+
* }]
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param featurePath - Path to the feature's routes.tsx file
|
|
106
|
+
* @param targetPath - Path to the base app's routes.tsx file
|
|
107
|
+
* @returns The merged routes source code
|
|
108
|
+
*/
|
|
109
|
+
export function mergeRoutes(featurePath, targetPath, project) {
|
|
110
|
+
try {
|
|
111
|
+
const proj = project || new Project();
|
|
112
|
+
const targetFile = project
|
|
113
|
+
? proj.getSourceFile(targetPath) || proj.addSourceFileAtPath(path.resolve(targetPath))
|
|
114
|
+
: proj.addSourceFileAtPath(path.resolve(targetPath));
|
|
115
|
+
const featureFile = project
|
|
116
|
+
? proj.getSourceFile(featurePath) || proj.addSourceFileAtPath(path.resolve(featurePath))
|
|
117
|
+
: proj.addSourceFileAtPath(path.resolve(featurePath));
|
|
118
|
+
// Get initial routes arrays to validate they exist
|
|
119
|
+
const initialTargetArray = getRoutesArrayLiteral(targetFile, 'routes');
|
|
120
|
+
const initialFeatureArray = getRoutesArrayLiteral(featureFile, 'routes');
|
|
121
|
+
if (!initialTargetArray) {
|
|
122
|
+
logger.warning('Could not extract routes array from target file');
|
|
123
|
+
return featureFile.getText();
|
|
124
|
+
}
|
|
125
|
+
if (!initialFeatureArray) {
|
|
126
|
+
logger.warning('Could not extract routes array from feature file');
|
|
127
|
+
return targetFile.getText();
|
|
128
|
+
}
|
|
129
|
+
// Merge imports from feature file into target file
|
|
130
|
+
// Note: This calls organizeImports() which invalidates AST node references
|
|
131
|
+
mergeImports(featureFile, targetFile);
|
|
132
|
+
// Re-get routes arrays after import merging (organizeImports invalidates previous references)
|
|
133
|
+
const targetArray = getRoutesArrayLiteral(targetFile, 'routes');
|
|
134
|
+
const featureArray = getRoutesArrayLiteral(featureFile, 'routes');
|
|
135
|
+
if (!targetArray || !featureArray) {
|
|
136
|
+
logger.error('Routes array was lost after import merging');
|
|
137
|
+
throw new Error('Failed to re-acquire routes arrays after import merging');
|
|
138
|
+
}
|
|
139
|
+
// Parse arrays to RouteObject[]
|
|
140
|
+
const targetRoutes = parseRoutesFromAST(targetArray);
|
|
141
|
+
const featureRoutes = parseRoutesFromAST(featureArray);
|
|
142
|
+
// Deep merge the routes
|
|
143
|
+
const mergedRoutes = deepMergeRoutes(targetRoutes, featureRoutes);
|
|
144
|
+
// Convert back to code and update the target
|
|
145
|
+
const mergedCode = generateRoutesCode(mergedRoutes);
|
|
146
|
+
targetArray.replaceWithText(mergedCode);
|
|
147
|
+
return targetFile.getText();
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
logger.error(`Route merge failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
151
|
+
throw new Error('Failed to merge routes');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get the array literal expression for the routes variable
|
|
156
|
+
*/
|
|
157
|
+
function getRoutesArrayLiteral(file, varName) {
|
|
158
|
+
const variable = file.getVariableDeclaration(varName);
|
|
159
|
+
if (!variable) {
|
|
160
|
+
logger.warning(`Variable "${varName}" not found in ${file.getFilePath()}`);
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
const initializer = variable.getInitializer();
|
|
164
|
+
if (!initializer || !ArrayLiteralExpression.isArrayLiteralExpression(initializer)) {
|
|
165
|
+
logger.warning(`Variable "${varName}" is not initialized with an array literal`);
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
return initializer;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Parse routes from AST ArrayLiteralExpression to RouteObject[]
|
|
172
|
+
*/
|
|
173
|
+
function parseRoutesFromAST(arrayLiteral) {
|
|
174
|
+
const routes = [];
|
|
175
|
+
for (const element of arrayLiteral.getElements()) {
|
|
176
|
+
if (Node.isObjectLiteralExpression(element)) {
|
|
177
|
+
const route = {};
|
|
178
|
+
for (const prop of element.getProperties()) {
|
|
179
|
+
if (Node.isPropertyAssignment(prop)) {
|
|
180
|
+
const name = prop.getName();
|
|
181
|
+
const initializer = prop.getInitializer();
|
|
182
|
+
if (!initializer)
|
|
183
|
+
continue;
|
|
184
|
+
if (name === 'children' && Node.isArrayLiteralExpression(initializer)) {
|
|
185
|
+
// Recursively parse children
|
|
186
|
+
route.children = parseRoutesFromAST(initializer);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// Store the raw text for other properties
|
|
190
|
+
route[name] = initializer.getText();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
routes.push(route);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return routes;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Deep merge two route arrays
|
|
201
|
+
* - Routes are matched by path equality
|
|
202
|
+
* - Feature routes replace target routes with the same path
|
|
203
|
+
* - Children arrays are recursively merged
|
|
204
|
+
* - All properties from feature route are preserved
|
|
205
|
+
* - Routes with path starting with '__delete__' are deletion markers
|
|
206
|
+
*/
|
|
207
|
+
function deepMergeRoutes(targetRoutes, featureRoutes) {
|
|
208
|
+
const result = [...targetRoutes];
|
|
209
|
+
for (const featureRoute of featureRoutes) {
|
|
210
|
+
// Check if this is a deletion marker
|
|
211
|
+
const DELETE_PREFIX = '__delete__';
|
|
212
|
+
if (featureRoute.path && typeof featureRoute.path === 'string') {
|
|
213
|
+
// Remove quotes from path string if present
|
|
214
|
+
const pathValue = featureRoute.path.replace(/^['"`]|['"`]$/g, '');
|
|
215
|
+
if (pathValue.startsWith(DELETE_PREFIX)) {
|
|
216
|
+
// This is a deletion marker - remove the route with matching path
|
|
217
|
+
const targetPath = pathValue.substring(DELETE_PREFIX.length);
|
|
218
|
+
const deleteIndex = result.findIndex((targetRoute) => {
|
|
219
|
+
if (targetRoute.path && typeof targetRoute.path === 'string') {
|
|
220
|
+
const targetPathValue = targetRoute.path.replace(/^['"`]|['"`]$/g, '');
|
|
221
|
+
return targetPathValue === targetPath;
|
|
222
|
+
}
|
|
223
|
+
return false;
|
|
224
|
+
});
|
|
225
|
+
if (deleteIndex >= 0) {
|
|
226
|
+
result.splice(deleteIndex, 1);
|
|
227
|
+
logger.info(`Deleted route with path: ${targetPath}`);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
logger.error(`\nValidation error: Cannot delete route that doesn't exist!\n`);
|
|
231
|
+
logger.info(`Route marked for deletion: ${targetPath}`);
|
|
232
|
+
logger.warning(`The route doesn't exist in the current routes.\n`);
|
|
233
|
+
throw new Error('Route deletion failed - cannot proceed');
|
|
234
|
+
}
|
|
235
|
+
// Don't add the deletion marker to result
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const matchIndex = result.findIndex((targetRoute) => {
|
|
240
|
+
// Match by path if both have paths
|
|
241
|
+
if (featureRoute.path && targetRoute.path) {
|
|
242
|
+
return featureRoute.path === targetRoute.path;
|
|
243
|
+
}
|
|
244
|
+
// Match index routes
|
|
245
|
+
if (featureRoute.index && targetRoute.index) {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
});
|
|
250
|
+
if (matchIndex >= 0) {
|
|
251
|
+
const targetRoute = result[matchIndex];
|
|
252
|
+
// Merge the route, starting with feature route properties
|
|
253
|
+
const mergedRoute = { ...featureRoute };
|
|
254
|
+
// If both have children, recursively merge them
|
|
255
|
+
if (targetRoute.children && featureRoute.children) {
|
|
256
|
+
mergedRoute.children = deepMergeRoutes(targetRoute.children, featureRoute.children);
|
|
257
|
+
}
|
|
258
|
+
else if (targetRoute.children) {
|
|
259
|
+
// Only target has children, preserve them
|
|
260
|
+
mergedRoute.children = targetRoute.children;
|
|
261
|
+
}
|
|
262
|
+
// If only feature has children, they're already in mergedRoute
|
|
263
|
+
result[matchIndex] = mergedRoute;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
// No match found, add the new route
|
|
267
|
+
result.push(featureRoute);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Generate TypeScript code from RouteObject[]
|
|
274
|
+
*/
|
|
275
|
+
function generateRoutesCode(routes) {
|
|
276
|
+
if (routes.length === 0) {
|
|
277
|
+
return '[]';
|
|
278
|
+
}
|
|
279
|
+
const routeStrings = routes.map((route) => generateRouteCode(route, 1));
|
|
280
|
+
return `[\n${routeStrings.join(',\n')}\n]`;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Generate code for a single route object
|
|
284
|
+
*/
|
|
285
|
+
function generateRouteCode(route, indentLevel) {
|
|
286
|
+
const indent = ' '.repeat(indentLevel);
|
|
287
|
+
const props = [];
|
|
288
|
+
for (const [key, value] of Object.entries(route)) {
|
|
289
|
+
if (key === 'children' && Array.isArray(value)) {
|
|
290
|
+
// Recursively generate children
|
|
291
|
+
const childrenCode = value.length > 0
|
|
292
|
+
? `[\n${value.map((child) => generateRouteCode(child, indentLevel + 2)).join(',\n')}\n${indent} ]`
|
|
293
|
+
: '[]';
|
|
294
|
+
props.push(`children: ${childrenCode}`);
|
|
295
|
+
}
|
|
296
|
+
else if (value !== undefined) {
|
|
297
|
+
// For other properties, use the raw text we stored
|
|
298
|
+
props.push(`${key}: ${value}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return `${indent}{\n${props.map((p) => `${indent} ${p}`).join(',\n')}\n${indent}}`;
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=route-merger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-merger.js","sourceRoot":"","sources":["../../src/utils/route-merger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAc,IAAI,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAelD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuGG;AACH,MAAM,UAAU,WAAW,CACzB,WAAmB,EACnB,UAAkB,EAClB,OAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,IAAI,IAAI,OAAO,EAAE,CAAC;QAE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,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare class ValidationError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Get the web application directory path from a base app path
|
|
6
|
+
* Structure: <basePath>/digitalExperiences/webApplications/<appName>
|
|
7
|
+
*/
|
|
8
|
+
export declare function getWebApplicationPath(basePath: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Validate that a feature path exists and resolve it to an absolute path
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateAndResolveFeaturePath(featurePath: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Validate and resolve an app path (can be relative or absolute)
|
|
15
|
+
* Validates that the web application directory exists with proper structure
|
|
16
|
+
* Returns the absolute path to the base app directory
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateAndResolveAppPath(appPath: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Validate that a app or feature name is valid
|
|
21
|
+
* - Must be in kebab-case (lowercase with hyphens)
|
|
22
|
+
* - Only alphanumeric characters and hyphens allowed
|
|
23
|
+
* - Cannot start or end with hyphens
|
|
24
|
+
* - No consecutive hyphens
|
|
25
|
+
* - Cannot be reserved names: "base", "cli"
|
|
26
|
+
* - Max 50 characters
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateAppOrFeatureName(name: string): void;
|
|
29
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAIA,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAgCzE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA+CjE;AAID;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CA2B3D"}
|