@spartacus/order
Version:
Order feature library for Spartacus
54 lines • 2.17 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addOrderFeatures = 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 addOrderFeatures(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_ORDER_FEATURE, options.features)
? addOrderFeature(options)
: schematics_1.noop(),
]);
};
}
exports.addOrderFeatures = addOrderFeatures;
function addOrderFeature(options) {
return schematics_2.addLibraryFeature(options, {
folderName: constants_1.ORDER_FOLDER_NAME,
moduleName: constants_1.ORDER_MODULE_NAME,
featureModule: {
name: constants_1.ORDER_MODULE,
importPath: schematics_2.SPARTACUS_ORDER,
},
rootModule: {
name: constants_1.ORDER_ROOT_MODULE,
importPath: constants_1.SPARTACUS_ORDER_ROOT,
},
lazyLoadingChunk: {
moduleSpecifier: constants_1.SPARTACUS_ORDER_ROOT,
namedImports: [constants_1.ORDER_FEATURE_NAME_CONSTANT],
},
i18n: {
resources: constants_1.ORDER_TRANSLATIONS,
chunks: constants_1.ORDER_TRANSLATION_CHUNKS_CONFIG,
importPath: constants_1.SPARTACUS_ORDER_ASSETS,
},
styles: {
scssFileName: constants_1.SCSS_FILE_NAME,
importStyle: schematics_2.SPARTACUS_ORDER,
},
dependencyManagement: {
featureName: schematics_2.CLI_ORDER_FEATURE,
featureDependencies: {
[schematics_2.SPARTACUS_USER]: [schematics_2.CLI_USER_ACCOUNT_FEATURE],
},
},
});
}
//# sourceMappingURL=index.js.map