zarro 1.115.0 → 1.115.1
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/pack.js +122 -118
- package/package.json +1 -1
package/gulp-tasks/pack.js
CHANGED
|
@@ -1,118 +1,122 @@
|
|
|
1
|
-
const getToolsFolder = requireModule("get-tools-folder"),
|
|
2
|
-
path = require("path"),
|
|
3
|
-
throwIfNoFiles = requireModule("throw-if-no-files"),
|
|
4
|
-
dotnetCli = require("gulp-dotnet-cli"),
|
|
5
|
-
dotnetPack = dotnetCli.pack,
|
|
6
|
-
{ incrementPackageVersion } = requireModule(
|
|
7
|
-
"gulp-increment-nuget-package-version"
|
|
8
|
-
),
|
|
9
|
-
resolveMasks = requireModule("resolve-masks"),
|
|
10
|
-
env = requireModule("env"),
|
|
11
|
-
fs = requireModule("fs"),
|
|
12
|
-
{ rewriteFile } = requireModule("rewrite-file"),
|
|
13
|
-
del = require("del"),
|
|
14
|
-
debug = require("debug")("pack"),
|
|
15
|
-
gulp = requireModule("gulp"),
|
|
16
|
-
{ pack } = requireModule("gulp-nuget-pack");
|
|
17
|
-
|
|
18
|
-
env.associate(
|
|
19
|
-
[
|
|
20
|
-
"PACKAGE_TARGET_FOLDER",
|
|
21
|
-
"DOTNET_CORE",
|
|
22
|
-
"PACK_INCLUDE_CSPROJ",
|
|
23
|
-
"PACK_EXCLUDE_CSPROJ",
|
|
24
|
-
"PACK_INCLUDE_NUSPEC",
|
|
25
|
-
"PACK_EXCLUDE_NUSPEC",
|
|
26
|
-
"PACK_INCREMENT_VERSION"
|
|
27
|
-
],
|
|
28
|
-
["pack"]
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
gulp.task(
|
|
32
|
-
"pack",
|
|
33
|
-
"Creates nupkgs from all nuspec files in this repo",
|
|
34
|
-
["prepack"],
|
|
35
|
-
() => {
|
|
36
|
-
const target = env.resolve("PACKAGE_TARGET_FOLDER"),
|
|
37
|
-
isDotnetCore = env.resolveFlag("DOTNET_CORE"),
|
|
38
|
-
incrementVersion = env.resolveFlag("PACK_INCREMENT_VERSION"),
|
|
39
|
-
packerFn = isDotnetCore ? packWithDotnetCore : packWithNuget;
|
|
40
|
-
debug({
|
|
41
|
-
isDotnetCore,
|
|
42
|
-
incrementVersion
|
|
43
|
-
});
|
|
44
|
-
return packerFn(target, incrementVersion);
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
function removeBadEntities(buffer) {
|
|
49
|
-
const
|
|
50
|
-
s = buffer.toString().replace(/
/g, "");
|
|
51
|
-
return Buffer.from(s);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function packWithNuget(target, incrementVersion) {
|
|
55
|
-
const nuspecs = resolveMasks(
|
|
56
|
-
"PACK_INCLUDE_NUSPEC",
|
|
57
|
-
"PACK_EXCLUDE_NUSPEC",
|
|
58
|
-
p => (p || "").match(/\.nuspec$/) ? p : `${p}.nuspec`
|
|
59
|
-
);
|
|
60
|
-
let stream = gulp
|
|
61
|
-
.src(nuspecs, `!${getToolsFolder()}/**/*`)
|
|
62
|
-
.pipe(throwIfNoFiles("No nuspec files found"));
|
|
63
|
-
if (incrementVersion) {
|
|
64
|
-
stream = stream
|
|
65
|
-
.pipe(incrementPackageVersion())
|
|
66
|
-
.pipe(rewriteFile(removeBadEntities));
|
|
67
|
-
}
|
|
68
|
-
return stream
|
|
69
|
-
.pipe(pack())
|
|
70
|
-
.pipe(gulp.dest(target));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function packWithDotnetCore(target, incrementVersion) {
|
|
74
|
-
const projects = resolveMasks("PACK_INCLUDE_CSPROJ", "PACK_EXCLUDE_CSPROJ", p => {
|
|
75
|
-
return (p || "").match(/\.csproj$/) ? p : `${p}.csproj`;
|
|
76
|
-
});
|
|
77
|
-
const configuration = env.resolve("PACK_CONFIGURATION");
|
|
78
|
-
debug({
|
|
79
|
-
projects,
|
|
80
|
-
configuration
|
|
81
|
-
});
|
|
82
|
-
let stream = gulp
|
|
83
|
-
.src(projects, `!${getToolsFolder()}/**/*`)
|
|
84
|
-
.pipe(
|
|
85
|
-
throwIfNoFiles(
|
|
86
|
-
"No target projects found to pack; check PACK_INCLUDE / PACK_EXCLUDE"
|
|
87
|
-
)
|
|
88
|
-
);
|
|
89
|
-
if (incrementVersion) {
|
|
90
|
-
stream = stream
|
|
91
|
-
.pipe(incrementPackageVersion())
|
|
92
|
-
.pipe(rewriteFile(removeBadEntities));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
1
|
+
const getToolsFolder = requireModule("get-tools-folder"),
|
|
2
|
+
path = require("path"),
|
|
3
|
+
throwIfNoFiles = requireModule("throw-if-no-files"),
|
|
4
|
+
dotnetCli = require("gulp-dotnet-cli"),
|
|
5
|
+
dotnetPack = dotnetCli.pack,
|
|
6
|
+
{ incrementPackageVersion } = requireModule(
|
|
7
|
+
"gulp-increment-nuget-package-version"
|
|
8
|
+
),
|
|
9
|
+
resolveMasks = requireModule("resolve-masks"),
|
|
10
|
+
env = requireModule("env"),
|
|
11
|
+
fs = requireModule("fs"),
|
|
12
|
+
{ rewriteFile } = requireModule("rewrite-file"),
|
|
13
|
+
del = require("del"),
|
|
14
|
+
debug = require("debug")("pack"),
|
|
15
|
+
gulp = requireModule("gulp"),
|
|
16
|
+
{ pack } = requireModule("gulp-nuget-pack");
|
|
17
|
+
|
|
18
|
+
env.associate(
|
|
19
|
+
[
|
|
20
|
+
"PACKAGE_TARGET_FOLDER",
|
|
21
|
+
"DOTNET_CORE",
|
|
22
|
+
"PACK_INCLUDE_CSPROJ",
|
|
23
|
+
"PACK_EXCLUDE_CSPROJ",
|
|
24
|
+
"PACK_INCLUDE_NUSPEC",
|
|
25
|
+
"PACK_EXCLUDE_NUSPEC",
|
|
26
|
+
"PACK_INCREMENT_VERSION"
|
|
27
|
+
],
|
|
28
|
+
["pack"]
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
gulp.task(
|
|
32
|
+
"pack",
|
|
33
|
+
"Creates nupkgs from all nuspec files in this repo",
|
|
34
|
+
["prepack"],
|
|
35
|
+
() => {
|
|
36
|
+
const target = env.resolve("PACKAGE_TARGET_FOLDER"),
|
|
37
|
+
isDotnetCore = env.resolveFlag("DOTNET_CORE"),
|
|
38
|
+
incrementVersion = env.resolveFlag("PACK_INCREMENT_VERSION"),
|
|
39
|
+
packerFn = isDotnetCore ? packWithDotnetCore : packWithNuget;
|
|
40
|
+
debug({
|
|
41
|
+
isDotnetCore,
|
|
42
|
+
incrementVersion
|
|
43
|
+
});
|
|
44
|
+
return packerFn(target, incrementVersion);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
function removeBadEntities(buffer) {
|
|
49
|
+
const
|
|
50
|
+
s = buffer.toString().replace(/
/g, "");
|
|
51
|
+
return Buffer.from(s);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function packWithNuget(target, incrementVersion) {
|
|
55
|
+
const nuspecs = resolveMasks(
|
|
56
|
+
"PACK_INCLUDE_NUSPEC",
|
|
57
|
+
"PACK_EXCLUDE_NUSPEC",
|
|
58
|
+
p => (p || "").match(/\.nuspec$/) ? p : `${p}.nuspec`
|
|
59
|
+
);
|
|
60
|
+
let stream = gulp
|
|
61
|
+
.src(nuspecs, `!${getToolsFolder()}/**/*`)
|
|
62
|
+
.pipe(throwIfNoFiles("No nuspec files found"));
|
|
63
|
+
if (incrementVersion) {
|
|
64
|
+
stream = stream
|
|
65
|
+
.pipe(incrementPackageVersion())
|
|
66
|
+
.pipe(rewriteFile(removeBadEntities));
|
|
67
|
+
}
|
|
68
|
+
return stream
|
|
69
|
+
.pipe(pack())
|
|
70
|
+
.pipe(gulp.dest(target));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function packWithDotnetCore(target, incrementVersion) {
|
|
74
|
+
const projects = resolveMasks("PACK_INCLUDE_CSPROJ", "PACK_EXCLUDE_CSPROJ", p => {
|
|
75
|
+
return (p || "").match(/\.csproj$/) ? p : `${p}.csproj`;
|
|
76
|
+
});
|
|
77
|
+
const configuration = env.resolve("PACK_CONFIGURATION");
|
|
78
|
+
debug({
|
|
79
|
+
projects,
|
|
80
|
+
configuration
|
|
81
|
+
});
|
|
82
|
+
let stream = gulp
|
|
83
|
+
.src(projects, `!${getToolsFolder()}/**/*`)
|
|
84
|
+
.pipe(
|
|
85
|
+
throwIfNoFiles(
|
|
86
|
+
"No target projects found to pack; check PACK_INCLUDE / PACK_EXCLUDE"
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
if (incrementVersion) {
|
|
90
|
+
stream = stream
|
|
91
|
+
.pipe(incrementPackageVersion())
|
|
92
|
+
.pipe(rewriteFile(removeBadEntities));
|
|
93
|
+
}
|
|
94
|
+
const packConfig = {
|
|
95
|
+
output: path.resolve(target),
|
|
96
|
+
configuration
|
|
97
|
+
};
|
|
98
|
+
if (process.env["PACK_VERSION"] !== undefined) {
|
|
99
|
+
packConfig.version = process.env["PACK_VERSION"]
|
|
100
|
+
}
|
|
101
|
+
return stream.pipe(
|
|
102
|
+
dotnetPack(packConfig)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
gulp.task(
|
|
107
|
+
"prepack",
|
|
108
|
+
"Skeleton task which you can replace to run logic just before packing",
|
|
109
|
+
() => {
|
|
110
|
+
return Promise.resolve();
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
gulp.task(
|
|
115
|
+
"clean-packages",
|
|
116
|
+
"Removes any existing package artifacts",
|
|
117
|
+
async () => {
|
|
118
|
+
const packageFolder = process.env.PACKAGE_TARGET_FOLDER || "packages";
|
|
119
|
+
await del(packageFolder);
|
|
120
|
+
await fs.ensureDirectoryExists(packageFolder);
|
|
121
|
+
}
|
|
122
|
+
);
|