@rushstack/package-extractor
Advanced tools
Comparing version 0.7.26 to 0.8.0
# Change Log - @rushstack/package-extractor | ||
This log was last generated on Tue, 10 Sep 2024 20:08:11 GMT and should not be manually modified. | ||
This log was last generated on Wed, 11 Sep 2024 19:54:47 GMT and should not be manually modified. | ||
## 0.8.0 | ||
Wed, 11 Sep 2024 19:54:47 GMT | ||
### Minor changes | ||
- Add the ability to change where the "create-links.js" file and the associated metadata file are generated when running in the "script" linkCreation mode | ||
## 0.7.26 | ||
@@ -6,0 +13,0 @@ Tue, 10 Sep 2024 20:08:11 GMT |
@@ -84,3 +84,3 @@ import { IPackageJson } from '@rushstack/node-core-library'; | ||
* Whether to skip copying files to the extraction target directory, and only create an extraction | ||
* archive. This is only supported when linkCreation is 'script' or 'none'. | ||
* archive. This is only supported when {@link IExtractorOptions.linkCreation} is 'script' or 'none'. | ||
*/ | ||
@@ -126,2 +126,7 @@ createArchiveOnly?: boolean; | ||
/** | ||
* The path to the generated link creation script. This is only used when {@link IExtractorOptions.linkCreation} | ||
* is 'script'. | ||
*/ | ||
linkCreationScriptPath?: string; | ||
/** | ||
* An additional folder containing files which will be copied into the root of the extraction. | ||
@@ -128,0 +133,0 @@ */ |
@@ -110,2 +110,4 @@ /******/ (() => { // webpackBootstrap | ||
const TARGET_ROOT_SCRIPT_RELATIVE_PATH = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}'; | ||
const TARGET_ROOT_FOLDER = path__WEBPACK_IMPORTED_MODULE_1__.resolve(__dirname, TARGET_ROOT_SCRIPT_RELATIVE_PATH); | ||
// API borrowed from @rushstack/node-core-library, since this script avoids using any | ||
@@ -195,4 +197,3 @@ // NPM dependencies. | ||
} | ||
const targetRootFolder = __dirname; | ||
const extractorMetadataPath = path__WEBPACK_IMPORTED_MODULE_1__.join(targetRootFolder, 'extractor-metadata.json'); | ||
const extractorMetadataPath = `${__dirname}/extractor-metadata.json`; | ||
if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(extractorMetadataPath)) { | ||
@@ -204,9 +205,9 @@ throw new Error('Input file not found: ' + extractorMetadataPath); | ||
if (args[0] === 'create') { | ||
console.log(`\nCreating links for extraction at path "${targetRootFolder}"`); | ||
removeLinks(targetRootFolder, extractorMetadataObject); | ||
createLinks(targetRootFolder, extractorMetadataObject); | ||
console.log(`\nCreating links for extraction at path "${TARGET_ROOT_FOLDER}"`); | ||
removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject); | ||
createLinks(TARGET_ROOT_FOLDER, extractorMetadataObject); | ||
} | ||
else { | ||
console.log(`\nRemoving links for extraction at path "${targetRootFolder}"`); | ||
removeLinks(targetRootFolder, extractorMetadataObject); | ||
console.log(`\nRemoving links for extraction at path "${TARGET_ROOT_FOLDER}"`); | ||
removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject); | ||
} | ||
@@ -213,0 +214,0 @@ console.log('The operation completed successfully.'); |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.47.7" | ||
"packageVersion": "7.47.8" | ||
} | ||
] | ||
} |
@@ -15,2 +15,3 @@ import { type IPackageJson } from '@rushstack/node-core-library'; | ||
} | ||
export declare const TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING: '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}'; | ||
/** | ||
@@ -169,3 +170,3 @@ * Part of the extractor-matadata.json file format. Represents an extracted project. | ||
* Whether to skip copying files to the extraction target directory, and only create an extraction | ||
* archive. This is only supported when linkCreation is 'script' or 'none'. | ||
* archive. This is only supported when {@link IExtractorOptions.linkCreation} is 'script' or 'none'. | ||
*/ | ||
@@ -211,2 +212,7 @@ createArchiveOnly?: boolean; | ||
/** | ||
* The path to the generated link creation script. This is only used when {@link IExtractorOptions.linkCreation} | ||
* is 'script'. | ||
*/ | ||
linkCreationScriptPath?: string; | ||
/** | ||
* An additional folder containing files which will be copied into the root of the extraction. | ||
@@ -213,0 +219,0 @@ */ |
@@ -31,3 +31,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PackageExtractor = void 0; | ||
exports.PackageExtractor = exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING = void 0; | ||
const path = __importStar(require("path")); | ||
@@ -46,2 +46,3 @@ const fs = __importStar(require("fs")); | ||
const PathConstants_1 = require("./PathConstants"); | ||
exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}'; | ||
/** | ||
@@ -164,3 +165,3 @@ * Manages the business logic for the "rush deploy" command. | ||
var _a; | ||
const { terminal, mainProjectName, sourceRootFolder, targetRootFolder, folderToCopy: additionalFolderToCopy, linkCreation } = options; | ||
const { terminal, mainProjectName, sourceRootFolder, targetRootFolder, folderToCopy: additionalFolderToCopy, linkCreation, linkCreationScriptPath, createArchiveOnly } = options; | ||
const { projectConfigurationsByName, foldersToCopy, symlinkAnalyzer } = state; | ||
@@ -188,3 +189,3 @@ const mainProjectConfiguration = projectConfigurationsByName.get(mainProjectName); | ||
} | ||
if (!options.createArchiveOnly) { | ||
if (!createArchiveOnly) { | ||
terminal.writeLine(`Copying folders to target folder "${targetRootFolder}"`); | ||
@@ -201,3 +202,3 @@ } | ||
const additionalFolderPath = path.resolve(sourceRootFolder, additionalFolderToCopy); | ||
const additionalFolderExtractorOptions = Object.assign(Object.assign({}, options), { sourceRootFolder: additionalFolderPath, targetRootFolder: options.targetRootFolder }); | ||
const additionalFolderExtractorOptions = Object.assign(Object.assign({}, options), { sourceRootFolder: additionalFolderPath, targetRootFolder }); | ||
await this._extractFolderAsync(additionalFolderPath, additionalFolderExtractorOptions, state); | ||
@@ -207,14 +208,17 @@ } | ||
case 'script': { | ||
const sourceFilePath = path.join(PathConstants_1.scriptsFolderPath, PathConstants_1.createLinksScriptFilename); | ||
if (!options.createArchiveOnly) { | ||
terminal.writeLine(`Creating ${PathConstants_1.createLinksScriptFilename}`); | ||
await node_core_library_1.FileSystem.copyFileAsync({ | ||
sourcePath: sourceFilePath, | ||
destinationPath: path.join(targetRootFolder, PathConstants_1.createLinksScriptFilename), | ||
alreadyExistsBehavior: node_core_library_1.AlreadyExistsBehavior.Error | ||
terminal.writeLine(`Creating ${PathConstants_1.createLinksScriptFilename}`); | ||
const createLinksSourceFilePath = `${PathConstants_1.scriptsFolderPath}/${PathConstants_1.createLinksScriptFilename}`; | ||
const createLinksTargetFilePath = linkCreationScriptPath | ||
? path.resolve(targetRootFolder, linkCreationScriptPath) | ||
: `${targetRootFolder}/${PathConstants_1.createLinksScriptFilename}`; | ||
let createLinksScriptContent = await node_core_library_1.FileSystem.readFileAsync(createLinksSourceFilePath); | ||
createLinksScriptContent = createLinksScriptContent.replace(exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING, node_core_library_1.Path.convertToSlashes(path.relative(path.dirname(createLinksTargetFilePath), targetRootFolder))); | ||
if (!createArchiveOnly) { | ||
await node_core_library_1.FileSystem.writeFileAsync(createLinksTargetFilePath, createLinksScriptContent, { | ||
ensureFolderExists: true | ||
}); | ||
} | ||
await ((_a = state.archiver) === null || _a === void 0 ? void 0 : _a.addToArchiveAsync({ | ||
filePath: sourceFilePath, | ||
archivePath: PathConstants_1.createLinksScriptFilename | ||
fileData: createLinksScriptContent, | ||
archivePath: path.relative(targetRootFolder, createLinksTargetFilePath) | ||
})); | ||
@@ -638,6 +642,9 @@ break; | ||
var _a; | ||
const { mainProjectName, targetRootFolder } = options; | ||
const { mainProjectName, targetRootFolder, linkCreation, linkCreationScriptPath } = options; | ||
const { projectConfigurationsByPath } = state; | ||
const extractorMetadataFileName = 'extractor-metadata.json'; | ||
const extractorMetadataFilePath = path.join(targetRootFolder, extractorMetadataFileName); | ||
const extractorMetadataFolderPath = linkCreation === 'script' && linkCreationScriptPath | ||
? path.dirname(path.resolve(targetRootFolder, linkCreationScriptPath)) | ||
: targetRootFolder; | ||
const extractorMetadataFilePath = path.join(extractorMetadataFolderPath, extractorMetadataFileName); | ||
const extractorMetadataJson = { | ||
@@ -667,8 +674,8 @@ mainProjectName, | ||
if (!options.createArchiveOnly) { | ||
await node_core_library_1.FileSystem.writeFileAsync(extractorMetadataFilePath, extractorMetadataFileContent); | ||
await node_core_library_1.FileSystem.writeFileAsync(extractorMetadataFilePath, extractorMetadataFileContent, { | ||
ensureFolderExists: true | ||
}); | ||
} | ||
await ((_a = state.archiver) === null || _a === void 0 ? void 0 : _a.addToArchiveAsync({ | ||
fileData: extractorMetadataFileContent, | ||
archivePath: extractorMetadataFileName | ||
})); | ||
const archivePath = path.relative(targetRootFolder, extractorMetadataFilePath); | ||
await ((_a = state.archiver) === null || _a === void 0 ? void 0 : _a.addToArchiveAsync({ archivePath, fileData: extractorMetadataFileContent })); | ||
} | ||
@@ -675,0 +682,0 @@ async _makeBinLinksAsync(options, state) { |
@@ -32,2 +32,4 @@ "use strict"; | ||
const path = __importStar(require("path")); | ||
const TARGET_ROOT_SCRIPT_RELATIVE_PATH = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}'; | ||
const TARGET_ROOT_FOLDER = path.resolve(__dirname, TARGET_ROOT_SCRIPT_RELATIVE_PATH); | ||
// API borrowed from @rushstack/node-core-library, since this script avoids using any | ||
@@ -117,4 +119,3 @@ // NPM dependencies. | ||
} | ||
const targetRootFolder = __dirname; | ||
const extractorMetadataPath = path.join(targetRootFolder, 'extractor-metadata.json'); | ||
const extractorMetadataPath = `${__dirname}/extractor-metadata.json`; | ||
if (!fs.existsSync(extractorMetadataPath)) { | ||
@@ -126,9 +127,9 @@ throw new Error('Input file not found: ' + extractorMetadataPath); | ||
if (args[0] === 'create') { | ||
console.log(`\nCreating links for extraction at path "${targetRootFolder}"`); | ||
removeLinks(targetRootFolder, extractorMetadataObject); | ||
createLinks(targetRootFolder, extractorMetadataObject); | ||
console.log(`\nCreating links for extraction at path "${TARGET_ROOT_FOLDER}"`); | ||
removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject); | ||
createLinks(TARGET_ROOT_FOLDER, extractorMetadataObject); | ||
} | ||
else { | ||
console.log(`\nRemoving links for extraction at path "${targetRootFolder}"`); | ||
removeLinks(targetRootFolder, extractorMetadataObject); | ||
console.log(`\nRemoving links for extraction at path "${TARGET_ROOT_FOLDER}"`); | ||
removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject); | ||
} | ||
@@ -135,0 +136,0 @@ console.log('The operation completed successfully.'); |
{ | ||
"name": "@rushstack/package-extractor", | ||
"version": "0.7.26", | ||
"version": "0.8.0", | ||
"description": "A library for bundling selected files and dependencies into a deployable package.", | ||
@@ -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
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
290152
4451