zarro 1.175.2 → 1.175.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -77,6 +77,9 @@
|
|
|
77
77
|
function findPackageReferencesOn(xml) {
|
|
78
78
|
const itemGroups = getByPath(xml, "Project.ItemGroup");
|
|
79
79
|
const result = [];
|
|
80
|
+
if (!itemGroups) {
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
80
83
|
for (const dict of itemGroups) {
|
|
81
84
|
const packageReferences = getByPath(dict, "PackageReference");
|
|
82
85
|
if (packageReferences) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(function () {
|
|
3
|
-
const { ls, FsEntities } = require("yafs"), gulp = requireModule("gulp");
|
|
3
|
+
const { ls, FsEntities, fileExistsSync } = require("yafs"), gulp = requireModule("gulp");
|
|
4
4
|
gulp.task("upgrade-packages", async () => {
|
|
5
5
|
const env = requireModule("env"), { upgradePackages } = requireModule("dotnet-cli"), rawPackageMask = env.resolveArray(env.UPGRADE_PACKAGES), packageMask = parseMasks(rawPackageMask, true), rawTargetMask = env.resolveArray(env.UPGRADE_PACKAGES_TARGET), nugetSource = env.resolve(env.NUGET_SOURCE), showProgress = env.resolveFlag(env.UPGRADE_PACKAGES_PROGRESS), preRelease = env.resolveFlag(env.UPGRADE_PACKAGES_PRERELEASE), noRestore = env.resolveFlag(env.UPGRADE_PACKAGES_NO_RESTORE), targets = await resolveTargets(rawTargetMask);
|
|
6
6
|
for (const target of targets) {
|
|
@@ -19,19 +19,29 @@
|
|
|
19
19
|
if (!rawTargets || rawTargets.length === 0) {
|
|
20
20
|
return await findSolutions();
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const exactMatches = rawTargets.filter(t => {
|
|
23
|
+
return fileExistsSync(t);
|
|
24
|
+
});
|
|
25
|
+
const inexactMatches = rawTargets.filter(s => exactMatches.indexOf(s) === -1);
|
|
26
|
+
const regexTargets = parseMasks(inexactMatches, false);
|
|
27
|
+
if (regexTargets.length === 0) {
|
|
28
|
+
return exactMatches;
|
|
29
|
+
}
|
|
23
30
|
const interestingFiles = await findFiles([
|
|
24
31
|
solutionRe,
|
|
25
32
|
projectRe
|
|
26
33
|
]);
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
return [
|
|
35
|
+
...exactMatches,
|
|
36
|
+
...interestingFiles.filter(filepath => {
|
|
37
|
+
for (const re of regexTargets) {
|
|
38
|
+
if (re.test(filepath)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
31
41
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
return false;
|
|
43
|
+
})
|
|
44
|
+
];
|
|
35
45
|
}
|
|
36
46
|
async function findSolutions() {
|
|
37
47
|
return await findFiles([solutionRe]);
|
|
@@ -48,11 +58,30 @@
|
|
|
48
58
|
function parseMasks(masks, strict) {
|
|
49
59
|
// package masks can be raw strings or strings representing regular expressions
|
|
50
60
|
return masks.map(s => looksLikeRegex(s)
|
|
51
|
-
?
|
|
61
|
+
? makeCaseInsensitiveRegex(s)
|
|
52
62
|
: looksLikeAGlob(s)
|
|
53
63
|
? createRegExpFromGlob(s)
|
|
54
64
|
: makeRegex(s, strict));
|
|
55
65
|
}
|
|
66
|
+
function makeCaseInsensitiveRegex(s) {
|
|
67
|
+
const parts = s.split("/"), hasEnoughParts = parts.length >= 3;
|
|
68
|
+
if (!hasEnoughParts) {
|
|
69
|
+
return new RegExp(s, "i");
|
|
70
|
+
}
|
|
71
|
+
const startsWithSlash = parts[0] === "", endsWithSlash = parts[parts.length - 1] === "", finalSlashIsEscaped = hasEnoughParts && !parts[parts.length - 2].endsWith("\\"), isEz = startsWithSlash && endsWithSlash && !finalSlashIsEscaped;
|
|
72
|
+
if (isEz) {
|
|
73
|
+
let re = s;
|
|
74
|
+
if (startsWithSlash) {
|
|
75
|
+
re = re.substring(1);
|
|
76
|
+
}
|
|
77
|
+
if (endsWithSlash) {
|
|
78
|
+
re = re.substring(0, re.length - 1);
|
|
79
|
+
}
|
|
80
|
+
return new RegExp(re, "i");
|
|
81
|
+
}
|
|
82
|
+
const bitsInTheMiddle = parts.slice(1, parts.length - 2), rejoined = bitsInTheMiddle.join("/");
|
|
83
|
+
return new RegExp(rejoined, "i");
|
|
84
|
+
}
|
|
56
85
|
function makeRegex(s, strict) {
|
|
57
86
|
const escaped = s.replace(".", "\\.");
|
|
58
87
|
return strict
|