source: trip-planner-front/node_modules/@schematics/angular/migrations/update-12/remove-emit-decorator-metadata.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: 1.9 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 json_file_1 = require("../../utility/json-file");
12const workspace_1 = require("../../utility/workspace");
13function* visitJsonFiles(directory) {
14 for (const path of directory.subfiles) {
15 if (!path.endsWith('.json')) {
16 continue;
17 }
18 yield core_1.join(directory.path, path);
19 }
20 for (const path of directory.subdirs) {
21 if (path === 'node_modules' || path.startsWith('.')) {
22 continue;
23 }
24 yield* visitJsonFiles(directory.dir(path));
25 }
26}
27function default_1() {
28 return async (tree, { logger }) => {
29 const workspace = await workspace_1.getWorkspace(tree);
30 const hasThirdPartyBuilders = [...workspace_1.allWorkspaceTargets(workspace)].some(([, target]) => {
31 const { builder } = target;
32 return !(builder.startsWith('@angular-devkit/build-angular') ||
33 builder.startsWith('@nguniversal/builders'));
34 });
35 if (hasThirdPartyBuilders) {
36 logger.warn('Skipping migration as the workspace uses third-party builders which may ' +
37 'require "emitDecoratorMetadata" TypeScript compiler option.');
38 return;
39 }
40 for (const path of visitJsonFiles(tree.root)) {
41 const content = tree.read(path);
42 if (content === null || content === void 0 ? void 0 : content.toString().includes('"emitDecoratorMetadata"')) {
43 const json = new json_file_1.JSONFile(tree, path);
44 json.remove(['compilerOptions', 'emitDecoratorMetadata']);
45 }
46 }
47 };
48}
49exports.default = default_1;
Note: See TracBrowser for help on using the repository browser.