zarro 1.170.0 → 1.170.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.
- package/gulp-tasks/nuget-push.js +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function () {
|
|
3
|
+
gulp.task("nuget-push", "Pushes the latest versions of packages in the package build dir", async () => {
|
|
4
|
+
const debug = requireModule("debug")(__filename), path = require("path"), nugetPush = requireModule("nuget-push"), { ls, FsEntities } = require("yafs"), env = requireModule("env"), folder = env.resolve(env.PACK_TARGET_FOLDER), versionRe = /^(?<id>[A-Za-z\.]+)\.(?<version>\d\.\d\.\d)(-(?<tag>.*))?.nupkg$/, packages = await ls(folder, {
|
|
5
|
+
recurse: false,
|
|
6
|
+
entities: FsEntities.files,
|
|
7
|
+
match: versionRe
|
|
8
|
+
}), sorted = packages.sort().reverse(), seen = new Set();
|
|
9
|
+
if (sorted.length === 0) {
|
|
10
|
+
throw new Error(`No .nupkg files found in ${path.resolve(folder)}`);
|
|
11
|
+
}
|
|
12
|
+
const toPush = [];
|
|
13
|
+
for (const file of sorted) {
|
|
14
|
+
const match = file.match(versionRe), id = match === null || match === void 0 ? void 0 : match.groups["id"];
|
|
15
|
+
if (seen.has(id)) {
|
|
16
|
+
debug(`already seen ${id}, skipping ${file}`);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
seen.add(id);
|
|
20
|
+
toPush.push(file);
|
|
21
|
+
}
|
|
22
|
+
if (env.resolveFlag(env.DRY_RUN)) {
|
|
23
|
+
const log = requireModule("log");
|
|
24
|
+
log.info("DRY_RUN set, would have pushed packages:");
|
|
25
|
+
for (const item of toPush) {
|
|
26
|
+
log.info(` ${item}`);
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
for (const file of toPush) {
|
|
31
|
+
await nugetPush(path.join(folder, file));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
})();
|