@rushstack/rig-package
Advanced tools
+110
-58
@@ -33,2 +33,99 @@ /** | ||
| /** | ||
| * This is the main API for loading the `config/rig.json` file format. | ||
| * | ||
| * @public | ||
| */ | ||
| export declare interface IRigConfig { | ||
| /** | ||
| * The project folder path that was passed to {@link RigConfig.loadForProjectFolder}, | ||
| * which maybe an absolute or relative path. | ||
| * | ||
| * @remarks | ||
| * Example: `.` | ||
| */ | ||
| readonly projectFolderOriginalPath: string; | ||
| /** | ||
| * The absolute path for the project folder path that was passed to {@link RigConfig.loadForProjectFolder}. | ||
| * | ||
| * @remarks | ||
| * Example: `/path/to/your-project` | ||
| */ | ||
| readonly projectFolderPath: string; | ||
| /** | ||
| * Returns `true` if `config/rig.json` was found, or `false` otherwise. | ||
| */ | ||
| readonly rigFound: boolean; | ||
| /** | ||
| * The full path to the `rig.json` file that was found, or `""` if none was found. | ||
| * | ||
| * @remarks | ||
| * Example: `/path/to/your-project/config/rig.json` | ||
| */ | ||
| readonly filePath: string; | ||
| /** | ||
| * The `"rigPackageName"` field from `rig.json`, or `""` if the file was not found. | ||
| * | ||
| * @remarks | ||
| * The name must be a valid NPM package name, and must end with the `-rig` suffix. | ||
| * | ||
| * Example: `example-rig` | ||
| */ | ||
| readonly rigPackageName: string; | ||
| /** | ||
| * The `"rigProfile"` value that was loaded from `rig.json`, or `""` if the file was not found. | ||
| * | ||
| * @remarks | ||
| * The name must consist of lowercase alphanumeric words separated by hyphens, for example `"sample-profile"`. | ||
| * If the `rig.json` file exists, but the `"rigProfile"` is not specified, then the profile | ||
| * name will be `"default"`. | ||
| * | ||
| * Example: `example-profile` | ||
| */ | ||
| readonly rigProfile: string; | ||
| /** | ||
| * The relative path to the rig profile specified by `rig.json`, or `""` if the file was not found. | ||
| * | ||
| * @remarks | ||
| * Example: `profiles/example-profile` | ||
| */ | ||
| readonly relativeProfileFolderPath: string; | ||
| /** | ||
| * Performs Node.js module resolution to locate the rig package folder, then returns the absolute path | ||
| * of the rig profile folder specified by `rig.json`. | ||
| * | ||
| * @remarks | ||
| * If no `rig.json` file was found, then this method throws an error. The first time this method | ||
| * is called, the result is cached and will be returned by all subsequent calls. | ||
| * | ||
| * Example: `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| */ | ||
| getResolvedProfileFolder(): string; | ||
| /** | ||
| * An async variant of {@link IRigConfig.getResolvedProfileFolder} | ||
| */ | ||
| getResolvedProfileFolderAsync(): Promise<string>; | ||
| /** | ||
| * This lookup first checks for the specified relative path under `projectFolderPath`; if it does | ||
| * not exist there, then it checks in the resolved rig profile folder. If the file is found, | ||
| * its absolute path is returned. Otherwise, `undefined` is returned. | ||
| * | ||
| * @remarks | ||
| * For example, suppose the rig profile is: | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| * | ||
| * And suppose `configFileRelativePath` is `folder/file.json`. Then the following locations will be checked: | ||
| * | ||
| * `/path/to/your-project/folder/file.json` | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile/folder/file.json` | ||
| */ | ||
| tryResolveConfigFilePath(configFileRelativePath: string): string | undefined; | ||
| /** | ||
| * An async variant of {@link IRigConfig.tryResolveConfigFilePath} | ||
| */ | ||
| tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined>; | ||
| } | ||
| /** | ||
| * Represents the literal contents of the `config/rig.json` file. | ||
@@ -61,7 +158,7 @@ * | ||
| /** | ||
| * This is the main API for loading the `config/rig.json` file format. | ||
| * {@inheritdoc IRigConfig} | ||
| * | ||
| * @public | ||
| */ | ||
| export declare class RigConfig { | ||
| export declare class RigConfig implements IRigConfig { | ||
| private static readonly _packageNameRegExp; | ||
@@ -84,52 +181,27 @@ private static readonly _rigNameRegExp; | ||
| /** | ||
| * The project folder path that was passed to {@link RigConfig.loadForProjectFolder}, | ||
| * which maybe an absolute or relative path. | ||
| * | ||
| * @remarks | ||
| * Example: `.` | ||
| * {@inheritdoc IRigConfig.projectFolderOriginalPath} | ||
| */ | ||
| readonly projectFolderOriginalPath: string; | ||
| /** | ||
| * The absolute path for the project folder path that was passed to {@link RigConfig.loadForProjectFolder}. | ||
| * | ||
| * @remarks | ||
| * Example: `/path/to/your-project` | ||
| * {@inheritdoc IRigConfig.projectFolderPath} | ||
| */ | ||
| readonly projectFolderPath: string; | ||
| /** | ||
| * Returns `true` if `config/rig.json` was found, or `false` otherwise. | ||
| * {@inheritdoc IRigConfig.rigFound} | ||
| */ | ||
| readonly rigFound: boolean; | ||
| /** | ||
| * The full path to the `rig.json` file that was found, or `""` if none was found. | ||
| * | ||
| * @remarks | ||
| * Example: `/path/to/your-project/config/rig.json` | ||
| * {@inheritdoc IRigConfig.filePath} | ||
| */ | ||
| readonly filePath: string; | ||
| /** | ||
| * The `"rigPackageName"` field from `rig.json`, or `""` if the file was not found. | ||
| * | ||
| * @remarks | ||
| * The name must be a valid NPM package name, and must end with the `-rig` suffix. | ||
| * | ||
| * Example: `example-rig` | ||
| * {@inheritdoc IRigConfig.rigPackageName} | ||
| */ | ||
| readonly rigPackageName: string; | ||
| /** | ||
| * The `"rigProfile"` value that was loaded from `rig.json`, or `""` if the file was not found. | ||
| * | ||
| * @remarks | ||
| * The name must consist of lowercase alphanumeric words separated by hyphens, for example `"sample-profile"`. | ||
| * If the `rig.json` file exists, but the `"rigProfile"` is not specified, then the profile | ||
| * name will be `"default"`. | ||
| * | ||
| * Example: `example-profile` | ||
| * {@inheritdoc IRigConfig.rigProfile} | ||
| */ | ||
| readonly rigProfile: string; | ||
| /** | ||
| * The relative path to the rig profile specified by `rig.json`, or `""` if the file was not found. | ||
| * | ||
| * @remarks | ||
| * Example: `profiles/example-profile` | ||
| * {@inheritdoc IRigConfig.relativeProfileFolderPath} | ||
| */ | ||
@@ -163,35 +235,15 @@ readonly relativeProfileFolderPath: string; | ||
| /** | ||
| * Performs Node.js module resolution to locate the rig package folder, then returns the absolute path | ||
| * of the rig profile folder specified by `rig.json`. | ||
| * | ||
| * @remarks | ||
| * If no `rig.json` file was found, then this method throws an error. The first time this method | ||
| * is called, the result is cached and will be returned by all subsequent calls. | ||
| * | ||
| * Example: `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| * {@inheritdoc IRigConfig.getResolvedProfileFolder} | ||
| */ | ||
| getResolvedProfileFolder(): string; | ||
| /** | ||
| * An async variant of {@link RigConfig.getResolvedProfileFolder} | ||
| * {@inheritdoc IRigConfig.getResolvedProfileFolderAsync} | ||
| */ | ||
| getResolvedProfileFolderAsync(): Promise<string>; | ||
| /** | ||
| * This lookup first checks for the specified relative path under `projectFolderPath`; if it does | ||
| * not exist there, then it checks in the resolved rig profile folder. If the file is found, | ||
| * its absolute path is returned. Otherwise, `undefined` is returned. | ||
| * | ||
| * @remarks | ||
| * For example, suppose the rig profile is: | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| * | ||
| * And suppose `configFileRelativePath` is `folder/file.json`. Then the following locations will be checked: | ||
| * | ||
| * `/path/to/your-project/folder/file.json` | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile/folder/file.json` | ||
| * {@inheritdoc IRigConfig.tryResolveConfigFilePath} | ||
| */ | ||
| tryResolveConfigFilePath(configFileRelativePath: string): string | undefined; | ||
| /** | ||
| * An async variant of {@link RigConfig.tryResolveConfigFilePath} | ||
| * {@inheritdoc IRigConfig.tryResolveConfigFilePathAsync} | ||
| */ | ||
@@ -198,0 +250,0 @@ tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined>; |
+1
-1
@@ -11,3 +11,3 @@ /** | ||
| */ | ||
| export { IRigConfigJson, RigConfig, ILoadForProjectFolderOptions } from './RigConfig'; | ||
| export { type IRigConfigJson, type IRigConfig, RigConfig, type ILoadForProjectFolderOptions } from './RigConfig'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,SAAS,EACT,KAAK,4BAA4B,EAClC,MAAM,aAAa,CAAC"} |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;;GASG;AAEH,yCAAsF;AAA7D,sGAAA,SAAS,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * A system for sharing tool configurations between projects without duplicating config files.\n *\n * @remarks\n * The `config/rig.json` file is a system that Node.js build tools can support, in order to eliminate\n * duplication of config files when many projects share a common configuration. This is particularly valuable\n * in a setup where hundreds of projects may be built using a small set of reusable recipes.\n *\n * @packageDocumentation\n */\n\nexport { IRigConfigJson, RigConfig, ILoadForProjectFolderOptions } from './RigConfig';\n"]} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;;GASG;AAEH,yCAKqB;AAFnB,sGAAA,SAAS,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * A system for sharing tool configurations between projects without duplicating config files.\n *\n * @remarks\n * The `config/rig.json` file is a system that Node.js build tools can support, in order to eliminate\n * duplication of config files when many projects share a common configuration. This is particularly valuable\n * in a setup where hundreds of projects may be built using a small set of reusable recipes.\n *\n * @packageDocumentation\n */\n\nexport {\n type IRigConfigJson,\n type IRigConfig,\n RigConfig,\n type ILoadForProjectFolderOptions\n} from './RigConfig';\n"]} |
+92
-41
@@ -51,20 +51,4 @@ /** | ||
| */ | ||
| export declare class RigConfig { | ||
| private static readonly _packageNameRegExp; | ||
| private static readonly _rigNameRegExp; | ||
| private static readonly _profileNameRegExp; | ||
| export interface IRigConfig { | ||
| /** | ||
| * Returns the absolute path of the `rig.schema.json` JSON schema file for `config/rig.json`, | ||
| * which is bundled with this NPM package. | ||
| * | ||
| * @remarks | ||
| * The `RigConfig` class already performs schema validation when loading `rig.json`; however | ||
| * this schema file may be useful for integration with other validation tools. | ||
| * | ||
| * @public | ||
| */ | ||
| static jsonSchemaPath: string; | ||
| private static _jsonSchemaObject; | ||
| private static readonly _configCache; | ||
| /** | ||
| * The project folder path that was passed to {@link RigConfig.loadForProjectFolder}, | ||
@@ -122,2 +106,89 @@ * which maybe an absolute or relative path. | ||
| readonly relativeProfileFolderPath: string; | ||
| /** | ||
| * Performs Node.js module resolution to locate the rig package folder, then returns the absolute path | ||
| * of the rig profile folder specified by `rig.json`. | ||
| * | ||
| * @remarks | ||
| * If no `rig.json` file was found, then this method throws an error. The first time this method | ||
| * is called, the result is cached and will be returned by all subsequent calls. | ||
| * | ||
| * Example: `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| */ | ||
| getResolvedProfileFolder(): string; | ||
| /** | ||
| * An async variant of {@link IRigConfig.getResolvedProfileFolder} | ||
| */ | ||
| getResolvedProfileFolderAsync(): Promise<string>; | ||
| /** | ||
| * This lookup first checks for the specified relative path under `projectFolderPath`; if it does | ||
| * not exist there, then it checks in the resolved rig profile folder. If the file is found, | ||
| * its absolute path is returned. Otherwise, `undefined` is returned. | ||
| * | ||
| * @remarks | ||
| * For example, suppose the rig profile is: | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| * | ||
| * And suppose `configFileRelativePath` is `folder/file.json`. Then the following locations will be checked: | ||
| * | ||
| * `/path/to/your-project/folder/file.json` | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile/folder/file.json` | ||
| */ | ||
| tryResolveConfigFilePath(configFileRelativePath: string): string | undefined; | ||
| /** | ||
| * An async variant of {@link IRigConfig.tryResolveConfigFilePath} | ||
| */ | ||
| tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined>; | ||
| } | ||
| /** | ||
| * {@inheritdoc IRigConfig} | ||
| * | ||
| * @public | ||
| */ | ||
| export declare class RigConfig implements IRigConfig { | ||
| private static readonly _packageNameRegExp; | ||
| private static readonly _rigNameRegExp; | ||
| private static readonly _profileNameRegExp; | ||
| /** | ||
| * Returns the absolute path of the `rig.schema.json` JSON schema file for `config/rig.json`, | ||
| * which is bundled with this NPM package. | ||
| * | ||
| * @remarks | ||
| * The `RigConfig` class already performs schema validation when loading `rig.json`; however | ||
| * this schema file may be useful for integration with other validation tools. | ||
| * | ||
| * @public | ||
| */ | ||
| static jsonSchemaPath: string; | ||
| private static _jsonSchemaObject; | ||
| private static readonly _configCache; | ||
| /** | ||
| * {@inheritdoc IRigConfig.projectFolderOriginalPath} | ||
| */ | ||
| readonly projectFolderOriginalPath: string; | ||
| /** | ||
| * {@inheritdoc IRigConfig.projectFolderPath} | ||
| */ | ||
| readonly projectFolderPath: string; | ||
| /** | ||
| * {@inheritdoc IRigConfig.rigFound} | ||
| */ | ||
| readonly rigFound: boolean; | ||
| /** | ||
| * {@inheritdoc IRigConfig.filePath} | ||
| */ | ||
| readonly filePath: string; | ||
| /** | ||
| * {@inheritdoc IRigConfig.rigPackageName} | ||
| */ | ||
| readonly rigPackageName: string; | ||
| /** | ||
| * {@inheritdoc IRigConfig.rigProfile} | ||
| */ | ||
| readonly rigProfile: string; | ||
| /** | ||
| * {@inheritdoc IRigConfig.relativeProfileFolderPath} | ||
| */ | ||
| readonly relativeProfileFolderPath: string; | ||
| private _resolvedRigPackageFolder; | ||
@@ -149,35 +220,15 @@ private _resolvedProfileFolder; | ||
| /** | ||
| * Performs Node.js module resolution to locate the rig package folder, then returns the absolute path | ||
| * of the rig profile folder specified by `rig.json`. | ||
| * | ||
| * @remarks | ||
| * If no `rig.json` file was found, then this method throws an error. The first time this method | ||
| * is called, the result is cached and will be returned by all subsequent calls. | ||
| * | ||
| * Example: `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| * {@inheritdoc IRigConfig.getResolvedProfileFolder} | ||
| */ | ||
| getResolvedProfileFolder(): string; | ||
| /** | ||
| * An async variant of {@link RigConfig.getResolvedProfileFolder} | ||
| * {@inheritdoc IRigConfig.getResolvedProfileFolderAsync} | ||
| */ | ||
| getResolvedProfileFolderAsync(): Promise<string>; | ||
| /** | ||
| * This lookup first checks for the specified relative path under `projectFolderPath`; if it does | ||
| * not exist there, then it checks in the resolved rig profile folder. If the file is found, | ||
| * its absolute path is returned. Otherwise, `undefined` is returned. | ||
| * | ||
| * @remarks | ||
| * For example, suppose the rig profile is: | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| * | ||
| * And suppose `configFileRelativePath` is `folder/file.json`. Then the following locations will be checked: | ||
| * | ||
| * `/path/to/your-project/folder/file.json` | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile/folder/file.json` | ||
| * {@inheritdoc IRigConfig.tryResolveConfigFilePath} | ||
| */ | ||
| tryResolveConfigFilePath(configFileRelativePath: string): string | undefined; | ||
| /** | ||
| * An async variant of {@link RigConfig.tryResolveConfigFilePath} | ||
| * {@inheritdoc IRigConfig.tryResolveConfigFilePathAsync} | ||
| */ | ||
@@ -184,0 +235,0 @@ tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined>; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"RigConfig.d.ts","sourceRoot":"","sources":["../src/RigConfig.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;OAOG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE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nD,OAAO;IAkBP;;;;;;;OAOG;IACH,WAAkB,gBAAgB,IAAI,MAAM,CAM3C;IAED;;;;;;OAMG;WACW,oBAAoB,CAAC,OAAO,EAAE,4BAA4B,GAAG,SAAS;IA2CpF;;OAEG;WACiB,yBAAyB,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,SAAS,CAAC;IA0CxG,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAoBjC;;OAEG;IACI,wBAAwB,IAAI,MAAM;IA8BzC;;OAEG;IACU,6BAA6B,IAAI,OAAO,CAAC,MAAM,CAAC;IA8B7D;;OAEG;IACI,wBAAwB,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAkBnF;;OAEG;IACU,6BAA6B,CAAC,sBAAsB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAqBvG,OAAO,CAAC,MAAM,CAAC,eAAe;CAoC/B"} |
+5
-25
@@ -38,3 +38,3 @@ "use strict"; | ||
| /** | ||
| * This is the main API for loading the `config/rig.json` file format. | ||
| * {@inheritdoc IRigConfig} | ||
| * | ||
@@ -166,10 +166,3 @@ * @public | ||
| /** | ||
| * Performs Node.js module resolution to locate the rig package folder, then returns the absolute path | ||
| * of the rig profile folder specified by `rig.json`. | ||
| * | ||
| * @remarks | ||
| * If no `rig.json` file was found, then this method throws an error. The first time this method | ||
| * is called, the result is cached and will be returned by all subsequent calls. | ||
| * | ||
| * Example: `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| * {@inheritdoc IRigConfig.getResolvedProfileFolder} | ||
| */ | ||
@@ -196,3 +189,3 @@ getResolvedProfileFolder() { | ||
| /** | ||
| * An async variant of {@link RigConfig.getResolvedProfileFolder} | ||
| * {@inheritdoc IRigConfig.getResolvedProfileFolderAsync} | ||
| */ | ||
@@ -219,16 +212,3 @@ async getResolvedProfileFolderAsync() { | ||
| /** | ||
| * This lookup first checks for the specified relative path under `projectFolderPath`; if it does | ||
| * not exist there, then it checks in the resolved rig profile folder. If the file is found, | ||
| * its absolute path is returned. Otherwise, `undefined` is returned. | ||
| * | ||
| * @remarks | ||
| * For example, suppose the rig profile is: | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile` | ||
| * | ||
| * And suppose `configFileRelativePath` is `folder/file.json`. Then the following locations will be checked: | ||
| * | ||
| * `/path/to/your-project/folder/file.json` | ||
| * | ||
| * `/path/to/your-project/node_modules/example-rig/profiles/example-profile/folder/file.json` | ||
| * {@inheritdoc IRigConfig.tryResolveConfigFilePath} | ||
| */ | ||
@@ -252,3 +232,3 @@ tryResolveConfigFilePath(configFileRelativePath) { | ||
| /** | ||
| * An async variant of {@link RigConfig.tryResolveConfigFilePath} | ||
| * {@inheritdoc IRigConfig.tryResolveConfigFilePathAsync} | ||
| */ | ||
@@ -255,0 +235,0 @@ async tryResolveConfigFilePathAsync(configFileRelativePath) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"RigConfig.js","sourceRoot":"","sources":["../src/RigConfig.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,uCAAyB;AACzB,qDAAuC;AACvC,8EAAoD;AAEpD,uCAAoC;AA6DpC;;;;GAIG;AACH,MAAa,SAAS;IA8FpB,YAAoB,OAA0B;QAC5C,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC;QAElG,IAAI,CAAC,yBAAyB,GAAG,iBAAiB,CAAC;QACnD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAEzD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAA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CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;YACvD,MAAM,IAAI,KAAK,CACb,2DAA2D,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAC9F,CAAC;SACH;QAED,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE;YACjC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBACvD,MAAM,IAAI,KAAK,CACb,sFAAsF;oBACpF,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAClC,CAAC;aACH;SACF;IACH,CAAC;;AAxZD,8EAA8E;AACtD,4BAAkB,GAAW,4CAA4C,CAAC;AAElG,iDAAiD;AACjD,gEAAgE;AACxC,wBAAc,GAAW,eAAe,CAAC;AAEjE,qEAAqE;AAC7C,4BAAkB,GAAW,iCAAiC,CAAC;AAEvF;;;;;;;;;GASG;AACW,wBAAc,GAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;AAC7E,2BAAiB,GAAuB,SAAS,CAAC;AAEzC,sBAAY,GAA2B,IAAI,GAAG,EAAE,CAAC;AAxB9D,8BAAS","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport * as nodeResolve from 'resolve';\nimport stripJsonComments from 'strip-json-comments';\n\nimport { Helpers } from './Helpers';\n\n/**\n * Represents the literal contents of the `config/rig.json` file.\n *\n * @public\n */\nexport interface IRigConfigJson {\n /**\n * The name of the rig package to use.\n *\n * @remarks\n * The name must be a valid NPM package name, and must end with the `-rig` suffix.\n *\n * Example: `example-rig`\n */\n rigPackageName: string;\n\n /**\n * Specify which rig profile to use from the rig package.\n *\n * @remarks\n * The name must consist of lowercase alphanumeric words separated by hyphens, for example `\"sample-profile\"`.\n * If the `\"rigProfile\"` is not specified, then the profile name `\"default\"` will be used.\n *\n * Example: `example-profile`\n */\n rigProfile?: string;\n}\n\ninterface IRigConfigOptions {\n projectFolderPath: string;\n\n rigFound: boolean;\n filePath: string;\n rigPackageName: string;\n rigProfile?: string;\n}\n\n/**\n * Options for {@link RigConfig.loadForProjectFolder}.\n *\n * @public\n */\nexport interface ILoadForProjectFolderOptions {\n /**\n * The path to the folder of the project to be analyzed. This folder should contain a `package.json` file.\n */\n projectFolderPath: string;\n\n /**\n * If specified, instead of loading the `config/rig.json` from disk, this object will be substituted instead.\n */\n overrideRigJsonObject?: IRigConfigJson;\n\n /**\n * If specified, force a fresh load instead of returning a cached entry, if one existed.\n */\n bypassCache?: boolean;\n}\n\n/**\n * This is the main API for loading the `config/rig.json` file format.\n *\n * @public\n */\nexport class RigConfig {\n // For syntax details, see PackageNameParser from @rushstack/node-core-library\n private static readonly _packageNameRegExp: RegExp = /^(@[A-Za-z0-9\\-_\\.]+\\/)?[A-Za-z0-9\\-_\\.]+$/;\n\n // Rig package names must have the \"-rig\" suffix.\n // Also silently accept \"-rig-test\" for our build test projects.\n private static readonly _rigNameRegExp: RegExp = /-rig(-test)?$/;\n\n // Profiles must be lowercase alphanumeric words separated by hyphens\n private static readonly _profileNameRegExp: RegExp = /^[a-z0-9_\\.]+(\\-[a-z0-9_\\.]+)*$/;\n\n /**\n * Returns the absolute path of the `rig.schema.json` JSON schema file for `config/rig.json`,\n * which is bundled with this NPM package.\n *\n * @remarks\n * The `RigConfig` class already performs schema validation when loading `rig.json`; however\n * this schema file may be useful for integration with other validation tools.\n *\n * @public\n */\n public static jsonSchemaPath: string = path.resolve(__dirname, './schemas/rig.schema.json');\n private static _jsonSchemaObject: object | undefined = undefined;\n\n private static readonly _configCache: Map<string, RigConfig> = new Map();\n\n /**\n * The project folder path that was passed to {@link RigConfig.loadForProjectFolder},\n * which maybe an absolute or relative path.\n *\n * @remarks\n * Example: `.`\n */\n public readonly projectFolderOriginalPath: string;\n\n /**\n * The absolute path for the project folder path that was passed to {@link RigConfig.loadForProjectFolder}.\n *\n * @remarks\n * Example: `/path/to/your-project`\n */\n public readonly projectFolderPath: string;\n\n /**\n * Returns `true` if `config/rig.json` was found, or `false` otherwise.\n */\n public readonly rigFound: boolean;\n\n /**\n * The full path to the `rig.json` file that was found, or `\"\"` if none was found.\n *\n * @remarks\n * Example: `/path/to/your-project/config/rig.json`\n */\n public readonly filePath: string;\n\n /**\n * The `\"rigPackageName\"` field from `rig.json`, or `\"\"` if the file was not found.\n *\n * @remarks\n * The name must be a valid NPM package name, and must end with the `-rig` suffix.\n *\n * Example: `example-rig`\n */\n public readonly rigPackageName: string;\n\n /**\n * The `\"rigProfile\"` value that was loaded from `rig.json`, or `\"\"` if the file was not found.\n *\n * @remarks\n * The name must consist of lowercase alphanumeric words separated by hyphens, for example `\"sample-profile\"`.\n * If the `rig.json` file exists, but the `\"rigProfile\"` is not specified, then the profile\n * name will be `\"default\"`.\n *\n * Example: `example-profile`\n */\n public readonly rigProfile: string;\n\n /**\n * The relative path to the rig profile specified by `rig.json`, or `\"\"` if the file was not found.\n *\n * @remarks\n * Example: `profiles/example-profile`\n */\n public readonly relativeProfileFolderPath: string;\n\n // Example: /path/to/your-project/node_modules/example-rig/\n // If the value is `undefined`, then getResolvedProfileFolder() has not calculated it yet\n private _resolvedRigPackageFolder: string | undefined;\n\n // Example: /path/to/your-project/node_modules/example-rig/profiles/example-profile\n // If the value is `undefined`, then getResolvedProfileFolder() has not calculated it yet\n private _resolvedProfileFolder: string | undefined;\n\n private constructor(options: IRigConfigOptions) {\n const { projectFolderPath, rigFound, filePath, rigPackageName, rigProfile = 'default' } = options;\n\n this.projectFolderOriginalPath = projectFolderPath;\n this.projectFolderPath = path.resolve(projectFolderPath);\n\n this.rigFound = rigFound;\n this.filePath = filePath;\n this.rigPackageName = rigPackageName;\n this.rigProfile = rigProfile;\n\n if (this.rigFound) {\n this.relativeProfileFolderPath = 'profiles/' + this.rigProfile;\n } else {\n this.relativeProfileFolderPath = '';\n }\n }\n\n /**\n * The JSON contents of the {@link RigConfig.jsonSchemaPath} file.\n *\n * @remarks\n * The JSON object will be lazily loaded when this property getter is accessed, and the result\n * will be cached.\n * Accessing this property may make a synchronous filesystem call.\n */\n public static get jsonSchemaObject(): object {\n if (RigConfig._jsonSchemaObject === undefined) {\n const jsonSchemaContent: string = fs.readFileSync(RigConfig.jsonSchemaPath).toString();\n RigConfig._jsonSchemaObject = JSON.parse(jsonSchemaContent);\n }\n return RigConfig._jsonSchemaObject!;\n }\n\n /**\n * Use this method to load the `config/rig.json` file for a given project.\n *\n * @remarks\n * If the file cannot be found, an empty `RigConfig` object will be returned with {@link RigConfig.rigFound}\n * equal to `false`.\n */\n public static loadForProjectFolder(options: ILoadForProjectFolderOptions): RigConfig {\n const { overrideRigJsonObject, projectFolderPath } = options;\n\n const fromCache: RigConfig | undefined =\n !options.bypassCache && !overrideRigJsonObject\n ? RigConfig._configCache.get(projectFolderPath)\n : undefined;\n\n if (fromCache) {\n return fromCache;\n }\n\n const rigConfigFilePath: string = path.join(projectFolderPath, 'config/rig.json');\n\n let config: RigConfig | undefined;\n let json: IRigConfigJson | undefined = overrideRigJsonObject;\n try {\n if (!json) {\n const rigConfigFileContent: string = fs.readFileSync(rigConfigFilePath).toString();\n json = JSON.parse(stripJsonComments(rigConfigFileContent)) as IRigConfigJson;\n }\n RigConfig._validateSchema(json);\n } catch (error) {\n config = RigConfig._handleConfigError(error as Error, projectFolderPath, rigConfigFilePath);\n }\n\n if (!config) {\n config = new RigConfig({\n projectFolderPath: projectFolderPath,\n\n rigFound: true,\n filePath: rigConfigFilePath,\n rigPackageName: json!.rigPackageName,\n rigProfile: json!.rigProfile\n });\n }\n\n if (!overrideRigJsonObject) {\n RigConfig._configCache.set(projectFolderPath, config);\n }\n return config;\n }\n\n /**\n * An async variant of {@link RigConfig.loadForProjectFolder}\n */\n public static async loadForProjectFolderAsync(options: ILoadForProjectFolderOptions): Promise<RigConfig> {\n const { overrideRigJsonObject, projectFolderPath } = options;\n\n const fromCache: RigConfig | false | undefined =\n !options.bypassCache && !overrideRigJsonObject && RigConfig._configCache.get(projectFolderPath);\n\n if (fromCache) {\n return fromCache;\n }\n\n const rigConfigFilePath: string = path.join(projectFolderPath, 'config/rig.json');\n\n let config: RigConfig | undefined;\n let json: IRigConfigJson | undefined = overrideRigJsonObject;\n try {\n if (!json) {\n const rigConfigFileContent: string = (await fs.promises.readFile(rigConfigFilePath)).toString();\n json = JSON.parse(stripJsonComments(rigConfigFileContent)) as IRigConfigJson;\n }\n\n RigConfig._validateSchema(json);\n } catch (error) {\n config = RigConfig._handleConfigError(error as Error, projectFolderPath, rigConfigFilePath);\n }\n\n if (!config) {\n config = new RigConfig({\n projectFolderPath: projectFolderPath,\n\n rigFound: true,\n filePath: rigConfigFilePath,\n rigPackageName: json!.rigPackageName,\n rigProfile: json!.rigProfile\n });\n }\n\n if (!overrideRigJsonObject) {\n RigConfig._configCache.set(projectFolderPath, config);\n }\n return config;\n }\n\n private static _handleConfigError(\n error: NodeJS.ErrnoException,\n projectFolderPath: string,\n rigConfigFilePath: string\n ): RigConfig {\n if (error.code !== 'ENOENT' && error.code !== 'ENOTDIR') {\n throw new Error(error.message + '\\nError loading config file: ' + rigConfigFilePath);\n }\n\n // File not found, i.e. no rig config\n return new RigConfig({\n projectFolderPath,\n\n rigFound: false,\n filePath: '',\n rigPackageName: '',\n rigProfile: ''\n });\n }\n\n /**\n * Performs Node.js module resolution to locate the rig package folder, then returns the absolute path\n * of the rig profile folder specified by `rig.json`.\n *\n * @remarks\n * If no `rig.json` file was found, then this method throws an error. The first time this method\n * is called, the result is cached and will be returned by all subsequent calls.\n *\n * Example: `/path/to/your-project/node_modules/example-rig/profiles/example-profile`\n */\n public getResolvedProfileFolder(): string {\n if (this._resolvedRigPackageFolder === undefined) {\n if (!this.rigFound) {\n throw new Error('Cannot resolve the rig package because no rig was specified for this project');\n }\n\n const rigPackageJsonModuleSpecifier: string = `${this.rigPackageName}/package.json`;\n const resolveOptions: nodeResolve.Opts = { basedir: this.projectFolderPath };\n const resolvedRigPackageJsonPath: string = nodeResolve.sync(\n rigPackageJsonModuleSpecifier,\n resolveOptions\n );\n\n this._resolvedRigPackageFolder = path.dirname(resolvedRigPackageJsonPath);\n }\n\n if (this._resolvedProfileFolder === undefined) {\n this._resolvedProfileFolder = path.join(this._resolvedRigPackageFolder, this.relativeProfileFolderPath);\n\n if (!fs.existsSync(this._resolvedProfileFolder)) {\n throw new Error(\n `The rig profile \"${this.rigProfile}\" is not defined` +\n ` by the rig package \"${this.rigPackageName}\"`\n );\n }\n }\n\n return this._resolvedProfileFolder;\n }\n\n /**\n * An async variant of {@link RigConfig.getResolvedProfileFolder}\n */\n public async getResolvedProfileFolderAsync(): Promise<string> {\n if (this._resolvedRigPackageFolder === undefined) {\n if (!this.rigFound) {\n throw new Error('Cannot resolve the rig package because no rig was specified for this project');\n }\n\n const rigPackageJsonModuleSpecifier: string = `${this.rigPackageName}/package.json`;\n const resolveOptions: nodeResolve.Opts = { basedir: this.projectFolderPath };\n const resolvedRigPackageJsonPath: string = await Helpers.nodeResolveAsync(\n rigPackageJsonModuleSpecifier,\n resolveOptions\n );\n\n this._resolvedRigPackageFolder = path.dirname(resolvedRigPackageJsonPath);\n }\n\n if (this._resolvedProfileFolder === undefined) {\n this._resolvedProfileFolder = path.join(this._resolvedRigPackageFolder, this.relativeProfileFolderPath);\n\n if (!(await Helpers.fsExistsAsync(this._resolvedProfileFolder))) {\n throw new Error(\n `The rig profile \"${this.rigProfile}\" is not defined` +\n ` by the rig package \"${this.rigPackageName}\"`\n );\n }\n }\n\n return this._resolvedProfileFolder;\n }\n\n /**\n * This lookup first checks for the specified relative path under `projectFolderPath`; if it does\n * not exist there, then it checks in the resolved rig profile folder. If the file is found,\n * its absolute path is returned. Otherwise, `undefined` is returned.\n *\n * @remarks\n * For example, suppose the rig profile is:\n *\n * `/path/to/your-project/node_modules/example-rig/profiles/example-profile`\n *\n * And suppose `configFileRelativePath` is `folder/file.json`. Then the following locations will be checked:\n *\n * `/path/to/your-project/folder/file.json`\n *\n * `/path/to/your-project/node_modules/example-rig/profiles/example-profile/folder/file.json`\n */\n public tryResolveConfigFilePath(configFileRelativePath: string): string | undefined {\n if (!Helpers.isDownwardRelative(configFileRelativePath)) {\n throw new Error('The configFileRelativePath is not a relative path: ' + configFileRelativePath);\n }\n\n const localPath: string = path.join(this.projectFolderPath, configFileRelativePath);\n if (fs.existsSync(localPath)) {\n return localPath;\n }\n if (this.rigFound) {\n const riggedPath: string = path.join(this.getResolvedProfileFolder(), configFileRelativePath);\n if (fs.existsSync(riggedPath)) {\n return riggedPath;\n }\n }\n return undefined;\n }\n\n /**\n * An async variant of {@link RigConfig.tryResolveConfigFilePath}\n */\n public async tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined> {\n if (!Helpers.isDownwardRelative(configFileRelativePath)) {\n throw new Error('The configFileRelativePath is not a relative path: ' + configFileRelativePath);\n }\n\n const localPath: string = path.join(this.projectFolderPath, configFileRelativePath);\n if (await Helpers.fsExistsAsync(localPath)) {\n return localPath;\n }\n if (this.rigFound) {\n const riggedPath: string = path.join(\n await this.getResolvedProfileFolderAsync(),\n configFileRelativePath\n );\n if (await Helpers.fsExistsAsync(riggedPath)) {\n return riggedPath;\n }\n }\n return undefined;\n }\n\n private static _validateSchema(json: IRigConfigJson): void {\n for (const key of Object.getOwnPropertyNames(json)) {\n switch (key) {\n case '$schema':\n case 'rigPackageName':\n case 'rigProfile':\n break;\n default:\n throw new Error(`Unsupported field ${JSON.stringify(key)}`);\n }\n }\n if (!json.rigPackageName) {\n throw new Error('Missing required field \"rigPackageName\"');\n }\n\n if (!RigConfig._packageNameRegExp.test(json.rigPackageName)) {\n throw new Error(\n `The \"rigPackageName\" value is not a valid NPM package name: ${JSON.stringify(json.rigPackageName)}`\n );\n }\n\n if (!RigConfig._rigNameRegExp.test(json.rigPackageName)) {\n throw new Error(\n `The \"rigPackageName\" value is missing the \"-rig\" suffix: ` + JSON.stringify(json.rigProfile)\n );\n }\n\n if (json.rigProfile !== undefined) {\n if (!RigConfig._profileNameRegExp.test(json.rigProfile)) {\n throw new Error(\n `The profile name must consist of lowercase alphanumeric words separated by hyphens: ` +\n JSON.stringify(json.rigProfile)\n );\n }\n }\n }\n}\n"]} | ||
| {"version":3,"file":"RigConfig.js","sourceRoot":"","sources":["../src/RigConfig.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,uCAAyB;AACzB,qDAAuC;AACvC,8EAAoD;AAEpD,uCAAoC;AAwKpC;;;;GAIG;AACH,MAAa,SAAS;IAqEpB,YAAoB,OAA0B;QAC5C,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC;QAElG,IAAI,CAAC,yBAAyB,GAAG,iBAAiB,CAAC;QACnD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAEzD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,yBAAyB,GAAG,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;SAChE;aAAM;YACL,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC;SACrC;IACH,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,KAAK,gBAAgB;QAChC,IAAI,SAAS,CAAC,iBAAiB,KAAK,SAAS,EAAE;YAC7C,MAAM,iBAAiB,GAAW,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,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,GAAW,4CAA4C,CAAC;AAElG,iDAAiD;AACjD,gEAAgE;AACxC,wBAAc,GAAW,eAAe,CAAC;AAEjE,qEAAqE;AAC7C,4BAAkB,GAAW,iCAAiC,CAAC;AAEvF;;;;;;;;;GASG;AACW,wBAAc,GAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;AAC7E,2BAAiB,GAAuB,SAAS,CAAC;AAEzC,sBAAY,GAA2B,IAAI,GAAG,EAAE,CAAC;AAxB9D,8BAAS","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport * as nodeResolve from 'resolve';\nimport stripJsonComments from 'strip-json-comments';\n\nimport { Helpers } from './Helpers';\n\n/**\n * Represents the literal contents of the `config/rig.json` file.\n *\n * @public\n */\nexport interface IRigConfigJson {\n /**\n * The name of the rig package to use.\n *\n * @remarks\n * The name must be a valid NPM package name, and must end with the `-rig` suffix.\n *\n * Example: `example-rig`\n */\n rigPackageName: string;\n\n /**\n * Specify which rig profile to use from the rig package.\n *\n * @remarks\n * The name must consist of lowercase alphanumeric words separated by hyphens, for example `\"sample-profile\"`.\n * If the `\"rigProfile\"` is not specified, then the profile name `\"default\"` will be used.\n *\n * Example: `example-profile`\n */\n rigProfile?: string;\n}\n\ninterface IRigConfigOptions {\n projectFolderPath: string;\n\n rigFound: boolean;\n filePath: string;\n rigPackageName: string;\n rigProfile?: string;\n}\n\n/**\n * Options for {@link RigConfig.loadForProjectFolder}.\n *\n * @public\n */\nexport interface ILoadForProjectFolderOptions {\n /**\n * The path to the folder of the project to be analyzed. This folder should contain a `package.json` file.\n */\n projectFolderPath: string;\n\n /**\n * If specified, instead of loading the `config/rig.json` from disk, this object will be substituted instead.\n */\n overrideRigJsonObject?: IRigConfigJson;\n\n /**\n * If specified, force a fresh load instead of returning a cached entry, if one existed.\n */\n bypassCache?: boolean;\n}\n\n/**\n * This is the main API for loading the `config/rig.json` file format.\n *\n * @public\n */\nexport interface IRigConfig {\n /**\n * The project folder path that was passed to {@link RigConfig.loadForProjectFolder},\n * which maybe an absolute or relative path.\n *\n * @remarks\n * Example: `.`\n */\n readonly projectFolderOriginalPath: string;\n\n /**\n * The absolute path for the project folder path that was passed to {@link RigConfig.loadForProjectFolder}.\n *\n * @remarks\n * Example: `/path/to/your-project`\n */\n readonly projectFolderPath: string;\n\n /**\n * Returns `true` if `config/rig.json` was found, or `false` otherwise.\n */\n readonly rigFound: boolean;\n\n /**\n * The full path to the `rig.json` file that was found, or `\"\"` if none was found.\n *\n * @remarks\n * Example: `/path/to/your-project/config/rig.json`\n */\n readonly filePath: string;\n\n /**\n * The `\"rigPackageName\"` field from `rig.json`, or `\"\"` if the file was not found.\n *\n * @remarks\n * The name must be a valid NPM package name, and must end with the `-rig` suffix.\n *\n * Example: `example-rig`\n */\n readonly rigPackageName: string;\n\n /**\n * The `\"rigProfile\"` value that was loaded from `rig.json`, or `\"\"` if the file was not found.\n *\n * @remarks\n * The name must consist of lowercase alphanumeric words separated by hyphens, for example `\"sample-profile\"`.\n * If the `rig.json` file exists, but the `\"rigProfile\"` is not specified, then the profile\n * name will be `\"default\"`.\n *\n * Example: `example-profile`\n */\n readonly rigProfile: string;\n\n /**\n * The relative path to the rig profile specified by `rig.json`, or `\"\"` if the file was not found.\n *\n * @remarks\n * Example: `profiles/example-profile`\n */\n readonly relativeProfileFolderPath: string;\n\n /**\n * Performs Node.js module resolution to locate the rig package folder, then returns the absolute path\n * of the rig profile folder specified by `rig.json`.\n *\n * @remarks\n * If no `rig.json` file was found, then this method throws an error. The first time this method\n * is called, the result is cached and will be returned by all subsequent calls.\n *\n * Example: `/path/to/your-project/node_modules/example-rig/profiles/example-profile`\n */\n getResolvedProfileFolder(): string;\n\n /**\n * An async variant of {@link IRigConfig.getResolvedProfileFolder}\n */\n getResolvedProfileFolderAsync(): Promise<string>;\n\n /**\n * This lookup first checks for the specified relative path under `projectFolderPath`; if it does\n * not exist there, then it checks in the resolved rig profile folder. If the file is found,\n * its absolute path is returned. Otherwise, `undefined` is returned.\n *\n * @remarks\n * For example, suppose the rig profile is:\n *\n * `/path/to/your-project/node_modules/example-rig/profiles/example-profile`\n *\n * And suppose `configFileRelativePath` is `folder/file.json`. Then the following locations will be checked:\n *\n * `/path/to/your-project/folder/file.json`\n *\n * `/path/to/your-project/node_modules/example-rig/profiles/example-profile/folder/file.json`\n */\n tryResolveConfigFilePath(configFileRelativePath: string): string | undefined;\n\n /**\n * An async variant of {@link IRigConfig.tryResolveConfigFilePath}\n */\n tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined>;\n}\n\n/**\n * {@inheritdoc IRigConfig}\n *\n * @public\n */\nexport class RigConfig implements IRigConfig {\n // For syntax details, see PackageNameParser from @rushstack/node-core-library\n private static readonly _packageNameRegExp: RegExp = /^(@[A-Za-z0-9\\-_\\.]+\\/)?[A-Za-z0-9\\-_\\.]+$/;\n\n // Rig package names must have the \"-rig\" suffix.\n // Also silently accept \"-rig-test\" for our build test projects.\n private static readonly _rigNameRegExp: RegExp = /-rig(-test)?$/;\n\n // Profiles must be lowercase alphanumeric words separated by hyphens\n private static readonly _profileNameRegExp: RegExp = /^[a-z0-9_\\.]+(\\-[a-z0-9_\\.]+)*$/;\n\n /**\n * Returns the absolute path of the `rig.schema.json` JSON schema file for `config/rig.json`,\n * which is bundled with this NPM package.\n *\n * @remarks\n * The `RigConfig` class already performs schema validation when loading `rig.json`; however\n * this schema file may be useful for integration with other validation tools.\n *\n * @public\n */\n public static jsonSchemaPath: string = path.resolve(__dirname, './schemas/rig.schema.json');\n private static _jsonSchemaObject: object | undefined = undefined;\n\n private static readonly _configCache: Map<string, RigConfig> = new Map();\n\n /**\n * {@inheritdoc IRigConfig.projectFolderOriginalPath}\n */\n public readonly projectFolderOriginalPath: string;\n\n /**\n * {@inheritdoc IRigConfig.projectFolderPath}\n */\n public readonly projectFolderPath: string;\n\n /**\n * {@inheritdoc IRigConfig.rigFound}\n */\n public readonly rigFound: boolean;\n\n /**\n * {@inheritdoc IRigConfig.filePath}\n */\n public readonly filePath: string;\n\n /**\n * {@inheritdoc IRigConfig.rigPackageName}\n */\n public readonly rigPackageName: string;\n\n /**\n * {@inheritdoc IRigConfig.rigProfile}\n */\n public readonly rigProfile: string;\n\n /**\n * {@inheritdoc IRigConfig.relativeProfileFolderPath}\n */\n public readonly relativeProfileFolderPath: string;\n\n // Example: /path/to/your-project/node_modules/example-rig/\n // If the value is `undefined`, then getResolvedProfileFolder() has not calculated it yet\n private _resolvedRigPackageFolder: string | undefined;\n\n // Example: /path/to/your-project/node_modules/example-rig/profiles/example-profile\n // If the value is `undefined`, then getResolvedProfileFolder() has not calculated it yet\n private _resolvedProfileFolder: string | undefined;\n\n private constructor(options: IRigConfigOptions) {\n const { projectFolderPath, rigFound, filePath, rigPackageName, rigProfile = 'default' } = options;\n\n this.projectFolderOriginalPath = projectFolderPath;\n this.projectFolderPath = path.resolve(projectFolderPath);\n\n this.rigFound = rigFound;\n this.filePath = filePath;\n this.rigPackageName = rigPackageName;\n this.rigProfile = rigProfile;\n\n if (this.rigFound) {\n this.relativeProfileFolderPath = 'profiles/' + this.rigProfile;\n } else {\n this.relativeProfileFolderPath = '';\n }\n }\n\n /**\n * The JSON contents of the {@link RigConfig.jsonSchemaPath} file.\n *\n * @remarks\n * The JSON object will be lazily loaded when this property getter is accessed, and the result\n * will be cached.\n * Accessing this property may make a synchronous filesystem call.\n */\n public static get jsonSchemaObject(): object {\n if (RigConfig._jsonSchemaObject === undefined) {\n const jsonSchemaContent: string = fs.readFileSync(RigConfig.jsonSchemaPath).toString();\n RigConfig._jsonSchemaObject = JSON.parse(jsonSchemaContent);\n }\n return RigConfig._jsonSchemaObject!;\n }\n\n /**\n * Use this method to load the `config/rig.json` file for a given project.\n *\n * @remarks\n * If the file cannot be found, an empty `RigConfig` object will be returned with {@link RigConfig.rigFound}\n * equal to `false`.\n */\n public static loadForProjectFolder(options: ILoadForProjectFolderOptions): RigConfig {\n const { overrideRigJsonObject, projectFolderPath } = options;\n\n const fromCache: RigConfig | undefined =\n !options.bypassCache && !overrideRigJsonObject\n ? RigConfig._configCache.get(projectFolderPath)\n : undefined;\n\n if (fromCache) {\n return fromCache;\n }\n\n const rigConfigFilePath: string = path.join(projectFolderPath, 'config/rig.json');\n\n let config: RigConfig | undefined;\n let json: IRigConfigJson | undefined = overrideRigJsonObject;\n try {\n if (!json) {\n const rigConfigFileContent: string = fs.readFileSync(rigConfigFilePath).toString();\n json = JSON.parse(stripJsonComments(rigConfigFileContent)) as IRigConfigJson;\n }\n RigConfig._validateSchema(json);\n } catch (error) {\n config = RigConfig._handleConfigError(error as Error, projectFolderPath, rigConfigFilePath);\n }\n\n if (!config) {\n config = new RigConfig({\n projectFolderPath: projectFolderPath,\n\n rigFound: true,\n filePath: rigConfigFilePath,\n rigPackageName: json!.rigPackageName,\n rigProfile: json!.rigProfile\n });\n }\n\n if (!overrideRigJsonObject) {\n RigConfig._configCache.set(projectFolderPath, config);\n }\n return config;\n }\n\n /**\n * An async variant of {@link RigConfig.loadForProjectFolder}\n */\n public static async loadForProjectFolderAsync(options: ILoadForProjectFolderOptions): Promise<RigConfig> {\n const { overrideRigJsonObject, projectFolderPath } = options;\n\n const fromCache: RigConfig | false | undefined =\n !options.bypassCache && !overrideRigJsonObject && RigConfig._configCache.get(projectFolderPath);\n\n if (fromCache) {\n return fromCache;\n }\n\n const rigConfigFilePath: string = path.join(projectFolderPath, 'config/rig.json');\n\n let config: RigConfig | undefined;\n let json: IRigConfigJson | undefined = overrideRigJsonObject;\n try {\n if (!json) {\n const rigConfigFileContent: string = (await fs.promises.readFile(rigConfigFilePath)).toString();\n json = JSON.parse(stripJsonComments(rigConfigFileContent)) as IRigConfigJson;\n }\n\n RigConfig._validateSchema(json);\n } catch (error) {\n config = RigConfig._handleConfigError(error as Error, projectFolderPath, rigConfigFilePath);\n }\n\n if (!config) {\n config = new RigConfig({\n projectFolderPath: projectFolderPath,\n\n rigFound: true,\n filePath: rigConfigFilePath,\n rigPackageName: json!.rigPackageName,\n rigProfile: json!.rigProfile\n });\n }\n\n if (!overrideRigJsonObject) {\n RigConfig._configCache.set(projectFolderPath, config);\n }\n return config;\n }\n\n private static _handleConfigError(\n error: NodeJS.ErrnoException,\n projectFolderPath: string,\n rigConfigFilePath: string\n ): RigConfig {\n if (error.code !== 'ENOENT' && error.code !== 'ENOTDIR') {\n throw new Error(error.message + '\\nError loading config file: ' + rigConfigFilePath);\n }\n\n // File not found, i.e. no rig config\n return new RigConfig({\n projectFolderPath,\n\n rigFound: false,\n filePath: '',\n rigPackageName: '',\n rigProfile: ''\n });\n }\n\n /**\n * {@inheritdoc IRigConfig.getResolvedProfileFolder}\n */\n public getResolvedProfileFolder(): string {\n if (this._resolvedRigPackageFolder === undefined) {\n if (!this.rigFound) {\n throw new Error('Cannot resolve the rig package because no rig was specified for this project');\n }\n\n const rigPackageJsonModuleSpecifier: string = `${this.rigPackageName}/package.json`;\n const resolveOptions: nodeResolve.Opts = { basedir: this.projectFolderPath };\n const resolvedRigPackageJsonPath: string = nodeResolve.sync(\n rigPackageJsonModuleSpecifier,\n resolveOptions\n );\n\n this._resolvedRigPackageFolder = path.dirname(resolvedRigPackageJsonPath);\n }\n\n if (this._resolvedProfileFolder === undefined) {\n this._resolvedProfileFolder = path.join(this._resolvedRigPackageFolder, this.relativeProfileFolderPath);\n\n if (!fs.existsSync(this._resolvedProfileFolder)) {\n throw new Error(\n `The rig profile \"${this.rigProfile}\" is not defined` +\n ` by the rig package \"${this.rigPackageName}\"`\n );\n }\n }\n\n return this._resolvedProfileFolder;\n }\n\n /**\n * {@inheritdoc IRigConfig.getResolvedProfileFolderAsync}\n */\n public async getResolvedProfileFolderAsync(): Promise<string> {\n if (this._resolvedRigPackageFolder === undefined) {\n if (!this.rigFound) {\n throw new Error('Cannot resolve the rig package because no rig was specified for this project');\n }\n\n const rigPackageJsonModuleSpecifier: string = `${this.rigPackageName}/package.json`;\n const resolveOptions: nodeResolve.Opts = { basedir: this.projectFolderPath };\n const resolvedRigPackageJsonPath: string = await Helpers.nodeResolveAsync(\n rigPackageJsonModuleSpecifier,\n resolveOptions\n );\n\n this._resolvedRigPackageFolder = path.dirname(resolvedRigPackageJsonPath);\n }\n\n if (this._resolvedProfileFolder === undefined) {\n this._resolvedProfileFolder = path.join(this._resolvedRigPackageFolder, this.relativeProfileFolderPath);\n\n if (!(await Helpers.fsExistsAsync(this._resolvedProfileFolder))) {\n throw new Error(\n `The rig profile \"${this.rigProfile}\" is not defined` +\n ` by the rig package \"${this.rigPackageName}\"`\n );\n }\n }\n\n return this._resolvedProfileFolder;\n }\n\n /**\n * {@inheritdoc IRigConfig.tryResolveConfigFilePath}\n */\n public tryResolveConfigFilePath(configFileRelativePath: string): string | undefined {\n if (!Helpers.isDownwardRelative(configFileRelativePath)) {\n throw new Error('The configFileRelativePath is not a relative path: ' + configFileRelativePath);\n }\n\n const localPath: string = path.join(this.projectFolderPath, configFileRelativePath);\n if (fs.existsSync(localPath)) {\n return localPath;\n }\n if (this.rigFound) {\n const riggedPath: string = path.join(this.getResolvedProfileFolder(), configFileRelativePath);\n if (fs.existsSync(riggedPath)) {\n return riggedPath;\n }\n }\n return undefined;\n }\n\n /**\n * {@inheritdoc IRigConfig.tryResolveConfigFilePathAsync}\n */\n public async tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined> {\n if (!Helpers.isDownwardRelative(configFileRelativePath)) {\n throw new Error('The configFileRelativePath is not a relative path: ' + configFileRelativePath);\n }\n\n const localPath: string = path.join(this.projectFolderPath, configFileRelativePath);\n if (await Helpers.fsExistsAsync(localPath)) {\n return localPath;\n }\n if (this.rigFound) {\n const riggedPath: string = path.join(\n await this.getResolvedProfileFolderAsync(),\n configFileRelativePath\n );\n if (await Helpers.fsExistsAsync(riggedPath)) {\n return riggedPath;\n }\n }\n return undefined;\n }\n\n private static _validateSchema(json: IRigConfigJson): void {\n for (const key of Object.getOwnPropertyNames(json)) {\n switch (key) {\n case '$schema':\n case 'rigPackageName':\n case 'rigProfile':\n break;\n default:\n throw new Error(`Unsupported field ${JSON.stringify(key)}`);\n }\n }\n if (!json.rigPackageName) {\n throw new Error('Missing required field \"rigPackageName\"');\n }\n\n if (!RigConfig._packageNameRegExp.test(json.rigPackageName)) {\n throw new Error(\n `The \"rigPackageName\" value is not a valid NPM package name: ${JSON.stringify(json.rigPackageName)}`\n );\n }\n\n if (!RigConfig._rigNameRegExp.test(json.rigPackageName)) {\n throw new Error(\n `The \"rigPackageName\" value is missing the \"-rig\" suffix: ` + JSON.stringify(json.rigProfile)\n );\n }\n\n if (json.rigProfile !== undefined) {\n if (!RigConfig._profileNameRegExp.test(json.rigProfile)) {\n throw new Error(\n `The profile name must consist of lowercase alphanumeric words separated by hyphens: ` +\n JSON.stringify(json.rigProfile)\n );\n }\n }\n }\n}\n"]} |
+1
-1
| { | ||
| "name": "@rushstack/rig-package", | ||
| "version": "0.3.21", | ||
| "version": "0.4.0", | ||
| "description": "A system for sharing tool configurations between projects without duplicating config files.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
77810
5.16%913
9.87%