@rushstack/node-core-library
Advanced tools
Comparing version 3.46.0 to 3.47.0
@@ -55,2 +55,6 @@ /** | ||
baseFolder: string; | ||
/** | ||
* If set to true, don't include the leading `./` if the path is under the base folder. | ||
*/ | ||
trimLeadingDotSlash?: boolean; | ||
} | ||
@@ -98,3 +102,4 @@ /** | ||
* @remarks | ||
* If `pathToConvert` is under the `baseFolder`, then it will be converted to a relative with the `./` prefix. | ||
* If `pathToConvert` is under the `baseFolder`, then it will be converted to a relative with the `./` prefix | ||
* unless the {@link IPathFormatConciselyOptions.trimLeadingDotSlash} option is set to `true`. | ||
* Otherwise, it will be converted to an absolute path. | ||
@@ -101,0 +106,0 @@ * |
@@ -80,3 +80,4 @@ "use strict"; | ||
* @remarks | ||
* If `pathToConvert` is under the `baseFolder`, then it will be converted to a relative with the `./` prefix. | ||
* If `pathToConvert` is under the `baseFolder`, then it will be converted to a relative with the `./` prefix | ||
* unless the {@link IPathFormatConciselyOptions.trimLeadingDotSlash} option is set to `true`. | ||
* Otherwise, it will be converted to an absolute path. | ||
@@ -92,3 +93,9 @@ * | ||
// Note that isUnderOrEqual()'s relativePath is the reverse direction | ||
return './' + Path.convertToSlashes(path.relative(options.baseFolder, options.pathToConvert)); | ||
const convertedPath = Path.convertToSlashes(path.relative(options.baseFolder, options.pathToConvert)); | ||
if (options.trimLeadingDotSlash) { | ||
return convertedPath; | ||
} | ||
else { | ||
return `./${convertedPath}`; | ||
} | ||
} | ||
@@ -113,3 +120,4 @@ const absolutePath = path.resolve(options.pathToConvert); | ||
pathToConvert: pathToFormat, | ||
baseFolder | ||
baseFolder, | ||
trimLeadingDotSlash: true | ||
}) | ||
@@ -116,0 +124,0 @@ : path.resolve(pathToFormat); |
{ | ||
"name": "@rushstack/node-core-library", | ||
"version": "3.46.0", | ||
"version": "3.47.0", | ||
"description": "Core libraries that every NodeJS toolchain project should use", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
977603
12886