@o3r/dynamic-content
Version:
This module provides a mechanism to retrieve media and data depending on the host or a server specific url.
34 lines • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ngAdd = void 0;
const path = require("node:path");
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
const reportMissingSchematicsDep = (logger) => (reason) => {
logger.error(`[ERROR]: Adding @o3r/apis-manager has failed.
You need to install '@o3r/schematics' to be able to use the o3r apis-manager package. Please run 'ng add @o3r/schematics' .`);
throw reason;
};
/**
* Add Otter dynamic-content to an Angular Project
* @param options
*/
function ngAddFn(options) {
/* ng add rules */
return async (tree) => {
const { getPackageInstallConfig, setupDependencies } = await Promise.resolve().then(() => require('@o3r/schematics'));
return setupDependencies({
projectName: options.projectName,
dependencies: getPackageInstallConfig(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion)
});
};
}
/**
* Add Otter dynamic-content to an Angular Project
* @param options
*/
const ngAdd = (options) => async (_, { logger }) => {
const { createOtterSchematic } = await Promise.resolve().then(() => require('@o3r/schematics')).catch(reportMissingSchematicsDep(logger));
return createOtterSchematic(ngAddFn)(options);
};
exports.ngAdd = ngAdd;
//# sourceMappingURL=index.js.map