@open-mercato/cli 0.9.1-develop.7575.1.8480826a9b → 0.10.0
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/.turbo/turbo-build.log +16 -2
- package/build.mjs +1 -0
- package/dist/agentic/claude-code/mcp.json.example +5 -1
- package/dist/agentic/codex/mcp.json.example +3 -0
- package/dist/agentic/cursor/mcp.json.example +4 -1
- package/dist/agentic/github-copilot/mcp.json.example +5 -1
- package/dist/agentic/guides/ai-workflows.md +1 -0
- package/dist/agentic/guides/architecture.md +9 -5
- package/dist/agentic/guides/customers-calendar.md +57 -0
- package/dist/agentic/guides/extensions.md +2 -0
- package/dist/agentic/guides/module-facts.json +25282 -6677
- package/dist/agentic/guides/module-facts.v2.json +25371 -6677
- package/dist/agentic/guides/module-tool.md +56 -0
- package/dist/agentic/guides/modules/agent_orchestrator/acl-features.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/backend-pages.md +3 -0
- package/dist/agentic/guides/modules/agent_orchestrator/cli-commands.md +4 -0
- package/dist/agentic/guides/modules/agent_orchestrator/contribution-resolutions.md +6 -0
- package/dist/agentic/guides/modules/agent_orchestrator/di-registrations-rich.md +32 -32
- package/dist/agentic/guides/modules/agent_orchestrator/di-service-tokens.md +14 -14
- package/dist/agentic/guides/modules/agent_orchestrator/domain-commands.md +3 -0
- package/dist/agentic/guides/modules/agent_orchestrator/events.md +30 -29
- package/dist/agentic/guides/modules/agent_orchestrator/exact-override-targets.md +104 -35
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +17 -6
- package/dist/agentic/guides/modules/agent_orchestrator/setup.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/umes-contributions.md +6 -0
- package/dist/agentic/guides/modules/agent_orchestrator/umes-hosts.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/workers.md +2 -0
- package/dist/agentic/guides/modules/ai_assistant/acl-features.md +4 -1
- package/dist/agentic/guides/modules/ai_assistant/ai-tools-mcp-capabilities.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/backend-pages.md +4 -0
- package/dist/agentic/guides/modules/ai_assistant/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/contribution-resolutions.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/di-registrations-rich.md +5 -3
- package/dist/agentic/guides/modules/ai_assistant/di-service-tokens.md +4 -2
- package/dist/agentic/guides/modules/ai_assistant/encryption.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/entities.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/events.md +9 -8
- package/dist/agentic/guides/modules/ai_assistant/exact-override-targets.md +23 -6
- package/dist/agentic/guides/modules/ai_assistant/index.md +9 -9
- package/dist/agentic/guides/modules/ai_assistant/notifications.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/setup.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/umes-contributions.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/ai_assistant/workers.md +2 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/active-extension-bindings.md +12 -0
- package/dist/agentic/guides/modules/attachments/ai-tools-mcp-capabilities.md +11 -0
- package/dist/agentic/guides/modules/attachments/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/attachments/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/attachments/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/attachments/di-registrations-rich.md +6 -6
- package/dist/agentic/guides/modules/attachments/di-service-tokens.md +5 -5
- package/dist/agentic/guides/modules/attachments/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/attachments/encryption.md +12 -0
- package/dist/agentic/guides/modules/attachments/entities.md +2 -0
- package/dist/agentic/guides/modules/attachments/events.md +3 -3
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +17 -7
- package/dist/agentic/guides/modules/attachments/generator-plugins.md +11 -0
- package/dist/agentic/guides/modules/attachments/index.md +13 -5
- package/dist/agentic/guides/modules/attachments/search-entities.md +11 -0
- package/dist/agentic/guides/modules/attachments/setup.md +1 -1
- package/dist/agentic/guides/modules/attachments/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/attachments/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/attachments/workers.md +2 -0
- package/dist/agentic/guides/modules/audit_logs/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/audit_logs/incoming-installed-contributions.md +12 -0
- package/dist/agentic/guides/modules/audit_logs/index.md +4 -2
- package/dist/agentic/guides/modules/auth/events.md +12 -12
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/events.md +3 -3
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/events.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/acl-features.md +12 -0
- package/dist/agentic/guides/modules/carrier_inpost/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/carrier_inpost/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/exact-override-targets.md +16 -0
- package/dist/agentic/guides/modules/carrier_inpost/index.md +18 -0
- package/dist/agentic/guides/modules/carrier_inpost/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/setup.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/cart/acl-features.md +19 -0
- package/dist/agentic/guides/modules/cart/contribution-resolutions.md +24 -0
- package/dist/agentic/guides/modules/cart/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/cart/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/cart/domain-commands.md +24 -0
- package/dist/agentic/guides/modules/cart/encryption.md +11 -0
- package/dist/agentic/guides/modules/cart/entities.md +15 -0
- package/dist/agentic/guides/modules/cart/events.md +35 -0
- package/dist/agentic/guides/modules/cart/exact-override-targets.md +27 -0
- package/dist/agentic/guides/modules/cart/index.md +25 -0
- package/dist/agentic/guides/modules/cart/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/cart/setup.md +11 -0
- package/dist/agentic/guides/modules/cart/umes-contributions.md +24 -0
- package/dist/agentic/guides/modules/cart/umes-hosts.md +40 -0
- package/dist/agentic/guides/modules/cart/workers.md +14 -0
- package/dist/agentic/guides/modules/catalog/acl-features.md +3 -1
- package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +3 -3
- package/dist/agentic/guides/modules/catalog/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +2 -0
- package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +7 -4
- package/dist/agentic/guides/modules/catalog/di-service-tokens.md +4 -1
- package/dist/agentic/guides/modules/catalog/entities.md +1 -0
- package/dist/agentic/guides/modules/catalog/events.md +18 -18
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +12 -4
- package/dist/agentic/guides/modules/catalog/index.md +6 -6
- package/dist/agentic/guides/modules/catalog/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/catalog/umes-contributions.md +2 -0
- package/dist/agentic/guides/modules/catalog/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/acl-features.md +12 -0
- package/dist/agentic/guides/modules/channel_smtp/contribution-resolutions.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/di-registrations-rich.md +12 -0
- package/dist/agentic/guides/modules/channel_smtp/exact-override-targets.md +16 -0
- package/dist/agentic/guides/modules/channel_smtp/index.md +18 -0
- package/dist/agentic/guides/modules/channel_smtp/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/setup.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/umes-contributions.md +11 -0
- package/dist/agentic/guides/modules/checkout/events.md +16 -16
- package/dist/agentic/guides/modules/checkout/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/setup.md +1 -1
- package/dist/agentic/guides/modules/checkout/workers.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/events.md +17 -17
- package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/communication_channels/index.md +2 -2
- package/dist/agentic/guides/modules/communication_channels/setup.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/workers.md +2 -2
- package/dist/agentic/guides/modules/configs/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/currencies/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/currencies/events.md +6 -6
- package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/currencies/index.md +4 -2
- package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -0
- package/dist/agentic/guides/modules/customer_accounts/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/customer_accounts/events.md +27 -26
- package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/incoming-installed-contributions.md +13 -0
- package/dist/agentic/guides/modules/customer_accounts/index.md +6 -4
- package/dist/agentic/guides/modules/customer_accounts/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/customer_groups/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/customer_groups/events.md +7 -7
- package/dist/agentic/guides/modules/customer_groups/incoming-installed-contributions.md +11 -0
- package/dist/agentic/guides/modules/customer_groups/index.md +3 -2
- package/dist/agentic/guides/modules/customer_groups/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/customers/active-extension-bindings.md +12 -13
- package/dist/agentic/guides/modules/customers/di-registrations-rich.md +6 -3
- package/dist/agentic/guides/modules/customers/encryption.md +1 -1
- package/dist/agentic/guides/modules/customers/events.md +51 -51
- package/dist/agentic/guides/modules/customers/exact-override-targets.md +6 -3
- package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +12 -8
- package/dist/agentic/guides/modules/customers/index.md +12 -4
- package/dist/agentic/guides/modules/customers/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/customers/umes-hosts.md +48 -0
- package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/data_sync/di-service-tokens.md +4 -4
- package/dist/agentic/guides/modules/data_sync/events.md +4 -4
- package/dist/agentic/guides/modules/data_sync/exact-override-targets.md +8 -8
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/events.md +5 -5
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/events.md +3 -3
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/directory/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/directory/events.md +6 -6
- package/dist/agentic/guides/modules/directory/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/directory/incoming-installed-contributions.md +4 -0
- package/dist/agentic/guides/modules/directory/index.md +2 -2
- package/dist/agentic/guides/modules/directory/umes-contributions.md +1 -0
- package/dist/agentic/guides/modules/documents/contribution-resolutions.md +3 -3
- package/dist/agentic/guides/modules/documents/events.md +15 -15
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/documents/umes-contributions.md +5 -5
- package/dist/agentic/guides/modules/ecommerce/acl-features.md +15 -0
- package/dist/agentic/guides/modules/ecommerce/active-extension-bindings.md +12 -0
- package/dist/agentic/guides/modules/ecommerce/backend-pages.md +12 -0
- package/dist/agentic/guides/modules/ecommerce/contribution-resolutions.md +33 -0
- package/dist/agentic/guides/modules/ecommerce/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/entities.md +13 -0
- package/dist/agentic/guides/modules/ecommerce/events.md +22 -0
- package/dist/agentic/guides/modules/ecommerce/exact-override-targets.md +42 -0
- package/dist/agentic/guides/modules/ecommerce/index.md +26 -0
- package/dist/agentic/guides/modules/ecommerce/notifications.md +12 -0
- package/dist/agentic/guides/modules/ecommerce/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/search-entities.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/setup.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/umes-contributions.md +33 -0
- package/dist/agentic/guides/modules/ecommerce/umes-hosts.md +27 -0
- package/dist/agentic/guides/modules/entities/contribution-resolutions.md +14 -0
- package/dist/agentic/guides/modules/entities/exact-override-targets.md +4 -0
- package/dist/agentic/guides/modules/entities/index.md +5 -3
- package/dist/agentic/guides/modules/entities/umes-contributions.md +14 -0
- package/dist/agentic/guides/modules/eudr/events.md +23 -23
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/events.md +18 -18
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/forms/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/acl-features.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/cli-commands.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/contribution-resolutions.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/gateway_autopay/index.md +19 -0
- package/dist/agentic/guides/modules/gateway_autopay/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/setup.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/umes-contributions.md +12 -0
- package/dist/agentic/guides/modules/gateway_stripe/di-registrations-rich.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/acl-features.md +12 -0
- package/dist/agentic/guides/modules/gateway_tpay/cli-commands.md +12 -0
- package/dist/agentic/guides/modules/gateway_tpay/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/gateway_tpay/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/gateway_tpay/exact-override-targets.md +20 -0
- package/dist/agentic/guides/modules/gateway_tpay/index.md +20 -0
- package/dist/agentic/guides/modules/gateway_tpay/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/gateway_tpay/setup.md +11 -0
- package/dist/agentic/guides/modules/gateway_tpay/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/gateway_tpay/workers.md +11 -0
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/events.md +13 -13
- package/dist/agentic/guides/modules/inbox_ops/index.md +2 -2
- package/dist/agentic/guides/modules/integrations/di-registrations-rich.md +9 -8
- package/dist/agentic/guides/modules/integrations/di-service-tokens.md +5 -4
- package/dist/agentic/guides/modules/integrations/events.md +4 -4
- package/dist/agentic/guides/modules/integrations/exact-override-targets.md +12 -10
- package/dist/agentic/guides/modules/integrations/incoming-installed-contributions.md +11 -0
- package/dist/agentic/guides/modules/integrations/index.md +3 -2
- package/dist/agentic/guides/modules/integrations/setup.md +1 -1
- package/dist/agentic/guides/modules/messages/entities.md +2 -0
- package/dist/agentic/guides/modules/messages/events.md +9 -9
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/messages/umes-hosts.md +2 -0
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/di-registrations-rich.md +4 -4
- package/dist/agentic/guides/modules/payment_gateways/di-service-tokens.md +2 -2
- package/dist/agentic/guides/modules/payment_gateways/events.md +9 -9
- package/dist/agentic/guides/modules/payment_gateways/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/setup.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/events.md +3 -3
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/planner/events.md +6 -6
- package/dist/agentic/guides/modules/planner/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/planner/setup.md +1 -1
- package/dist/agentic/guides/modules/portal/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/portal/frontend-pages.md +1 -0
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/portal/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/progress/events.md +6 -6
- package/dist/agentic/guides/modules/progress/index.md +2 -2
- package/dist/agentic/guides/modules/promotions/acl-features.md +18 -0
- package/dist/agentic/guides/modules/promotions/active-extension-bindings.md +12 -0
- package/dist/agentic/guides/modules/promotions/backend-pages.md +16 -0
- package/dist/agentic/guides/modules/promotions/contribution-resolutions.md +18 -0
- package/dist/agentic/guides/modules/promotions/di-registrations-rich.md +15 -0
- package/dist/agentic/guides/modules/promotions/di-service-tokens.md +15 -0
- package/dist/agentic/guides/modules/promotions/domain-commands.md +23 -0
- package/dist/agentic/guides/modules/promotions/entities.md +19 -0
- package/dist/agentic/guides/modules/promotions/events.md +24 -0
- package/dist/agentic/guides/modules/promotions/exact-override-targets.md +41 -0
- package/dist/agentic/guides/modules/promotions/index.md +26 -0
- package/dist/agentic/guides/modules/promotions/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/promotions/setup.md +11 -0
- package/dist/agentic/guides/modules/promotions/umes-contributions.md +18 -0
- package/dist/agentic/guides/modules/promotions/umes-hosts.md +33 -0
- package/dist/agentic/guides/modules/promotions/workers.md +12 -0
- package/dist/agentic/guides/modules/push_notifications/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/push_notifications/events.md +2 -2
- package/dist/agentic/guides/modules/push_notifications/index.md +3 -2
- package/dist/agentic/guides/modules/query_index/events.md +8 -8
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/events.md +10 -10
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/events.md +15 -15
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/active-extension-bindings.md +5 -0
- package/dist/agentic/guides/modules/sales/di-registrations-rich.md +30 -30
- package/dist/agentic/guides/modules/sales/di-service-tokens.md +5 -5
- package/dist/agentic/guides/modules/sales/domain-commands.md +1 -0
- package/dist/agentic/guides/modules/sales/events.md +44 -44
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +30 -30
- package/dist/agentic/guides/modules/sales/incoming-installed-contributions.md +3 -1
- package/dist/agentic/guides/modules/sales/index.md +4 -4
- package/dist/agentic/guides/modules/sales/umes-hosts.md +5 -2
- package/dist/agentic/guides/modules/scheduler/events.md +4 -4
- package/dist/agentic/guides/modules/scheduler/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/workers.md +1 -1
- package/dist/agentic/guides/modules/search/events.md +1 -1
- package/dist/agentic/guides/modules/search/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/search/workers.md +1 -1
- package/dist/agentic/guides/modules/security/contribution-resolutions.md +2 -0
- package/dist/agentic/guides/modules/security/events.md +22 -21
- package/dist/agentic/guides/modules/security/exact-override-targets.md +2 -0
- package/dist/agentic/guides/modules/security/index.md +2 -2
- package/dist/agentic/guides/modules/security/notifications.md +1 -0
- package/dist/agentic/guides/modules/security/umes-contributions.md +2 -0
- package/dist/agentic/guides/modules/security/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/contribution-resolutions.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/events.md +7 -7
- package/dist/agentic/guides/modules/shipping_carriers/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/umes-contributions.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/workers.md +1 -1
- package/dist/agentic/guides/modules/sso/di-registrations-rich.md +8 -7
- package/dist/agentic/guides/modules/sso/di-service-tokens.md +7 -6
- package/dist/agentic/guides/modules/sso/events.md +12 -12
- package/dist/agentic/guides/modules/sso/exact-override-targets.md +8 -7
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/active-extension-bindings.md +5 -3
- package/dist/agentic/guides/modules/staff/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/staff/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/staff/contribution-resolutions.md +23 -0
- package/dist/agentic/guides/modules/staff/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/staff/domain-commands.md +2 -0
- package/dist/agentic/guides/modules/staff/encryption.md +1 -0
- package/dist/agentic/guides/modules/staff/entities.md +3 -0
- package/dist/agentic/guides/modules/staff/events.md +75 -70
- package/dist/agentic/guides/modules/staff/exact-override-targets.md +99 -12
- package/dist/agentic/guides/modules/staff/frontend-pages.md +3 -0
- package/dist/agentic/guides/modules/staff/index.md +26 -13
- package/dist/agentic/guides/modules/staff/notifications.md +4 -0
- package/dist/agentic/guides/modules/staff/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/staff/setup.md +1 -1
- package/dist/agentic/guides/modules/staff/umes-contributions.md +24 -1
- package/dist/agentic/guides/modules/staff/umes-hosts.md +9 -0
- package/dist/agentic/guides/modules/storage_s3/di-registrations-rich.md +3 -3
- package/dist/agentic/guides/modules/storage_s3/di-service-tokens.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/translations/events.md +2 -2
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/events.md +14 -14
- package/dist/agentic/guides/modules/warranty_claims/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/warranty_claims/index.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/setup.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/workers.md +1 -1
- package/dist/agentic/guides/modules/webhooks/events.md +12 -12
- package/dist/agentic/guides/modules/webhooks/exact-override-targets.md +2 -2
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/workers.md +2 -2
- package/dist/agentic/guides/modules/wms/acl-features.md +3 -1
- package/dist/agentic/guides/modules/wms/backend-pages.md +4 -0
- package/dist/agentic/guides/modules/wms/contribution-resolutions.md +7 -1
- package/dist/agentic/guides/modules/wms/custom-entities.md +3 -0
- package/dist/agentic/guides/modules/wms/domain-commands.md +16 -0
- package/dist/agentic/guides/modules/wms/entities.md +3 -0
- package/dist/agentic/guides/modules/wms/events.md +40 -28
- package/dist/agentic/guides/modules/wms/exact-override-targets.md +10 -0
- package/dist/agentic/guides/modules/wms/host-extension-points.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +14 -10
- package/dist/agentic/guides/modules/wms/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/wms/search-entities.md +2 -0
- package/dist/agentic/guides/modules/wms/umes-contributions.md +7 -1
- package/dist/agentic/guides/modules/wms/umes-diagnostics.md +2 -0
- package/dist/agentic/guides/modules/wms/umes-hosts.md +54 -0
- package/dist/agentic/guides/modules/workflows/contribution-resolutions.md +3 -3
- package/dist/agentic/guides/modules/workflows/events.md +32 -32
- package/dist/agentic/guides/modules/workflows/exact-override-targets.md +2 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/workflows/setup.md +1 -1
- package/dist/agentic/guides/modules/workflows/umes-contributions.md +3 -3
- package/dist/agentic/guides/production-deployment.md +82 -0
- package/dist/agentic/guides/reference-module-facts.json +819 -33
- package/dist/agentic/guides/reference-modules/example/active-extension-bindings.md +2 -0
- package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +15 -4
- package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -2
- package/dist/agentic/guides/reference-modules/example/di-service-tokens.md +1 -1
- package/dist/agentic/guides/reference-modules/example/events.md +5 -5
- package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +21 -11
- package/dist/agentic/guides/reference-modules/example/index.md +4 -4
- package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
- package/dist/agentic/guides/reference-modules/example/umes-contributions.md +16 -5
- package/dist/agentic/guides/reference-modules/example/umes-hosts.md +1 -0
- package/dist/agentic/guides/template-tool.md +38 -0
- package/dist/agentic/guides/testing-debugging.md +2 -2
- package/dist/agentic/guides/upstream/AGENTS.md +3 -3
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +343 -206
- package/dist/agentic/guides/upstream/manifest.json +3 -3
- package/dist/agentic/shared/AGENTS.md.template +16 -10
- package/dist/agentic/shared/ai/harness/README.md +10 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +639 -44
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/design-system-inventory.json +63 -3
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +516 -8
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/qa/tests/playwright.config.ts +1 -0
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.9.0-to-0.10.0/SKILL.md +269 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +6 -5
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +27 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +1 -1
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +13 -1
- package/dist/agentic/shared/ai/skills/om-find-module/SKILL.md +52 -0
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +1 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +1 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +1 -1
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +2 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +7 -5
- package/dist/agentic/shared/ai/skills/om-setup-ci/SKILL.md +42 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/setup-ci.mjs +525 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/verify-semgrep-rules.mjs +54 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/docs/README.md +463 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/gitleaks/action.yml +25 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/playwright/action.yml +31 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/setup/action.yml +55 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/dependabot.yml +27 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/audit.yml +193 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/ci.yml +477 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/codeql.yml +63 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/security.yml +254 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci-allowlist.json +4 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci.mjs +283 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.fixture.txt +89 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.yml +146 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/time-bomb-scanner.mjs +286 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/zap-rules.tsv +11 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +1 -1
- package/dist/agentic/shared/ai/skills/tiers.json +5 -2
- package/dist/agentic/shared/ai/trackers/github.md +314 -44
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +78 -9
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +9 -7
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +3 -3
- package/dist/bin.js +2 -0
- package/dist/bin.js.map +2 -2
- package/dist/i18n/de.json +4 -0
- package/dist/i18n/en.json +4 -0
- package/dist/i18n/es.json +4 -0
- package/dist/i18n/ko.json +4 -0
- package/dist/i18n/pl.json +4 -0
- package/dist/lib/__fixtures__/module-search/built-in.json +235 -0
- package/dist/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
- package/dist/lib/__fixtures__/module-search/modules-index.json +1980 -0
- package/dist/lib/__fixtures__/official-module-package/package.json +33 -0
- package/dist/lib/__integration__/TC-INT-007.spec.js +241 -21
- package/dist/lib/__integration__/TC-INT-007.spec.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-009.spec.js +267 -0
- package/dist/lib/__integration__/TC-INT-009.spec.js.map +7 -0
- package/dist/lib/db/commands.js +2 -0
- package/dist/lib/db/commands.js.map +2 -2
- package/dist/lib/db/numeric-snapshots.js +13 -0
- package/dist/lib/db/numeric-snapshots.js.map +7 -0
- package/dist/lib/eject.js +25 -9
- package/dist/lib/eject.js.map +2 -2
- package/dist/lib/env-example.js +25 -0
- package/dist/lib/env-example.js.map +7 -0
- package/dist/lib/generate-child-process.js +23 -0
- package/dist/lib/generate-child-process.js.map +7 -0
- package/dist/lib/generators/ast/imports.js +9 -4
- package/dist/lib/generators/ast/imports.js.map +2 -2
- package/dist/lib/generators/entity-ids.js +12 -12
- package/dist/lib/generators/entity-ids.js.map +2 -2
- package/dist/lib/generators/extensions/agent-files.js +119 -4
- package/dist/lib/generators/extensions/agent-files.js.map +2 -2
- package/dist/lib/generators/module-di.js +8 -9
- package/dist/lib/generators/module-di.js.map +2 -2
- package/dist/lib/generators/module-entities.js +8 -9
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-facts.js +7 -5
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-override-targets.js +6 -1
- package/dist/lib/generators/module-override-targets.js.map +2 -2
- package/dist/lib/generators/module-package-sources.js +6 -4
- package/dist/lib/generators/module-package-sources.js.map +2 -2
- package/dist/lib/generators/module-registry.js +157 -144
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/openapi.js +9 -2
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/generators/source-exports.js +73 -0
- package/dist/lib/generators/source-exports.js.map +7 -0
- package/dist/lib/in-process-generate-watcher.js +11 -5
- package/dist/lib/in-process-generate-watcher.js.map +2 -2
- package/dist/lib/init-existing-database.js +26 -0
- package/dist/lib/init-existing-database.js.map +7 -0
- package/dist/lib/init-secrets.js +33 -1
- package/dist/lib/init-secrets.js.map +2 -2
- package/dist/lib/init-summary.js +44 -0
- package/dist/lib/init-summary.js.map +7 -0
- package/dist/lib/module-github.js +98 -0
- package/dist/lib/module-github.js.map +7 -0
- package/dist/lib/module-identity.js +131 -0
- package/dist/lib/module-identity.js.map +7 -0
- package/dist/lib/module-inspection.js +124 -0
- package/dist/lib/module-inspection.js.map +7 -0
- package/dist/lib/module-install.js +186 -19
- package/dist/lib/module-install.js.map +3 -3
- package/dist/lib/module-package.js +205 -15
- package/dist/lib/module-package.js.map +2 -2
- package/dist/lib/module-search-args.js +97 -0
- package/dist/lib/module-search-args.js.map +7 -0
- package/dist/lib/module-search-index.js +681 -0
- package/dist/lib/module-search-index.js.map +7 -0
- package/dist/lib/module-search.js +727 -0
- package/dist/lib/module-search.js.map +7 -0
- package/dist/lib/modules-config.js +210 -66
- package/dist/lib/modules-config.js.map +2 -2
- package/dist/lib/queue-worker-supervisor.js +3 -0
- package/dist/lib/queue-worker-supervisor.js.map +2 -2
- package/dist/lib/resolver.js +54 -35
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/telemetry-init.js +1 -1
- package/dist/lib/telemetry-init.js.map +1 -1
- package/dist/lib/testing/integration-discovery.js +61 -21
- package/dist/lib/testing/integration-discovery.js.map +2 -2
- package/dist/lib/testing/integration.js +35 -4
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +209 -79
- package/dist/mercato.js.map +2 -2
- package/jest.config.cjs +1 -1
- package/package.json +9 -9
- package/src/__tests__/documented-queue-subcommands.test.ts +63 -0
- package/src/__tests__/mercato.test.ts +905 -0
- package/src/bin.ts +5 -0
- package/src/i18n/de.json +4 -0
- package/src/i18n/en.json +4 -0
- package/src/i18n/es.json +4 -0
- package/src/i18n/ko.json +4 -0
- package/src/i18n/pl.json +4 -0
- package/src/lib/__fixtures__/module-search/README.md +97 -0
- package/src/lib/__fixtures__/module-search/built-in.json +235 -0
- package/src/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
- package/src/lib/__fixtures__/module-search/modules-index.json +1980 -0
- package/src/lib/__fixtures__/official-module-package/dist/modules/test_package/widgets/injection/test/widget.js +1 -0
- package/src/lib/__integration__/TC-INT-007.spec.ts +259 -21
- package/src/lib/__integration__/TC-INT-009.spec.ts +279 -0
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +4 -0
- package/src/lib/__tests__/bin-next-subpath-hook.test.ts +25 -0
- package/src/lib/__tests__/eject.test.ts +98 -4
- package/src/lib/__tests__/env-example.test.ts +58 -0
- package/src/lib/__tests__/generate-child-process.test.ts +185 -0
- package/src/lib/__tests__/generate-quiet-entrypoint.test.ts +47 -0
- package/src/lib/__tests__/in-process-generate-watcher.test.ts +91 -0
- package/src/lib/__tests__/init-existing-database.test.ts +27 -0
- package/src/lib/__tests__/init-secrets.test.ts +85 -1
- package/src/lib/__tests__/init-summary.test.ts +50 -0
- package/src/lib/__tests__/module-github.test.ts +108 -0
- package/src/lib/__tests__/module-identity.test.ts +144 -0
- package/src/lib/__tests__/module-inspection.test.ts +195 -0
- package/src/lib/__tests__/module-install.test.ts +614 -19
- package/src/lib/__tests__/module-package.test.ts +154 -0
- package/src/lib/__tests__/module-search.test.ts +1040 -0
- package/src/lib/__tests__/modules-config.test.ts +453 -1
- package/src/lib/__tests__/queue-worker-supervisor.test.ts +145 -1
- package/src/lib/__tests__/resolver.enterprise.test.ts +60 -0
- package/src/lib/__tests__/resolver.packages.test.ts +29 -0
- package/src/lib/__tests__/telemetry-init.test.ts +1 -1
- package/src/lib/db/__tests__/identifiers.test.ts +19 -0
- package/src/lib/db/__tests__/numeric-snapshots.test.ts +79 -0
- package/src/lib/db/commands.ts +2 -0
- package/src/lib/db/numeric-snapshots.ts +12 -0
- package/src/lib/eject.ts +28 -10
- package/src/lib/env-example.ts +31 -0
- package/src/lib/generate-child-process.ts +35 -0
- package/src/lib/generators/__tests__/agent-files-extension.test.ts +178 -0
- package/src/lib/generators/__tests__/attachment-access.test.ts +70 -0
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +42 -18
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +9 -8
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +5 -1
- package/src/lib/generators/__tests__/module-id-collisions.test.ts +146 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +8 -2
- package/src/lib/generators/__tests__/module-package-sources.test.ts +26 -6
- package/src/lib/generators/__tests__/module-registry-requires-enforcement.test.ts +130 -0
- package/src/lib/generators/__tests__/module-requirements.test.ts +56 -0
- package/src/lib/generators/__tests__/module-requires.test.ts +242 -0
- package/src/lib/generators/__tests__/module-subset.test.ts +103 -0
- package/src/lib/generators/__tests__/openapi.test.ts +24 -0
- package/src/lib/generators/ast/imports.ts +14 -4
- package/src/lib/generators/entity-ids.ts +12 -12
- package/src/lib/generators/extensions/agent-files.ts +154 -4
- package/src/lib/generators/module-di.ts +8 -9
- package/src/lib/generators/module-entities.ts +8 -9
- package/src/lib/generators/module-facts.ts +9 -5
- package/src/lib/generators/module-override-targets.ts +6 -1
- package/src/lib/generators/module-package-sources.ts +7 -5
- package/src/lib/generators/module-registry.ts +224 -182
- package/src/lib/generators/openapi.ts +10 -2
- package/src/lib/generators/source-exports.ts +93 -0
- package/src/lib/in-process-generate-watcher.ts +14 -6
- package/src/lib/init-existing-database.ts +24 -0
- package/src/lib/init-secrets.ts +37 -0
- package/src/lib/init-summary.ts +54 -0
- package/src/lib/module-github.ts +109 -0
- package/src/lib/module-identity.ts +145 -0
- package/src/lib/module-inspection.ts +133 -0
- package/src/lib/module-install.ts +214 -22
- package/src/lib/module-package.ts +243 -16
- package/src/lib/module-search-args.ts +116 -0
- package/src/lib/module-search-index.ts +1037 -0
- package/src/lib/module-search.ts +1013 -0
- package/src/lib/modules-config.ts +278 -80
- package/src/lib/queue-worker-supervisor.ts +3 -0
- package/src/lib/resolver.ts +58 -40
- package/src/lib/telemetry-init.ts +1 -1
- package/src/lib/testing/__tests__/integration-discovery.test.ts +89 -0
- package/src/lib/testing/__tests__/integration.test.ts +55 -0
- package/src/lib/testing/integration-discovery.ts +101 -32
- package/src/lib/testing/integration.ts +36 -4
- package/src/mercato.ts +267 -94
- package/src/types/cross-spawn.d.ts +2 -2
- package/src/lib/__tests__/agentic-build-artifacts.test.ts +0 -28
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events'
|
|
1
2
|
import fs from 'node:fs'
|
|
2
3
|
import os from 'node:os'
|
|
3
4
|
import path from 'node:path'
|
|
4
|
-
import type
|
|
5
|
+
import { readEnabledModulesFromConfig, type PackageResolver } from '../resolver'
|
|
5
6
|
import { addOfficialModule, enableOfficialModule } from '../module-install'
|
|
7
|
+
import * as github from '../module-github'
|
|
8
|
+
import * as inspection from '../module-inspection'
|
|
9
|
+
import spawn from 'cross-spawn'
|
|
10
|
+
import { execFileSync } from 'node:child_process'
|
|
11
|
+
import { getModuleLocators } from '../module-identity'
|
|
12
|
+
import { resolveModuleRequirement } from '@open-mercato/shared/modules/module-locators'
|
|
13
|
+
|
|
14
|
+
import * as modulesConfig from '../modules-config'
|
|
15
|
+
|
|
16
|
+
jest.mock('cross-spawn', () => ({ __esModule: true, default: jest.fn() }))
|
|
17
|
+
|
|
18
|
+
const mockedSpawn = spawn as unknown as jest.Mock
|
|
6
19
|
|
|
7
20
|
function buildPackageFixture(
|
|
8
21
|
packageRoot: string,
|
|
@@ -11,10 +24,12 @@ function buildPackageFixture(
|
|
|
11
24
|
ejectable?: boolean
|
|
12
25
|
extraSourceFiles?: Array<{ relativePath: string; content: string }>
|
|
13
26
|
packageName?: string
|
|
27
|
+
requires?: string[]
|
|
14
28
|
},
|
|
15
29
|
): void {
|
|
16
30
|
const ejectable = options?.ejectable ?? false
|
|
17
31
|
const packageName = options?.packageName ?? '@open-mercato/test-package'
|
|
32
|
+
const requires = options?.requires ?? []
|
|
18
33
|
for (const base of ['src', 'dist']) {
|
|
19
34
|
fs.mkdirSync(path.join(packageRoot, base, 'modules', moduleId), { recursive: true })
|
|
20
35
|
}
|
|
@@ -24,7 +39,7 @@ function buildPackageFixture(
|
|
|
24
39
|
)
|
|
25
40
|
fs.writeFileSync(
|
|
26
41
|
path.join(packageRoot, 'src', 'modules', moduleId, 'index.ts'),
|
|
27
|
-
`export const metadata = { title: 'Test', ejectable: ${ejectable ? 'true' : 'false'} }\n`,
|
|
42
|
+
`export const metadata = { title: 'Test', ejectable: ${ejectable ? 'true' : 'false'}, requires: ${JSON.stringify(requires)} }\n`,
|
|
28
43
|
)
|
|
29
44
|
fs.writeFileSync(
|
|
30
45
|
path.join(packageRoot, 'dist', 'modules', moduleId, 'index.js'),
|
|
@@ -35,6 +50,18 @@ function buildPackageFixture(
|
|
|
35
50
|
const targetPath = path.join(packageRoot, 'src', 'modules', moduleId, file.relativePath)
|
|
36
51
|
fs.mkdirSync(path.dirname(targetPath), { recursive: true })
|
|
37
52
|
fs.writeFileSync(targetPath, file.content)
|
|
53
|
+
|
|
54
|
+
if (/\.[jt]sx?$/.test(file.relativePath)) {
|
|
55
|
+
const runtimePath = path.join(
|
|
56
|
+
packageRoot,
|
|
57
|
+
'dist',
|
|
58
|
+
'modules',
|
|
59
|
+
moduleId,
|
|
60
|
+
file.relativePath.replace(/\.[jt]sx?$/, '.js'),
|
|
61
|
+
)
|
|
62
|
+
fs.mkdirSync(path.dirname(runtimePath), { recursive: true })
|
|
63
|
+
fs.writeFileSync(runtimePath, 'module.exports = {}\n')
|
|
64
|
+
}
|
|
38
65
|
}
|
|
39
66
|
}
|
|
40
67
|
|
|
@@ -46,6 +73,7 @@ function buildResolver(
|
|
|
46
73
|
const modulesTsPath = path.join(appDir, 'src', 'modules.ts')
|
|
47
74
|
fs.mkdirSync(path.join(appDir, 'src'), { recursive: true })
|
|
48
75
|
fs.writeFileSync(modulesTsPath, modulesTsContent)
|
|
76
|
+
const initiallyEnabledModules = readEnabledModulesFromConfig(modulesTsPath)
|
|
49
77
|
|
|
50
78
|
return {
|
|
51
79
|
getAppDir: () => appDir,
|
|
@@ -53,8 +81,17 @@ function buildResolver(
|
|
|
53
81
|
getPackageRoot: () => packageRoot,
|
|
54
82
|
isMonorepo: () => false,
|
|
55
83
|
getRootDir: () => appDir,
|
|
56
|
-
|
|
57
|
-
|
|
84
|
+
discoverPackages: () => [],
|
|
85
|
+
loadEnabledModules: () => initiallyEnabledModules,
|
|
86
|
+
getModulePaths: (entry) => ({
|
|
87
|
+
appBase: path.join(appDir, 'src', 'modules', entry.id),
|
|
88
|
+
pkgBase: path.join(packageRoot, 'src', 'modules', entry.id),
|
|
89
|
+
}),
|
|
90
|
+
getModuleImportBase: (entry) => ({
|
|
91
|
+
appBase: `@/modules/${entry.id}`,
|
|
92
|
+
pkgBase: `${entry.from ?? '@open-mercato/core'}/modules/${entry.id}`,
|
|
93
|
+
}),
|
|
94
|
+
getPackageOutputDir: () => path.join(packageRoot, 'generated'),
|
|
58
95
|
getOutputDir: () => path.join(appDir, '.mercato', 'generated'),
|
|
59
96
|
} as unknown as PackageResolver
|
|
60
97
|
}
|
|
@@ -70,7 +107,15 @@ describe('enableOfficialModule', () => {
|
|
|
70
107
|
fs.rmSync(tmpDir, { recursive: true, force: true })
|
|
71
108
|
})
|
|
72
109
|
|
|
73
|
-
it('
|
|
110
|
+
it.each(['../outside-package', '/absolute/package', 'npm:package', '@vendor/package@next'])('rejects %s as an installed binding before package resolution', async (binding) => {
|
|
111
|
+
const resolver = buildResolver(path.join(tmpDir, 'app'), path.join(tmpDir, 'package'), 'export const enabledModules = []\n')
|
|
112
|
+
const lookup = jest.spyOn(resolver, 'getPackageRoot')
|
|
113
|
+
await expect(enableOfficialModule(resolver, binding, undefined, false, true)).rejects.toThrow('Unsupported installed package binding')
|
|
114
|
+
expect(lookup).not.toHaveBeenCalled()
|
|
115
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe('export const enabledModules = []\n')
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it('succeeds without changes when the module is already enabled with the same source', async () => {
|
|
74
119
|
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'test-package')
|
|
75
120
|
const appDir = path.join(tmpDir, 'app')
|
|
76
121
|
buildPackageFixture(packageRoot, 'test_package')
|
|
@@ -81,9 +126,17 @@ describe('enableOfficialModule', () => {
|
|
|
81
126
|
"export const enabledModules = [{ id: 'test_package', from: '@open-mercato/test-package' }]\n",
|
|
82
127
|
)
|
|
83
128
|
|
|
129
|
+
const modulesTsBefore = fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')
|
|
130
|
+
|
|
84
131
|
await expect(
|
|
85
132
|
enableOfficialModule(resolver, '@open-mercato/test-package'),
|
|
86
|
-
).
|
|
133
|
+
).resolves.toEqual({
|
|
134
|
+
moduleId: 'test_package',
|
|
135
|
+
packageName: '@open-mercato/test-package',
|
|
136
|
+
from: '@open-mercato/test-package',
|
|
137
|
+
registrationChanged: false,
|
|
138
|
+
})
|
|
139
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(modulesTsBefore)
|
|
87
140
|
})
|
|
88
141
|
|
|
89
142
|
it('throws when module is already enabled with different casing in the source field', async () => {
|
|
@@ -104,7 +157,7 @@ describe('enableOfficialModule', () => {
|
|
|
104
157
|
).rejects.toThrow('already registered from')
|
|
105
158
|
})
|
|
106
159
|
|
|
107
|
-
it('
|
|
160
|
+
it('stays a no-op success when enable runs again for an enabled module', async () => {
|
|
108
161
|
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'test-package')
|
|
109
162
|
const appDir = path.join(tmpDir, 'app')
|
|
110
163
|
buildPackageFixture(packageRoot, 'test_package')
|
|
@@ -115,16 +168,14 @@ describe('enableOfficialModule', () => {
|
|
|
115
168
|
"export const enabledModules = [{ id: 'test_package', from: '@open-mercato/test-package' }]\n",
|
|
116
169
|
)
|
|
117
170
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
enableOfficialModule(resolver, '@open-mercato/test-package'),
|
|
124
|
-
).rejects.toThrow('"@open-mercato/test-package"')
|
|
171
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
172
|
+
await expect(
|
|
173
|
+
enableOfficialModule(resolver, '@open-mercato/test-package'),
|
|
174
|
+
).resolves.toMatchObject({ moduleId: 'test_package', registrationChanged: false })
|
|
175
|
+
}
|
|
125
176
|
})
|
|
126
177
|
|
|
127
|
-
it('
|
|
178
|
+
it('succeeds without changes when the specific module is already enabled in a multi-module package', async () => {
|
|
128
179
|
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'multi')
|
|
129
180
|
const appDir = path.join(tmpDir, 'app')
|
|
130
181
|
|
|
@@ -155,15 +206,15 @@ describe('enableOfficialModule', () => {
|
|
|
155
206
|
|
|
156
207
|
await expect(
|
|
157
208
|
enableOfficialModule(resolver, '@open-mercato/multi', 'alpha'),
|
|
158
|
-
).
|
|
209
|
+
).resolves.toMatchObject({ moduleId: 'alpha', registrationChanged: false })
|
|
159
210
|
|
|
160
|
-
// beta is not yet enabled — must not throw "already enabled", even if generators fail afterwards
|
|
161
211
|
try {
|
|
162
212
|
await enableOfficialModule(resolver, '@open-mercato/multi', 'beta')
|
|
163
213
|
} catch (error) {
|
|
164
214
|
const message = error instanceof Error ? error.message : String(error)
|
|
165
|
-
expect(message).
|
|
215
|
+
expect(message).toContain('Module "beta" is enabled')
|
|
166
216
|
}
|
|
217
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toContain("id: 'beta'")
|
|
167
218
|
})
|
|
168
219
|
|
|
169
220
|
it('copies module source into the app when enabling with --eject', async () => {
|
|
@@ -184,6 +235,7 @@ describe('enableOfficialModule', () => {
|
|
|
184
235
|
packageRoot,
|
|
185
236
|
"export const enabledModules = []\n",
|
|
186
237
|
)
|
|
238
|
+
fs.writeFileSync(path.join(appDir, 'package.json'), JSON.stringify({ dependencies: { '@open-mercato/test-package': '0.1.0' } }))
|
|
187
239
|
|
|
188
240
|
await expect(
|
|
189
241
|
enableOfficialModule(
|
|
@@ -202,8 +254,75 @@ describe('enableOfficialModule', () => {
|
|
|
202
254
|
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'test_package', 'index.ts'))).toBe(true)
|
|
203
255
|
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'test_package', 'backend', 'page.tsx'))).toBe(true)
|
|
204
256
|
expect(fs.readFileSync(path.join(appDir, 'src', 'modules.ts'), 'utf8')).toContain(
|
|
205
|
-
"{ id: 'test_package', from: '@app' }",
|
|
257
|
+
"{ id: 'test_package', from: '@app', locator: 'npm:@open-mercato/test-package', packageName: '@open-mercato/test-package' }",
|
|
258
|
+
)
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
it('rejects missing descriptor dependencies before registration or ejection', async () => {
|
|
262
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'test-package')
|
|
263
|
+
const appDir = path.join(tmpDir, 'app')
|
|
264
|
+
const initialModulesSource = "export const enabledModules = [{ id: 'customers' }]\n"
|
|
265
|
+
buildPackageFixture(packageRoot, 'test_package', {
|
|
266
|
+
ejectable: true,
|
|
267
|
+
requires: ['customers', 'catalog'],
|
|
268
|
+
})
|
|
269
|
+
const resolver = buildResolver(appDir, packageRoot, initialModulesSource)
|
|
270
|
+
|
|
271
|
+
await expect(
|
|
272
|
+
enableOfficialModule(resolver, '@open-mercato/test-package', undefined, true),
|
|
273
|
+
).rejects.toThrow(
|
|
274
|
+
'Module "test_package" requires module(s) that are not enabled: catalog.\n'
|
|
275
|
+
+ 'Enable the missing module(s) in src/modules.ts first, then rerun this command.',
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
expect(fs.readFileSync(path.join(appDir, 'src', 'modules.ts'), 'utf8')).toBe(initialModulesSource)
|
|
279
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'test_package'))).toBe(false)
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
it('allows registration when every descriptor dependency is enabled', async () => {
|
|
283
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'test-package')
|
|
284
|
+
const appDir = path.join(tmpDir, 'app')
|
|
285
|
+
buildPackageFixture(packageRoot, 'test_package', {
|
|
286
|
+
requires: ['customers', 'catalog'],
|
|
287
|
+
})
|
|
288
|
+
const resolver = buildResolver(
|
|
289
|
+
appDir,
|
|
290
|
+
packageRoot,
|
|
291
|
+
"export const enabledModules = [{ id: 'customers' }, { id: 'catalog' }]\n",
|
|
206
292
|
)
|
|
293
|
+
|
|
294
|
+
await expect(
|
|
295
|
+
enableOfficialModule(resolver, '@open-mercato/test-package'),
|
|
296
|
+
).resolves.toMatchObject({ moduleId: 'test_package', registrationChanged: true })
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
it('rejects --eject for a module gated behind a disabled env flag before copying any source', async () => {
|
|
300
|
+
const originalFlag = process.env.OM_ENABLE_TEST_PACKAGE
|
|
301
|
+
delete process.env.OM_ENABLE_TEST_PACKAGE
|
|
302
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'test-package')
|
|
303
|
+
const appDir = path.join(tmpDir, 'app')
|
|
304
|
+
buildPackageFixture(packageRoot, 'test_package', { ejectable: true })
|
|
305
|
+
|
|
306
|
+
const resolver = buildResolver(
|
|
307
|
+
appDir,
|
|
308
|
+
packageRoot,
|
|
309
|
+
[
|
|
310
|
+
'export const enabledModules = []',
|
|
311
|
+
"if (process.env.OM_ENABLE_TEST_PACKAGE === 'true') {",
|
|
312
|
+
" enabledModules.push({ id: 'test_package', from: '@open-mercato/test-package' })",
|
|
313
|
+
'}',
|
|
314
|
+
].join('\n'),
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
try {
|
|
318
|
+
await expect(
|
|
319
|
+
enableOfficialModule(resolver, '@open-mercato/test-package', undefined, true),
|
|
320
|
+
).rejects.toThrow('behind a condition that is currently off')
|
|
321
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'test_package'))).toBe(false)
|
|
322
|
+
} finally {
|
|
323
|
+
if (originalFlag === undefined) delete process.env.OM_ENABLE_TEST_PACKAGE
|
|
324
|
+
else process.env.OM_ENABLE_TEST_PACKAGE = originalFlag
|
|
325
|
+
}
|
|
207
326
|
})
|
|
208
327
|
|
|
209
328
|
it('rejects enabling with --eject when the package is not ejectable', async () => {
|
|
@@ -301,3 +420,479 @@ describe('third-party module packages', () => {
|
|
|
301
420
|
)
|
|
302
421
|
})
|
|
303
422
|
})
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
describe('canonical module preflight', () => {
|
|
426
|
+
let root: string
|
|
427
|
+
beforeEach(() => { root = fs.mkdtempSync(path.join(os.tmpdir(), 'module-canonical-')) })
|
|
428
|
+
afterEach(() => fs.rmSync(root, { recursive: true, force: true }))
|
|
429
|
+
|
|
430
|
+
it.each(['directory', 'archive'] as const)('keeps an already-enabled file %s a no-op without reinstalling', async (kind) => {
|
|
431
|
+
const packageRoot = path.join(root, 'package')
|
|
432
|
+
const appDir = path.join(root, 'app')
|
|
433
|
+
const packageName = '@vendor/consents'
|
|
434
|
+
buildPackageFixture(packageRoot, 'consents', { packageName })
|
|
435
|
+
if (kind === 'archive') execFileSync('tar', ['-czf', path.join(root, 'candidate.tgz'), '-C', root, 'package'])
|
|
436
|
+
const fileLocator = kind === 'archive' ? 'file:../candidate.tgz' : 'file:../package'
|
|
437
|
+
const source = `export const enabledModules = [{ id: 'consents', from: '${packageName}' }]\n`
|
|
438
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
439
|
+
const manifest = JSON.stringify({ dependencies: { [packageName]: fileLocator } })
|
|
440
|
+
fs.writeFileSync(path.join(appDir, 'package.json'), manifest)
|
|
441
|
+
jest.mocked(spawn).mockClear()
|
|
442
|
+
|
|
443
|
+
await expect(addOfficialModule(resolver, `${packageName}@${fileLocator}`, false, undefined, true)).resolves.toMatchObject({ moduleId: 'consents', registrationChanged: false })
|
|
444
|
+
expect(spawn).not.toHaveBeenCalled()
|
|
445
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
446
|
+
expect(fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')).toBe(manifest)
|
|
447
|
+
expect(fs.existsSync(resolver.getOutputDir())).toBe(false)
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
it.each(['directory', 'archive'] as const)('rejects a different unknown file %s even when its module is already enabled', async (kind) => {
|
|
451
|
+
const packageRoot = path.join(root, 'package')
|
|
452
|
+
const appDir = path.join(root, 'app')
|
|
453
|
+
const packageName = '@vendor/consents'
|
|
454
|
+
buildPackageFixture(packageRoot, 'consents', { packageName })
|
|
455
|
+
if (kind === 'archive') execFileSync('tar', ['-czf', path.join(root, 'candidate.tgz'), '-C', root, 'package'])
|
|
456
|
+
const fileLocator = kind === 'archive' ? 'file:../candidate.tgz' : 'file:../package'
|
|
457
|
+
const source = `export const enabledModules = [{ id: 'consents', from: '${packageName}' }]\n`
|
|
458
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
459
|
+
const manifest = JSON.stringify({ dependencies: { [packageName]: 'file:../other-package' } })
|
|
460
|
+
fs.writeFileSync(path.join(appDir, 'package.json'), manifest)
|
|
461
|
+
jest.mocked(spawn).mockClear()
|
|
462
|
+
|
|
463
|
+
await expect(addOfficialModule(resolver, `${packageName}@${fileLocator}`, false, undefined, true)).rejects.toThrow('Package binding collision')
|
|
464
|
+
expect(spawn).not.toHaveBeenCalled()
|
|
465
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
466
|
+
expect(fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')).toBe(manifest)
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
it.each([
|
|
470
|
+
['directory', false], ['archive', false], ['directory', true], ['archive', true],
|
|
471
|
+
] as const)('keeps a new file %s install provenance unknown with eject=%s', async (kind, eject) => {
|
|
472
|
+
const packageRoot = path.join(root, 'package')
|
|
473
|
+
const appDir = path.join(root, 'app')
|
|
474
|
+
const packageName = '@vendor/consents'
|
|
475
|
+
buildPackageFixture(packageRoot, 'consents', { packageName, ejectable: true })
|
|
476
|
+
if (kind === 'archive') execFileSync('tar', ['-czf', path.join(root, 'candidate.tgz'), '-C', root, 'package'])
|
|
477
|
+
const fileLocator = kind === 'archive' ? 'file:../candidate.tgz' : 'file:../package'
|
|
478
|
+
const resolver = buildResolver(appDir, packageRoot, 'export const enabledModules = []\n')
|
|
479
|
+
resolver.loadEnabledModules = () => readEnabledModulesFromConfig(resolver.getModulesConfigPath())
|
|
480
|
+
jest.mocked(spawn).mockImplementation(() => {
|
|
481
|
+
fs.writeFileSync(path.join(appDir, 'package.json'), JSON.stringify({ dependencies: { [packageName]: fileLocator } }))
|
|
482
|
+
const child = new EventEmitter()
|
|
483
|
+
queueMicrotask(() => child.emit('exit', 0))
|
|
484
|
+
return child as ReturnType<typeof spawn>
|
|
485
|
+
})
|
|
486
|
+
try {
|
|
487
|
+
await addOfficialModule(resolver, `${packageName}@${fileLocator}`, eject, undefined, true)
|
|
488
|
+
const [entry] = resolver.loadEnabledModules()
|
|
489
|
+
expect(entry).toMatchObject({ id: 'consents', from: eject ? '@app' : packageName })
|
|
490
|
+
expect(entry.locator).toBeUndefined()
|
|
491
|
+
if (eject) {
|
|
492
|
+
expect(entry.packageName).toBe(packageName)
|
|
493
|
+
expect(fs.readFileSync(path.join(appDir, 'src/modules/consents/index.ts'), 'utf8')).toBe(fs.readFileSync(path.join(packageRoot, 'src/modules/consents/index.ts'), 'utf8'))
|
|
494
|
+
}
|
|
495
|
+
const locators = getModuleLocators(entry, resolver)
|
|
496
|
+
expect(locators).toEqual([])
|
|
497
|
+
expect(resolveModuleRequirement(`npm:${packageName}`, [{ id: entry.id, locators }])).toBeUndefined()
|
|
498
|
+
expect(resolveModuleRequirement('consents', [{ id: entry.id, locators }])).toBe('consents')
|
|
499
|
+
|
|
500
|
+
const dependentRoot = path.join(root, 'dependent')
|
|
501
|
+
buildPackageFixture(dependentRoot, 'dependent', { packageName: '@vendor/dependent', requires: [`npm:${packageName}`], ejectable: true })
|
|
502
|
+
resolver.getPackageRoot = (binding) => binding === '@vendor/dependent' ? dependentRoot : packageRoot
|
|
503
|
+
const sourceBefore = fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')
|
|
504
|
+
await expect(enableOfficialModule(resolver, '@vendor/dependent', undefined, true, true)).rejects.toThrow('requires module(s) that are not enabled: npm:@vendor/consents')
|
|
505
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(sourceBefore)
|
|
506
|
+
expect(fs.existsSync(path.join(appDir, 'src/modules/dependent'))).toBe(false)
|
|
507
|
+
} finally { jest.mocked(spawn).mockReset() }
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
it.each([
|
|
511
|
+
['directory', false], ['archive', false], ['directory', true], ['archive', true],
|
|
512
|
+
] as const)('rejects an unknown file %s origin before replacing an enabled binding with implicit core=%s', async (kind, implicitCore) => {
|
|
513
|
+
const packageRoot = path.join(root, 'package')
|
|
514
|
+
const appDir = path.join(root, 'app')
|
|
515
|
+
const packageName = implicitCore ? '@open-mercato/core' : '@vendor/consents'
|
|
516
|
+
buildPackageFixture(packageRoot, 'consents', { packageName, ejectable: true })
|
|
517
|
+
if (kind === 'archive') execFileSync('tar', ['-czf', path.join(root, 'candidate.tgz'), '-C', root, 'package'])
|
|
518
|
+
const source = `export const enabledModules = [{ id: 'consents', ${implicitCore ? '' : `from: '${packageName}', `}locator: 'npm:${packageName}' }]\n`
|
|
519
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
520
|
+
if (implicitCore) resolver.loadEnabledModules = () => [{ id: 'consents', locator: `npm:${packageName}` }]
|
|
521
|
+
const manifest = JSON.stringify({ dependencies: { [packageName]: '1.0.0' } })
|
|
522
|
+
fs.writeFileSync(path.join(appDir, 'package.json'), manifest)
|
|
523
|
+
jest.mocked(spawn).mockClear()
|
|
524
|
+
const fileLocator = kind === 'archive' ? 'file:../candidate.tgz' : 'file:../package'
|
|
525
|
+
await expect(addOfficialModule(resolver, `${packageName}@${fileLocator}`, true, undefined, true)).rejects.toThrow('Package binding collision')
|
|
526
|
+
expect(spawn).not.toHaveBeenCalled()
|
|
527
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
528
|
+
expect(fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')).toBe(manifest)
|
|
529
|
+
expect(fs.existsSync(path.join(appDir, 'src/modules/consents'))).toBe(false)
|
|
530
|
+
})
|
|
531
|
+
|
|
532
|
+
it('revalidates implicit core binding consumers after package installation before any registration or eject copy', async () => {
|
|
533
|
+
const appDir = path.join(root, 'app')
|
|
534
|
+
const packageRoot = path.join(appDir, 'node_modules', '@open-mercato', 'core')
|
|
535
|
+
const packageName = '@open-mercato/core'
|
|
536
|
+
buildPackageFixture(packageRoot, 'active', { packageName })
|
|
537
|
+
buildPackageFixture(packageRoot, 'candidate', { packageName, ejectable: true })
|
|
538
|
+
const source = "export const enabledModules = [{ id: 'active' }]\n"
|
|
539
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
540
|
+
resolver.loadEnabledModules = () => [{ id: 'active' }]
|
|
541
|
+
fs.writeFileSync(path.join(appDir, 'package.json'), JSON.stringify({ dependencies: { [packageName]: '0.1.0' } }))
|
|
542
|
+
const inspect = jest.spyOn(inspection, 'inspectNpmModuleTarget').mockReturnValue({ packageName, packageSpec: `${packageName}@next`, locator: `npm:${packageName}`, moduleIds: ['active', 'candidate'] })
|
|
543
|
+
jest.mocked(spawn).mockImplementation(() => {
|
|
544
|
+
for (const base of ['src', 'dist']) fs.rmSync(path.join(packageRoot, base, 'modules/active'), { recursive: true })
|
|
545
|
+
const child = new EventEmitter()
|
|
546
|
+
queueMicrotask(() => child.emit('exit', 0))
|
|
547
|
+
return child as ReturnType<typeof spawn>
|
|
548
|
+
})
|
|
549
|
+
try {
|
|
550
|
+
await expect(addOfficialModule(resolver, `${packageName}@next`, true, 'candidate')).rejects.toThrow('does not contain module "active"')
|
|
551
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
552
|
+
expect(fs.existsSync(path.join(appDir, 'src/modules/candidate'))).toBe(false)
|
|
553
|
+
} finally { inspect.mockRestore(); jest.mocked(spawn).mockReset() }
|
|
554
|
+
})
|
|
555
|
+
|
|
556
|
+
it('does not satisfy a required scoped package with a same-name module from another scope', async () => {
|
|
557
|
+
const packageRoot = path.join(root, 'package')
|
|
558
|
+
const appDir = path.join(root, 'app')
|
|
559
|
+
const source = "export const enabledModules = [{ id: 'marketing_consents', from: '@other/marketing_consents' }]\n"
|
|
560
|
+
buildPackageFixture(packageRoot, 'test_package', { requires: ['@pkarw/marketing_consents@latest'] })
|
|
561
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
562
|
+
await expect(enableOfficialModule(resolver, '@open-mercato/test-package')).rejects.toThrow("npx create-mercato-module install '@pkarw/marketing_consents@latest'")
|
|
563
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
564
|
+
})
|
|
565
|
+
|
|
566
|
+
it('matches canonical npm requirements to the enabled package source', async () => {
|
|
567
|
+
const packageRoot = path.join(root, 'package')
|
|
568
|
+
const appDir = path.join(root, 'app')
|
|
569
|
+
buildPackageFixture(packageRoot, 'test_package', { requires: ['npm:@pkarw/marketing_consents@1.2.0'] })
|
|
570
|
+
for (const base of ['src', 'dist']) {
|
|
571
|
+
fs.mkdirSync(path.join(packageRoot, base, 'modules', 'marketing_consents'), { recursive: true })
|
|
572
|
+
fs.writeFileSync(path.join(packageRoot, base, 'modules', 'marketing_consents', base === 'src' ? 'index.ts' : 'index.js'), 'export const metadata = {}')
|
|
573
|
+
}
|
|
574
|
+
const resolver = buildResolver(appDir, packageRoot, "export const enabledModules = [{ id: 'marketing_consents', from: '@pkarw/marketing_consents' }]\n")
|
|
575
|
+
const requiredPackageRoot = path.join(root, 'required-package')
|
|
576
|
+
fs.mkdirSync(requiredPackageRoot, { recursive: true })
|
|
577
|
+
fs.writeFileSync(path.join(requiredPackageRoot, 'package.json'), JSON.stringify({ name: '@pkarw/marketing_consents' }))
|
|
578
|
+
fs.writeFileSync(path.join(appDir, 'package.json'), JSON.stringify({ dependencies: { '@pkarw/marketing_consents': '1.2.0' } }))
|
|
579
|
+
resolver.getPackageRoot = (packageName) => packageName === '@pkarw/marketing_consents' ? requiredPackageRoot : packageRoot
|
|
580
|
+
await expect(enableOfficialModule(resolver, '@open-mercato/test-package', 'test_package')).resolves.toMatchObject({ moduleId: 'test_package' })
|
|
581
|
+
})
|
|
582
|
+
|
|
583
|
+
it('rejects name collisions before copying ejected sources', async () => {
|
|
584
|
+
const packageRoot = path.join(root, 'package')
|
|
585
|
+
const appDir = path.join(root, 'app')
|
|
586
|
+
buildPackageFixture(packageRoot, 'marketing_consents', { ejectable: true })
|
|
587
|
+
const source = "export const enabledModules = [{ id: 'marketing_consents', from: '@other/marketing_consents' }]\n"
|
|
588
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
589
|
+
await expect(enableOfficialModule(resolver, '@open-mercato/test-package', undefined, true)).rejects.toThrow('Module name collision')
|
|
590
|
+
expect(fs.existsSync(path.join(appDir, 'src/modules/marketing_consents'))).toBe(false)
|
|
591
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
592
|
+
})
|
|
593
|
+
|
|
594
|
+
it('rejects a GitHub same-name collision before package installation', async () => {
|
|
595
|
+
const packageRoot = path.join(root, 'package')
|
|
596
|
+
const appDir = path.join(root, 'app')
|
|
597
|
+
const source = "export const enabledModules = [{ id: 'marketing_consents', from: '@other/marketing_consents' }]\n"
|
|
598
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
599
|
+
const lookup = jest.spyOn(github, 'resolveGithubModuleTarget').mockReturnValue({
|
|
600
|
+
packageName: '@pkarw/marketing_consents', moduleIds: ['marketing_consents'],
|
|
601
|
+
packageSpec: '@pkarw/marketing_consents@github:pkarw/consents#' + 'a'.repeat(40), locator: 'github:pkarw/consents',
|
|
602
|
+
})
|
|
603
|
+
try {
|
|
604
|
+
await expect(addOfficialModule(resolver, 'github:pkarw/consents', false, undefined, true)).rejects.toThrow('Module name collision')
|
|
605
|
+
expect(fs.existsSync(path.join(appDir, 'package.json'))).toBe(false)
|
|
606
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
607
|
+
} finally {
|
|
608
|
+
lookup.mockRestore()
|
|
609
|
+
}
|
|
610
|
+
})
|
|
611
|
+
|
|
612
|
+
it('rejects replacing the same npm name from a different GitHub origin', async () => {
|
|
613
|
+
const packageRoot = path.join(root, 'package')
|
|
614
|
+
const appDir = path.join(root, 'app')
|
|
615
|
+
const resolver = buildResolver(appDir, packageRoot, "export const enabledModules = [{ id: 'marketing_consents', from: '@pkarw/consents', locator: 'github:pkarw/original' }]\n")
|
|
616
|
+
const lookup = jest.spyOn(github, 'resolveGithubModuleTarget').mockReturnValue({
|
|
617
|
+
packageName: '@pkarw/consents', moduleIds: ['marketing_consents'],
|
|
618
|
+
packageSpec: '@pkarw/consents@github:pkarw/replacement#' + 'a'.repeat(40), locator: 'github:pkarw/replacement',
|
|
619
|
+
})
|
|
620
|
+
try {
|
|
621
|
+
await expect(addOfficialModule(resolver, 'github:pkarw/replacement', false, undefined, true)).rejects.toThrow('github:pkarw/original')
|
|
622
|
+
} finally {
|
|
623
|
+
lookup.mockRestore()
|
|
624
|
+
}
|
|
625
|
+
})
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
it('requires explicit trust for GitHub sources even if they declare an official npm namespace', async () => {
|
|
629
|
+
const resolver = buildResolver(path.join(root, 'app'), path.join(root, 'package'), 'export const enabledModules = []\n')
|
|
630
|
+
const lookup = jest.spyOn(github, 'resolveGithubModuleTarget').mockReturnValue({
|
|
631
|
+
packageName: '@open-mercato/consents', moduleIds: ['marketing_consents'],
|
|
632
|
+
packageSpec: '@open-mercato/consents@github:attacker/consents#' + 'a'.repeat(40), locator: 'github:attacker/consents',
|
|
633
|
+
})
|
|
634
|
+
try {
|
|
635
|
+
await expect(addOfficialModule(resolver, 'github:attacker/consents', false)).rejects.toThrow('--allow-third-party')
|
|
636
|
+
expect(lookup).not.toHaveBeenCalled()
|
|
637
|
+
} finally {
|
|
638
|
+
lookup.mockRestore()
|
|
639
|
+
}
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
it('rejects duplicate existing registrations before eject source writes', async () => {
|
|
644
|
+
const packageRoot = path.join(root, 'package')
|
|
645
|
+
const appDir = path.join(root, 'app')
|
|
646
|
+
buildPackageFixture(packageRoot, 'marketing_consents', { ejectable: true })
|
|
647
|
+
const source = "export const enabledModules = [{ id: 'marketing_consents', from: '@open-mercato/test-package' }, { id: 'marketing_consents', from: '@other/consents' }]\n"
|
|
648
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
649
|
+
await expect(enableOfficialModule(resolver, '@open-mercato/test-package', undefined, true)).rejects.toThrow('Duplicate enabled module ID')
|
|
650
|
+
expect(fs.existsSync(path.join(appDir, 'src/modules/marketing_consents'))).toBe(false)
|
|
651
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
652
|
+
})
|
|
653
|
+
|
|
654
|
+
it('rejects a changed GitHub binding before Yarn even when the selected ID differs', async () => {
|
|
655
|
+
const packageRoot = path.join(root, 'package')
|
|
656
|
+
const appDir = path.join(root, 'app')
|
|
657
|
+
buildPackageFixture(packageRoot, 'original', { packageName: '@vendor/bundle' })
|
|
658
|
+
const source = "export const enabledModules = [{ id: 'original', from: '@vendor/bundle', locator: 'github:vendor/original' }]\n"
|
|
659
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
660
|
+
const lookup = jest.spyOn(github, 'resolveGithubModuleTarget').mockReturnValue({
|
|
661
|
+
packageName: '@vendor/bundle', moduleIds: ['replacement'], locator: 'github:vendor/replacement',
|
|
662
|
+
packageSpec: '@vendor/bundle@github:vendor/replacement#' + 'a'.repeat(40),
|
|
663
|
+
})
|
|
664
|
+
try {
|
|
665
|
+
await expect(addOfficialModule(resolver, 'github:vendor/replacement', false, undefined, true)).rejects.toThrow('Package binding collision')
|
|
666
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
667
|
+
expect(fs.existsSync(path.join(appDir, 'package.json'))).toBe(false)
|
|
668
|
+
} finally { lookup.mockRestore() }
|
|
669
|
+
})
|
|
670
|
+
|
|
671
|
+
it('rejects npm updates that remove an active sibling before installation', async () => {
|
|
672
|
+
const packageRoot = path.join(root, 'package')
|
|
673
|
+
const appDir = path.join(root, 'app')
|
|
674
|
+
buildPackageFixture(packageRoot, 'original', { packageName: '@vendor/bundle' })
|
|
675
|
+
const source = "export const enabledModules = [{ id: 'original', from: '@vendor/bundle', locator: 'npm:@vendor/bundle' }]\n"
|
|
676
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
677
|
+
const lookup = jest.spyOn(inspection, 'inspectNpmModuleTarget').mockReturnValue({
|
|
678
|
+
packageName: '@vendor/bundle', moduleIds: ['replacement'], locator: 'npm:@vendor/bundle', packageSpec: '@vendor/bundle@2.0.0',
|
|
679
|
+
})
|
|
680
|
+
try {
|
|
681
|
+
await expect(addOfficialModule(resolver, '@vendor/bundle@next', false, 'replacement', true)).rejects.toThrow('preserve its source and module layout')
|
|
682
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
683
|
+
} finally { lookup.mockRestore() }
|
|
684
|
+
})
|
|
685
|
+
|
|
686
|
+
it('preserves a single package registration with a local overlay on repeated enable', async () => {
|
|
687
|
+
const packageRoot = path.join(root, 'package')
|
|
688
|
+
const appDir = path.join(root, 'app')
|
|
689
|
+
buildPackageFixture(packageRoot, 'test_package')
|
|
690
|
+
const source = "export const enabledModules = [{ id: 'test_package', from: '@open-mercato/test-package' }]\n"
|
|
691
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
692
|
+
const localPath = path.join(appDir, 'src/modules/test_package/index.ts')
|
|
693
|
+
fs.mkdirSync(path.dirname(localPath), { recursive: true })
|
|
694
|
+
fs.writeFileSync(localPath, 'export const metadata = { title: "Overlay" }')
|
|
695
|
+
await expect(enableOfficialModule(resolver, '@open-mercato/test-package')).resolves.toMatchObject({ registrationChanged: false })
|
|
696
|
+
expect(fs.readFileSync(localPath, 'utf8')).toContain('Overlay')
|
|
697
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
698
|
+
})
|
|
699
|
+
|
|
700
|
+
it('reports a post-install version disagreement without registering or ejecting', async () => {
|
|
701
|
+
const packageRoot = path.join(root, 'package')
|
|
702
|
+
const appDir = path.join(root, 'app')
|
|
703
|
+
buildPackageFixture(packageRoot, 'test_package', { ejectable: true })
|
|
704
|
+
const source = 'export const enabledModules = []\n'
|
|
705
|
+
const resolver = buildResolver(appDir, packageRoot, source)
|
|
706
|
+
const lookup = jest.spyOn(inspection, 'inspectNpmModuleTarget').mockReturnValue({
|
|
707
|
+
packageName: '@open-mercato/test-package', packageSpec: '@open-mercato/test-package@next',
|
|
708
|
+
locator: 'npm:@open-mercato/test-package', moduleIds: ['test_package'], version: '2.0.0',
|
|
709
|
+
})
|
|
710
|
+
jest.mocked(spawn).mockImplementation(() => {
|
|
711
|
+
const child = new EventEmitter()
|
|
712
|
+
queueMicrotask(() => child.emit('exit', 0))
|
|
713
|
+
return child as ReturnType<typeof spawn>
|
|
714
|
+
})
|
|
715
|
+
try {
|
|
716
|
+
await expect(addOfficialModule(resolver, '@open-mercato/test-package@next', true)).rejects.toThrow('differs from inspected version')
|
|
717
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(source)
|
|
718
|
+
expect(fs.existsSync(path.join(appDir, 'src/modules/test_package'))).toBe(false)
|
|
719
|
+
expect(spawn).toHaveBeenCalledWith(expect.anything(), ['add', '@open-mercato/test-package@next'], expect.anything())
|
|
720
|
+
} finally { lookup.mockRestore(); jest.mocked(spawn).mockReset() }
|
|
721
|
+
})
|
|
722
|
+
|
|
723
|
+
})
|
|
724
|
+
|
|
725
|
+
describe('addOfficialModule', () => {
|
|
726
|
+
let tmpDir: string
|
|
727
|
+
|
|
728
|
+
beforeEach(() => {
|
|
729
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'module-install-add-test-'))
|
|
730
|
+
mockedSpawn.mockReset()
|
|
731
|
+
jest.spyOn(inspection, 'inspectNpmModuleTarget').mockImplementation((packageSpec, packageName) => ({
|
|
732
|
+
packageName,
|
|
733
|
+
packageSpec,
|
|
734
|
+
moduleIds: ['test_package'],
|
|
735
|
+
locator: `npm:${packageName}`,
|
|
736
|
+
}))
|
|
737
|
+
})
|
|
738
|
+
|
|
739
|
+
afterEach(() => {
|
|
740
|
+
jest.restoreAllMocks()
|
|
741
|
+
fs.rmSync(tmpDir, { recursive: true, force: true })
|
|
742
|
+
})
|
|
743
|
+
|
|
744
|
+
function simulateYarnAdd(appDir: string, packageName: string): void {
|
|
745
|
+
mockedSpawn.mockImplementation(() => {
|
|
746
|
+
const child = new EventEmitter()
|
|
747
|
+
const packageJsonPath = path.join(appDir, 'package.json')
|
|
748
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) as {
|
|
749
|
+
dependencies?: Record<string, string>
|
|
750
|
+
}
|
|
751
|
+
packageJson.dependencies = { ...packageJson.dependencies, [packageName]: '0.1.0' }
|
|
752
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson))
|
|
753
|
+
setImmediate(() => child.emit('exit', 0))
|
|
754
|
+
return child
|
|
755
|
+
})
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function writeAppPackageJson(appDir: string, dependencies: Record<string, string> = {}): void {
|
|
759
|
+
fs.mkdirSync(appDir, { recursive: true })
|
|
760
|
+
fs.writeFileSync(path.join(appDir, 'package.json'), JSON.stringify({ name: 'test-app', dependencies }))
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
it('succeeds without changes when the module is already enabled', async () => {
|
|
764
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'test-package')
|
|
765
|
+
const appDir = path.join(tmpDir, 'app')
|
|
766
|
+
buildPackageFixture(packageRoot, 'test_package')
|
|
767
|
+
writeAppPackageJson(appDir, { '@open-mercato/test-package': '0.1.0' })
|
|
768
|
+
const resolver = buildResolver(
|
|
769
|
+
appDir,
|
|
770
|
+
packageRoot,
|
|
771
|
+
"export const enabledModules = [{ id: 'test_package', from: '@open-mercato/test-package' }]\n",
|
|
772
|
+
)
|
|
773
|
+
simulateYarnAdd(appDir, '@open-mercato/test-package')
|
|
774
|
+
const modulesTsBefore = fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')
|
|
775
|
+
|
|
776
|
+
await expect(
|
|
777
|
+
addOfficialModule(resolver, '@open-mercato/test-package@0.1.0', false),
|
|
778
|
+
).resolves.toEqual({
|
|
779
|
+
moduleId: 'test_package',
|
|
780
|
+
packageName: '@open-mercato/test-package',
|
|
781
|
+
from: '@open-mercato/test-package',
|
|
782
|
+
registrationChanged: false,
|
|
783
|
+
})
|
|
784
|
+
expect(mockedSpawn).toHaveBeenCalledTimes(1)
|
|
785
|
+
expect(fs.readFileSync(resolver.getModulesConfigPath(), 'utf8')).toBe(modulesTsBefore)
|
|
786
|
+
})
|
|
787
|
+
|
|
788
|
+
it('tells the user how to remove a newly added package that has no modules', async () => {
|
|
789
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'no-modules')
|
|
790
|
+
const appDir = path.join(tmpDir, 'app')
|
|
791
|
+
fs.mkdirSync(packageRoot, { recursive: true })
|
|
792
|
+
fs.writeFileSync(
|
|
793
|
+
path.join(packageRoot, 'package.json'),
|
|
794
|
+
JSON.stringify({ name: '@open-mercato/no-modules', version: '0.1.0' }),
|
|
795
|
+
)
|
|
796
|
+
writeAppPackageJson(appDir)
|
|
797
|
+
const resolver = buildResolver(appDir, packageRoot, 'export const enabledModules = []\n')
|
|
798
|
+
simulateYarnAdd(appDir, '@open-mercato/no-modules')
|
|
799
|
+
|
|
800
|
+
const failure = addOfficialModule(resolver, '@open-mercato/no-modules', false)
|
|
801
|
+
await expect(failure).rejects.toThrow('has no modules in src/modules/ or dist/modules/.')
|
|
802
|
+
await expect(failure).rejects.toThrow(
|
|
803
|
+
'The package "@open-mercato/no-modules" stayed in package.json. To remove it, run: yarn remove @open-mercato/no-modules',
|
|
804
|
+
)
|
|
805
|
+
})
|
|
806
|
+
|
|
807
|
+
it('names the app workspace in the remove command inside a monorepo', async () => {
|
|
808
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'no-modules')
|
|
809
|
+
const appDir = path.join(tmpDir, 'apps', 'mercato')
|
|
810
|
+
fs.mkdirSync(packageRoot, { recursive: true })
|
|
811
|
+
fs.writeFileSync(
|
|
812
|
+
path.join(packageRoot, 'package.json'),
|
|
813
|
+
JSON.stringify({ name: '@open-mercato/no-modules', version: '0.1.0' }),
|
|
814
|
+
)
|
|
815
|
+
writeAppPackageJson(appDir)
|
|
816
|
+
const resolver = {
|
|
817
|
+
...buildResolver(appDir, packageRoot, 'export const enabledModules = []\n'),
|
|
818
|
+
isMonorepo: () => true,
|
|
819
|
+
getRootDir: () => tmpDir,
|
|
820
|
+
} as PackageResolver
|
|
821
|
+
simulateYarnAdd(appDir, '@open-mercato/no-modules')
|
|
822
|
+
|
|
823
|
+
await expect(addOfficialModule(resolver, '@open-mercato/no-modules', false)).rejects.toThrow(
|
|
824
|
+
'To remove it, run: yarn workspace test-app remove @open-mercato/no-modules',
|
|
825
|
+
)
|
|
826
|
+
})
|
|
827
|
+
|
|
828
|
+
it('does not suggest removing a package the app already depended on', async () => {
|
|
829
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'no-modules')
|
|
830
|
+
const appDir = path.join(tmpDir, 'app')
|
|
831
|
+
fs.mkdirSync(packageRoot, { recursive: true })
|
|
832
|
+
fs.writeFileSync(
|
|
833
|
+
path.join(packageRoot, 'package.json'),
|
|
834
|
+
JSON.stringify({ name: '@open-mercato/no-modules', version: '0.1.0' }),
|
|
835
|
+
)
|
|
836
|
+
writeAppPackageJson(appDir, { '@open-mercato/no-modules': '0.0.9' })
|
|
837
|
+
const resolver = buildResolver(appDir, packageRoot, 'export const enabledModules = []\n')
|
|
838
|
+
simulateYarnAdd(appDir, '@open-mercato/no-modules')
|
|
839
|
+
|
|
840
|
+
const failure = addOfficialModule(resolver, '@open-mercato/no-modules', false)
|
|
841
|
+
await expect(failure).rejects.toThrow('has no modules')
|
|
842
|
+
await expect(failure).rejects.not.toThrow('yarn remove')
|
|
843
|
+
})
|
|
844
|
+
|
|
845
|
+
it('rethrows a gated-off registration error without the leftover-package hint', async () => {
|
|
846
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'test-package')
|
|
847
|
+
const appDir = path.join(tmpDir, 'app')
|
|
848
|
+
buildPackageFixture(packageRoot, 'test_package')
|
|
849
|
+
writeAppPackageJson(appDir)
|
|
850
|
+
const resolver = buildResolver(appDir, packageRoot, 'export const enabledModules = []\n')
|
|
851
|
+
simulateYarnAdd(appDir, '@open-mercato/test-package')
|
|
852
|
+
const gatedOffError = Object.assign(
|
|
853
|
+
new Error('Module "test_package" is gated off. Enable it by setting OM_ENABLE_TEST_PACKAGE=true, then run `yarn generate`.'),
|
|
854
|
+
{ code: 'MODULE_GATED_OFF' },
|
|
855
|
+
)
|
|
856
|
+
const prepareRegistration = modulesConfig.prepareModuleRegistration
|
|
857
|
+
const registrationSpy = jest
|
|
858
|
+
.spyOn(modulesConfig, 'prepareModuleRegistration')
|
|
859
|
+
.mockImplementationOnce(prepareRegistration)
|
|
860
|
+
.mockImplementationOnce(() => {
|
|
861
|
+
throw gatedOffError
|
|
862
|
+
})
|
|
863
|
+
|
|
864
|
+
try {
|
|
865
|
+
const failure = addOfficialModule(resolver, '@open-mercato/test-package', false)
|
|
866
|
+
await expect(failure).rejects.toBe(gatedOffError)
|
|
867
|
+
await expect(failure).rejects.not.toThrow('stayed in package.json')
|
|
868
|
+
} finally {
|
|
869
|
+
registrationSpy.mockRestore()
|
|
870
|
+
}
|
|
871
|
+
})
|
|
872
|
+
|
|
873
|
+
it('keeps the leftover-package hint for a plain registration error on a newly added package', async () => {
|
|
874
|
+
const packageRoot = path.join(tmpDir, 'node_modules', '@open-mercato', 'test-package')
|
|
875
|
+
const appDir = path.join(tmpDir, 'app')
|
|
876
|
+
buildPackageFixture(packageRoot, 'test_package')
|
|
877
|
+
writeAppPackageJson(appDir)
|
|
878
|
+
const resolver = buildResolver(appDir, packageRoot, 'export const enabledModules = []\n')
|
|
879
|
+
simulateYarnAdd(appDir, '@open-mercato/test-package')
|
|
880
|
+
const prepareRegistration = modulesConfig.prepareModuleRegistration
|
|
881
|
+
const registrationSpy = jest
|
|
882
|
+
.spyOn(modulesConfig, 'prepareModuleRegistration')
|
|
883
|
+
.mockImplementationOnce(prepareRegistration)
|
|
884
|
+
.mockImplementationOnce(() => {
|
|
885
|
+
throw new Error('Could not update modules.ts.')
|
|
886
|
+
})
|
|
887
|
+
|
|
888
|
+
try {
|
|
889
|
+
const failure = addOfficialModule(resolver, '@open-mercato/test-package', false)
|
|
890
|
+
await expect(failure).rejects.toThrow('Could not update modules.ts.')
|
|
891
|
+
await expect(failure).rejects.toThrow(
|
|
892
|
+
'The package "@open-mercato/test-package" stayed in package.json. To remove it, run: yarn remove @open-mercato/test-package',
|
|
893
|
+
)
|
|
894
|
+
} finally {
|
|
895
|
+
registrationSpy.mockRestore()
|
|
896
|
+
}
|
|
897
|
+
})
|
|
898
|
+
})
|