source: trip-planner-front/node_modules/@schematics/angular/utility/generate-from-files.js@ ceaed42

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

initial commit

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[6a3a178]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.generateFromFiles = void 0;
11const core_1 = require("@angular-devkit/core");
12const schematics_1 = require("@angular-devkit/schematics");
13const lint_fix_1 = require("./lint-fix");
14const parse_name_1 = require("./parse-name");
15const workspace_1 = require("./workspace");
16function generateFromFiles(options, extraTemplateValues = {}) {
17 return async (host) => {
18 var _a, _b, _c;
19 (_a = options.path) !== null && _a !== void 0 ? _a : (options.path = await workspace_1.createDefaultPath(host, options.project));
20 (_b = options.prefix) !== null && _b !== void 0 ? _b : (options.prefix = '');
21 (_c = options.flat) !== null && _c !== void 0 ? _c : (options.flat = true);
22 const parsedPath = parse_name_1.parseName(options.path, options.name);
23 options.name = parsedPath.name;
24 options.path = parsedPath.path;
25 const templateSource = schematics_1.apply(schematics_1.url('./files'), [
26 options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
27 schematics_1.applyTemplates({
28 ...core_1.strings,
29 ...options,
30 ...extraTemplateValues,
31 }),
32 schematics_1.move(parsedPath.path + (options.flat ? '' : '/' + core_1.strings.dasherize(options.name))),
33 ]);
34 return schematics_1.chain([
35 schematics_1.mergeWith(templateSource),
36 options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
37 ]);
38 };
39}
40exports.generateFromFiles = generateFromFiles;
Note: See TracBrowser for help on using the repository browser.