source: trip-planner-front/node_modules/@angular/cli/utilities/project.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: 2.7 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 */
9var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12}) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
14 o[k2] = m[k];
15}));
16var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
18}) : function(o, v) {
19 o["default"] = v;
20});
21var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
23 var result = {};
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
26 return result;
27};
28Object.defineProperty(exports, "__esModule", { value: true });
29exports.findWorkspaceFile = void 0;
30const core_1 = require("@angular-devkit/core");
31const fs = __importStar(require("fs"));
32const os = __importStar(require("os"));
33const path = __importStar(require("path"));
34const find_up_1 = require("./find-up");
35function findWorkspaceFile(currentDirectory = process.cwd()) {
36 const possibleConfigFiles = [
37 'angular.json',
38 '.angular.json',
39 'angular-cli.json',
40 '.angular-cli.json',
41 ];
42 const configFilePath = find_up_1.findUp(possibleConfigFiles, currentDirectory);
43 if (configFilePath === null) {
44 return null;
45 }
46 const possibleDir = path.dirname(configFilePath);
47 const homedir = os.homedir();
48 if (core_1.normalize(possibleDir) === core_1.normalize(homedir)) {
49 const packageJsonPath = path.join(possibleDir, 'package.json');
50 try {
51 const packageJsonText = fs.readFileSync(packageJsonPath, 'utf-8');
52 const packageJson = JSON.parse(packageJsonText);
53 if (!containsCliDep(packageJson)) {
54 // No CLI dependency
55 return null;
56 }
57 }
58 catch {
59 // No or invalid package.json
60 return null;
61 }
62 }
63 return configFilePath;
64}
65exports.findWorkspaceFile = findWorkspaceFile;
66function containsCliDep(obj) {
67 var _a, _b;
68 const pkgName = '@angular/cli';
69 if (!obj) {
70 return false;
71 }
72 return !!(((_a = obj.dependencies) === null || _a === void 0 ? void 0 : _a[pkgName]) || ((_b = obj.devDependencies) === null || _b === void 0 ? void 0 : _b[pkgName]));
73}
Note: See TracBrowser for help on using the repository browser.