Skip to content

Commit 2c95bcb

Browse files
committed
use filter functioon
1 parent f55228d commit 2c95bcb

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/package.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,15 +1978,7 @@ export async function printAndValidatePackagedFiles(files: IFile[], cwd: string,
19781978
// the package does not include at least one file for each include pattern
19791979
else if (manifest.files !== undefined && manifest.files.length > 0 && !options.allowUnusedFilesPattern) {
19801980
const originalFilePaths = files.map(f => util.vsixPathToFilePath(f.path));
1981-
1982-
const unusedIncludePatterns = [];
1983-
for (const includePattern of manifest.files) {
1984-
const hasMatchingFile = originalFilePaths.some(file => minimatch(file, includePattern, MinimatchOptions));
1985-
if (!hasMatchingFile) {
1986-
unusedIncludePatterns.push(includePattern);
1987-
}
1988-
}
1989-
1981+
const unusedIncludePatterns = manifest.files.filter(includePattern => !originalFilePaths.some(filePath => minimatch(filePath, includePattern, MinimatchOptions)));
19901982
if (unusedIncludePatterns.length > 0) {
19911983
let message = '';
19921984
message += `The following include patterns in the ${chalk.bold('"files"')} property in package.json do not match any files packaged in the extension:\n`;

0 commit comments

Comments
 (0)