Skip to content

Commit cddd0f8

Browse files
committed
fix micromatch usage
1 parent 467f916 commit cddd0f8

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

Common/Node/multimatch.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@ import micromatch = require('micromatch');
22
import path = require('path');
33
import * as tl from 'azure-pipelines-task-lib/task';
44

5-
export function getMatches(directory: string, filters: string): string[] {
6-
return applyMatch(directory, filters, tl.find(directory));
7-
}
8-
95
export function applyMatch(
106
directory: string,
117
filters: string,
128
files: string[]
13-
) {
9+
): string[] {
1410
var patterns = filters.split('\n').map(pattern => {
1511
if (pattern.match(/^!/)) {
1612
return '!' + path.join(directory, pattern.substr(1));
@@ -19,9 +15,12 @@ export function applyMatch(
1915
});
2016

2117
var allFiles = files.map(file => path.resolve(file));
22-
var filteredFiles = allFiles.filter(
23-
micromatch.filter(patterns, { nodupes: true })
24-
);
25-
18+
var filteredFiles = (micromatch as any)(allFiles, patterns, {
19+
nodupes: true
20+
});
2621
return filteredFiles;
2722
}
23+
24+
export function getMatches(directory: string, filters: string): string[] {
25+
return applyMatch(directory, filters, tl.find(directory));
26+
}

Tasks/JsonPatch/jsonPatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ try {
99
var targetPath = tl.getPathInput('JsonWorkingDir', true);
1010
var patchContent = tl.getInput('JsonPatchContent', true);
1111

12-
var patterns: any = tl.getInput('JsonTargetFilters', true);
12+
var patterns: string = tl.getInput('JsonTargetFilters', true);
1313
var outputPatchedFile = tl.getBoolInput('OutputPatchFile', true);
1414
var failIfNoPatchApplied = tl.getBoolInput('FailIfNoPatchApplied', true);
1515
var treatErrors = tl.getInput('TreatErrors', true);

Tasks/JsonPatch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"micromatch": "^4.0.2",
99
"fast-json-patch": "2.1.0",
1010
"xregexp": "4.2.4",
11-
"azure-pipelines-task-lib": "2.8.0",
11+
"azure-pipelines-task-lib": "^2.8.0",
1212
"json5": "2.1.0",
1313
"shelljs": "0.8.3"
1414
}

Tasks/JsonPatch/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
core-js "^2.6.5"
1010
regenerator-runtime "^0.13.2"
1111

12-
azure-pipelines-task-lib@2.8.0:
12+
azure-pipelines-task-lib@^2.8.0:
1313
version "2.8.0"
1414
resolved "https://registry.yarnpkg.com/azure-pipelines-task-lib/-/azure-pipelines-task-lib-2.8.0.tgz#8a0117a98f86c2e9ee85333e649874bf83ccb836"
1515
dependencies:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@types/jasmine": "^2.5.53",
4242
"@types/js-yaml": "^3.9.0",
4343
"@types/json5": "0.0.29",
44-
"@types/micromatch": "^2.3.29",
44+
"@types/micromatch": "^3.1.0",
4545
"@types/node": "8.0.19",
4646
"@types/parse-glob": "^3.0.29",
4747
"@types/q": "^1.0.3",

yarn.lock

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
version "3.0.0"
2121
resolved "https://registry.yarnpkg.com/@types/async/-/async-3.0.0.tgz#d403560ee2aabccdb7936cb9a3fee5f147d626bd"
2222

23+
"@types/braces@*":
24+
version "3.0.0"
25+
resolved "https://registry.yarnpkg.com/@types/braces/-/braces-3.0.0.tgz#7da1c0d44ff1c7eb660a36ec078ea61ba7eb42cb"
26+
2327
"@types/events@*":
2428
version "3.0.0"
2529
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
@@ -70,11 +74,11 @@
7074
version "4.14.133"
7175
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.133.tgz#430721c96da22dd1694443e68e6cec7ba1c1003d"
7276

73-
"@types/micromatch@^2.3.29":
74-
version "2.3.30"
75-
resolved "https://registry.yarnpkg.com/@types/micromatch/-/micromatch-2.3.30.tgz#c2a143675f200fbcebe57fb0dab0cbf58093d4b0"
77+
"@types/micromatch@^3.1.0":
78+
version "3.1.0"
79+
resolved "https://registry.yarnpkg.com/@types/micromatch/-/micromatch-3.1.0.tgz#514c8a3d24b2680a9b838eeb80e6d7d724545433"
7680
dependencies:
77-
"@types/parse-glob" "*"
81+
"@types/braces" "*"
7882

7983
"@types/minimatch@*":
8084
version "3.0.3"
@@ -92,7 +96,7 @@
9296
version "8.0.19"
9397
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.19.tgz#e46e2b0243de7d03f15b26b45c59ebb84f657a4e"
9498

95-
"@types/parse-glob@*", "@types/parse-glob@^3.0.29":
99+
"@types/parse-glob@^3.0.29":
96100
version "3.0.29"
97101
resolved "https://registry.yarnpkg.com/@types/parse-glob/-/parse-glob-3.0.29.tgz#6a40ec7ebd2418ee69ee397e48e42169268a10bf"
98102

0 commit comments

Comments
 (0)