@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,247 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
translatePathToBaseApp,
|
|
4
|
+
translatePathToTargetApp
|
|
5
|
+
} from '../../src/utils/paths.js';
|
|
6
|
+
|
|
7
|
+
describe('paths', () => {
|
|
8
|
+
describe('translatePathToBaseApp', () => {
|
|
9
|
+
it('should translate full path format to base app', () => {
|
|
10
|
+
const featurePath = 'digitalExperiences/webApplications/feature-simple/src/routes.tsx';
|
|
11
|
+
const featureName = 'feature-simple';
|
|
12
|
+
const baseAppPath = '/path/to/base-app';
|
|
13
|
+
|
|
14
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
15
|
+
|
|
16
|
+
expect(result).toBe('digitalExperiences/webApplications/base-app/src/routes.tsx');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should keep bare src paths at root level', () => {
|
|
20
|
+
const featurePath = 'src/routes.tsx';
|
|
21
|
+
const featureName = 'feature-simple';
|
|
22
|
+
const baseAppPath = '/path/to/base-app';
|
|
23
|
+
|
|
24
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
25
|
+
|
|
26
|
+
// Bare src/ paths (without webApp/ prefix) should stay at root
|
|
27
|
+
expect(result).toBe('src/routes.tsx');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should handle nested paths correctly', () => {
|
|
31
|
+
const featurePath = 'digitalExperiences/webApplications/feature-auth/src/components/Login.tsx';
|
|
32
|
+
const featureName = 'feature-auth';
|
|
33
|
+
const baseAppPath = '/path/to/my-base-app';
|
|
34
|
+
|
|
35
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
36
|
+
|
|
37
|
+
expect(result).toBe('digitalExperiences/webApplications/my-base-app/src/components/Login.tsx');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should handle different base app names', () => {
|
|
41
|
+
const featurePath = 'digitalExperiences/webApplications/feature-test/src/app.tsx';
|
|
42
|
+
const featureName = 'feature-test';
|
|
43
|
+
const baseAppPath = '/projects/custom-base-app-name';
|
|
44
|
+
|
|
45
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
46
|
+
|
|
47
|
+
expect(result).toBe('digitalExperiences/webApplications/custom-base-app-name/src/app.tsx');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should add prefix to webApp paths', () => {
|
|
51
|
+
const featurePath = 'webApp/src/routes.tsx';
|
|
52
|
+
const featureName = 'feature-simple';
|
|
53
|
+
const baseAppPath = '/path/to/base-app';
|
|
54
|
+
|
|
55
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
56
|
+
|
|
57
|
+
// WebApp paths get the prefix added
|
|
58
|
+
expect(result).toBe('digitalExperiences/webApplications/base-app/src/routes.tsx');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should keep SFDX metadata paths at root level', () => {
|
|
62
|
+
const featurePath = 'classes/NavMenu.cls';
|
|
63
|
+
const featureName = 'feature-navigation-menu';
|
|
64
|
+
const baseAppPath = '/path/to/base-app';
|
|
65
|
+
|
|
66
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
67
|
+
|
|
68
|
+
// SFDX metadata paths should remain unchanged
|
|
69
|
+
expect(result).toBe('classes/NavMenu.cls');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should keep triggers at root level', () => {
|
|
73
|
+
const featurePath = 'triggers/MyTrigger.trigger';
|
|
74
|
+
const featureName = 'feature-simple';
|
|
75
|
+
const baseAppPath = '/path/to/base-app';
|
|
76
|
+
|
|
77
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
78
|
+
|
|
79
|
+
expect(result).toBe('triggers/MyTrigger.trigger');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should keep objects at root level', () => {
|
|
83
|
+
const featurePath = 'objects/CustomObject__c/fields/CustomField__c.field-meta.xml';
|
|
84
|
+
const featureName = 'feature-simple';
|
|
85
|
+
const baseAppPath = '/path/to/base-app';
|
|
86
|
+
|
|
87
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
88
|
+
|
|
89
|
+
expect(result).toBe('objects/CustomObject__c/fields/CustomField__c.field-meta.xml');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should handle paths with same prefix but different feature name', () => {
|
|
93
|
+
const featurePath = 'digitalExperiences/webApplications/other-feature/src/routes.tsx';
|
|
94
|
+
const featureName = 'feature-simple';
|
|
95
|
+
const baseAppPath = '/path/to/base-app';
|
|
96
|
+
|
|
97
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
98
|
+
|
|
99
|
+
// Should not match and return as-is
|
|
100
|
+
expect(result).toBe('digitalExperiences/webApplications/other-feature/src/routes.tsx');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should keep bare src paths with subdirectories at root level', () => {
|
|
104
|
+
const featurePath = 'src/components/Header/index.tsx';
|
|
105
|
+
const featureName = 'feature-ui';
|
|
106
|
+
const baseAppPath = '/path/to/base-app';
|
|
107
|
+
|
|
108
|
+
const result = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
109
|
+
|
|
110
|
+
// Bare src/ paths (without webApp/ prefix) should stay at root
|
|
111
|
+
expect(result).toBe('src/components/Header/index.tsx');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('translatePathToTargetApp', () => {
|
|
116
|
+
it('should translate full path format to target app', () => {
|
|
117
|
+
const featurePath = 'digitalExperiences/webApplications/feature-simple/src/routes.tsx';
|
|
118
|
+
const featureName = 'feature-simple';
|
|
119
|
+
const targetAppName = 'my-target-app';
|
|
120
|
+
|
|
121
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
122
|
+
|
|
123
|
+
expect(result).toBe('digitalExperiences/webApplications/my-target-app/src/routes.tsx');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should keep bare src paths at root level', () => {
|
|
127
|
+
const featurePath = 'src/routes.tsx';
|
|
128
|
+
const featureName = 'feature-simple';
|
|
129
|
+
const targetAppName = 'my-target-app';
|
|
130
|
+
|
|
131
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
132
|
+
|
|
133
|
+
// Bare src/ paths (without webApp/ prefix) should stay at root
|
|
134
|
+
expect(result).toBe('src/routes.tsx');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('should handle nested paths correctly', () => {
|
|
138
|
+
const featurePath = 'digitalExperiences/webApplications/feature-auth/src/components/Login.tsx';
|
|
139
|
+
const featureName = 'feature-auth';
|
|
140
|
+
const targetAppName = 'my-app';
|
|
141
|
+
|
|
142
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
143
|
+
|
|
144
|
+
expect(result).toBe('digitalExperiences/webApplications/my-app/src/components/Login.tsx');
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('should handle different target app names', () => {
|
|
148
|
+
const featurePath = 'digitalExperiences/webApplications/feature-test/src/app.tsx';
|
|
149
|
+
const featureName = 'feature-test';
|
|
150
|
+
const targetAppName = 'production-app';
|
|
151
|
+
|
|
152
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
153
|
+
|
|
154
|
+
expect(result).toBe('digitalExperiences/webApplications/production-app/src/app.tsx');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('should add prefix to webApp paths', () => {
|
|
158
|
+
const featurePath = 'webApp/src/routes.tsx';
|
|
159
|
+
const featureName = 'feature-simple';
|
|
160
|
+
const targetAppName = 'my-app';
|
|
161
|
+
|
|
162
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
163
|
+
|
|
164
|
+
// WebApp paths get the prefix added
|
|
165
|
+
expect(result).toBe('digitalExperiences/webApplications/my-app/src/routes.tsx');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should keep SFDX metadata paths at root level', () => {
|
|
169
|
+
const featurePath = 'classes/NavMenu.cls';
|
|
170
|
+
const featureName = 'feature-navigation-menu';
|
|
171
|
+
const targetAppName = 'my-app';
|
|
172
|
+
|
|
173
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
174
|
+
|
|
175
|
+
// SFDX metadata paths should remain unchanged
|
|
176
|
+
expect(result).toBe('classes/NavMenu.cls');
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('should keep triggers at root level', () => {
|
|
180
|
+
const featurePath = 'triggers/MyTrigger.trigger';
|
|
181
|
+
const featureName = 'feature-simple';
|
|
182
|
+
const targetAppName = 'my-app';
|
|
183
|
+
|
|
184
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
185
|
+
|
|
186
|
+
expect(result).toBe('triggers/MyTrigger.trigger');
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('should keep objects at root level', () => {
|
|
190
|
+
const featurePath = 'objects/CustomObject__c/fields/CustomField__c.field-meta.xml';
|
|
191
|
+
const featureName = 'feature-simple';
|
|
192
|
+
const targetAppName = 'my-app';
|
|
193
|
+
|
|
194
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
195
|
+
|
|
196
|
+
expect(result).toBe('objects/CustomObject__c/fields/CustomField__c.field-meta.xml');
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should handle paths with same prefix but different feature name', () => {
|
|
200
|
+
const featurePath = 'digitalExperiences/webApplications/other-feature/src/routes.tsx';
|
|
201
|
+
const featureName = 'feature-simple';
|
|
202
|
+
const targetAppName = 'my-app';
|
|
203
|
+
|
|
204
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
205
|
+
|
|
206
|
+
// Should not match and return as-is
|
|
207
|
+
expect(result).toBe('digitalExperiences/webApplications/other-feature/src/routes.tsx');
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('should keep bare src paths with subdirectories at root level', () => {
|
|
211
|
+
const featurePath = 'src/components/Header/index.tsx';
|
|
212
|
+
const featureName = 'feature-ui';
|
|
213
|
+
const targetAppName = 'final-app';
|
|
214
|
+
|
|
215
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
216
|
+
|
|
217
|
+
// Bare src/ paths (without webApp/ prefix) should stay at root
|
|
218
|
+
expect(result).toBe('src/components/Header/index.tsx');
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('should work with hyphenated target app names', () => {
|
|
222
|
+
const featurePath = 'digitalExperiences/webApplications/feature-nav/src/nav.tsx';
|
|
223
|
+
const featureName = 'feature-nav';
|
|
224
|
+
const targetAppName = 'my-custom-app-name';
|
|
225
|
+
|
|
226
|
+
const result = translatePathToTargetApp(featurePath, featureName, targetAppName);
|
|
227
|
+
|
|
228
|
+
expect(result).toBe('digitalExperiences/webApplications/my-custom-app-name/src/nav.tsx');
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
describe('translatePathToBaseApp vs translatePathToTargetApp', () => {
|
|
233
|
+
it('should produce similar results with equivalent inputs', () => {
|
|
234
|
+
const featurePath = 'digitalExperiences/webApplications/feature-test/src/app.tsx';
|
|
235
|
+
const featureName = 'feature-test';
|
|
236
|
+
const appName = 'test-app';
|
|
237
|
+
const baseAppPath = '/path/to/test-app';
|
|
238
|
+
|
|
239
|
+
const baseResult = translatePathToBaseApp(featurePath, featureName, baseAppPath);
|
|
240
|
+
const targetResult = translatePathToTargetApp(featurePath, featureName, appName);
|
|
241
|
+
|
|
242
|
+
// Both should translate to the same app name
|
|
243
|
+
expect(baseResult).toBe(targetResult);
|
|
244
|
+
expect(baseResult).toBe('digitalExperiences/webApplications/test-app/src/app.tsx');
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
});
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { Project } from 'ts-morph';
|
|
3
|
+
import { mergeRoutes } from '../../src/utils/route-merger.js';
|
|
4
|
+
|
|
5
|
+
describe('route-merger', () => {
|
|
6
|
+
describe('mergeRoutes', () => {
|
|
7
|
+
it('should merge routes according to documented example', () => {
|
|
8
|
+
const project = new Project({ useInMemoryFileSystem: true });
|
|
9
|
+
|
|
10
|
+
// Base app routes (target)
|
|
11
|
+
project.createSourceFile(
|
|
12
|
+
'/test/target-routes.tsx',
|
|
13
|
+
`import AppLayout from './appLayout';
|
|
14
|
+
import Home from './Home';
|
|
15
|
+
|
|
16
|
+
export const routes: RouteObject[] = [
|
|
17
|
+
{
|
|
18
|
+
path: '/',
|
|
19
|
+
element: <AppLayout />,
|
|
20
|
+
children: [
|
|
21
|
+
{ index: true, element: <Home /> }
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
];`
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// Feature routes
|
|
28
|
+
project.createSourceFile(
|
|
29
|
+
'/test/feature-routes.tsx',
|
|
30
|
+
`import AppLayout from './appLayout';
|
|
31
|
+
import About from './About';
|
|
32
|
+
import Contact from './Contact';
|
|
33
|
+
|
|
34
|
+
export const routes: RouteObject[] = [
|
|
35
|
+
{
|
|
36
|
+
path: '/',
|
|
37
|
+
element: <AppLayout />,
|
|
38
|
+
children: [
|
|
39
|
+
{ path: 'about', element: <About /> },
|
|
40
|
+
{ path: 'contact', element: <Contact /> }
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
];`
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const result = mergeRoutes('/test/feature-routes.tsx', '/test/target-routes.tsx', project);
|
|
47
|
+
|
|
48
|
+
// Verify the merged result contains all expected elements
|
|
49
|
+
expect(result).toContain("path: '/'");
|
|
50
|
+
expect(result).toContain('element: <AppLayout />');
|
|
51
|
+
expect(result).toContain('index: true');
|
|
52
|
+
expect(result).toContain('element: <Home />');
|
|
53
|
+
expect(result).toContain("path: 'about'");
|
|
54
|
+
expect(result).toContain('element: <About />');
|
|
55
|
+
expect(result).toContain("path: 'contact'");
|
|
56
|
+
expect(result).toContain('element: <Contact />');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should preserve all route properties including handle', () => {
|
|
60
|
+
const project = new Project({ useInMemoryFileSystem: true });
|
|
61
|
+
|
|
62
|
+
project.createSourceFile(
|
|
63
|
+
'/test/target2-routes.tsx',
|
|
64
|
+
`export const routes: RouteObject[] = [
|
|
65
|
+
{
|
|
66
|
+
path: '/',
|
|
67
|
+
element: <AppLayout />,
|
|
68
|
+
children: []
|
|
69
|
+
}
|
|
70
|
+
];`
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
project.createSourceFile(
|
|
74
|
+
'/test/feature2-routes.tsx',
|
|
75
|
+
`export const routes: RouteObject[] = [
|
|
76
|
+
{
|
|
77
|
+
path: '/',
|
|
78
|
+
element: <AppLayout />,
|
|
79
|
+
children: [
|
|
80
|
+
{
|
|
81
|
+
path: 'about',
|
|
82
|
+
element: <About />,
|
|
83
|
+
handle: { showInNavigation: true, label: 'About' }
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
];`
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const result = mergeRoutes('/test/feature2-routes.tsx', '/test/target2-routes.tsx', project);
|
|
91
|
+
|
|
92
|
+
expect(result).toContain('handle:');
|
|
93
|
+
expect(result).toContain('showInNavigation: true');
|
|
94
|
+
expect(result).toContain("label: 'About'");
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should add new routes when paths do not match', () => {
|
|
98
|
+
const project = new Project({ useInMemoryFileSystem: true });
|
|
99
|
+
|
|
100
|
+
project.createSourceFile(
|
|
101
|
+
'/test/target3-routes.tsx',
|
|
102
|
+
`export const routes: RouteObject[] = [
|
|
103
|
+
{
|
|
104
|
+
path: '/dashboard',
|
|
105
|
+
element: <Dashboard />
|
|
106
|
+
}
|
|
107
|
+
];`
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
project.createSourceFile(
|
|
111
|
+
'/test/feature3-routes.tsx',
|
|
112
|
+
`export const routes: RouteObject[] = [
|
|
113
|
+
{
|
|
114
|
+
path: '/settings',
|
|
115
|
+
element: <Settings />
|
|
116
|
+
}
|
|
117
|
+
];`
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const result = mergeRoutes('/test/feature3-routes.tsx', '/test/target3-routes.tsx', project);
|
|
121
|
+
|
|
122
|
+
expect(result).toContain("path: '/dashboard'");
|
|
123
|
+
expect(result).toContain('element: <Dashboard />');
|
|
124
|
+
expect(result).toContain("path: '/settings'");
|
|
125
|
+
expect(result).toContain('element: <Settings />');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should replace matching routes but preserve non-matching children', () => {
|
|
129
|
+
const project = new Project({ useInMemoryFileSystem: true });
|
|
130
|
+
|
|
131
|
+
project.createSourceFile(
|
|
132
|
+
'/test/target4-routes.tsx',
|
|
133
|
+
`export const routes: RouteObject[] = [
|
|
134
|
+
{
|
|
135
|
+
path: '/',
|
|
136
|
+
element: <OldLayout />,
|
|
137
|
+
children: [
|
|
138
|
+
{ path: 'old-page', element: <OldPage /> },
|
|
139
|
+
{ path: 'shared-page', element: <OldShared /> }
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
];`
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
project.createSourceFile(
|
|
146
|
+
'/test/feature4-routes.tsx',
|
|
147
|
+
`export const routes: RouteObject[] = [
|
|
148
|
+
{
|
|
149
|
+
path: '/',
|
|
150
|
+
element: <NewLayout />,
|
|
151
|
+
children: [
|
|
152
|
+
{ path: 'shared-page', element: <NewShared /> },
|
|
153
|
+
{ path: 'new-page', element: <NewPage /> }
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
];`
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const result = mergeRoutes('/test/feature4-routes.tsx', '/test/target4-routes.tsx', project);
|
|
160
|
+
|
|
161
|
+
// Should have new layout
|
|
162
|
+
expect(result).toContain('element: <NewLayout />');
|
|
163
|
+
|
|
164
|
+
// Should preserve old-page from target
|
|
165
|
+
expect(result).toContain("path: 'old-page'");
|
|
166
|
+
expect(result).toContain('element: <OldPage />');
|
|
167
|
+
|
|
168
|
+
// Should have new-page from feature
|
|
169
|
+
expect(result).toContain("path: 'new-page'");
|
|
170
|
+
expect(result).toContain('element: <NewPage />');
|
|
171
|
+
|
|
172
|
+
// Should replace shared-page with feature version
|
|
173
|
+
expect(result).toContain('element: <NewShared />');
|
|
174
|
+
expect(result).not.toContain('element: <OldShared />');
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should handle route deletion with __delete__ prefix', () => {
|
|
178
|
+
const project = new Project({ useInMemoryFileSystem: true });
|
|
179
|
+
|
|
180
|
+
project.createSourceFile(
|
|
181
|
+
'/test/target5-routes.tsx',
|
|
182
|
+
`export const routes: RouteObject[] = [
|
|
183
|
+
{
|
|
184
|
+
path: '/',
|
|
185
|
+
element: <AppLayout />,
|
|
186
|
+
children: [
|
|
187
|
+
{ path: 'home', element: <Home /> },
|
|
188
|
+
{ path: 'old', element: <OldPage /> },
|
|
189
|
+
{ path: 'about', element: <About /> }
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
];`
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
project.createSourceFile(
|
|
196
|
+
'/test/feature5-routes.tsx',
|
|
197
|
+
`export const routes: RouteObject[] = [
|
|
198
|
+
{
|
|
199
|
+
path: '/',
|
|
200
|
+
element: <AppLayout />,
|
|
201
|
+
children: [
|
|
202
|
+
{ path: '__delete__old', element: null }
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
];`
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
const result = mergeRoutes('/test/feature5-routes.tsx', '/test/target5-routes.tsx', project);
|
|
209
|
+
|
|
210
|
+
// Should keep home and about
|
|
211
|
+
expect(result).toContain("path: 'home'");
|
|
212
|
+
expect(result).toContain("path: 'about'");
|
|
213
|
+
|
|
214
|
+
// Should NOT have 'old' route
|
|
215
|
+
expect(result).not.toContain("path: 'old'");
|
|
216
|
+
expect(result).not.toContain('element: <OldPage />');
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('should handle multiple route deletions', () => {
|
|
220
|
+
const project = new Project({ useInMemoryFileSystem: true });
|
|
221
|
+
|
|
222
|
+
project.createSourceFile(
|
|
223
|
+
'/test/target6-routes.tsx',
|
|
224
|
+
`export const routes: RouteObject[] = [
|
|
225
|
+
{
|
|
226
|
+
path: '/',
|
|
227
|
+
element: <AppLayout />,
|
|
228
|
+
children: [
|
|
229
|
+
{ path: 'keep1', element: <Keep1 /> },
|
|
230
|
+
{ path: 'delete1', element: <Delete1 /> },
|
|
231
|
+
{ path: 'keep2', element: <Keep2 /> },
|
|
232
|
+
{ path: 'delete2', element: <Delete2 /> }
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
];`
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
project.createSourceFile(
|
|
239
|
+
'/test/feature6-routes.tsx',
|
|
240
|
+
`export const routes: RouteObject[] = [
|
|
241
|
+
{
|
|
242
|
+
path: '/',
|
|
243
|
+
element: <AppLayout />,
|
|
244
|
+
children: [
|
|
245
|
+
{ path: '__delete__delete1', element: null },
|
|
246
|
+
{ path: '__delete__delete2', element: null }
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
];`
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
const result = mergeRoutes('/test/feature6-routes.tsx', '/test/target6-routes.tsx', project);
|
|
253
|
+
|
|
254
|
+
// Should keep these routes
|
|
255
|
+
expect(result).toContain("path: 'keep1'");
|
|
256
|
+
expect(result).toContain("path: 'keep2'");
|
|
257
|
+
|
|
258
|
+
// Should NOT have deleted routes
|
|
259
|
+
expect(result).not.toContain("path: 'delete1'");
|
|
260
|
+
expect(result).not.toContain("path: 'delete2'");
|
|
261
|
+
expect(result).not.toContain('element: <Delete1 />');
|
|
262
|
+
expect(result).not.toContain('element: <Delete2 />');
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
});
|