1 | "use strict";
|
2 |
|
3 |
|
4 | Object.defineProperty(exports, "__esModule", { value: true });
|
5 | const path = require("path");
|
6 | const node_core_library_1 = require("@microsoft/node-core-library");
|
7 | const rush_lib_1 = require("@microsoft/rush-lib");
|
8 | const RushConstants_1 = require("@microsoft/rush-lib/lib/logic/RushConstants");
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | class MinimalRushConfiguration {
|
14 | constructor(minimalRushConfigurationJson, rushJsonFilename) {
|
15 | this._rushVersion = minimalRushConfigurationJson.rushVersion || minimalRushConfigurationJson.rushMinimumVersion;
|
16 | this._commonRushConfigFolder = path.join(path.dirname(rushJsonFilename), RushConstants_1.RushConstants.commonFolderName, 'config', 'rush');
|
17 | }
|
18 | static loadFromDefaultLocation() {
|
19 | const rushJsonLocation = rush_lib_1.RushConfiguration.tryFindRushJsonLocation({ showVerbose: true });
|
20 | if (rushJsonLocation) {
|
21 | return MinimalRushConfiguration._loadFromConfigurationFile(rushJsonLocation);
|
22 | }
|
23 | else {
|
24 | return undefined;
|
25 | }
|
26 | }
|
27 | static _loadFromConfigurationFile(rushJsonFilename) {
|
28 | try {
|
29 | const minimalRushConfigurationJson = node_core_library_1.JsonFile.load(rushJsonFilename);
|
30 | return new MinimalRushConfiguration(minimalRushConfigurationJson, rushJsonFilename);
|
31 | }
|
32 | catch (e) {
|
33 | return undefined;
|
34 | }
|
35 | }
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 | get rushVersion() {
|
42 | return this._rushVersion;
|
43 | }
|
44 | |
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | get commonRushConfigFolder() {
|
53 | return this._commonRushConfigFolder;
|
54 | }
|
55 | }
|
56 | exports.MinimalRushConfiguration = MinimalRushConfiguration;
|
57 |
|
\ | No newline at end of file |