source: trip-planner-front/node_modules/@schematics/angular/e2e/index.js@ 6a3a178

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

initial commit

  • Property mode set to 100644
File size: 3.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 core_1 = require("@angular-devkit/core");
11const schematics_1 = require("@angular-devkit/schematics");
12const dependencies_1 = require("../utility/dependencies");
13const json_file_1 = require("../utility/json-file");
14const paths_1 = require("../utility/paths");
15const workspace_1 = require("../utility/workspace");
16const workspace_models_1 = require("../utility/workspace-models");
17function addScriptsToPackageJson() {
18 return (host) => {
19 const pkgJson = new json_file_1.JSONFile(host, 'package.json');
20 const e2eScriptPath = ['scripts', 'e2e'];
21 if (!pkgJson.get(e2eScriptPath)) {
22 pkgJson.modify(e2eScriptPath, 'ng e2e', false);
23 }
24 };
25}
26function default_1(options) {
27 return async (host) => {
28 const appProject = options.relatedAppName;
29 const workspace = await workspace_1.getWorkspace(host);
30 const project = workspace.projects.get(appProject);
31 if (!project) {
32 throw new schematics_1.SchematicsException(`Project name "${appProject}" doesn't not exist.`);
33 }
34 const root = core_1.join(core_1.normalize(project.root), 'e2e');
35 project.targets.add({
36 name: 'e2e',
37 builder: workspace_models_1.Builders.Protractor,
38 defaultConfiguration: 'development',
39 options: {
40 protractorConfig: `${root}/protractor.conf.js`,
41 },
42 configurations: {
43 production: {
44 devServerTarget: `${options.relatedAppName}:serve:production`,
45 },
46 development: {
47 devServerTarget: `${options.relatedAppName}:serve:development`,
48 },
49 },
50 });
51 return schematics_1.chain([
52 workspace_1.updateWorkspace(workspace),
53 schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./files'), [
54 schematics_1.applyTemplates({
55 utils: core_1.strings,
56 ...options,
57 relativePathToWorkspaceRoot: paths_1.relativePathToWorkspaceRoot(root),
58 }),
59 schematics_1.move(root),
60 ])),
61 (host) => [
62 {
63 type: dependencies_1.NodeDependencyType.Dev,
64 name: 'protractor',
65 version: '~7.0.0',
66 },
67 {
68 type: dependencies_1.NodeDependencyType.Dev,
69 name: 'jasmine-spec-reporter',
70 version: '~7.0.0',
71 },
72 {
73 type: dependencies_1.NodeDependencyType.Dev,
74 name: 'ts-node',
75 version: '~9.1.1',
76 },
77 ].forEach((dep) => dependencies_1.addPackageJsonDependency(host, dep)),
78 addScriptsToPackageJson(),
79 ]);
80 };
81}
82exports.default = default_1;
Note: See TracBrowser for help on using the repository browser.