zarro 1.92.0 → 1.94.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.
@@ -1,23 +1,24 @@
1
- const { publish } = require("gulp-dotnet-cli"),
2
- env = requireModule("env"),
3
- gulp = requireModule("gulp");
4
-
5
- gulp.task(
6
- "dotnet-publish",
7
- "Performs `dotnet publish` on all non-test projects in the tree",
8
- () => {
9
- const publishOpts = {
10
- configuration: env.resolve("DOTNET_PUBLISH_BUILD_CONFIGURATION", "BUILD_CONFIGURATION"),
11
- runtime: env.resolve("DOTNET_PUBLISH_RUNTIMES"),
12
- output: env.resolve("OUTPUT")
13
- };
14
-
15
- const testInclusionsInverted = env.resolveArray("TEST_INCLUDE")
16
- .map(p => `!${p}.csproj`)
17
- return gulp
18
- .src(["**/*.csproj"].concat(testInclusionsInverted))
19
- .pipe(
20
- publish(publishOpts)
21
- );
22
- }
23
- );
1
+ const
2
+ { publish } = require("gulp-dotnet-cli"),
3
+ env = requireModule("env"),
4
+ gulp = requireModule("gulp");
5
+
6
+ gulp.task(
7
+ "dotnet-publish",
8
+ "Performs `dotnet publish` on all non-test projects in the tree",
9
+ () => {
10
+ const publishOpts = {
11
+ configuration: env.resolve("DOTNET_PUBLISH_BUILD_CONFIGURATION", "BUILD_CONFIGURATION"),
12
+ runtime: env.resolve("DOTNET_PUBLISH_RUNTIMES"),
13
+ output: env.resolve("OUTPUT"),
14
+ };
15
+
16
+ const testInclusionsInverted = env.resolveArray("TEST_INCLUDE")
17
+ .map(p => `!${p}.csproj`)
18
+ return gulp
19
+ .src(["**/*.csproj"].concat(testInclusionsInverted))
20
+ .pipe(
21
+ publish(publishOpts)
22
+ );
23
+ }
24
+ );
@@ -1,21 +1,28 @@
1
- const
2
- fs = require("fs"),
3
- debug = require("debug")("ensure-folder-exists")
4
-
5
- module.exports = function ensureFolderExists(folder) {
6
- debug(`Ensuring existence of tools folder "${folder}"`);
7
- return new Promise((resolve, reject) => {
8
- try {
9
- if (!fs.existsSync(folder)) {
10
- fs.mkdirSync(folder);
11
- }
12
- debug(`${folder} exists!`);
13
- resolve();
14
- } catch (e) {
15
- debug(`${folder} doesn't exist and not creatable`);
16
- debug(e);
17
- reject(e);
18
- }
19
- });
20
- }
21
-
1
+ const
2
+ fs = require("fs"),
3
+ debug = require("debug")("ensure-folder-exists")
4
+
5
+ function ensureFolderExists(folder) {
6
+ debug(`Ensuring existence of tools folder "${folder}"`);
7
+ return new Promise((resolve, reject) => {
8
+ try {
9
+ ensureFolderExistsSync(folder);
10
+ debug(`${folder} exists!`);
11
+ resolve();
12
+ } catch (e) {
13
+ debug(`${folder} doesn't exist and not creatable`);
14
+ debug(e);
15
+ reject(e);
16
+ }
17
+ });
18
+ }
19
+
20
+ function ensureFolderExistsSync(folder) {
21
+ if (!fs.existsSync(folder)) {
22
+ fs.mkdirSync(folder);
23
+ }
24
+ }
25
+
26
+ ensureFolderExists.sync = ensureFolderExistsSync;
27
+
28
+ module.exports = ensureFolderExists;
@@ -1,113 +1,113 @@
1
- var
2
- fs = require('fs'),
3
- path = require("path"),
4
- ensureFolderExists = require("./ensure-folder-exists"),
5
- request = require('request'),
6
- debug = require('debug')('http-downloader');
7
-
8
- function HttpDownloader(infoLogFunction, debugLogFunction) {
9
- this._info = infoLogFunction || console.log;
10
- this._debug = debugLogFunction || debug;
11
- this.assumeDownloadedIfExistsAndSizeMatches = true;
12
- }
13
-
14
- HttpDownloader.prototype = {
15
- download: function (url, target) {
16
- const partFile = `${target}.part`;
17
- ensureFolderExists(path.dirname(partFile));
18
- return new Promise((resolve, reject) => {
19
- this._request = request.get(url, { timeout: 30000 })
20
- .on("response", (response) => {
21
- this._debug(`got response: ${JSON.stringify(response)}`);
22
- this._downloadSize = parseInt(response.headers["content-length"]);
23
- this._statusSuffix = '% of ' + this._humanSize(this._downloadSize);
24
- })
25
- .on("error", (e) => {
26
- this._debug(`got error: ${e}`);
27
- reject(e);
28
- })
29
- .on("data", (data) => {
30
- this._debug(`got ${data.length} bytes`);
31
- this._updateStatus(data);
32
- })
33
- .on("end", () => {
34
- this._clear();
35
- this._rename(resolve, reject, partFile, target);
36
- }).pipe(fs.createWriteStream(partFile));
37
- });
38
- },
39
- abort: function () {
40
- if (this._request) {
41
- self._errored = true;
42
- this._request.abort();
43
- this._clear();
44
- }
45
- },
46
- _updateStatus: function (data) {
47
- if (process.env.SUPPRESS_DOWNLOAD_PROGRESS || process.env.BUILD_NUMBER /* automatically disable at Jenkins CI */) {
48
- return;
49
- }
50
- this._written = this._written || 0;
51
- this._written += data.length;
52
- var perc = Math.round((100 * this._written) / this._downloadSize);
53
- if (perc != this._lastPerc) {
54
- this._writeStatus(perc + this._statusSuffix);
55
- this._lastPerc = perc;
56
- }
57
- },
58
- _writeStatus: function (msg) {
59
- this._clearStatus();
60
- process.stdout.write(msg);
61
- },
62
- _rename: function (resolve, reject, src, dst, attempts) {
63
- try {
64
- this._debug('attempt rename of temp file');
65
- fs.renameSync(src, dst)
66
- this._clearStatus();
67
- this._info(`-> ${dst} download complete!`);
68
- resolve(dst)
69
- } catch (e) {
70
- this._debug('rename error:', e);
71
- if (attempts > 99) {
72
- reject(['Unable to rename "', src, '" to "', ds, '": ', e].join(''));
73
- } else {
74
- setTimeout(()=> {
75
- this._rename(resolve, reject, src, dst, attempts++);
76
- }, 100);
77
- }
78
- }
79
- },
80
- _clearStatus: function () {
81
- process.stdout.write('\r \r');
82
- },
83
- _humanSize: function (size) {
84
- var suffixes = ['b', 'kb', 'mb', 'tb', 'pb'];
85
- for (var i = 0; i < suffixes.length - 1; i++) {
86
- if (size < 1024) {
87
- return size.toFixed(2) + suffixes[i];
88
- }
89
- size /= 1024;
90
- }
91
- return size.toFixed(2) + suffixes[suffixes.length - 1];
92
- },
93
- _clear: function () {
94
- var self = this;
95
- ['_request', '_response', '_downloadSize', '_lastPerc',
96
- '_resolveFunction', '_rejectFunction', '_lastData', '_statusSuffix'
97
- ].forEach(function (prop) {
98
- self[prop] = undefined;
99
- });
100
- },
101
- _alreadyDownloaded: function () {
102
- if (!this.assumeDownloadedIfExistsAndSizeMatches) {
103
- return false;
104
- }
105
- if (!fs.existsSync(this._target)) {
106
- return false;
107
- }
108
- var lstat = fs.lstatSync(this._target);
109
- return lstat.size === this._downloadSize;
110
- }
111
- }
112
-
113
- module.exports = HttpDownloader;
1
+ const
2
+ fs = require('fs'),
3
+ path = require("path"),
4
+ ensureFolderExists = require("./ensure-folder-exists").sync,
5
+ request = require('request'),
6
+ debug = require('debug')('http-downloader');
7
+
8
+ function HttpDownloader(infoLogFunction, debugLogFunction) {
9
+ this._info = infoLogFunction || console.log;
10
+ this._debug = debugLogFunction || debug;
11
+ this.assumeDownloadedIfExistsAndSizeMatches = true;
12
+ }
13
+
14
+ HttpDownloader.prototype = {
15
+ download: function (url, target) {
16
+ const partFile = `${target}.part`;
17
+ ensureFolderExists(path.dirname(partFile));
18
+ return new Promise((resolve, reject) => {
19
+ this._request = request.get(url, { timeout: 30000 })
20
+ .on("response", (response) => {
21
+ this._debug(`got response: ${JSON.stringify(response)}`);
22
+ this._downloadSize = parseInt(response.headers["content-length"]);
23
+ this._statusSuffix = '% of ' + this._humanSize(this._downloadSize);
24
+ })
25
+ .on("error", (e) => {
26
+ this._debug(`got error: ${e}`);
27
+ reject(e);
28
+ })
29
+ .on("data", (data) => {
30
+ this._debug(`got ${data.length} bytes`);
31
+ this._updateStatus(data);
32
+ })
33
+ .on("end", () => {
34
+ this._clear();
35
+ this._rename(resolve, reject, partFile, target);
36
+ }).pipe(fs.createWriteStream(partFile));
37
+ });
38
+ },
39
+ abort: function () {
40
+ if (this._request) {
41
+ self._errored = true;
42
+ this._request.abort();
43
+ this._clear();
44
+ }
45
+ },
46
+ _updateStatus: function (data) {
47
+ if (process.env.SUPPRESS_DOWNLOAD_PROGRESS || process.env.BUILD_NUMBER /* automatically disable at Jenkins CI */) {
48
+ return;
49
+ }
50
+ this._written = this._written || 0;
51
+ this._written += data.length;
52
+ var perc = Math.round((100 * this._written) / this._downloadSize);
53
+ if (perc != this._lastPerc) {
54
+ this._writeStatus(perc + this._statusSuffix);
55
+ this._lastPerc = perc;
56
+ }
57
+ },
58
+ _writeStatus: function (msg) {
59
+ this._clearStatus();
60
+ process.stdout.write(msg);
61
+ },
62
+ _rename: function (resolve, reject, src, dst, attempts) {
63
+ try {
64
+ this._debug('attempt rename of temp file');
65
+ fs.renameSync(src, dst)
66
+ this._clearStatus();
67
+ this._info(`-> ${dst} download complete!`);
68
+ resolve(dst)
69
+ } catch (e) {
70
+ this._debug('rename error:', e);
71
+ if (attempts > 99) {
72
+ reject(['Unable to rename "', src, '" to "', ds, '": ', e].join(''));
73
+ } else {
74
+ setTimeout(()=> {
75
+ this._rename(resolve, reject, src, dst, attempts++);
76
+ }, 100);
77
+ }
78
+ }
79
+ },
80
+ _clearStatus: function () {
81
+ process.stdout.write('\r \r');
82
+ },
83
+ _humanSize: function (size) {
84
+ var suffixes = ['b', 'kb', 'mb', 'tb', 'pb'];
85
+ for (var i = 0; i < suffixes.length - 1; i++) {
86
+ if (size < 1024) {
87
+ return size.toFixed(2) + suffixes[i];
88
+ }
89
+ size /= 1024;
90
+ }
91
+ return size.toFixed(2) + suffixes[suffixes.length - 1];
92
+ },
93
+ _clear: function () {
94
+ var self = this;
95
+ ['_request', '_response', '_downloadSize', '_lastPerc',
96
+ '_resolveFunction', '_rejectFunction', '_lastData', '_statusSuffix'
97
+ ].forEach(function (prop) {
98
+ self[prop] = undefined;
99
+ });
100
+ },
101
+ _alreadyDownloaded: function () {
102
+ if (!this.assumeDownloadedIfExistsAndSizeMatches) {
103
+ return false;
104
+ }
105
+ if (!fs.existsSync(this._target)) {
106
+ return false;
107
+ }
108
+ var lstat = fs.lstatSync(this._target);
109
+ return lstat.size === this._downloadSize;
110
+ }
111
+ }
112
+
113
+ module.exports = HttpDownloader;
@@ -17,7 +17,8 @@ function isDotnetCore(binaryPath) {
17
17
  async function nugetPush(
18
18
  packageFile,
19
19
  sourceName,
20
- options) {
20
+ options
21
+ ) {
21
22
  options = options || {};
22
23
  options.suppressDuplicateError = options.suppressDuplicateError === undefined
23
24
  ? env.resolveFlag("NUGET_IGNORE_DUPLICATE_PACKAGES")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.92.0",
3
+ "version": "1.94.2",
4
4
  "description": "Some glue to make gulp easier, perhaps even zero- or close-to-zero-conf",
5
5
  "bin": {
6
6
  "zarro": "./index.js"
@@ -42,7 +42,7 @@
42
42
  "gulp-dotnet-cli": "^1.1.0",
43
43
  "gulp-edit-xml": "^3.1.1",
44
44
  "gulp-filter": "^6.0.0",
45
- "gulp-msbuild": "^0.8.0",
45
+ "gulp-msbuild": "^0.9.0",
46
46
  "mkdirp": "^1.0.4",
47
47
  "nodemon": "^2.0.7",
48
48
  "npm-run-all": "^4.1.5",