UNPKG

4.08 kBSource Map (JSON)View Raw
1{"version":3,"file":"MinimalRushConfiguration.js","sourceRoot":"","sources":["../src/MinimalRushConfiguration.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,6BAA6B;AAE7B,oEAAwD;AACxD,kDAAwD;AACxD,+EAA4E;AAO5E;;;GAGG;AACH,MAAa,wBAAwB;IAInC,YAAoB,4BAA2D,EAAE,gBAAwB;QACvG,IAAI,CAAC,YAAY,GAAG,4BAA4B,CAAC,WAAW,IAAI,4BAA4B,CAAC,kBAAkB,CAAC;QAChH,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EACrE,6BAAa,CAAC,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAEM,MAAM,CAAC,uBAAuB;QACnC,MAAM,gBAAgB,GAAuB,4BAAiB,CAAC,uBAAuB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9G,IAAI,gBAAgB,EAAE;YACpB,OAAO,wBAAwB,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;SAC9E;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;IAEO,MAAM,CAAC,0BAA0B,CAAC,gBAAwB;QAChE,IAAI;YACF,MAAM,4BAA4B,GAAkC,4BAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACpG,OAAO,IAAI,wBAAwB,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;SACrF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;IAED;;;;OAIG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACH,IAAW,sBAAsB;QAC/B,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACtC,CAAC;CACF;AAhDD,4DAgDC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport * as path from 'path';\r\n\r\nimport { JsonFile } from '@microsoft/node-core-library';\r\nimport { RushConfiguration } from '@microsoft/rush-lib';\r\nimport { RushConstants } from '@microsoft/rush-lib/lib/logic/RushConstants';\r\n\r\ninterface IMinimalRushConfigurationJson {\r\n rushMinimumVersion: string;\r\n rushVersion?: string;\r\n}\r\n\r\n/**\r\n * Represents a minimal subset of the rush.json configuration file. It provides the information necessary to\r\n * decide which version of Rush should be installed/used.\r\n */\r\nexport class MinimalRushConfiguration {\r\n private _rushVersion: string;\r\n private _commonRushConfigFolder: string;\r\n\r\n private constructor(minimalRushConfigurationJson: IMinimalRushConfigurationJson, rushJsonFilename: string) {\r\n this._rushVersion = minimalRushConfigurationJson.rushVersion || minimalRushConfigurationJson.rushMinimumVersion;\r\n this._commonRushConfigFolder = path.join(path.dirname(rushJsonFilename),\r\n RushConstants.commonFolderName, 'config', 'rush');\r\n }\r\n\r\n public static loadFromDefaultLocation(): MinimalRushConfiguration | undefined {\r\n const rushJsonLocation: string | undefined = RushConfiguration.tryFindRushJsonLocation({ showVerbose: true });\r\n if (rushJsonLocation) {\r\n return MinimalRushConfiguration._loadFromConfigurationFile(rushJsonLocation);\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n\r\n private static _loadFromConfigurationFile(rushJsonFilename: string): MinimalRushConfiguration | undefined {\r\n try {\r\n const minimalRushConfigurationJson: IMinimalRushConfigurationJson = JsonFile.load(rushJsonFilename);\r\n return new MinimalRushConfiguration(minimalRushConfigurationJson, rushJsonFilename);\r\n } catch (e) {\r\n return undefined;\r\n }\r\n }\r\n\r\n /**\r\n * The version of rush specified by the rushVersion property of the rush.json configuration file. If the\r\n * rushVersion property is not specified, this falls back to the rushMinimumVersion property. This should be\r\n * a semver style version number like \"4.0.0\"\r\n */\r\n public get rushVersion(): string {\r\n return this._rushVersion;\r\n }\r\n\r\n /**\r\n * The folder where Rush's additional config files are stored. This folder is always a\r\n * subfolder called \"config\\rush\" inside the common folder. (The \"common\\config\" folder\r\n * is reserved for configuration files used by other tools.) To avoid confusion or mistakes,\r\n * Rush will report an error if this this folder contains any unrecognized files.\r\n *\r\n * Example: \"C:\\MyRepo\\common\\config\\rush\"\r\n */\r\n public get commonRushConfigFolder(): string {\r\n return this._commonRushConfigFolder;\r\n }\r\n}\r\n"]}
\No newline at end of file