source: trip-planner-front/node_modules/@angular/cdk/schematics/utils/schematic-options.mjs@ 571e0df

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

initial commit

  • Property mode set to 100644
File size: 8.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 });
10exports.getDefaultComponentOptions = void 0;
11const core_1 = require("@angular-devkit/core");
12const schema_1 = require("@schematics/angular/component/schema");
13/**
14 * Returns the default options for the `@schematics/angular:component` schematic which would
15 * have been specified at project initialization (ng new or ng init).
16 *
17 * This is necessary because the Angular CLI only exposes the default values for the "--style",
18 * "--inlineStyle", "--skipTests" and "--inlineTemplate" options to the "component" schematic.
19 */
20function getDefaultComponentOptions(project) {
21 // Note: Not all options which are available when running "ng new" will be stored in the
22 // workspace config. List of options which will be available in the configuration:
23 // angular/angular-cli/blob/master/packages/schematics/angular/application/index.ts#L109-L131
24 let skipTests = getDefaultComponentOption(project, ['skipTests'], null);
25 // In case "skipTests" is not set explicitly, also look for the "spec" option. The "spec"
26 // option has been deprecated but can be still used in older Angular CLI projects.
27 // See: https://github.com/angular/angular-cli/commit/a12a4e02a4689b5bdbc6e740c0d9865afb55671a
28 if (skipTests === null) {
29 skipTests = !getDefaultComponentOption(project, ['spec'], true);
30 }
31 return {
32 style: getDefaultComponentOption(project, ['style', 'styleext'], schema_1.Style.Css),
33 inlineStyle: getDefaultComponentOption(project, ['inlineStyle'], false),
34 inlineTemplate: getDefaultComponentOption(project, ['inlineTemplate'], false),
35 skipTests: skipTests,
36 };
37}
38exports.getDefaultComponentOptions = getDefaultComponentOptions;
39/**
40 * Gets the default value for the specified option. The default options will be determined
41 * by looking at the stored schematic options for `@schematics/angular:component` in the
42 * CLI workspace configuration.
43 */
44function getDefaultComponentOption(project, optionNames, fallbackValue) {
45 const schematicOptions = core_1.isJsonObject(project.extensions.schematics || null) ?
46 project.extensions.schematics : null;
47 const defaultSchematic = schematicOptions ?
48 schematicOptions['@schematics/angular:component'] : null;
49 for (const optionName of optionNames) {
50 if (defaultSchematic && defaultSchematic[optionName] != null) {
51 return defaultSchematic[optionName];
52 }
53 }
54 return fallbackValue;
55}
56//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NoZW1hdGljLW9wdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL3NjaGVtYXRpY3MvdXRpbHMvc2NoZW1hdGljLW9wdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7O0FBR0gsK0NBQThEO0FBQzlELGlFQUFtRTtBQUVuRTs7Ozs7O0dBTUc7QUFDSCxTQUFnQiwwQkFBMEIsQ0FBQyxPQUEwQjtJQUNuRSx3RkFBd0Y7SUFDeEYsa0ZBQWtGO0lBQ2xGLDZGQUE2RjtJQUM3RixJQUFJLFNBQVMsR0FBRyx5QkFBeUIsQ0FBZSxPQUFPLEVBQUUsQ0FBQyxXQUFXLENBQUMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUV0Rix5RkFBeUY7SUFDekYsa0ZBQWtGO0lBQ2xGLDhGQUE4RjtJQUM5RixJQUFJLFNBQVMsS0FBSyxJQUFJLEVBQUU7UUFDdEIsU0FBUyxHQUFHLENBQUMseUJBQXlCLENBQUMsT0FBTyxFQUFFLENBQUMsTUFBTSxDQUFDLEVBQUUsSUFBSSxDQUFDLENBQUM7S0FDakU7SUFFRCxPQUFPO1FBQ0wsS0FBSyxFQUFFLHlCQUF5QixDQUFRLE9BQU8sRUFBRSxDQUFDLE9BQU8sRUFBRSxVQUFVLENBQUMsRUFBRSxjQUFLLENBQUMsR0FBRyxDQUFDO1FBQ2xGLFdBQVcsRUFBRSx5QkFBeUI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ydAc2NoZW1hdGljcy9hbmd1bGFyOmNvbXBvbmVudCddIGFzIEpzb25PYmplY3QgfCBudWxsIDogbnVsbDtcblxuICBmb3IgKGNvbnN0IG9wdGlvbk5hbWUgb2Ygb3B0aW9uTmFtZXMpIHtcbiAgICBpZiAoZGVmYXVsdFNjaGVtYXRpYyAmJiBkZWZhdWx0U2NoZW1hdGljW29wdGlvbk5hbWVdICE9IG51bGwpIHtcbiAgICAgIHJldHVybiBkZWZhdWx0U2NoZW1hdGljW29wdGlvbk5hbWVdIGFzIHVua25vd24gYXMgVDtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gZmFsbGJhY2tWYWx1ZTtcbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.