"use strict"; /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ Object.defineProperty(exports, "__esModule", { value: true }); const tasks_1 = require("@angular-devkit/schematics/tasks"); const package_config_1 = require("./package-config"); /** * Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be * automatically executed if developers run `ng add @angular/cdk`. * * By default, the CLI already installs the package that has been specified with `ng add`. * We just store the version in the `package.json` in case the package manager didn't. Also * this ensures that there will be no error that says that the CDK does not support `ng add`. */ function default_1() { return (host, context) => { // The CLI inserts `@angular/cdk` into the `package.json` before this schematic runs. This // means that we do not need to insert the CDK into `package.json` files again. In some cases // though, it could happen that this schematic runs outside of the CLI `ng add` command, or // the CDK is only listed as a dev dependency. If that is the case, we insert a version based // on the current build version (substituted version placeholder). if (package_config_1.getPackageVersionFromPackageJson(host, '@angular/cdk') === null) { // In order to align the CDK version with other Angular dependencies that are setup by // `@schematics/angular`, we use tilde instead of caret. This is default for Angular // dependencies in new CLI projects. package_config_1.addPackageToPackageJson(host, '@angular/cdk', `~12.2.13`); // Add a task to run the package manager. This is necessary because we updated the // workspace "package.json" file and we want lock files to reflect the new version range. context.addTask(new tasks_1.NodePackageInstallTask()); } }; } exports.default = default_1; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL3NjaGVtYXRpY3MvbmctYWRkL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7O0dBTUc7O0FBR0gsNERBQXdFO0FBQ3hFLHFEQUEyRjtBQUUzRjs7Ozs7OztHQU9HO0FBQ0g7SUFDRSxPQUFPLENBQUMsSUFBVSxFQUFFLE9BQXlCLEVBQUUsRUFBRTtRQUMvQywwRkFBMEY7UUFDMUYsNkZBQTZGO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