@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,395 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
+
import { Project } from 'ts-morph';
|
|
3
|
+
import { mergeImports } from '../../src/utils/import-merger.js';
|
|
4
|
+
|
|
5
|
+
describe('import-merger', () => {
|
|
6
|
+
let project: Project;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
project = new Project({ useInMemoryFileSystem: true });
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('mergeImports - Scenarios that work', () => {
|
|
13
|
+
it('should merge named imports from the same module', () => {
|
|
14
|
+
const targetFile = project.createSourceFile(
|
|
15
|
+
'target.ts',
|
|
16
|
+
`import { useState } from 'react';
|
|
17
|
+
|
|
18
|
+
export const App = () => {
|
|
19
|
+
const [state, setState] = useState(0);
|
|
20
|
+
return <div>{state}</div>;
|
|
21
|
+
};`
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const featureFile = project.createSourceFile(
|
|
25
|
+
'feature.ts',
|
|
26
|
+
`import { useEffect } from 'react';`
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
mergeImports(featureFile, targetFile);
|
|
30
|
+
|
|
31
|
+
const result = targetFile.getText();
|
|
32
|
+
|
|
33
|
+
// Should have both named imports
|
|
34
|
+
expect(result).toContain('useState');
|
|
35
|
+
expect(result).toContain('useEffect');
|
|
36
|
+
expect(result).toMatch(/from ['"]react['"]/);
|
|
37
|
+
|
|
38
|
+
// Should preserve code
|
|
39
|
+
expect(result).toContain('export const App');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should deduplicate imports from the same module in target', () => {
|
|
43
|
+
const targetFile = project.createSourceFile(
|
|
44
|
+
'target.ts',
|
|
45
|
+
`import { useState } from 'react';
|
|
46
|
+
import { useEffect } from 'react';
|
|
47
|
+
|
|
48
|
+
export const App = () => <div>Test</div>;`
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const featureFile = project.createSourceFile(
|
|
52
|
+
'feature.ts',
|
|
53
|
+
`import { useMemo } from 'react';`
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
mergeImports(featureFile, targetFile);
|
|
57
|
+
|
|
58
|
+
const result = targetFile.getText();
|
|
59
|
+
|
|
60
|
+
// Should have all three hooks
|
|
61
|
+
expect(result).toContain('useState');
|
|
62
|
+
expect(result).toContain('useEffect');
|
|
63
|
+
expect(result).toContain('useMemo');
|
|
64
|
+
|
|
65
|
+
// Should preserve code
|
|
66
|
+
expect(result).toContain('export const App');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should not duplicate imports that already exist', () => {
|
|
70
|
+
const targetFile = project.createSourceFile(
|
|
71
|
+
'target.ts',
|
|
72
|
+
`import { useState, useEffect } from 'react';
|
|
73
|
+
|
|
74
|
+
export const App = () => <div>Test</div>;`
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const featureFile = project.createSourceFile(
|
|
78
|
+
'feature.ts',
|
|
79
|
+
`import { useState } from 'react';`
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
mergeImports(featureFile, targetFile);
|
|
83
|
+
|
|
84
|
+
const result = targetFile.getText();
|
|
85
|
+
|
|
86
|
+
// Should have both hooks
|
|
87
|
+
expect(result).toContain('useState');
|
|
88
|
+
expect(result).toContain('useEffect');
|
|
89
|
+
|
|
90
|
+
// Count occurrences of 'useState' in imports (should be 1)
|
|
91
|
+
const importSection = result.split('export')[0];
|
|
92
|
+
const useStateCount = (importSection.match(/useState/g) || []).length;
|
|
93
|
+
expect(useStateCount).toBe(1);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should handle when feature has no imports', () => {
|
|
97
|
+
const targetFile = project.createSourceFile(
|
|
98
|
+
'target.ts',
|
|
99
|
+
`import React from 'react';
|
|
100
|
+
|
|
101
|
+
export const App = () => <div>Test</div>;`
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const featureFile = project.createSourceFile(
|
|
105
|
+
'feature.ts',
|
|
106
|
+
`export const value = 42;`
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
mergeImports(featureFile, targetFile);
|
|
110
|
+
|
|
111
|
+
const result = targetFile.getText();
|
|
112
|
+
|
|
113
|
+
// Should keep existing import
|
|
114
|
+
expect(result).toMatch(/import React from ['"]react['"]/);
|
|
115
|
+
// Should preserve code
|
|
116
|
+
expect(result).toContain('export const App');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should handle when both files have no imports', () => {
|
|
120
|
+
const targetFile = project.createSourceFile(
|
|
121
|
+
'target.ts',
|
|
122
|
+
`export const value = 42;`
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const featureFile = project.createSourceFile(
|
|
126
|
+
'feature.ts',
|
|
127
|
+
`export const other = 100;`
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
mergeImports(featureFile, targetFile);
|
|
131
|
+
|
|
132
|
+
const result = targetFile.getText();
|
|
133
|
+
|
|
134
|
+
// Should preserve code
|
|
135
|
+
expect(result).toContain('export const value = 42');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should add imports from different modules (no conflicts)', () => {
|
|
139
|
+
const targetFile = project.createSourceFile(
|
|
140
|
+
'target.ts',
|
|
141
|
+
`import React from 'react';
|
|
142
|
+
import { Link } from 'react-router';
|
|
143
|
+
|
|
144
|
+
export const App = () => <Link to="/">Home</Link>;`
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const featureFile = project.createSourceFile(
|
|
148
|
+
'feature.ts',
|
|
149
|
+
`import { Outlet } from 'react-router';
|
|
150
|
+
import styles from './styles.css';`
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
mergeImports(featureFile, targetFile);
|
|
154
|
+
|
|
155
|
+
const result = targetFile.getText();
|
|
156
|
+
|
|
157
|
+
// Should have all imports
|
|
158
|
+
expect(result).toContain('React');
|
|
159
|
+
expect(result).toContain('Link');
|
|
160
|
+
expect(result).toContain('Outlet');
|
|
161
|
+
expect(result).toContain('styles');
|
|
162
|
+
// Should preserve code
|
|
163
|
+
expect(result).toContain('export const App');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('should handle relative imports from different paths', () => {
|
|
167
|
+
const targetFile = project.createSourceFile(
|
|
168
|
+
'target.ts',
|
|
169
|
+
`import ComponentA from './components/ComponentA';
|
|
170
|
+
|
|
171
|
+
export const App = () => <ComponentA />;`
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const featureFile = project.createSourceFile(
|
|
175
|
+
'feature.ts',
|
|
176
|
+
`import ComponentB from './components/ComponentB';
|
|
177
|
+
import UtilA from '../utils/UtilA';`
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
mergeImports(featureFile, targetFile);
|
|
181
|
+
|
|
182
|
+
const result = targetFile.getText();
|
|
183
|
+
|
|
184
|
+
// Should have all imports
|
|
185
|
+
expect(result).toContain('ComponentA');
|
|
186
|
+
expect(result).toContain('ComponentB');
|
|
187
|
+
expect(result).toContain('UtilA');
|
|
188
|
+
expect(result).toContain('./components/');
|
|
189
|
+
expect(result).toContain('../utils/');
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
describe('mergeImports - Conflicting imports', () => {
|
|
194
|
+
it('should handle when target and feature have same default import name from different modules', () => {
|
|
195
|
+
// When both files import the same name from different modules,
|
|
196
|
+
// feature should take precedence
|
|
197
|
+
|
|
198
|
+
const targetFile = project.createSourceFile(
|
|
199
|
+
'target.ts',
|
|
200
|
+
`import AppLayout from './appLayout';
|
|
201
|
+
|
|
202
|
+
export const routes = [];`
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
const featureFile = project.createSourceFile(
|
|
206
|
+
'feature.ts',
|
|
207
|
+
`import AppLayout from './different';
|
|
208
|
+
import NewComponent from './new';`
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
mergeImports(featureFile, targetFile);
|
|
212
|
+
|
|
213
|
+
const result = targetFile.getText();
|
|
214
|
+
|
|
215
|
+
// Feature's import should replace target's import
|
|
216
|
+
expect(result).toContain('AppLayout');
|
|
217
|
+
expect(result).toContain('NewComponent');
|
|
218
|
+
expect(result).toMatch(/from ['"]\.\/different['"]/); // Feature's module path
|
|
219
|
+
expect(result).not.toMatch(/from ['"]\.\/appLayout['"]/); // Target's old module path should be replaced
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('should add imports when target has no imports', () => {
|
|
223
|
+
// Should be able to add imports to a file with no existing imports
|
|
224
|
+
|
|
225
|
+
const targetFile = project.createSourceFile(
|
|
226
|
+
'target.ts',
|
|
227
|
+
`export const value = 42;`
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const featureFile = project.createSourceFile(
|
|
231
|
+
'feature.ts',
|
|
232
|
+
`import { useState } from 'react';`
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
mergeImports(featureFile, targetFile);
|
|
236
|
+
|
|
237
|
+
const result = targetFile.getText();
|
|
238
|
+
|
|
239
|
+
expect(result).toContain('useState');
|
|
240
|
+
expect(result).toMatch(/from ['"]react['"]/); // Accept both single and double quotes
|
|
241
|
+
expect(result).toContain('export const value = 42');
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
describe('mergeImports - Deduplication', () => {
|
|
246
|
+
it('should deduplicate duplicate named imports within an import declaration', () => {
|
|
247
|
+
// When target has duplicate imports, should deduplicate them
|
|
248
|
+
const targetFile = project.createSourceFile(
|
|
249
|
+
'target.ts',
|
|
250
|
+
`import { RouteObject, RouteObject } from 'react-router';
|
|
251
|
+
|
|
252
|
+
export const routes = [];`
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
const featureFile = project.createSourceFile(
|
|
256
|
+
'feature.ts',
|
|
257
|
+
`import { Outlet } from 'react-router';`
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
mergeImports(featureFile, targetFile);
|
|
261
|
+
|
|
262
|
+
const result = targetFile.getText();
|
|
263
|
+
|
|
264
|
+
// Should deduplicate RouteObject and add Outlet
|
|
265
|
+
expect(result).toContain('RouteObject');
|
|
266
|
+
expect(result).toContain('Outlet');
|
|
267
|
+
expect(result).toMatch(/from ['"]react-router['"]/);
|
|
268
|
+
|
|
269
|
+
// Count occurrences of "RouteObject" in the import section (should be 1)
|
|
270
|
+
const importLines = result.split('export')[0]; // Get just the import section
|
|
271
|
+
const matches = importLines.match(/RouteObject/g);
|
|
272
|
+
expect(matches?.length).toBe(1);
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
describe('mergeImports - Type imports', () => {
|
|
277
|
+
it('should keep type imports separate from regular imports', () => {
|
|
278
|
+
// When target has type import and feature has regular import from same module,
|
|
279
|
+
// should keep both as separate import declarations
|
|
280
|
+
const targetFile = project.createSourceFile(
|
|
281
|
+
'target.ts',
|
|
282
|
+
`import type { RouteObject } from 'react-router';
|
|
283
|
+
|
|
284
|
+
export const routes: RouteObject[] = [];`
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
const featureFile = project.createSourceFile(
|
|
288
|
+
'feature.ts',
|
|
289
|
+
`import { Outlet } from 'react-router';`
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
mergeImports(featureFile, targetFile);
|
|
293
|
+
|
|
294
|
+
const result = targetFile.getText();
|
|
295
|
+
|
|
296
|
+
// Should keep type import and add regular import as separate declarations
|
|
297
|
+
expect(result).toContain('RouteObject');
|
|
298
|
+
expect(result).toContain('Outlet');
|
|
299
|
+
expect(result).toContain('react-router');
|
|
300
|
+
|
|
301
|
+
// Should have both type and regular import declarations
|
|
302
|
+
expect(result).toContain('import type');
|
|
303
|
+
expect(result).toMatch(/import\s+\{[^}]*Outlet[^}]*\}\s+from/); // Regular import with Outlet
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
describe('mergeImports - Formatting', () => {
|
|
308
|
+
it('should preserve blank line between imports and code after removing __delete__ imports', () => {
|
|
309
|
+
// This simulates the scenario where a feature deletes an import,
|
|
310
|
+
// and we need to ensure proper formatting is maintained
|
|
311
|
+
const targetFile = project.createSourceFile(
|
|
312
|
+
'target.ts',
|
|
313
|
+
`import type { RouteObject } from 'react-router';
|
|
314
|
+
import AppLayout from './appLayout';
|
|
315
|
+
import Home from './home';
|
|
316
|
+
import OldPage from './old-page';
|
|
317
|
+
|
|
318
|
+
export const routes: RouteObject[] = [];`
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
const featureFile = project.createSourceFile(
|
|
322
|
+
'feature.ts',
|
|
323
|
+
`import type { RouteObject } from 'react-router';
|
|
324
|
+
import AppLayout from './__inherit__appLayout';
|
|
325
|
+
import About from './about';
|
|
326
|
+
import OldPage from './__delete__old-page';
|
|
327
|
+
|
|
328
|
+
export const routes: RouteObject[] = [];`
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
mergeImports(featureFile, targetFile);
|
|
332
|
+
|
|
333
|
+
const result = targetFile.getText();
|
|
334
|
+
|
|
335
|
+
// Should have the About import added
|
|
336
|
+
expect(result).toContain('About');
|
|
337
|
+
|
|
338
|
+
// Should NOT have the __delete__ import
|
|
339
|
+
expect(result).not.toContain('__delete__');
|
|
340
|
+
|
|
341
|
+
// Most importantly: should have blank line between imports and export
|
|
342
|
+
// Check that there's a newline after the last import before the export
|
|
343
|
+
expect(result).toMatch(/from ['"][^'"]+['"];\n\nexport const routes/);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('should maintain blank line when merging routes with imports', () => {
|
|
347
|
+
// Simulates real-world scenario: base app + feature with routes
|
|
348
|
+
const targetFile = project.createSourceFile(
|
|
349
|
+
'routes.tsx',
|
|
350
|
+
`import type { RouteObject } from 'react-router';
|
|
351
|
+
import AppLayout from './appLayout';
|
|
352
|
+
import Home from './home';
|
|
353
|
+
import OldPage from './old-page';
|
|
354
|
+
|
|
355
|
+
export const routes: RouteObject[] = [
|
|
356
|
+
{
|
|
357
|
+
path: '/',
|
|
358
|
+
element: <AppLayout />,
|
|
359
|
+
children: [
|
|
360
|
+
{ index: true, element: <Home /> },
|
|
361
|
+
{ path: 'old', element: <OldPage /> }
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
];`
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
const featureFile = project.createSourceFile(
|
|
368
|
+
'feature-routes.tsx',
|
|
369
|
+
`import type { RouteObject } from 'react-router';
|
|
370
|
+
import AppLayout from './__inherit__appLayout';
|
|
371
|
+
import About from './about';
|
|
372
|
+
|
|
373
|
+
export const routes: RouteObject[] = [
|
|
374
|
+
{
|
|
375
|
+
path: '/',
|
|
376
|
+
element: <AppLayout />,
|
|
377
|
+
children: [
|
|
378
|
+
{ path: 'about', element: <About /> }
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
];`
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
mergeImports(featureFile, targetFile);
|
|
385
|
+
|
|
386
|
+
const result = targetFile.getText();
|
|
387
|
+
|
|
388
|
+
// Should have About import
|
|
389
|
+
expect(result).toContain('About');
|
|
390
|
+
|
|
391
|
+
// Should have blank line between imports and export
|
|
392
|
+
expect(result).toMatch(/from ['"][^'"]+['"];\n\nexport const routes/);
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
});
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
|
|
4
|
+
// Mock the commands before importing index
|
|
5
|
+
vi.mock('../../src/commands/apply-patches.js', () => ({
|
|
6
|
+
applyPatchesCommand: vi.fn().mockResolvedValue(undefined)
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
vi.mock('../../src/commands/watch-patches.js', () => ({
|
|
10
|
+
watchPatchesCommand: vi.fn().mockResolvedValue({ shutdown: vi.fn() })
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
describe('CLI index', () => {
|
|
14
|
+
let originalArgv: string[];
|
|
15
|
+
let exitSpy: ReturnType<typeof vi.spyOn>;
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
originalArgv = process.argv;
|
|
19
|
+
exitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined as never);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
process.argv = originalArgv;
|
|
24
|
+
exitSpy.mockRestore();
|
|
25
|
+
vi.clearAllMocks();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should have apply-patches command defined', async () => {
|
|
29
|
+
const program = new Command();
|
|
30
|
+
|
|
31
|
+
// Simulate the index.ts command setup
|
|
32
|
+
program
|
|
33
|
+
.name('apply-patches')
|
|
34
|
+
.version('1.0.0');
|
|
35
|
+
|
|
36
|
+
program
|
|
37
|
+
.command('apply-patches')
|
|
38
|
+
.description('Apply feature patches to an app')
|
|
39
|
+
.argument('<feature-path>', 'Path to the feature')
|
|
40
|
+
.argument('<app-path>', 'Path to the app')
|
|
41
|
+
.argument('<target-dir>', 'Target directory')
|
|
42
|
+
.option('--skip-dependency-changes', 'Skip installing dependencies')
|
|
43
|
+
.option('--clean', 'Remove target directory if it exists');
|
|
44
|
+
|
|
45
|
+
const applyPatchesCmd = program.commands.find(cmd => cmd.name() === 'apply-patches');
|
|
46
|
+
expect(applyPatchesCmd).toBeDefined();
|
|
47
|
+
expect(applyPatchesCmd?.description()).toBe('Apply feature patches to an app');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should have watch-patches command defined', () => {
|
|
51
|
+
const program = new Command();
|
|
52
|
+
|
|
53
|
+
program
|
|
54
|
+
.name('apply-patches')
|
|
55
|
+
.version('1.0.0');
|
|
56
|
+
|
|
57
|
+
program
|
|
58
|
+
.command('watch-patches')
|
|
59
|
+
.description('Watch feature template directory and auto-apply patches on changes')
|
|
60
|
+
.argument('<feature-path>', 'Path to the feature')
|
|
61
|
+
.argument('<app-path>', 'Path to the app')
|
|
62
|
+
.argument('<target-dir>', 'Target directory')
|
|
63
|
+
.option('--clean', 'Remove target directory if it exists');
|
|
64
|
+
|
|
65
|
+
const watchPatchesCmd = program.commands.find(cmd => cmd.name() === 'watch-patches');
|
|
66
|
+
expect(watchPatchesCmd).toBeDefined();
|
|
67
|
+
expect(watchPatchesCmd?.description()).toBe('Watch feature template directory and auto-apply patches on changes');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should parse apply-patches command arguments correctly', () => {
|
|
71
|
+
const program = new Command();
|
|
72
|
+
|
|
73
|
+
program
|
|
74
|
+
.command('apply-patches')
|
|
75
|
+
.argument('<feature-path>', 'Path to the feature')
|
|
76
|
+
.argument('<app-path>', 'Path to the app')
|
|
77
|
+
.argument('<target-dir>', 'Target directory')
|
|
78
|
+
.option('--skip-dependency-changes', 'Skip installing dependencies')
|
|
79
|
+
.option('--clean', 'Remove target directory if it exists')
|
|
80
|
+
.action((featurePath, appPath, targetDir, options) => {
|
|
81
|
+
expect(featurePath).toBe('packages/feature-test');
|
|
82
|
+
expect(appPath).toBe('packages/base-app');
|
|
83
|
+
expect(targetDir).toBe('my-app');
|
|
84
|
+
expect(options.skipDependencyChanges).toBe(true);
|
|
85
|
+
expect(options.clean).toBeUndefined(); // Not provided, so undefined
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
program.parse(['node', 'cli', 'apply-patches', 'packages/feature-test', 'packages/base-app', 'my-app', '--skip-dependency-changes']);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('should parse watch-patches command arguments correctly', () => {
|
|
92
|
+
const program = new Command();
|
|
93
|
+
|
|
94
|
+
program
|
|
95
|
+
.command('watch-patches')
|
|
96
|
+
.argument('<feature-path>', 'Path to the feature')
|
|
97
|
+
.argument('<app-path>', 'Path to the app')
|
|
98
|
+
.argument('<target-dir>', 'Target directory')
|
|
99
|
+
.option('--clean', 'Remove target directory if it exists')
|
|
100
|
+
.action((featurePath, appPath, targetDir, options) => {
|
|
101
|
+
expect(featurePath).toBe('packages/feature-test');
|
|
102
|
+
expect(appPath).toBe('packages/base-app');
|
|
103
|
+
expect(targetDir).toBe('watch-target');
|
|
104
|
+
expect(options.clean).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
program.parse(['node', 'cli', 'watch-patches', 'packages/feature-test', 'packages/base-app', 'watch-target', '--clean']);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should handle missing required arguments', () => {
|
|
111
|
+
const program = new Command();
|
|
112
|
+
program.exitOverride(); // Prevent actual exit in tests
|
|
113
|
+
|
|
114
|
+
program
|
|
115
|
+
.command('apply-patches')
|
|
116
|
+
.argument('<feature-path>', 'Path to the feature')
|
|
117
|
+
.argument('<app-path>', 'Path to the app')
|
|
118
|
+
.argument('<target-dir>', 'Target directory');
|
|
119
|
+
|
|
120
|
+
expect(() => {
|
|
121
|
+
program.parse(['node', 'cli', 'apply-patches']); // Missing required args
|
|
122
|
+
}).toThrow();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should have correct option flags for apply-patches', () => {
|
|
126
|
+
const program = new Command();
|
|
127
|
+
|
|
128
|
+
program
|
|
129
|
+
.command('apply-patches')
|
|
130
|
+
.argument('<feature-path>', 'Path to the feature')
|
|
131
|
+
.argument('<app-path>', 'Path to the app')
|
|
132
|
+
.argument('<target-dir>', 'Target directory')
|
|
133
|
+
.option('--skip-dependency-changes', 'Skip installing dependencies from package.json')
|
|
134
|
+
.option('--clean', 'Remove target directory if it exists before applying patches');
|
|
135
|
+
|
|
136
|
+
const cmd = program.commands[0];
|
|
137
|
+
const options = cmd.options;
|
|
138
|
+
|
|
139
|
+
expect(options.find(opt => opt.long === '--skip-dependency-changes')).toBeDefined();
|
|
140
|
+
expect(options.find(opt => opt.long === '--clean')).toBeDefined();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('should have correct option flags for watch-patches', () => {
|
|
144
|
+
const program = new Command();
|
|
145
|
+
|
|
146
|
+
program
|
|
147
|
+
.command('watch-patches')
|
|
148
|
+
.argument('<feature-path>', 'Path to the feature')
|
|
149
|
+
.argument('<app-path>', 'Path to the app')
|
|
150
|
+
.argument('<target-dir>', 'Target directory')
|
|
151
|
+
.option('--clean', 'Remove target directory if it exists before applying patches');
|
|
152
|
+
|
|
153
|
+
const cmd = program.commands[0];
|
|
154
|
+
const options = cmd.options;
|
|
155
|
+
|
|
156
|
+
expect(options.find(opt => opt.long === '--clean')).toBeDefined();
|
|
157
|
+
});
|
|
158
|
+
});
|