zarro 1.92.0

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.
Files changed (201) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +260 -0
  3. package/gulp-tasks/.editorconfig +8 -0
  4. package/gulp-tasks/.git +1 -0
  5. package/gulp-tasks/.gitignore +9 -0
  6. package/gulp-tasks/.gitmodules +0 -0
  7. package/gulp-tasks/LICENSE +24 -0
  8. package/gulp-tasks/README.md +144 -0
  9. package/gulp-tasks/build.js +135 -0
  10. package/gulp-tasks/clean.js +37 -0
  11. package/gulp-tasks/cover-dotnet.js +56 -0
  12. package/gulp-tasks/default-report-generator.js +51 -0
  13. package/gulp-tasks/default-tools-installer.js +33 -0
  14. package/gulp-tasks/default.js +17 -0
  15. package/gulp-tasks/dotnet-publish.js +23 -0
  16. package/gulp-tasks/generate-reports.js +7 -0
  17. package/gulp-tasks/get-local-nuget.js +16 -0
  18. package/gulp-tasks/git-submodules.js +83 -0
  19. package/gulp-tasks/increment-package-json-version.js +12 -0
  20. package/gulp-tasks/increment-package-json-version.ts +17 -0
  21. package/gulp-tasks/install-tools.js +24 -0
  22. package/gulp-tasks/modules/add-stream-on-any-handler.js +31 -0
  23. package/gulp-tasks/modules/alter-package-json-version.js +64 -0
  24. package/gulp-tasks/modules/alter-package-json-version.ts +113 -0
  25. package/gulp-tasks/modules/are-all-dotnet-core.js +96 -0
  26. package/gulp-tasks/modules/ask.js +31 -0
  27. package/gulp-tasks/modules/ask.ts +41 -0
  28. package/gulp-tasks/modules/collect-files.js +15 -0
  29. package/gulp-tasks/modules/collect-files.ts +16 -0
  30. package/gulp-tasks/modules/config-generator.js +10 -0
  31. package/gulp-tasks/modules/defaults.js +9 -0
  32. package/gulp-tasks/modules/download-nuget.js +104 -0
  33. package/gulp-tasks/modules/ensure-folder-exists.js +21 -0
  34. package/gulp-tasks/modules/env-helpers.js +49 -0
  35. package/gulp-tasks/modules/env-helpers.ts +67 -0
  36. package/gulp-tasks/modules/env.js +364 -0
  37. package/gulp-tasks/modules/exec.js +257 -0
  38. package/gulp-tasks/modules/exec.ts +346 -0
  39. package/gulp-tasks/modules/fail-after.js +30 -0
  40. package/gulp-tasks/modules/fail-after.ts +34 -0
  41. package/gulp-tasks/modules/fallback.js +6 -0
  42. package/gulp-tasks/modules/find-dirs.js +39 -0
  43. package/gulp-tasks/modules/find-local-nuget.js +42 -0
  44. package/gulp-tasks/modules/find-npm-base.js +42 -0
  45. package/gulp-tasks/modules/fs.js +79 -0
  46. package/gulp-tasks/modules/gather-paths.js +23 -0
  47. package/gulp-tasks/modules/gather-paths.ts +29 -0
  48. package/gulp-tasks/modules/generate-env-help-for.js +30 -0
  49. package/gulp-tasks/modules/get-tools-folder.js +12 -0
  50. package/gulp-tasks/modules/git-push-tags.js +33 -0
  51. package/gulp-tasks/modules/git-push-tags.ts +42 -0
  52. package/gulp-tasks/modules/git-push.js +51 -0
  53. package/gulp-tasks/modules/git-tag.js +36 -0
  54. package/gulp-tasks/modules/gulp-dotnetcover.js +537 -0
  55. package/gulp-tasks/modules/gulp-git-tag-from-csproj.js +50 -0
  56. package/gulp-tasks/modules/gulp-git-tag-from-csproj.ts +71 -0
  57. package/gulp-tasks/modules/gulp-git-tag-from-package-nuspec.js +55 -0
  58. package/gulp-tasks/modules/gulp-increment-nuget-package-dependency-version.js +40 -0
  59. package/gulp-tasks/modules/gulp-increment-nuget-package-version.js +87 -0
  60. package/gulp-tasks/modules/gulp-increment-nuget-package-version.ts +122 -0
  61. package/gulp-tasks/modules/gulp-msbuild.js +1 -0
  62. package/gulp-tasks/modules/gulp-npm-run.js +40 -0
  63. package/gulp-tasks/modules/gulp-npm-run.ts +52 -0
  64. package/gulp-tasks/modules/gulp-nuget-pack.js +168 -0
  65. package/gulp-tasks/modules/gulp-nuget-restore.js +106 -0
  66. package/gulp-tasks/modules/gulp-nunit-runner/.jshintrc +5 -0
  67. package/gulp-tasks/modules/gulp-nunit-runner/.npmignore +16 -0
  68. package/gulp-tasks/modules/gulp-nunit-runner/LICENSE +21 -0
  69. package/gulp-tasks/modules/gulp-nunit-runner/README.md +300 -0
  70. package/gulp-tasks/modules/gulp-nunit-runner/index.js +1 -0
  71. package/gulp-tasks/modules/gulp-nunit-runner/lib/index.js +205 -0
  72. package/gulp-tasks/modules/gulp-nunit-runner/lib/teamcity.js +86 -0
  73. package/gulp-tasks/modules/gulp-purge.js +88 -0
  74. package/gulp-tasks/modules/gulp-util.js +5 -0
  75. package/gulp-tasks/modules/gulp-version.js +8 -0
  76. package/gulp-tasks/modules/gulp-with-help.js +1 -0
  77. package/gulp-tasks/modules/gulp-xbuild.js +62 -0
  78. package/gulp-tasks/modules/gulp.js +92 -0
  79. package/gulp-tasks/modules/http-downloader.js +113 -0
  80. package/gulp-tasks/modules/import-npm-tasks.js +33 -0
  81. package/gulp-tasks/modules/increment-version-string.js +18 -0
  82. package/gulp-tasks/modules/increment-version.js +30 -0
  83. package/gulp-tasks/modules/increment-version.ts +41 -0
  84. package/gulp-tasks/modules/install-local-tools.js +122 -0
  85. package/gulp-tasks/modules/load-xml-file.js +12 -0
  86. package/gulp-tasks/modules/load-xml-file.ts +15 -0
  87. package/gulp-tasks/modules/log-config.js +31 -0
  88. package/gulp-tasks/modules/log.js +142 -0
  89. package/gulp-tasks/modules/longest-string-length.js +13 -0
  90. package/gulp-tasks/modules/looks-like-a-promise.js +11 -0
  91. package/gulp-tasks/modules/ls-r.js +52 -0
  92. package/gulp-tasks/modules/multi-split.js +29 -0
  93. package/gulp-tasks/modules/net-framework-test-assembly-filter.js +45 -0
  94. package/gulp-tasks/modules/nuget-push.js +66 -0
  95. package/gulp-tasks/modules/nuget-update-self.js +9 -0
  96. package/gulp-tasks/modules/nuget.js +8 -0
  97. package/gulp-tasks/modules/nuget.ts +14 -0
  98. package/gulp-tasks/modules/pad-left.js +4 -0
  99. package/gulp-tasks/modules/pad-right.js +4 -0
  100. package/gulp-tasks/modules/pad.js +25 -0
  101. package/gulp-tasks/modules/parse-xml-string.js +5 -0
  102. package/gulp-tasks/modules/parse-xml-string.ts +6 -0
  103. package/gulp-tasks/modules/parse-xml.js +14 -0
  104. package/gulp-tasks/modules/parse-xml.ts +15 -0
  105. package/gulp-tasks/modules/path-unquote.js +6 -0
  106. package/gulp-tasks/modules/promisify-function.js +19 -0
  107. package/gulp-tasks/modules/promisify-function.ts +18 -0
  108. package/gulp-tasks/modules/promisify-stream.js +73 -0
  109. package/gulp-tasks/modules/promisify.js +1 -0
  110. package/gulp-tasks/modules/quote-if-required.js +14 -0
  111. package/gulp-tasks/modules/read-all-git-branches.js +10 -0
  112. package/gulp-tasks/modules/read-all-git-branches.ts +13 -0
  113. package/gulp-tasks/modules/read-all-git-remotes.js +36 -0
  114. package/gulp-tasks/modules/read-all-git-remotes.ts +44 -0
  115. package/gulp-tasks/modules/read-csproj-package-version.js +16 -0
  116. package/gulp-tasks/modules/read-csproj-package-version.ts +26 -0
  117. package/gulp-tasks/modules/read-csproj-version.js +16 -0
  118. package/gulp-tasks/modules/read-csproj-version.ts +26 -0
  119. package/gulp-tasks/modules/read-current-git-branch.js +12 -0
  120. package/gulp-tasks/modules/read-current-git-branch.ts +16 -0
  121. package/gulp-tasks/modules/read-git-commit-delta-count.js +21 -0
  122. package/gulp-tasks/modules/read-git-commit-delta-count.ts +33 -0
  123. package/gulp-tasks/modules/read-git-info.js +28 -0
  124. package/gulp-tasks/modules/read-git-info.ts +31 -0
  125. package/gulp-tasks/modules/read-git-remote.js +17 -0
  126. package/gulp-tasks/modules/read-git-remote.ts +23 -0
  127. package/gulp-tasks/modules/read-last-fetch-time.js +21 -0
  128. package/gulp-tasks/modules/read-last-fetch-time.ts +17 -0
  129. package/gulp-tasks/modules/read-main-branch-name.js +48 -0
  130. package/gulp-tasks/modules/read-main-branch-name.ts +76 -0
  131. package/gulp-tasks/modules/read-nuspec-version.js +14 -0
  132. package/gulp-tasks/modules/read-nuspec-version.ts +22 -0
  133. package/gulp-tasks/modules/read-package-json.js +16 -0
  134. package/gulp-tasks/modules/read-package-json.ts +22 -0
  135. package/gulp-tasks/modules/read-package-version.js +8 -0
  136. package/gulp-tasks/modules/read-package-version.ts +10 -0
  137. package/gulp-tasks/modules/read-text-file.js +14 -0
  138. package/gulp-tasks/modules/read-text-file.ts +14 -0
  139. package/gulp-tasks/modules/reduce-gulp-noise.js +34 -0
  140. package/gulp-tasks/modules/register-environment-variables.js +526 -0
  141. package/gulp-tasks/modules/require-module.js +28 -0
  142. package/gulp-tasks/modules/resolve-git-branch.js +11 -0
  143. package/gulp-tasks/modules/resolve-git-branch.ts +13 -0
  144. package/gulp-tasks/modules/resolve-git-remote.js +11 -0
  145. package/gulp-tasks/modules/resolve-git-remote.ts +13 -0
  146. package/gulp-tasks/modules/resolve-masks.js +47 -0
  147. package/gulp-tasks/modules/resolve-nuget.js +135 -0
  148. package/gulp-tasks/modules/resolve-test-masks.js +10 -0
  149. package/gulp-tasks/modules/rewrite-file.js +26 -0
  150. package/gulp-tasks/modules/rewrite-file.ts +34 -0
  151. package/gulp-tasks/modules/rimraf.js +21 -0
  152. package/gulp-tasks/modules/rimraf.ts +31 -0
  153. package/gulp-tasks/modules/run-sequence.js +16 -0
  154. package/gulp-tasks/modules/safe-git.js +23 -0
  155. package/gulp-tasks/modules/safe-git.ts +23 -0
  156. package/gulp-tasks/modules/seed.js +12 -0
  157. package/gulp-tasks/modules/set-task-name.js +9 -0
  158. package/gulp-tasks/modules/sleep.js +5 -0
  159. package/gulp-tasks/modules/spawn-nuget.js +13 -0
  160. package/gulp-tasks/modules/spawn.js +103 -0
  161. package/gulp-tasks/modules/split-path.js +3 -0
  162. package/gulp-tasks/modules/stat.js +8 -0
  163. package/gulp-tasks/modules/status.js +57 -0
  164. package/gulp-tasks/modules/status.ts +71 -0
  165. package/gulp-tasks/modules/test-path.js +3 -0
  166. package/gulp-tasks/modules/testutil-finder.js +176 -0
  167. package/gulp-tasks/modules/throw-if-no-files.js +15 -0
  168. package/gulp-tasks/modules/uniq.js +6 -0
  169. package/gulp-tasks/modules/uniq.ts +5 -0
  170. package/gulp-tasks/modules/verify-exe.js +17 -0
  171. package/gulp-tasks/modules/version-reading-shared.js +12 -0
  172. package/gulp-tasks/modules/version-reading-shared.ts +16 -0
  173. package/gulp-tasks/modules/write-text-file.js +10 -0
  174. package/gulp-tasks/modules/zarro-error.js +6 -0
  175. package/gulp-tasks/nuget-restore.js +57 -0
  176. package/gulp-tasks/pack.js +118 -0
  177. package/gulp-tasks/purge.js +94 -0
  178. package/gulp-tasks/release-npm.js +58 -0
  179. package/gulp-tasks/release-npm.ts +81 -0
  180. package/gulp-tasks/start/_package.json +39 -0
  181. package/gulp-tasks/start/gulpfile.js +204 -0
  182. package/gulp-tasks/start/update-starter-packages.js +63 -0
  183. package/gulp-tasks/test-dotnet.js +195 -0
  184. package/gulp-tasks/update-git-submodules.js +11 -0
  185. package/gulp-tasks/update-git-submodules.ts +29 -0
  186. package/gulp-tasks/update-self.js +65 -0
  187. package/gulp-tasks/update-self.ts +88 -0
  188. package/gulp-tasks/verify-up-to-date.js +77 -0
  189. package/gulp-tasks/verify-up-to-date.ts +119 -0
  190. package/index-modules/contains-any.js +31 -0
  191. package/index-modules/gather-args.js +21 -0
  192. package/index-modules/handlers/help.js +17 -0
  193. package/index-modules/handlers/init.js +57 -0
  194. package/index-modules/handlers/invoke-gulp.js +111 -0
  195. package/index-modules/handlers/show-env.js +46 -0
  196. package/index-modules/is-dir.js +6 -0
  197. package/index-modules/is-file.js +6 -0
  198. package/index.js +53 -0
  199. package/package.json +96 -0
  200. package/tsconfig.json +66 -0
  201. package/types.d.ts +753 -0
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ (function () {
4
+ const PLUGIN_NAME = __filename.replace(/\.js$/, ""), gutil = requireModule("gulp-util"), loadXmlFile = requireModule("load-xml-file"), es = require("event-stream"), gitTag = requireModule("git-tag"), gitPushTags = requireModule("git-push-tags"), gitPush = requireModule("git-push"), { ZarroError } = requireModule("zarro-error"), defaultOptions = {
5
+ push: true,
6
+ dryRun: false
7
+ };
8
+ module.exports = function gitTagFromCsProj(options) {
9
+ const opts = Object.assign({}, defaultOptions, options);
10
+ const csprojFiles = [];
11
+ return es.through(async function write(file) {
12
+ csprojFiles.push(file.path);
13
+ this.emit("data", file);
14
+ }, async function end() {
15
+ if (csprojFiles.length == 0) {
16
+ throw new ZarroError("no csproj files found to tag from?");
17
+ }
18
+ if (csprojFiles.length > 1) {
19
+ throw new ZarroError(`too many csproj files! specify the one to use for creating a versioned tag!\n${csprojFiles.join("\n- ")}`);
20
+ }
21
+ const xml = await loadXmlFile(csprojFiles[0]), version = findPackageVersion(xml, csprojFiles[0]);
22
+ if (opts.dryRun) {
23
+ console.log(`Dry run: would have tagged at ${version}`);
24
+ return this.emit("end");
25
+ }
26
+ try {
27
+ await gitTag({
28
+ tag: `v${version}`,
29
+ comment: `:bookmark: ${version}`
30
+ });
31
+ if (opts.push) {
32
+ await gitPushTags();
33
+ await gitPush();
34
+ gutil.log(gutil.colors.green("-> all commits and tags pushed!"));
35
+ }
36
+ this.emit("end");
37
+ }
38
+ catch (e) {
39
+ this.emit("error", new gutil.PluginError(PLUGIN_NAME, e));
40
+ }
41
+ });
42
+ };
43
+ function findPackageVersion(xml, fileName) {
44
+ const packageVersionPropGroup = xml.Project.PropertyGroup.filter((g) => !!g.PackageVersion)[0];
45
+ if (!packageVersionPropGroup || (packageVersionPropGroup.PackageVersion[0] || "").trim() === "") {
46
+ throw new ZarroError(`No valid PackageVersion node found in any PropertyGroup within ${fileName}`);
47
+ }
48
+ return packageVersionPropGroup.PackageVersion[0].trim();
49
+ }
50
+ })();
@@ -0,0 +1,71 @@
1
+ import * as vinyl from "vinyl";
2
+ import { Stream } from "stream";
3
+
4
+ (function() {
5
+ const
6
+ PLUGIN_NAME = __filename.replace(/\.js$/, ""),
7
+ gutil = requireModule<GulpUtil>("gulp-util"),
8
+ loadXmlFile = requireModule<LoadXmlFile>("load-xml-file"),
9
+ es = require("event-stream"),
10
+ gitTag = requireModule<GitTag>("git-tag"),
11
+ gitPushTags = requireModule<GitPushTags>("git-push-tags"),
12
+ gitPush = requireModule<GitPush>("git-push"),
13
+ { ZarroError } = requireModule("zarro-error"),
14
+ defaultOptions = {
15
+ push: true,
16
+ dryRun: false
17
+ } as Partial<GitTagOptions>;
18
+
19
+ module.exports = function gitTagFromCsProj(options?: GitTagFromCsProjOptions) {
20
+ const opts = Object.assign({}, defaultOptions, options) as GitTagFromCsProjOptions;
21
+ const csprojFiles: string[] = [];
22
+ return es.through(
23
+ async function write(this: Stream, file: vinyl.BufferFile) {
24
+ csprojFiles.push(file.path);
25
+ this.emit("data", file);
26
+ },
27
+ async function end(this: Stream) {
28
+ if (csprojFiles.length == 0) {
29
+ throw new ZarroError("no csproj files found to tag from?");
30
+ }
31
+ if (csprojFiles.length > 1) {
32
+ throw new ZarroError(
33
+ `too many csproj files! specify the one to use for creating a versioned tag!\n${ csprojFiles.join(
34
+ "\n- "
35
+ ) }`
36
+ );
37
+ }
38
+ const xml = await loadXmlFile(csprojFiles[0]),
39
+ version = findPackageVersion(xml, csprojFiles[0]);
40
+ if (opts.dryRun) {
41
+ console.log(`Dry run: would have tagged at ${ version }`);
42
+ return this.emit("end");
43
+ }
44
+ try {
45
+ await gitTag({
46
+ tag: `v${ version }`,
47
+ comment: `:bookmark: ${ version }`
48
+ });
49
+ if (opts.push) {
50
+ await gitPushTags();
51
+ await gitPush();
52
+ gutil.log(gutil.colors.green("-> all commits and tags pushed!"));
53
+ }
54
+ this.emit("end");
55
+ } catch (e) {
56
+ this.emit("error", new gutil.PluginError(PLUGIN_NAME, e));
57
+ }
58
+ }
59
+ );
60
+ };
61
+
62
+ function findPackageVersion(xml: any, fileName: string) {
63
+ const packageVersionPropGroup = xml.Project.PropertyGroup.filter(
64
+ (g: any) => !!g.PackageVersion
65
+ )[0];
66
+ if (!packageVersionPropGroup || (packageVersionPropGroup.PackageVersion[0] || "").trim() === "") {
67
+ throw new ZarroError(`No valid PackageVersion node found in any PropertyGroup within ${ fileName }`);
68
+ }
69
+ return packageVersionPropGroup.PackageVersion[0].trim();
70
+ }
71
+ })();
@@ -0,0 +1,55 @@
1
+ const
2
+ PLUGIN_NAME = __filename.replace(/\.js$/, ""),
3
+ gutil = requireModule("gulp-util"),
4
+ loadXmlFile = requireModule("load-xml-file"),
5
+ es = require("event-stream"),
6
+ gitTag = requireModule("git-tag"),
7
+ gitPushTags = requireModule("git-push-tags"),
8
+ gitPush = requireModule("git-push"),
9
+ { ZarroError } = requireModule("zarro-error"),
10
+ defaultOptions = {
11
+ push: true,
12
+ dryRun: false
13
+ };
14
+
15
+ module.exports = function gitTagFromPackageNuspec(options) {
16
+ options = Object.assign({}, defaultOptions, options);
17
+ const nuspecs = [];
18
+ return es.through(
19
+ async function write(file) {
20
+ nuspecs.push(file.path);
21
+ this.emit("data", file);
22
+ },
23
+ async function end() {
24
+ if (nuspecs.length == 0) {
25
+ throw new ZarroError("no nuspecs found to tag from?");
26
+ }
27
+ if (nuspecs.length > 1) {
28
+ throw new ZarroError(
29
+ `too many nuspecs! specify the one to use for creating a versioned tag!\n${nuspecs.join(
30
+ "\n- "
31
+ )}`
32
+ );
33
+ }
34
+ const xml = await loadXmlFile(nuspecs[0]),
35
+ version = xml.package.metadata[0].version[0].trim();
36
+
37
+ if (options.dryRun) {
38
+ console.log(`Dry run: would have tagged at ${version}`);
39
+ return this.emit("end");
40
+ }
41
+
42
+ try {
43
+ await gitTag(`v${version}`, `:bookmark: ${version}`);
44
+ if (options.push) {
45
+ await gitPushTags();
46
+ await gitPush();
47
+ gutil.log(gutil.colors.green("-> all commits and tags pushed!"));
48
+ }
49
+ this.emit("end");
50
+ } catch (e) {
51
+ this.emit("error", new gutil.PluginError(PLUGIN_NAME, e));
52
+ }
53
+ }
54
+ );
55
+ };
@@ -0,0 +1,40 @@
1
+ const
2
+ gutil = requireModule("gulp-util"),
3
+ editXml = require("gulp-edit-xml"),
4
+ incrementVersion = require("./increment-version-string");
5
+
6
+ module.exports = function incrementDependencyVersion(packageMatch) {
7
+ if (typeof packageMatch === "string") {
8
+ packageMatch = new RegExp(`^${packageMatch}$`);
9
+ }
10
+ return editXml(
11
+ xml => {
12
+ const
13
+ meta = xml.package.metadata[0],
14
+ packageId = meta.id[0],
15
+ dependencies = meta.dependencies[0].group;
16
+ dependencies.forEach(dep => {
17
+ var dependency = (dep.dependency || [])[0];
18
+ if (!dependency) {
19
+ return;
20
+ }
21
+ if ((dependency.$.id || "").match(packageMatch)) {
22
+ const newVersion = incrementVersion(dependency.$.version);
23
+ gutil.log(
24
+ gutil.colors.yellow(
25
+ `${packageId}: dependency ${
26
+ dependency.$.id
27
+ } version incremented to: ${newVersion}`
28
+ )
29
+ );
30
+ dependency.$.version = newVersion;
31
+ }
32
+ });
33
+ return xml;
34
+ },
35
+ {
36
+ builderOptions: { renderOpts: { pretty: true } }
37
+ }
38
+ );
39
+ }
40
+
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ (function () {
3
+ const gutil = requireModule("gulp-util"), debug = require("debug")("gulp-increment-nuget-package-version"), editXml = require("gulp-edit-xml"), incrementVersion = require("./increment-version-string"), { ZarroError } = requireModule("zarro-error"), xmlOpts = {
4
+ builderOptions: {
5
+ renderOpts: {
6
+ pretty: true
7
+ }
8
+ }
9
+ };
10
+ // FIXME: proper types plz
11
+ function incrementPackageVersionInCsProj(xml, file) {
12
+ debug(JSON.stringify(xml, null, 2));
13
+ const packageVersionPropGroup = xml.Project.PropertyGroup.filter((g) => !!g.PackageVersion)[0];
14
+ if (!packageVersionPropGroup) {
15
+ debug("No PropertyGroup found with PackageVersion node");
16
+ return xml;
17
+ }
18
+ const node = packageVersionPropGroup.PackageVersion;
19
+ const newVersion = incrementVersion(node[0]);
20
+ node[0] = newVersion;
21
+ let packageIdPropGroup = xml.Project.PropertyGroup.filter((g) => !!g.PackageId)[0];
22
+ let packageName = "(unknown)";
23
+ if (!packageIdPropGroup) {
24
+ if (!file) {
25
+ throw new ZarroError([
26
+ `the installed version of gulp-edit-xml does not pass in the file being operated on.`,
27
+ `either:`,
28
+ `- update to the latest version`,
29
+ ` or`,
30
+ `- set the version to use "https://github.com/fluffynuts/gulp-edit-xml.git#pass-file-to-transform"`,
31
+ ` (if the update doesn't make this message go away)`
32
+ ].join("\n"));
33
+ }
34
+ const filePath = file.history[0];
35
+ packageIdPropGroup = xml.Project.PropertyGroup.filter((g) => !!g.AssemblyName)[0];
36
+ if (!packageIdPropGroup) {
37
+ debug({
38
+ file: JSON.stringify(file),
39
+ fileName: file.name,
40
+ stat: file.stat,
41
+ string: file.toString(),
42
+ hist: filePath
43
+ });
44
+ if (filePath) {
45
+ const parts = filePath.split(/[\\/]/);
46
+ debug({
47
+ parts
48
+ });
49
+ packageName = parts[parts.length - 2] || packageName;
50
+ }
51
+ }
52
+ else {
53
+ packageName = (packageIdPropGroup.AssemblyName[0] || packageName).trim();
54
+ }
55
+ }
56
+ else {
57
+ packageName = (packageIdPropGroup.PackageId[0] || packageName).trim();
58
+ }
59
+ gutil.log(gutil.colors.yellow(`${packageName}: package version incremented to: ${newVersion}`));
60
+ debug({
61
+ label: "final xml",
62
+ doc: JSON.stringify(xml, null, 2)
63
+ });
64
+ return xml;
65
+ }
66
+ function incrementPackageVersionInNuspec(xml, file) {
67
+ const meta = xml.package.metadata[0], packageName = meta.id[0], node = meta.version, current = node[0];
68
+ const newVersion = incrementVersion(current);
69
+ node[0] = newVersion;
70
+ gutil.log(gutil.colors.yellow(`${packageName}: package version incremented to: ${newVersion}`));
71
+ return xml;
72
+ }
73
+ function incrementPackageVersion() {
74
+ return editXml((xml, file) => {
75
+ if (xml.package) {
76
+ return incrementPackageVersionInNuspec(xml, file);
77
+ }
78
+ else if (xml.Project) {
79
+ return incrementPackageVersionInCsProj(xml, file);
80
+ }
81
+ throw new ZarroError(`Don't know how to increment package version in document:\n\n${JSON.stringify(xml)}`);
82
+ }, xmlOpts);
83
+ }
84
+ module.exports = {
85
+ incrementPackageVersion
86
+ };
87
+ })();
@@ -0,0 +1,122 @@
1
+ (function () {
2
+ const gutil = requireModule<GulpUtil>("gulp-util"),
3
+ debug = require("debug")("gulp-increment-nuget-package-version"),
4
+ editXml = require("gulp-edit-xml"),
5
+ incrementVersion = require("./increment-version-string"),
6
+ { ZarroError } = requireModule("zarro-error"),
7
+ xmlOpts = {
8
+ builderOptions: {
9
+ renderOpts: {
10
+ pretty: true
11
+ }
12
+ }
13
+ };
14
+
15
+ // FIXME: proper types plz
16
+ function incrementPackageVersionInCsProj(xml: any, file: any) {
17
+ debug(JSON.stringify(xml, null, 2));
18
+ const packageVersionPropGroup = xml.Project.PropertyGroup.filter(
19
+ (g: any) => !!g.PackageVersion
20
+ )[0];
21
+ if (!packageVersionPropGroup) {
22
+ debug("No PropertyGroup found with PackageVersion node");
23
+ return xml;
24
+ }
25
+ const node = packageVersionPropGroup.PackageVersion;
26
+ const newVersion = incrementVersion(node[0]);
27
+ node[0] = newVersion;
28
+
29
+ let packageIdPropGroup = xml.Project.PropertyGroup.filter(
30
+ (g: any) => !!g.PackageId
31
+ )[0];
32
+ let packageName = "(unknown)";
33
+ if (!packageIdPropGroup) {
34
+ if (!file) {
35
+ throw new ZarroError([
36
+ `the installed version of gulp-edit-xml does not pass in the file being operated on.`,
37
+ `either:`,
38
+ `- update to the latest version`,
39
+ ` or`,
40
+ `- set the version to use "https://github.com/fluffynuts/gulp-edit-xml.git#pass-file-to-transform"`,
41
+ ` (if the update doesn't make this message go away)`
42
+ ].join("\n"));
43
+ }
44
+ const filePath = file.history[0];
45
+ packageIdPropGroup = xml.Project.PropertyGroup.filter(
46
+ (g: any) => !!g.AssemblyName
47
+ )[0];
48
+ if (!packageIdPropGroup) {
49
+ debug({
50
+ file: JSON.stringify(file),
51
+ fileName: file.name,
52
+ stat: file.stat,
53
+ string: file.toString(),
54
+ hist: filePath
55
+ });
56
+
57
+ if (filePath) {
58
+ const parts = filePath.split(/[\\/]/);
59
+ debug({
60
+ parts
61
+ });
62
+ packageName = parts[parts.length - 2] || packageName;
63
+ }
64
+ } else {
65
+ packageName = (packageIdPropGroup.AssemblyName[0] || packageName).trim();
66
+ }
67
+ } else {
68
+ packageName = (packageIdPropGroup.PackageId[0] || packageName).trim();
69
+ }
70
+
71
+ gutil.log(
72
+ gutil.colors.yellow(
73
+ `${packageName}: package version incremented to: ${newVersion}`
74
+ )
75
+ );
76
+
77
+ debug({
78
+ label: "final xml",
79
+ doc: JSON.stringify(xml, null, 2)
80
+ });
81
+
82
+ return xml;
83
+ }
84
+
85
+ function incrementPackageVersionInNuspec(xml: any, file: any) {
86
+ const meta = xml.package.metadata[0],
87
+ packageName = meta.id[0],
88
+ node = meta.version,
89
+ current = node[0];
90
+ const newVersion = incrementVersion(current);
91
+ node[0] = newVersion;
92
+ gutil.log(
93
+ gutil.colors.yellow(
94
+ `${packageName}: package version incremented to: ${newVersion}`
95
+ )
96
+ );
97
+ return xml;
98
+ }
99
+
100
+ function incrementPackageVersion() {
101
+ return editXml(
102
+ (xml: any, file: any) => {
103
+ if (xml.package) {
104
+ return incrementPackageVersionInNuspec(xml, file);
105
+ } else if (xml.Project) {
106
+ return incrementPackageVersionInCsProj(xml, file);
107
+ }
108
+ throw new ZarroError(
109
+ `Don't know how to increment package version in document:\n\n${JSON.stringify(
110
+ xml
111
+ )}`
112
+ );
113
+ },
114
+ xmlOpts
115
+ );
116
+ }
117
+
118
+ module.exports = {
119
+ incrementPackageVersion
120
+ };
121
+
122
+ })();
@@ -0,0 +1 @@
1
+ module.exports = require("gulp-msbuild");
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ (function () {
3
+ // replaces the gulp-npm-run node module
4
+ // which relies on ramda -- that keeps on having
5
+ // breaking changes released. NO MORE.
6
+ const { readFileSync } = require("fs"), debug = require("debug")("gulp-npm-run"), exec = require("./exec"), path = require("path"), chalk = require("ansi-colors"), { ZarroError } = requireModule("zarro-error"), findNpmBase = require("./find-npm-base");
7
+ function gulpNpmRun(gulp) {
8
+ const packageIndex = findPackageIndex(), scripts = packageIndex.scripts || {};
9
+ Object.keys(scripts).forEach(k => {
10
+ gulp.task(k, `npm script: ${k}`, async () => {
11
+ // npm run produces extra output, prefixed with >
12
+ // at the start, including package information and the script line
13
+ // -> we'll ignore it unless someone _really_ wants it
14
+ let ignoredFirstLine = false;
15
+ await exec("npm", ["run", k], undefined, {
16
+ stderr: (d) => console.error(chalk.red(d)),
17
+ stdout: (d) => {
18
+ if (!ignoredFirstLine) {
19
+ debug(`npm diagnostics:\n${d}`);
20
+ ignoredFirstLine = true;
21
+ return;
22
+ }
23
+ console.log(chalk.yellow(d));
24
+ }
25
+ });
26
+ });
27
+ });
28
+ }
29
+ function findPackageIndex() {
30
+ const packageIndexFolder = findNpmBase(), packageIndexPath = path.join(packageIndexFolder, "package.json");
31
+ try {
32
+ const contents = readFileSync(packageIndexPath, { encoding: "utf8" });
33
+ return JSON.parse(contents);
34
+ }
35
+ catch (e) {
36
+ throw new ZarroError(`Unable to read package.json at ${packageIndexPath}`);
37
+ }
38
+ }
39
+ module.exports = gulpNpmRun;
40
+ })();