zarro 1.175.0 → 1.175.2
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.
|
@@ -462,6 +462,29 @@
|
|
|
462
462
|
help: "Ignore errors produced by attempting to push duplicate packages",
|
|
463
463
|
default: "true"
|
|
464
464
|
});
|
|
465
|
+
env.register({
|
|
466
|
+
name: "UPGRADE_PACKAGES",
|
|
467
|
+
help: "A list of packages/regular expressions for packages to guid the upgrade-packages task"
|
|
468
|
+
});
|
|
469
|
+
env.register({
|
|
470
|
+
name: "UPGRADE_PACKAGES_TARGET",
|
|
471
|
+
help: "The solution(s) or project(s) to upgrade. If not specified, all found _solutions_ are upgraded"
|
|
472
|
+
});
|
|
473
|
+
env.register({
|
|
474
|
+
name: "UPGRADE_PACKAGES_PROGRESS",
|
|
475
|
+
help: "Flag: when set falsey, show no progress",
|
|
476
|
+
default: "true"
|
|
477
|
+
});
|
|
478
|
+
env.register({
|
|
479
|
+
name: "UPGRADE_PACKAGES_PRERELEASE",
|
|
480
|
+
help: "Flag: when set truthy, include pre-release packages in the upgrade process",
|
|
481
|
+
default: "false"
|
|
482
|
+
});
|
|
483
|
+
env.register({
|
|
484
|
+
name: "UPGRADE_PACKAGES_NO_RESTORE",
|
|
485
|
+
help: "Flag: when set truthy (default), don't actively restore packages (next build will do so) - makes the process faster",
|
|
486
|
+
default: "false"
|
|
487
|
+
});
|
|
465
488
|
env.register({
|
|
466
489
|
name: "PACK_INCLUDE_CSPROJ",
|
|
467
490
|
help: "Mask to apply for inclusions to 'dotnet pack'",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function () {
|
|
3
|
+
const { ls, FsEntities } = require("yafs"), gulp = requireModule("gulp");
|
|
4
|
+
gulp.task("upgrade-packages", async () => {
|
|
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
|
+
for (const target of targets) {
|
|
7
|
+
await upgradePackages({
|
|
8
|
+
source: nugetSource,
|
|
9
|
+
showProgress: showProgress,
|
|
10
|
+
packages: packageMask,
|
|
11
|
+
pathToProjectOrSolution: target,
|
|
12
|
+
preRelease: preRelease,
|
|
13
|
+
noRestore: noRestore
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const solutionRe = /.*\.sln$/i, projectRe = /.*\.csproj$/i;
|
|
18
|
+
async function resolveTargets(rawTargets) {
|
|
19
|
+
if (!rawTargets || rawTargets.length === 0) {
|
|
20
|
+
return await findSolutions();
|
|
21
|
+
}
|
|
22
|
+
const regexTargets = parseMasks(rawTargets, false);
|
|
23
|
+
const interestingFiles = await findFiles([
|
|
24
|
+
solutionRe,
|
|
25
|
+
projectRe
|
|
26
|
+
]);
|
|
27
|
+
return interestingFiles.filter(filepath => {
|
|
28
|
+
for (const re of regexTargets) {
|
|
29
|
+
if (re.test(filepath)) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function findSolutions() {
|
|
37
|
+
return await findFiles([solutionRe]);
|
|
38
|
+
}
|
|
39
|
+
async function findFiles(match) {
|
|
40
|
+
return await ls(".", {
|
|
41
|
+
entities: FsEntities.files,
|
|
42
|
+
match,
|
|
43
|
+
recurse: true,
|
|
44
|
+
fullPaths: true,
|
|
45
|
+
doNotTraverse: [/node_modules/]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function parseMasks(masks, strict) {
|
|
49
|
+
// package masks can be raw strings or strings representing regular expressions
|
|
50
|
+
return masks.map(s => looksLikeRegex(s)
|
|
51
|
+
? new RegExp(s)
|
|
52
|
+
: looksLikeAGlob(s)
|
|
53
|
+
? createRegExpFromGlob(s)
|
|
54
|
+
: makeRegex(s, strict));
|
|
55
|
+
}
|
|
56
|
+
function makeRegex(s, strict) {
|
|
57
|
+
const escaped = s.replace(".", "\\.");
|
|
58
|
+
return strict
|
|
59
|
+
? new RegExp(`/^${escaped}$/i`)
|
|
60
|
+
: new RegExp(`/${escaped}/i`);
|
|
61
|
+
}
|
|
62
|
+
function createRegExpFrom(s) {
|
|
63
|
+
if (s.endsWith('/')) {
|
|
64
|
+
s += "i"; // make case-insensitive by default
|
|
65
|
+
}
|
|
66
|
+
return new RegExp(s);
|
|
67
|
+
}
|
|
68
|
+
function looksLikeAGlob(s) {
|
|
69
|
+
return s.includes("*");
|
|
70
|
+
}
|
|
71
|
+
function createRegExpFromGlob(str) {
|
|
72
|
+
return createRegExpFrom(str.replace(/\.\*/, "\\.*"));
|
|
73
|
+
}
|
|
74
|
+
function looksLikeRegex(s) {
|
|
75
|
+
return !!s && // defend against null and undefined
|
|
76
|
+
s.length > 2 && // must have at least 2 slashes
|
|
77
|
+
s.startsWith('/') && // must start with a slash
|
|
78
|
+
s.substring(1).includes('/'); // must have another slash somewhere (doesn't have to be the end because the caller can do /i (we'll do that automatically if not)
|
|
79
|
+
}
|
|
80
|
+
})();
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -454,6 +454,8 @@ declare global {
|
|
|
454
454
|
"GIT_TAG" |
|
|
455
455
|
"GIT_VERSION_INCREMENT_MESSAGE" |
|
|
456
456
|
"PACKAGE_REGISTRY" |
|
|
457
|
+
"UPGRADE_PACKAGES" |
|
|
458
|
+
"UPGRADE_PACKAGES_TARGET" |
|
|
457
459
|
string; // allow client-side extension, encourage usage of env.associate & env.register
|
|
458
460
|
|
|
459
461
|
type NumericEnvVar =
|
|
@@ -519,6 +521,8 @@ declare global {
|
|
|
519
521
|
"SKIP_NUGET_UPDATE" |
|
|
520
522
|
"PACK_INCREMENT_MINOR_ON_FIRST_PRERELEASE" |
|
|
521
523
|
"BUILD_TOOLS_INSTALL_FORCE_NUGET_EXE" |
|
|
524
|
+
"UPGRADE_PACKAGES_PROGRESS" |
|
|
525
|
+
"UPGRADE_PACKAGES_PRERELEASE" |
|
|
522
526
|
string;
|
|
523
527
|
|
|
524
528
|
type AnyEnvVar = StringEnvVar | NumericEnvVar | FlagEnvVar | VersionIncrementStrategy;
|
|
@@ -650,6 +654,8 @@ declare global {
|
|
|
650
654
|
GIT_TAG: StringEnvVar;
|
|
651
655
|
GIT_VERSION_INCREMENT_MESSAGE: StringEnvVar;
|
|
652
656
|
PACKAGE_REGISTRY: StringEnvVar;
|
|
657
|
+
UPGRADE_PACKAGES: StringEnvVar;
|
|
658
|
+
UPGRADE_PACKAGES_TARGET: StringEnvVar;
|
|
653
659
|
|
|
654
660
|
ENABLE_NUGET_PARALLEL_PROCESSING: FlagEnvVar;
|
|
655
661
|
BUILD_SHOW_INFO: FlagEnvVar;
|
|
@@ -696,6 +702,8 @@ declare global {
|
|
|
696
702
|
SKIP_NUGET_UPDATE: FlagEnvVar;
|
|
697
703
|
PACK_INCREMENT_MINOR_ON_FIRST_PRERELEASE: FlagEnvVar;
|
|
698
704
|
BUILD_TOOLS_INSTALL_FORCE_NUGET_EXE: FlagEnvVar;
|
|
705
|
+
UPGRADE_PACKAGES_PROGRESS: FlagEnvVar;
|
|
706
|
+
UPGRADE_PACKAGES_PRERELEASE: FlagEnvVar;
|
|
699
707
|
|
|
700
708
|
BUILD_MAX_CPU_COUNT: NumericEnvVar;
|
|
701
709
|
MAX_NUNIT_AGENTS: NumericEnvVar;
|