UNPKG

@o3r/configuration

Version:

This module contains configuration-related features such as CMS compatibility, Configuration override, store and debugging. It enables your application runtime configuration and comes with an integrated ng builder to help you generate configurations suppo

54 lines 2.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ngAdd = void 0; const fs = require("node:fs"); const path = require("node:path"); const schematics_1 = require("@angular-devkit/schematics"); const schematics_2 = require("@o3r/schematics"); const devtools_registration_1 = require("./helpers/devtools-registration"); /** * List of external dependencies to be added to the project as peer dependencies */ const dependenciesToInstall = [ '@angular/core', '@angular/platform-browser-dynamic', '@ngrx/entity', '@ngrx/store', 'rxjs' ]; /** * List of external dependencies to be added to the project as dev dependencies */ const devDependenciesToInstall = [ 'rxjs' ]; /** * Add Otter configuration to an Angular Project * @param options The options to pass to ng-add execution */ function ngAddFn(options) { const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json'); const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' })); const schematicsDefaultOptions = { useOtterConfig: undefined }; return () => (0, schematics_1.chain)([ (_, context) => { context.logger.info(`The package @o3r/configuration comes with a debug mechanism`); context.logger.info('Get more information on the following page: https://github.com/AmadeusITGroup/otter/tree/main/docs/configuration/OVERVIEW.md#Runtime-debugging'); }, (0, schematics_2.registerPackageCollectionSchematics)(packageJson), (0, schematics_2.setupSchematicsParamsForProject)({ '@o3r/core:component': schematicsDefaultOptions, '@o3r/core:component-container': schematicsDefaultOptions, '@o3r/core:component-presenter': schematicsDefaultOptions }, options.projectName), (0, schematics_2.ngAddDependenciesRule)(options, packageJsonPath, { dependenciesToInstall, devDependenciesToInstall }), () => (0, devtools_registration_1.registerDevtools)(options) ]); } /** * Add Otter configuration to an Angular Project * @param options The options to pass to ng-add execution */ const ngAdd = (options) => (0, schematics_2.createOtterSchematic)(ngAddFn)(options); exports.ngAdd = ngAdd; //# sourceMappingURL=index.js.map