Skip to content

Commit

Permalink
Merge pull request #1021 from microsoft/benibenj/chronic-spider
Browse files Browse the repository at this point in the history
Refactor file inclusion logic
  • Loading branch information
benibenj committed Jul 17, 2024
2 parents f55228d + 2c95bcb commit a97062f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1978,15 +1978,7 @@ export async function printAndValidatePackagedFiles(files: IFile[], cwd: string,
// the package does not include at least one file for each include pattern
else if (manifest.files !== undefined && manifest.files.length > 0 && !options.allowUnusedFilesPattern) {
const originalFilePaths = files.map(f => util.vsixPathToFilePath(f.path));

const unusedIncludePatterns = [];
for (const includePattern of manifest.files) {
const hasMatchingFile = originalFilePaths.some(file => minimatch(file, includePattern, MinimatchOptions));
if (!hasMatchingFile) {
unusedIncludePatterns.push(includePattern);
}
}

const unusedIncludePatterns = manifest.files.filter(includePattern => !originalFilePaths.some(filePath => minimatch(filePath, includePattern, MinimatchOptions)));
if (unusedIncludePatterns.length > 0) {
let message = '';
message += `The following include patterns in the ${chalk.bold('"files"')} property in package.json do not match any files packaged in the extension:\n`;
Expand Down

0 comments on commit a97062f

Please sign in to comment.