init
This commit is contained in:
10
node_modules/@rushstack/rig-package/lib/Helpers.d.ts
generated
vendored
Normal file
10
node_modules/@rushstack/rig-package/lib/Helpers.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
import nodeResolve from 'resolve';
|
||||
export declare class Helpers {
|
||||
private static _upwardPathSegmentRegex;
|
||||
static nodeResolveAsync(id: string, opts: nodeResolve.AsyncOpts): Promise<string>;
|
||||
static fsExistsAsync(filesystemPath: fs.PathLike): Promise<boolean>;
|
||||
static isDownwardRelative(inputPath: string): boolean;
|
||||
}
|
||||
//# sourceMappingURL=Helpers.d.ts.map
|
1
node_modules/@rushstack/rig-package/lib/Helpers.d.ts.map
generated
vendored
Normal file
1
node_modules/@rushstack/rig-package/lib/Helpers.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Helpers.d.ts","sourceRoot":"","sources":["../src/Helpers.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,WAAW,MAAM,SAAS,CAAC;AAGlC,qBAAa,OAAO;IAElB,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAsC;WAExD,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;WAY1E,aAAa,CAAC,cAAc,EAAE,EAAE,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;WASlE,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;CAU7D"}
|
71
node_modules/@rushstack/rig-package/lib/Helpers.js
generated
vendored
Normal file
71
node_modules/@rushstack/rig-package/lib/Helpers.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Helpers = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const resolve_1 = __importDefault(require("resolve"));
|
||||
// These helpers avoid taking dependencies on other NPM packages
|
||||
class Helpers {
|
||||
static async nodeResolveAsync(id, opts) {
|
||||
return await new Promise((resolve, reject) => {
|
||||
(0, resolve_1.default)(id, opts, (error, result) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
static async fsExistsAsync(filesystemPath) {
|
||||
return await new Promise((resolve) => {
|
||||
fs.exists(filesystemPath, (exists) => {
|
||||
resolve(exists);
|
||||
});
|
||||
});
|
||||
}
|
||||
// Based on Path.isDownwardRelative() from @rushstack/node-core-library
|
||||
static isDownwardRelative(inputPath) {
|
||||
if (path.isAbsolute(inputPath)) {
|
||||
return false;
|
||||
}
|
||||
// Does it contain ".."
|
||||
if (Helpers._upwardPathSegmentRegex.test(inputPath)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Based on Path.isDownwardRelative() from @rushstack/node-core-library
|
||||
Helpers._upwardPathSegmentRegex = /([\/\\]|^)\.\.([\/\\]|$)/;
|
||||
exports.Helpers = Helpers;
|
||||
//# sourceMappingURL=Helpers.js.map
|
1
node_modules/@rushstack/rig-package/lib/Helpers.js.map
generated
vendored
Normal file
1
node_modules/@rushstack/rig-package/lib/Helpers.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Helpers.js","sourceRoot":"","sources":["../src/Helpers.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,uCAAyB;AACzB,sDAAkC;AAElC,gEAAgE;AAChE,MAAa,OAAO;IAIX,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAU,EAAE,IAA2B;QAC1E,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAiC,EAAE,MAA8B,EAAE,EAAE;YAC7F,IAAA,iBAAW,EAAC,EAAE,EAAE,IAAI,EAAE,CAAC,KAAmB,EAAE,MAA0B,EAAE,EAAE;gBACxE,IAAI,KAAK,EAAE;oBACT,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;qBAAM;oBACL,OAAO,CAAC,MAAO,CAAC,CAAC;iBAClB;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,cAA2B;QAC3D,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAkC,EAAE,EAAE;YAC9D,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,MAAe,EAAE,EAAE;gBAC5C,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,uEAAuE;IAChE,MAAM,CAAC,kBAAkB,CAAC,SAAiB;QAChD,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAC9B,OAAO,KAAK,CAAC;SACd;QACD,uBAAuB;QACvB,IAAI,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YACnD,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;;AAjCD,uEAAuE;AACxD,+BAAuB,GAAW,0BAA0B,CAAC;AAFjE,0BAAO","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 nodeResolve from 'resolve';\n\n// These helpers avoid taking dependencies on other NPM packages\nexport class Helpers {\n // Based on Path.isDownwardRelative() from @rushstack/node-core-library\n private static _upwardPathSegmentRegex: RegExp = /([\\/\\\\]|^)\\.\\.([\\/\\\\]|$)/;\n\n public static async nodeResolveAsync(id: string, opts: nodeResolve.AsyncOpts): Promise<string> {\n return await new Promise((resolve: (result: string) => void, reject: (error: Error) => void) => {\n nodeResolve(id, opts, (error: Error | null, result: string | undefined) => {\n if (error) {\n reject(error);\n } else {\n resolve(result!);\n }\n });\n });\n }\n\n public static async fsExistsAsync(filesystemPath: fs.PathLike): Promise<boolean> {\n return await new Promise((resolve: (result: boolean) => void) => {\n fs.exists(filesystemPath, (exists: boolean) => {\n resolve(exists);\n });\n });\n }\n\n // Based on Path.isDownwardRelative() from @rushstack/node-core-library\n public static isDownwardRelative(inputPath: string): boolean {\n if (path.isAbsolute(inputPath)) {\n return false;\n }\n // Does it contain \"..\"\n if (Helpers._upwardPathSegmentRegex.test(inputPath)) {\n return false;\n }\n return true;\n }\n}\n"]}
|
235
node_modules/@rushstack/rig-package/lib/RigConfig.d.ts
generated
vendored
Normal file
235
node_modules/@rushstack/rig-package/lib/RigConfig.d.ts
generated
vendored
Normal file
@ -0,0 +1,235 @@
|
||||
/**
|
||||
* Represents the literal contents of the `config/rig.json` file.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IRigConfigJson {
|
||||
/**
|
||||
* The name of the rig package to use.
|
||||
*
|
||||
* @remarks
|
||||
* The name must be a valid NPM package name, and must end with the `-rig` suffix.
|
||||
*
|
||||
* Example: `example-rig`
|
||||
*/
|
||||
rigPackageName: string;
|
||||
/**
|
||||
* Specify which rig profile to use from the rig package.
|
||||
*
|
||||
* @remarks
|
||||
* The name must consist of lowercase alphanumeric words separated by hyphens, for example `"sample-profile"`.
|
||||
* If the `"rigProfile"` is not specified, then the profile name `"default"` will be used.
|
||||
*
|
||||
* Example: `example-profile`
|
||||
*/
|
||||
rigProfile?: string;
|
||||
}
|
||||
/**
|
||||
* Options for {@link RigConfig.loadForProjectFolder}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface ILoadForProjectFolderOptions {
|
||||
/**
|
||||
* The path to the folder of the project to be analyzed. This folder should contain a `package.json` file.
|
||||
*/
|
||||
projectFolderPath: string;
|
||||
/**
|
||||
* If specified, instead of loading the `config/rig.json` from disk, this object will be substituted instead.
|
||||
*/
|
||||
overrideRigJsonObject?: IRigConfigJson;
|
||||
/**
|
||||
* If specified, force a fresh load instead of returning a cached entry, if one existed.
|
||||
*/
|
||||
bypassCache?: boolean;
|
||||
}
|
||||
/**
|
||||
* This is the main API for loading the `config/rig.json` file format.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export 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>;
|
||||
}
|
||||
/**
|
||||
* {@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;
|
||||
private _resolvedProfileFolder;
|
||||
private constructor();
|
||||
/**
|
||||
* The JSON contents of the {@link RigConfig.jsonSchemaPath} file.
|
||||
*
|
||||
* @remarks
|
||||
* The JSON object will be lazily loaded when this property getter is accessed, and the result
|
||||
* will be cached.
|
||||
* Accessing this property may make a synchronous filesystem call.
|
||||
*/
|
||||
static get jsonSchemaObject(): object;
|
||||
/**
|
||||
* Use this method to load the `config/rig.json` file for a given project.
|
||||
*
|
||||
* @remarks
|
||||
* If the file cannot be found, an empty `RigConfig` object will be returned with {@link RigConfig.rigFound}
|
||||
* equal to `false`.
|
||||
*/
|
||||
static loadForProjectFolder(options: ILoadForProjectFolderOptions): RigConfig;
|
||||
/**
|
||||
* An async variant of {@link RigConfig.loadForProjectFolder}
|
||||
*/
|
||||
static loadForProjectFolderAsync(options: ILoadForProjectFolderOptions): Promise<RigConfig>;
|
||||
private static _handleConfigError;
|
||||
/**
|
||||
* {@inheritdoc IRigConfig.getResolvedProfileFolder}
|
||||
*/
|
||||
getResolvedProfileFolder(): string;
|
||||
/**
|
||||
* {@inheritdoc IRigConfig.getResolvedProfileFolderAsync}
|
||||
*/
|
||||
getResolvedProfileFolderAsync(): Promise<string>;
|
||||
/**
|
||||
* {@inheritdoc IRigConfig.tryResolveConfigFilePath}
|
||||
*/
|
||||
tryResolveConfigFilePath(configFileRelativePath: string): string | undefined;
|
||||
/**
|
||||
* {@inheritdoc IRigConfig.tryResolveConfigFilePathAsync}
|
||||
*/
|
||||
tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined>;
|
||||
private static _validateSchema;
|
||||
}
|
||||
//# sourceMappingURL=RigConfig.d.ts.map
|
1
node_modules/@rushstack/rig-package/lib/RigConfig.d.ts.map
generated
vendored
Normal file
1
node_modules/@rushstack/rig-package/lib/RigConfig.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"RigConfig.d.ts","sourceRoot":"","sources":["../src/RigConfig.ts"],"names":[],"mappings":"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"}
|
295
node_modules/@rushstack/rig-package/lib/RigConfig.js
generated
vendored
Normal file
295
node_modules/@rushstack/rig-package/lib/RigConfig.js
generated
vendored
Normal file
@ -0,0 +1,295 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RigConfig = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const nodeResolve = __importStar(require("resolve"));
|
||||
const strip_json_comments_1 = __importDefault(require("strip-json-comments"));
|
||||
const Helpers_1 = require("./Helpers");
|
||||
/**
|
||||
* {@inheritdoc IRigConfig}
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
class RigConfig {
|
||||
constructor(options) {
|
||||
const { projectFolderPath, rigFound, filePath, rigPackageName, rigProfile = 'default' } = options;
|
||||
this.projectFolderOriginalPath = projectFolderPath;
|
||||
this.projectFolderPath = path.resolve(projectFolderPath);
|
||||
this.rigFound = rigFound;
|
||||
this.filePath = filePath;
|
||||
this.rigPackageName = rigPackageName;
|
||||
this.rigProfile = rigProfile;
|
||||
if (this.rigFound) {
|
||||
this.relativeProfileFolderPath = 'profiles/' + this.rigProfile;
|
||||
}
|
||||
else {
|
||||
this.relativeProfileFolderPath = '';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The JSON contents of the {@link RigConfig.jsonSchemaPath} file.
|
||||
*
|
||||
* @remarks
|
||||
* The JSON object will be lazily loaded when this property getter is accessed, and the result
|
||||
* will be cached.
|
||||
* Accessing this property may make a synchronous filesystem call.
|
||||
*/
|
||||
static get jsonSchemaObject() {
|
||||
if (RigConfig._jsonSchemaObject === undefined) {
|
||||
const jsonSchemaContent = fs.readFileSync(RigConfig.jsonSchemaPath).toString();
|
||||
RigConfig._jsonSchemaObject = JSON.parse(jsonSchemaContent);
|
||||
}
|
||||
return RigConfig._jsonSchemaObject;
|
||||
}
|
||||
/**
|
||||
* Use this method to load the `config/rig.json` file for a given project.
|
||||
*
|
||||
* @remarks
|
||||
* If the file cannot be found, an empty `RigConfig` object will be returned with {@link RigConfig.rigFound}
|
||||
* equal to `false`.
|
||||
*/
|
||||
static loadForProjectFolder(options) {
|
||||
const { overrideRigJsonObject, projectFolderPath } = options;
|
||||
const fromCache = !options.bypassCache && !overrideRigJsonObject
|
||||
? RigConfig._configCache.get(projectFolderPath)
|
||||
: undefined;
|
||||
if (fromCache) {
|
||||
return fromCache;
|
||||
}
|
||||
const rigConfigFilePath = path.join(projectFolderPath, 'config/rig.json');
|
||||
let config;
|
||||
let json = overrideRigJsonObject;
|
||||
try {
|
||||
if (!json) {
|
||||
const rigConfigFileContent = fs.readFileSync(rigConfigFilePath).toString();
|
||||
json = JSON.parse((0, strip_json_comments_1.default)(rigConfigFileContent));
|
||||
}
|
||||
RigConfig._validateSchema(json);
|
||||
}
|
||||
catch (error) {
|
||||
config = RigConfig._handleConfigError(error, projectFolderPath, rigConfigFilePath);
|
||||
}
|
||||
if (!config) {
|
||||
config = new RigConfig({
|
||||
projectFolderPath: projectFolderPath,
|
||||
rigFound: true,
|
||||
filePath: rigConfigFilePath,
|
||||
rigPackageName: json.rigPackageName,
|
||||
rigProfile: json.rigProfile
|
||||
});
|
||||
}
|
||||
if (!overrideRigJsonObject) {
|
||||
RigConfig._configCache.set(projectFolderPath, config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
/**
|
||||
* An async variant of {@link RigConfig.loadForProjectFolder}
|
||||
*/
|
||||
static async loadForProjectFolderAsync(options) {
|
||||
const { overrideRigJsonObject, projectFolderPath } = options;
|
||||
const fromCache = !options.bypassCache && !overrideRigJsonObject && RigConfig._configCache.get(projectFolderPath);
|
||||
if (fromCache) {
|
||||
return fromCache;
|
||||
}
|
||||
const rigConfigFilePath = path.join(projectFolderPath, 'config/rig.json');
|
||||
let config;
|
||||
let json = overrideRigJsonObject;
|
||||
try {
|
||||
if (!json) {
|
||||
const rigConfigFileContent = (await fs.promises.readFile(rigConfigFilePath)).toString();
|
||||
json = JSON.parse((0, strip_json_comments_1.default)(rigConfigFileContent));
|
||||
}
|
||||
RigConfig._validateSchema(json);
|
||||
}
|
||||
catch (error) {
|
||||
config = RigConfig._handleConfigError(error, projectFolderPath, rigConfigFilePath);
|
||||
}
|
||||
if (!config) {
|
||||
config = new RigConfig({
|
||||
projectFolderPath: projectFolderPath,
|
||||
rigFound: true,
|
||||
filePath: rigConfigFilePath,
|
||||
rigPackageName: json.rigPackageName,
|
||||
rigProfile: json.rigProfile
|
||||
});
|
||||
}
|
||||
if (!overrideRigJsonObject) {
|
||||
RigConfig._configCache.set(projectFolderPath, config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
static _handleConfigError(error, projectFolderPath, rigConfigFilePath) {
|
||||
if (error.code !== 'ENOENT' && error.code !== 'ENOTDIR') {
|
||||
throw new Error(error.message + '\nError loading config file: ' + rigConfigFilePath);
|
||||
}
|
||||
// File not found, i.e. no rig config
|
||||
return new RigConfig({
|
||||
projectFolderPath,
|
||||
rigFound: false,
|
||||
filePath: '',
|
||||
rigPackageName: '',
|
||||
rigProfile: ''
|
||||
});
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc IRigConfig.getResolvedProfileFolder}
|
||||
*/
|
||||
getResolvedProfileFolder() {
|
||||
if (this._resolvedRigPackageFolder === undefined) {
|
||||
if (!this.rigFound) {
|
||||
throw new Error('Cannot resolve the rig package because no rig was specified for this project');
|
||||
}
|
||||
const rigPackageJsonModuleSpecifier = `${this.rigPackageName}/package.json`;
|
||||
const resolveOptions = { basedir: this.projectFolderPath };
|
||||
const resolvedRigPackageJsonPath = nodeResolve.sync(rigPackageJsonModuleSpecifier, resolveOptions);
|
||||
this._resolvedRigPackageFolder = path.dirname(resolvedRigPackageJsonPath);
|
||||
}
|
||||
if (this._resolvedProfileFolder === undefined) {
|
||||
this._resolvedProfileFolder = path.join(this._resolvedRigPackageFolder, this.relativeProfileFolderPath);
|
||||
if (!fs.existsSync(this._resolvedProfileFolder)) {
|
||||
throw new Error(`The rig profile "${this.rigProfile}" is not defined` +
|
||||
` by the rig package "${this.rigPackageName}"`);
|
||||
}
|
||||
}
|
||||
return this._resolvedProfileFolder;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc IRigConfig.getResolvedProfileFolderAsync}
|
||||
*/
|
||||
async getResolvedProfileFolderAsync() {
|
||||
if (this._resolvedRigPackageFolder === undefined) {
|
||||
if (!this.rigFound) {
|
||||
throw new Error('Cannot resolve the rig package because no rig was specified for this project');
|
||||
}
|
||||
const rigPackageJsonModuleSpecifier = `${this.rigPackageName}/package.json`;
|
||||
const resolveOptions = { basedir: this.projectFolderPath };
|
||||
const resolvedRigPackageJsonPath = await Helpers_1.Helpers.nodeResolveAsync(rigPackageJsonModuleSpecifier, resolveOptions);
|
||||
this._resolvedRigPackageFolder = path.dirname(resolvedRigPackageJsonPath);
|
||||
}
|
||||
if (this._resolvedProfileFolder === undefined) {
|
||||
this._resolvedProfileFolder = path.join(this._resolvedRigPackageFolder, this.relativeProfileFolderPath);
|
||||
if (!(await Helpers_1.Helpers.fsExistsAsync(this._resolvedProfileFolder))) {
|
||||
throw new Error(`The rig profile "${this.rigProfile}" is not defined` +
|
||||
` by the rig package "${this.rigPackageName}"`);
|
||||
}
|
||||
}
|
||||
return this._resolvedProfileFolder;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc IRigConfig.tryResolveConfigFilePath}
|
||||
*/
|
||||
tryResolveConfigFilePath(configFileRelativePath) {
|
||||
if (!Helpers_1.Helpers.isDownwardRelative(configFileRelativePath)) {
|
||||
throw new Error('The configFileRelativePath is not a relative path: ' + configFileRelativePath);
|
||||
}
|
||||
const localPath = path.join(this.projectFolderPath, configFileRelativePath);
|
||||
if (fs.existsSync(localPath)) {
|
||||
return localPath;
|
||||
}
|
||||
if (this.rigFound) {
|
||||
const riggedPath = path.join(this.getResolvedProfileFolder(), configFileRelativePath);
|
||||
if (fs.existsSync(riggedPath)) {
|
||||
return riggedPath;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc IRigConfig.tryResolveConfigFilePathAsync}
|
||||
*/
|
||||
async tryResolveConfigFilePathAsync(configFileRelativePath) {
|
||||
if (!Helpers_1.Helpers.isDownwardRelative(configFileRelativePath)) {
|
||||
throw new Error('The configFileRelativePath is not a relative path: ' + configFileRelativePath);
|
||||
}
|
||||
const localPath = path.join(this.projectFolderPath, configFileRelativePath);
|
||||
if (await Helpers_1.Helpers.fsExistsAsync(localPath)) {
|
||||
return localPath;
|
||||
}
|
||||
if (this.rigFound) {
|
||||
const riggedPath = path.join(await this.getResolvedProfileFolderAsync(), configFileRelativePath);
|
||||
if (await Helpers_1.Helpers.fsExistsAsync(riggedPath)) {
|
||||
return riggedPath;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
static _validateSchema(json) {
|
||||
for (const key of Object.getOwnPropertyNames(json)) {
|
||||
switch (key) {
|
||||
case '$schema':
|
||||
case 'rigPackageName':
|
||||
case 'rigProfile':
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unsupported field ${JSON.stringify(key)}`);
|
||||
}
|
||||
}
|
||||
if (!json.rigPackageName) {
|
||||
throw new Error('Missing required field "rigPackageName"');
|
||||
}
|
||||
if (!RigConfig._packageNameRegExp.test(json.rigPackageName)) {
|
||||
throw new Error(`The "rigPackageName" value is not a valid NPM package name: ${JSON.stringify(json.rigPackageName)}`);
|
||||
}
|
||||
if (!RigConfig._rigNameRegExp.test(json.rigPackageName)) {
|
||||
throw new Error(`The "rigPackageName" value is missing the "-rig" suffix: ` + JSON.stringify(json.rigProfile));
|
||||
}
|
||||
if (json.rigProfile !== undefined) {
|
||||
if (!RigConfig._profileNameRegExp.test(json.rigProfile)) {
|
||||
throw new Error(`The profile name must consist of lowercase alphanumeric words separated by hyphens: ` +
|
||||
JSON.stringify(json.rigProfile));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// For syntax details, see PackageNameParser from @rushstack/node-core-library
|
||||
RigConfig._packageNameRegExp = /^(@[A-Za-z0-9\-_\.]+\/)?[A-Za-z0-9\-_\.]+$/;
|
||||
// Rig package names must have the "-rig" suffix.
|
||||
// Also silently accept "-rig-test" for our build test projects.
|
||||
RigConfig._rigNameRegExp = /-rig(-test)?$/;
|
||||
// Profiles must be lowercase alphanumeric words separated by hyphens
|
||||
RigConfig._profileNameRegExp = /^[a-z0-9_\.]+(\-[a-z0-9_\.]+)*$/;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
RigConfig.jsonSchemaPath = path.resolve(__dirname, './schemas/rig.schema.json');
|
||||
RigConfig._jsonSchemaObject = undefined;
|
||||
RigConfig._configCache = new Map();
|
||||
exports.RigConfig = RigConfig;
|
||||
//# sourceMappingURL=RigConfig.js.map
|
1
node_modules/@rushstack/rig-package/lib/RigConfig.js.map
generated
vendored
Normal file
1
node_modules/@rushstack/rig-package/lib/RigConfig.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/@rushstack/rig-package/lib/index.d.ts
generated
vendored
Normal file
12
node_modules/@rushstack/rig-package/lib/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* A system for sharing tool configurations between projects without duplicating config files.
|
||||
*
|
||||
* @remarks
|
||||
* The `config/rig.json` file is a system that Node.js build tools can support, in order to eliminate
|
||||
* duplication of config files when many projects share a common configuration. This is particularly valuable
|
||||
* in a setup where hundreds of projects may be built using a small set of reusable recipes.
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
export { type IRigConfigJson, type IRigConfig, RigConfig, type ILoadForProjectFolderOptions } from './RigConfig';
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/@rushstack/rig-package/lib/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@rushstack/rig-package/lib/index.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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"}
|
18
node_modules/@rushstack/rig-package/lib/index.js
generated
vendored
Normal file
18
node_modules/@rushstack/rig-package/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RigConfig = void 0;
|
||||
/**
|
||||
* A system for sharing tool configurations between projects without duplicating config files.
|
||||
*
|
||||
* @remarks
|
||||
* The `config/rig.json` file is a system that Node.js build tools can support, in order to eliminate
|
||||
* duplication of config files when many projects share a common configuration. This is particularly valuable
|
||||
* in a setup where hundreds of projects may be built using a small set of reusable recipes.
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
var RigConfig_1 = require("./RigConfig");
|
||||
Object.defineProperty(exports, "RigConfig", { enumerable: true, get: function () { return RigConfig_1.RigConfig; } });
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@rushstack/rig-package/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@rushstack/rig-package/lib/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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"]}
|
27
node_modules/@rushstack/rig-package/lib/schemas/rig.schema.json
generated
vendored
Normal file
27
node_modules/@rushstack/rig-package/lib/schemas/rig.schema.json
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "Describes the config/rig.json file",
|
||||
"description": "The rig.json file is a standard for sharing project configuration in a monorepo without duplicating files",
|
||||
"type": "object",
|
||||
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
"rigPackageName": {
|
||||
"type": "string",
|
||||
"description": "(Required) The name of the rig package to inherit from. It should be an NPM package name with the \"-rig\" suffix."
|
||||
},
|
||||
|
||||
"rigProfile": {
|
||||
"type": "string",
|
||||
"description": "Selects a config profile from the rig package. The name must consist of lowercase alphanumeric words separated by hyphens, for example \"sample-profile\". If omitted, then the \"default\" profile will be used."
|
||||
}
|
||||
},
|
||||
|
||||
"required": ["rigPackageName"]
|
||||
}
|
Reference in New Issue
Block a user