diff --git a/feature-libs/asm/schematics/add-asm/index.ts b/feature-libs/asm/schematics/add-asm/index.ts index 43a5a4a12f0..0e1654345b3 100644 --- a/feature-libs/asm/schematics/add-asm/index.ts +++ b/feature-libs/asm/schematics/add-asm/index.ts @@ -18,6 +18,7 @@ import { finalizeInstallation, LibraryOptions as SpartacusAsmOptions, readPackageJson, + normalizeOptionsFeatures, validateSpartacusInstallation, } from '@spartacus/schematics'; import { peerDependencies } from '../../package.json'; @@ -26,6 +27,7 @@ export function addAsmFeatures(options: SpartacusAsmOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/asm/schematics/add-asm/schema.json b/feature-libs/asm/schematics/add-asm/schema.json index fbf6c3ec0ec..d1155888715 100644 --- a/feature-libs/asm/schematics/add-asm/schema.json +++ b/feature-libs/asm/schematics/add-asm/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["ASM"] } diff --git a/feature-libs/cart/schematics/add-cart/index.ts b/feature-libs/cart/schematics/add-cart/index.ts index 477e7aa5bc9..db3c3e8133f 100644 --- a/feature-libs/cart/schematics/add-cart/index.ts +++ b/feature-libs/cart/schematics/add-cart/index.ts @@ -18,6 +18,7 @@ import { finalizeInstallation, LibraryOptions as SpartacusCartOptions, readPackageJson, + normalizeOptionsFeatures, validateSpartacusInstallation, } from '@spartacus/schematics'; import { peerDependencies } from '../../package.json'; @@ -26,6 +27,7 @@ export function addCartFeatures(options: SpartacusCartOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/cart/schematics/add-cart/schema.json b/feature-libs/cart/schematics/add-cart/schema.json index 66919c02e17..03989860d0b 100644 --- a/feature-libs/cart/schematics/add-cart/schema.json +++ b/feature-libs/cart/schematics/add-cart/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": [ diff --git a/feature-libs/checkout/schematics/add-checkout/index.ts b/feature-libs/checkout/schematics/add-checkout/index.ts index 983e2cc2139..80f17657456 100644 --- a/feature-libs/checkout/schematics/add-checkout/index.ts +++ b/feature-libs/checkout/schematics/add-checkout/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusCheckoutOptions, readPackageJson, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addCheckoutFeatures(options: SpartacusCheckoutOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/checkout/schematics/add-checkout/schema.json b/feature-libs/checkout/schematics/add-checkout/schema.json index 26f97410b01..b894c3300ac 100644 --- a/feature-libs/checkout/schematics/add-checkout/schema.json +++ b/feature-libs/checkout/schematics/add-checkout/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": [ diff --git a/feature-libs/customer-ticketing/schematics/add-customer-ticketing/index.ts b/feature-libs/customer-ticketing/schematics/add-customer-ticketing/index.ts index e2beef8ec43..23b9c14053d 100644 --- a/feature-libs/customer-ticketing/schematics/add-customer-ticketing/index.ts +++ b/feature-libs/customer-ticketing/schematics/add-customer-ticketing/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusCustomerTicketingOptions, readPackageJson, validateSpartacusInstallation, @@ -28,6 +29,7 @@ export function addCustomerTicketingFeatures( return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/customer-ticketing/schematics/add-customer-ticketing/schema.json b/feature-libs/customer-ticketing/schematics/add-customer-ticketing/schema.json index c8dbff4f38c..483744bade2 100644 --- a/feature-libs/customer-ticketing/schematics/add-customer-ticketing/schema.json +++ b/feature-libs/customer-ticketing/schematics/add-customer-ticketing/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Customer-Ticketing"] } diff --git a/feature-libs/estimated-delivery-date/schematics/add-estimated-delivery-date/index.ts b/feature-libs/estimated-delivery-date/schematics/add-estimated-delivery-date/index.ts index 00fcfd78e4e..0737fba98f0 100644 --- a/feature-libs/estimated-delivery-date/schematics/add-estimated-delivery-date/index.ts +++ b/feature-libs/estimated-delivery-date/schematics/add-estimated-delivery-date/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusEstimatedDeliveryDateOptions, readPackageJson, validateSpartacusInstallation, @@ -28,6 +29,7 @@ export function addEstimatedDeliveryDateFeature( return (tree: Tree, _context: SchematicContext) => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/estimated-delivery-date/schematics/add-estimated-delivery-date/schema.json b/feature-libs/estimated-delivery-date/schematics/add-estimated-delivery-date/schema.json index 0fe37b4d2c8..9b88478d658 100644 --- a/feature-libs/estimated-delivery-date/schematics/add-estimated-delivery-date/schema.json +++ b/feature-libs/estimated-delivery-date/schematics/add-estimated-delivery-date/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Estimated-Delivery-Date"] } diff --git a/feature-libs/order/schematics/add-order/index.ts b/feature-libs/order/schematics/add-order/index.ts index 285c387af8d..355a6cc608c 100644 --- a/feature-libs/order/schematics/add-order/index.ts +++ b/feature-libs/order/schematics/add-order/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusOrderOptions, readPackageJson, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addOrderFeatures(options: SpartacusOrderOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/order/schematics/add-order/schema.json b/feature-libs/order/schematics/add-order/schema.json index c78d416e68e..4897dbcb8fa 100644 --- a/feature-libs/order/schematics/add-order/schema.json +++ b/feature-libs/order/schematics/add-order/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Order"] } diff --git a/feature-libs/organization/schematics/add-organization/index.ts b/feature-libs/organization/schematics/add-organization/index.ts index b372e527e7f..f64fe2d397c 100644 --- a/feature-libs/organization/schematics/add-organization/index.ts +++ b/feature-libs/organization/schematics/add-organization/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusOrganizationOptions, readPackageJson, validateSpartacusInstallation, @@ -28,6 +29,7 @@ export function addSpartacusOrganization( return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/organization/schematics/add-organization/schema.json b/feature-libs/organization/schematics/add-organization/schema.json index dc7e47a8962..46226cf1b4b 100644 --- a/feature-libs/organization/schematics/add-organization/schema.json +++ b/feature-libs/organization/schematics/add-organization/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": [ diff --git a/feature-libs/pdf-invoices/schematics/add-pdf-invoices/index.ts b/feature-libs/pdf-invoices/schematics/add-pdf-invoices/index.ts index e36496f2fb9..560b0b86ad5 100644 --- a/feature-libs/pdf-invoices/schematics/add-pdf-invoices/index.ts +++ b/feature-libs/pdf-invoices/schematics/add-pdf-invoices/index.ts @@ -17,6 +17,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusPDFInvoicesOptions, readPackageJson, validateSpartacusInstallation, @@ -29,6 +30,7 @@ export function addPDFInvoicesFeature( return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/pdf-invoices/schematics/add-pdf-invoices/schema.json b/feature-libs/pdf-invoices/schematics/add-pdf-invoices/schema.json index 5940aa3c67f..74df19c6119 100644 --- a/feature-libs/pdf-invoices/schematics/add-pdf-invoices/schema.json +++ b/feature-libs/pdf-invoices/schematics/add-pdf-invoices/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["PDF-Invoices"] } diff --git a/feature-libs/pickup-in-store/schematics/add-pickup-in-store/index.ts b/feature-libs/pickup-in-store/schematics/add-pickup-in-store/index.ts index b7074b83c77..f95a88d6a12 100644 --- a/feature-libs/pickup-in-store/schematics/add-pickup-in-store/index.ts +++ b/feature-libs/pickup-in-store/schematics/add-pickup-in-store/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusPickupInStoreOptions, readPackageJson, validateSpartacusInstallation, @@ -28,6 +29,7 @@ export function addPickupInStoreFeatures( return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/pickup-in-store/schematics/add-pickup-in-store/schema.json b/feature-libs/pickup-in-store/schematics/add-pickup-in-store/schema.json index 04231174358..b5410e724dc 100644 --- a/feature-libs/pickup-in-store/schematics/add-pickup-in-store/schema.json +++ b/feature-libs/pickup-in-store/schematics/add-pickup-in-store/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Pickup-In-Store"] } diff --git a/feature-libs/product-configurator/schematics/add-product-configurator/index.ts b/feature-libs/product-configurator/schematics/add-product-configurator/index.ts index f4c66fbd309..4d8bae6de87 100644 --- a/feature-libs/product-configurator/schematics/add-product-configurator/index.ts +++ b/feature-libs/product-configurator/schematics/add-product-configurator/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusProductConfiguratorOptions, readPackageJson, validateSpartacusInstallation, @@ -28,6 +29,7 @@ export function addProductConfiguratorFeatures( return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/product-configurator/schematics/add-product-configurator/schema.json b/feature-libs/product-configurator/schematics/add-product-configurator/schema.json index a74fd006a2c..bdd56f55f2b 100644 --- a/feature-libs/product-configurator/schematics/add-product-configurator/schema.json +++ b/feature-libs/product-configurator/schematics/add-product-configurator/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": [ diff --git a/feature-libs/product/schematics/add-product/index.ts b/feature-libs/product/schematics/add-product/index.ts index 19d5c8a4ea8..26ced6772c8 100644 --- a/feature-libs/product/schematics/add-product/index.ts +++ b/feature-libs/product/schematics/add-product/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusProductOptions, readPackageJson, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addSpartacusProduct(options: SpartacusProductOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/product/schematics/add-product/schema.json b/feature-libs/product/schematics/add-product/schema.json index 48b8319ea2b..d233e05025e 100644 --- a/feature-libs/product/schematics/add-product/schema.json +++ b/feature-libs/product/schematics/add-product/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": [ diff --git a/feature-libs/qualtrics/schematics/add-qualtrics/index.ts b/feature-libs/qualtrics/schematics/add-qualtrics/index.ts index 3eae2e71b66..7cc77476473 100644 --- a/feature-libs/qualtrics/schematics/add-qualtrics/index.ts +++ b/feature-libs/qualtrics/schematics/add-qualtrics/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusQualtricsOptions, readPackageJson, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addQualtricsFeatures(options: SpartacusQualtricsOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/qualtrics/schematics/add-qualtrics/schema.json b/feature-libs/qualtrics/schematics/add-qualtrics/schema.json index 301a1e7fe05..e8757d29b95 100644 --- a/feature-libs/qualtrics/schematics/add-qualtrics/schema.json +++ b/feature-libs/qualtrics/schematics/add-qualtrics/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Qualtrics"] } diff --git a/feature-libs/quote/schematics/add-quote/index.ts b/feature-libs/quote/schematics/add-quote/index.ts index 863b6497202..2d054324e8c 100644 --- a/feature-libs/quote/schematics/add-quote/index.ts +++ b/feature-libs/quote/schematics/add-quote/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusQuoteOptions, readPackageJson, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addQuoteFeatures(options: SpartacusQuoteOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/quote/schematics/add-quote/schema.json b/feature-libs/quote/schematics/add-quote/schema.json index 903358ab28f..01c61a2dbd9 100644 --- a/feature-libs/quote/schematics/add-quote/schema.json +++ b/feature-libs/quote/schematics/add-quote/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Quote"] } diff --git a/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index.ts b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index.ts index 560f358bd3c..25eb50e327e 100644 --- a/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index.ts +++ b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index.ts @@ -17,6 +17,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusRequestedDeliveryDateOptions, readPackageJson, validateSpartacusInstallation, @@ -29,6 +30,7 @@ export function addRequestedDeliveryDateFeature( return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/schema.json b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/schema.json index 536d90100ba..b8aaab1fef9 100644 --- a/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/schema.json +++ b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Requested-Delivery-Date"] } diff --git a/feature-libs/smartedit/schematics/add-smartedit/index.ts b/feature-libs/smartedit/schematics/add-smartedit/index.ts index 8532f1c72ef..4908a23d1d4 100644 --- a/feature-libs/smartedit/schematics/add-smartedit/index.ts +++ b/feature-libs/smartedit/schematics/add-smartedit/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, readPackageJson, SpartacusSmartEditOptions, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addSmartEditFeatures(options: SpartacusSmartEditOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/smartedit/schematics/add-smartedit/schema.json b/feature-libs/smartedit/schematics/add-smartedit/schema.json index 06605c9ff33..5147f85e767 100644 --- a/feature-libs/smartedit/schematics/add-smartedit/schema.json +++ b/feature-libs/smartedit/schematics/add-smartedit/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["SmartEdit"] }, diff --git a/feature-libs/storefinder/schematics/add-storefinder/index.ts b/feature-libs/storefinder/schematics/add-storefinder/index.ts index b7a0c982872..7b9966a0a92 100644 --- a/feature-libs/storefinder/schematics/add-storefinder/index.ts +++ b/feature-libs/storefinder/schematics/add-storefinder/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusStorefinderOptions, readPackageJson, validateSpartacusInstallation, @@ -28,6 +29,7 @@ export function addStorefinderFeatures( return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/storefinder/schematics/add-storefinder/schema.json b/feature-libs/storefinder/schematics/add-storefinder/schema.json index b4c3c2c58c6..7631f7699b7 100644 --- a/feature-libs/storefinder/schematics/add-storefinder/schema.json +++ b/feature-libs/storefinder/schematics/add-storefinder/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Store-Finder"] } diff --git a/feature-libs/tracking/schematics/add-tracking/index.ts b/feature-libs/tracking/schematics/add-tracking/index.ts index 10dc3fe2a41..2600a8e3d74 100644 --- a/feature-libs/tracking/schematics/add-tracking/index.ts +++ b/feature-libs/tracking/schematics/add-tracking/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusTrackingOptions, readPackageJson, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addTrackingFeatures(options: SpartacusTrackingOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/tracking/schematics/add-tracking/schema.json b/feature-libs/tracking/schematics/add-tracking/schema.json index 22e043fc89d..213122b305c 100644 --- a/feature-libs/tracking/schematics/add-tracking/schema.json +++ b/feature-libs/tracking/schematics/add-tracking/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": ["Personalization", "TMS-GTM", "TMS-AEPL"], diff --git a/feature-libs/user/schematics/add-user/index.ts b/feature-libs/user/schematics/add-user/index.ts index 9c9758e56e7..e03582ea769 100644 --- a/feature-libs/user/schematics/add-user/index.ts +++ b/feature-libs/user/schematics/add-user/index.ts @@ -18,6 +18,7 @@ import { finalizeInstallation, LibraryOptions as SpartacusUserOptions, readPackageJson, + normalizeOptionsFeatures, validateSpartacusInstallation, } from '@spartacus/schematics'; import { peerDependencies } from '../../package.json'; @@ -26,6 +27,7 @@ export function addUserFeatures(options: SpartacusUserOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/feature-libs/user/schematics/add-user/schema.json b/feature-libs/user/schematics/add-user/schema.json index aaed8f89f01..7087750e66a 100644 --- a/feature-libs/user/schematics/add-user/schema.json +++ b/feature-libs/user/schematics/add-user/schema.json @@ -23,7 +23,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": ["User-Account", "User-Profile"], diff --git a/integration-libs/cdc/schematics/add-cdc/index.ts b/integration-libs/cdc/schematics/add-cdc/index.ts index 83e29e5b54f..1c51b573fa5 100644 --- a/integration-libs/cdc/schematics/add-cdc/index.ts +++ b/integration-libs/cdc/schematics/add-cdc/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, readPackageJson, SpartacusCdcOptions, validateSpartacusInstallation, @@ -27,6 +28,8 @@ export function addCdcFeature(options: SpartacusCdcOptions): Rule { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); + const features = analyzeCrossFeatureDependencies( options.features as string[] ); diff --git a/integration-libs/cdc/schematics/add-cdc/schema.json b/integration-libs/cdc/schematics/add-cdc/schema.json index 449a1a75c42..99fc2b97db2 100644 --- a/integration-libs/cdc/schematics/add-cdc/schema.json +++ b/integration-libs/cdc/schematics/add-cdc/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": ["CDC", "CDC-B2B"], diff --git a/integration-libs/cdp/schematics/add-cdp/index.ts b/integration-libs/cdp/schematics/add-cdp/index.ts index 6a1dcd670c8..6b9840ab53a 100644 --- a/integration-libs/cdp/schematics/add-cdp/index.ts +++ b/integration-libs/cdp/schematics/add-cdp/index.ts @@ -17,6 +17,7 @@ import { analyzeCrossFeatureDependencies, finalizeInstallation, readPackageJson, + normalizeOptionsFeatures, LibraryOptions as SpartacusCdpOptions, validateSpartacusInstallation, } from '@spartacus/schematics'; @@ -26,6 +27,7 @@ export function addCdpFeature(options: SpartacusCdpOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/integration-libs/cdp/schematics/add-cdp/schema.json b/integration-libs/cdp/schematics/add-cdp/schema.json index e2cb2c87e02..4f058c1b78d 100644 --- a/integration-libs/cdp/schematics/add-cdp/schema.json +++ b/integration-libs/cdp/schematics/add-cdp/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["CDP"] } diff --git a/integration-libs/cds/src/schematics/add-cds/index.ts b/integration-libs/cds/src/schematics/add-cds/index.ts index 96f21a61328..9d95306b4a5 100644 --- a/integration-libs/cds/src/schematics/add-cds/index.ts +++ b/integration-libs/cds/src/schematics/add-cds/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, readPackageJson, SpartacusCdsOptions, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addCdsFeature(options: SpartacusCdsOptions): Rule { return (tree: Tree, _context: SchematicContext) => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/integration-libs/cds/src/schematics/add-cds/schema.json b/integration-libs/cds/src/schematics/add-cds/schema.json index 529a264cdb9..a1bb0ccff0c 100644 --- a/integration-libs/cds/src/schematics/add-cds/schema.json +++ b/integration-libs/cds/src/schematics/add-cds/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["CDS"] }, diff --git a/integration-libs/digital-payments/schematics/add-digital-payments/index.ts b/integration-libs/digital-payments/schematics/add-digital-payments/index.ts index 0a8b1bb0bc7..973541a5cec 100644 --- a/integration-libs/digital-payments/schematics/add-digital-payments/index.ts +++ b/integration-libs/digital-payments/schematics/add-digital-payments/index.ts @@ -18,6 +18,7 @@ import { finalizeInstallation, LibraryOptions as SpartacusDigitalPaymentsOptions, readPackageJson, + normalizeOptionsFeatures, validateSpartacusInstallation, } from '@spartacus/schematics'; import { peerDependencies } from '../../package.json'; @@ -28,6 +29,7 @@ export function addDigitalPaymentsFeature( return (tree: Tree, _context: SchematicContext) => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/integration-libs/digital-payments/schematics/add-digital-payments/schema.json b/integration-libs/digital-payments/schematics/add-digital-payments/schema.json index 6a3d90d3934..f28eadbec1c 100644 --- a/integration-libs/digital-payments/schematics/add-digital-payments/schema.json +++ b/integration-libs/digital-payments/schematics/add-digital-payments/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Digital-Payments"] } diff --git a/integration-libs/epd-visualization/schematics/add-epd-visualization/index.ts b/integration-libs/epd-visualization/schematics/add-epd-visualization/index.ts index ef13969bb90..7a999f985da 100644 --- a/integration-libs/epd-visualization/schematics/add-epd-visualization/index.ts +++ b/integration-libs/epd-visualization/schematics/add-epd-visualization/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, readPackageJson, SpartacusEpdVisualizationOptions, validateSpartacusInstallation, @@ -28,6 +29,7 @@ export function addEpdVisualizationFeature( return (tree: Tree, _context: SchematicContext) => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/integration-libs/epd-visualization/schematics/add-epd-visualization/schema.json b/integration-libs/epd-visualization/schematics/add-epd-visualization/schema.json index c108723a5c8..220cdaf2336 100644 --- a/integration-libs/epd-visualization/schematics/add-epd-visualization/schema.json +++ b/integration-libs/epd-visualization/schematics/add-epd-visualization/schema.json @@ -12,7 +12,7 @@ } }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["EPD-Visualization"] }, diff --git a/integration-libs/opps/schematics/add-opps/index.ts b/integration-libs/opps/schematics/add-opps/index.ts index 9b80c5d23b2..200e8b926b3 100644 --- a/integration-libs/opps/schematics/add-opps/index.ts +++ b/integration-libs/opps/schematics/add-opps/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, readPackageJson, validateSpartacusInstallation, LibraryOptions as SpartacusOppsOptions, @@ -26,6 +27,7 @@ export function addOppsFeature(options: SpartacusOppsOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/integration-libs/opps/schematics/add-opps/schema.json b/integration-libs/opps/schematics/add-opps/schema.json index 7f00fb102fd..28d28c4ec49 100644 --- a/integration-libs/opps/schematics/add-opps/schema.json +++ b/integration-libs/opps/schematics/add-opps/schema.json @@ -17,7 +17,7 @@ "default": false }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["OPPS"] } diff --git a/integration-libs/s4om/schematics/add-s4om/index.ts b/integration-libs/s4om/schematics/add-s4om/index.ts index 5aa04fac340..b79b4aaa7c4 100644 --- a/integration-libs/s4om/schematics/add-s4om/index.ts +++ b/integration-libs/s4om/schematics/add-s4om/index.ts @@ -16,6 +16,7 @@ import { analyzeApplication, analyzeCrossFeatureDependencies, finalizeInstallation, + normalizeOptionsFeatures, LibraryOptions as SpartacusOrganizationOptions, readPackageJson, validateSpartacusInstallation, @@ -26,6 +27,7 @@ export function addS4OMFeature(options: SpartacusOrganizationOptions): Rule { return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/integration-libs/s4om/schematics/add-s4om/schema.json b/integration-libs/s4om/schematics/add-s4om/schema.json index b9e70316943..32dc6e77cd2 100644 --- a/integration-libs/s4om/schematics/add-s4om/schema.json +++ b/integration-libs/s4om/schematics/add-s4om/schema.json @@ -22,7 +22,7 @@ "default": true }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["S4HANA-Order-Management"], "x-prompt": { diff --git a/integration-libs/segment-refs/schematics/add-segment-refs/index.ts b/integration-libs/segment-refs/schematics/add-segment-refs/index.ts index 0190ba6877a..baac98818d4 100644 --- a/integration-libs/segment-refs/schematics/add-segment-refs/index.ts +++ b/integration-libs/segment-refs/schematics/add-segment-refs/index.ts @@ -17,6 +17,7 @@ import { analyzeCrossFeatureDependencies, finalizeInstallation, readPackageJson, + normalizeOptionsFeatures, validateSpartacusInstallation, LibraryOptions as SpartacusSegmentRefsOptions, } from '@spartacus/schematics'; @@ -28,6 +29,7 @@ export function addSegmentRefsFeature( return (tree: Tree, _context: SchematicContext): Rule => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); + options.features = normalizeOptionsFeatures(options); const features = analyzeCrossFeatureDependencies( options.features as string[] diff --git a/integration-libs/segment-refs/schematics/add-segment-refs/schema.json b/integration-libs/segment-refs/schematics/add-segment-refs/schema.json index 77eb434283f..c23b7b5b179 100644 --- a/integration-libs/segment-refs/schematics/add-segment-refs/schema.json +++ b/integration-libs/segment-refs/schematics/add-segment-refs/schema.json @@ -17,7 +17,7 @@ "default": false }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "default": ["Segment-Refs"] } diff --git a/projects/schematics/src/add-spartacus/index.ts b/projects/schematics/src/add-spartacus/index.ts index d55046488a9..38f9d67dfe4 100644 --- a/projects/schematics/src/add-spartacus/index.ts +++ b/projects/schematics/src/add-spartacus/index.ts @@ -28,7 +28,11 @@ import { analyzeCrossFeatureDependencies, analyzeCrossLibraryDependenciesByFeatures, } from '../shared/utils/dependency-utils'; -import { addFeatures, analyzeApplication } from '../shared/utils/feature-utils'; +import { + addFeatures, + analyzeApplication, + normalizeOptionsFeatures, +} from '../shared/utils/feature-utils'; import { getIndexHtmlPath } from '../shared/utils/file-utils'; import { appendHtmlElementToHead } from '../shared/utils/html-utils'; import { @@ -328,7 +332,7 @@ function verifyAppModuleExists(options: SpartacusOptions): Rule { 1. remove your application code 2. make sure to pass the flag "--standalone=false" to the command "ng new". For more, see https://angular.io/cli/new#options 3. try again installing Spartacus with a command "ng add @spartacus/schematics" ... - + Note: Since version 17, Angular's command "ng new" by default creates an app without a file "app.module.ts" (in a so-called "standalone" mode). But Spartacus installer requires this file to be present. ` ); @@ -557,7 +561,8 @@ function addAppRoutingModuleImport( export function addSpartacus(options: SpartacusOptions): Rule { return (tree: Tree, context: SchematicContext) => { - const features = analyzeCrossFeatureDependencies(options.features ?? []); + options.features = normalizeOptionsFeatures(options); + const features = analyzeCrossFeatureDependencies(options.features); const dependencies = prepareDependencies(features); const spartacusRxjsDependency: NodeDependency[] = [ dependencies.find((dep) => dep.name === RXJS) as NodeDependency, diff --git a/projects/schematics/src/add-spartacus/index_spec.ts b/projects/schematics/src/add-spartacus/index_spec.ts index c4239278bc1..64146b292dc 100644 --- a/projects/schematics/src/add-spartacus/index_spec.ts +++ b/projects/schematics/src/add-spartacus/index_spec.ts @@ -97,7 +97,7 @@ describe('add-spartacus', () => { 1. remove your application code 2. make sure to pass the flag "--standalone=false" to the command "ng new". For more, see https://angular.io/cli/new#options 3. try again installing Spartacus with a command "ng add @spartacus/schematics" ... - + Note: Since version 17, Angular's command "ng new" by default creates an app without a file "app.module.ts" (in a so-called "standalone" mode). But Spartacus installer requires this file to be present. ] `); diff --git a/projects/schematics/src/add-spartacus/schema.json b/projects/schematics/src/add-spartacus/schema.json index 60335279246..e7694348ce4 100644 --- a/projects/schematics/src/add-spartacus/schema.json +++ b/projects/schematics/src/add-spartacus/schema.json @@ -12,7 +12,7 @@ } }, "features": { - "type": "array", + "type": ["array", "string"], "uniqueItems": true, "items": { "enum": [ diff --git a/projects/schematics/src/shared/utils/feature-utils.ts b/projects/schematics/src/shared/utils/feature-utils.ts index 82ee1ce90d0..a1badcc7fbd 100644 --- a/projects/schematics/src/shared/utils/feature-utils.ts +++ b/projects/schematics/src/shared/utils/feature-utils.ts @@ -484,3 +484,29 @@ function createDependentFeaturesLog( ', ' )}: ${notSelectedFeatures.join(', ')}\n`; } + +/** + * This function is a workaround for the GitHub issue + * https://github.com/angular/angular-cli/issues/16320. + * Using `ng add` with options of type array (--features) + * may not work correctly in some situations, and might only work on the + * second attempt. + */ +export function normalizeOptionsFeatures( + options: OPTIONS +): string[] { + return convertToArray(options.features ?? []); +} + +export function convertToArray(values: string[] | string): string[] { + let optionsArray: string[] = []; + if (Array.isArray(values)) { + optionsArray = values; + } else if (values.includes(',')) { + optionsArray = values.split(','); + } else { + optionsArray = [values]; + } + + return optionsArray; +}