source: trip-planner-front/node_modules/@angular/material/schematics/ng-add/index.mjs@ 6c1585f

Last change on this file since 6c1585f was fa375fe, checked in by Ema <ema_spirova@…>, 3 years ago

adding new components

  • Property mode set to 100644
File size: 9.1 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10const tasks_1 = require("@angular-devkit/schematics/tasks");
11const package_config_1 = require("./package-config");
12/**
13 * Version range that will be used for the Angular CDK and Angular Material if this
14 * schematic has been run outside of the CLI `ng add` command. In those cases, there
15 * can be no dependency on `@angular/material` in the `package.json` file, and we need
16 * to manually insert the dependency based on the build version placeholder.
17 *
18 * Note that the fallback version range does not use caret, but tilde because that is
19 * the default for Angular framework dependencies in CLI projects.
20 */
21const fallbackMaterialVersionRange = `~12.2.10`;
22/**
23 * Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be
24 * automatically executed if developers run `ng add @angular/material`.
25 *
26 * Since the Angular Material schematics depend on the schematic utility functions from the CDK,
27 * we need to install the CDK before loading the schematic files that import from the CDK.
28 */
29function default_1(options) {
30 return (host, context) => {
31 // Version tag of the `@angular/core` dependency that has been loaded from the `package.json`
32 // of the CLI project. This tag should be preferred because all Angular dependencies should
33 // have the same version tag if possible.
34 const ngCoreVersionTag = package_config_1.getPackageVersionFromPackageJson(host, '@angular/core');
35 const materialVersionRange = package_config_1.getPackageVersionFromPackageJson(host, '@angular/material');
36 const angularDependencyVersion = ngCoreVersionTag || `^12.0.0 || ^13.0.0-0`;
37 // The CLI inserts `@angular/material` into the `package.json` before this schematic runs.
38 // This means that we do not need to insert Angular Material into `package.json` files again.
39 // In some cases though, it could happen that this schematic runs outside of the CLI `ng add`
40 // command, or Material is only listed a dev dependency. If that is the case, we insert a
41 // version based on the current build version (substituted version placeholder).
42 if (materialVersionRange === null) {
43 package_config_1.addPackageToPackageJson(host, '@angular/material', fallbackMaterialVersionRange);
44 }
45 package_config_1.addPackageToPackageJson(host, '@angular/cdk', materialVersionRange || fallbackMaterialVersionRange);
46 package_config_1.addPackageToPackageJson(host, '@angular/forms', angularDependencyVersion);
47 package_config_1.addPackageToPackageJson(host, '@angular/animations', angularDependencyVersion);
48 // Since the Angular Material schematics depend on the schematic utility functions from the
49 // CDK, we need to install the CDK before loading the schematic files that import from the CDK.
50 const installTaskId = context.addTask(new tasks_1.NodePackageInstallTask());
51 context.addTask(new tasks_1.RunSchematicTask('ng-add-setup-project', options), [installTaskId]);
52 };
53}
54exports.default = default_1;
55//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvc2NoZW1hdGljcy9uZy1hZGQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7QUFHSCw0REFBMEY7QUFDMUYscURBQTJGO0FBRzNGOzs7Ozs7OztHQVFHO0FBQ0gsTUFBTSw0QkFBNEIsR0FBRyxvQkFBb0IsQ0FBQztBQUUxRDs7Ozs7O0dBTUc7QUFDSCxtQkFBd0IsT0FBZTtJQUNyQyxPQUFPLENBQUMsSUFBVSxFQUFFLE9BQXlCLEVBQUUsRUFBRTtRQUMvQyw2RkFBNkY7UUFDN0YsMkZBQTJGO1FBQzNGLHlDQUF5QztRQUN6QyxNQUFNLGdCQUFnQixHQUFHLGlEQUFnQyxDQUFDLElBQUksRUFBRSxlQUFlLENBQUMsQ0FBQztRQUNqRixNQUFNLG9CQUFvQixHQUFHLGlEQUFnQyxDQUFDLElBQUksRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO1FBQ3pGLE1BQU0sd0JBQXdCLEdBQUcsZ0JBQWdCLElBQUksVUFBVSxDQUFDO1FBRWhFLDBGQ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