source: trip-planner-front/node_modules/@schematics/angular/migrations/update-12/replace-prod-flag.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: 1019 bytes
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 json_file_1 = require("../../utility/json-file");
11function default_1() {
12 return (tree) => {
13 const file = new json_file_1.JSONFile(tree, 'package.json');
14 const scripts = file.get(['scripts']);
15 if (!scripts || typeof scripts !== 'object') {
16 return;
17 }
18 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
19 const updatedScripts = Object.entries(scripts).map(([key, value]) => [
20 key,
21 typeof value === 'string'
22 ? value.replace(/ --prod(?!\w)/g, ' --configuration production')
23 : value,
24 ]);
25 file.modify(['scripts'], Object.fromEntries(updatedScripts));
26 };
27}
28exports.default = default_1;
Note: See TracBrowser for help on using the repository browser.