@spartacus/checkout
Version:
Checkout feature library for Spartacus
54 lines • 2.24 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addCheckoutFeatures = void 0;
const schematics_1 = require("@angular-devkit/schematics");
const schematics_2 = require("@spartacus/schematics");
const package_json_1 = require("../../package.json");
const constants_1 = require("../constants");
function addCheckoutFeatures(options) {
return (tree, _context) => {
const packageJson = schematics_2.readPackageJson(tree);
schematics_2.validateSpartacusInstallation(packageJson);
return schematics_1.chain([
schematics_2.addPackageJsonDependenciesForLibrary(package_json_1.peerDependencies, options),
schematics_2.shouldAddFeature(schematics_2.CLI_CHECKOUT_FEATURE, options.features)
? addSavedCheckoutFeature(options)
: schematics_1.noop(),
]);
};
}
exports.addCheckoutFeatures = addCheckoutFeatures;
function addSavedCheckoutFeature(options) {
return schematics_2.addLibraryFeature(options, {
folderName: constants_1.CHECKOUT_FOLDER_NAME,
moduleName: constants_1.CHECKOUT_MODULE_NAME,
featureModule: {
name: constants_1.CHECKOUT_MODULE,
importPath: schematics_2.SPARTACUS_CHECKOUT,
},
rootModule: {
name: constants_1.CHECKOUT_ROOT_MODULE,
importPath: constants_1.SPARTACUS_CHECKOUT_ROOT,
},
lazyLoadingChunk: {
moduleSpecifier: constants_1.SPARTACUS_CHECKOUT_ROOT,
namedImports: [constants_1.CHECKOUT_FEATURE_NAME_CONSTANT],
},
i18n: {
resources: constants_1.CHECKOUT_TRANSLATIONS,
chunks: constants_1.CHECKOUT_TRANSLATION_CHUNKS_CONFIG,
importPath: constants_1.SPARTACUS_CHECKOUT_ASSETS,
},
styles: {
scssFileName: constants_1.SCSS_FILE_NAME,
importStyle: schematics_2.SPARTACUS_CHECKOUT,
},
dependencyManagement: {
featureName: schematics_2.CLI_CHECKOUT_FEATURE,
featureDependencies: {
[schematics_2.SPARTACUS_USER]: [schematics_2.CLI_USER_ACCOUNT_FEATURE],
},
},
});
}
//# sourceMappingURL=index.js.map