Skip to content

Commit 8ab973b

Browse files
committed
Show uploading process
1 parent 46eec2b commit 8ab973b

File tree

3 files changed

+35
-22
lines changed

3 files changed

+35
-22
lines changed

bin/dropstack-deploy

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ function deploy({folder, token, variables, instances, alias, https, type, url, e
6363
.then(settings => {
6464
console.log(`Deploying ${chalk.green.underline(settings.alias || settings.name || '-')} for ${chalk.green.underline(settings.username || '-')} on ${chalk.green.underline(settings.url || '-')}`);
6565
if(verbose) {
66-
console.log(chalk.gray(`${settings.name || '--------'} packing ... please wait!`));
66+
console.log(chalk.gray(`${settings.name || '--------'} packing ...`));
6767
} else {
6868
process.stdout.cursorTo(0);
6969
process.stdout.clearLine();
70-
process.stdout.write(chalk.gray(' Packing ... please wait!'));
70+
process.stdout.write(chalk.gray(' Packing ...'));
7171
}
7272
fstream.Reader({ path: args, type: 'Directory', follow: false, filter: x => tarFileFilter(x, settings.excludes)})
7373
.on('error', err => console.error(chalk.red(`\nAn unexpected error occurred!\nMessage: ${chalk.gray(err.message)}`)))
@@ -125,11 +125,11 @@ function deployment(settings, verbose) {
125125
const startDate = new Date();
126126

127127
if(verbose) {
128-
console.log(chalk.gray(`${settings.name || '--------'} uploading ... please wait!`))
128+
console.log(chalk.gray(`${settings.name || '--------'} uploading`))
129129
} else {
130130
process.stdout.cursorTo(0);
131131
process.stdout.clearLine();
132-
process.stdout.write(chalk.gray(` Uploading ... please wait!`))
132+
process.stdout.write(chalk.gray(` Uploading`))
133133
};
134134

135135
if(settings.name) form.append('serviceName', settings.name);
@@ -139,7 +139,20 @@ function deployment(settings, verbose) {
139139
if(settings.instances) form.append('serviceInstances', settings.instances);
140140
if(settings.aliveEndpoint) form.append('serviceAliveEndpoint', settings.aliveEndpoint);
141141
if(settings.variables) form.append('serviceVariables', settings.variables);
142-
form.append(pathObj.name, fs.createReadStream(settings.tarPath));
142+
const tarStream = fs.createReadStream(settings.tarPath);
143+
const stat = fs.statSync(settings.tarPath);
144+
let uploadedSize = 0;
145+
tarStream.on('data', buffer => {
146+
uploadedSize += buffer.length;
147+
if(verbose) {
148+
console.log(chalk.gray(`${settings.name || '--------'} ${(uploadedSize/stat.size*100).toFixed(2)}% uploaded`));
149+
} else {
150+
process.stdout.cursorTo(0);
151+
process.stdout.clearLine();
152+
process.stdout.write(chalk.gray(` ${(uploadedSize/stat.size*100).toFixed(2)}% uploaded`));
153+
}
154+
});
155+
form.append(pathObj.name, tarStream);
143156

144157
return new Promise((resolve, reject) => {
145158
const spin = ' ⢹⢺⢼⣸⣇⡧⡗⡏'.split('');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dropstack-cli",
3-
"version": "2.3.10",
3+
"version": "2.3.11",
44
"description": "A CLI to simplify continuous deployments into hybrid clouds.",
55
"author": "Mike Bild <mike@codecommission.com>",
66
"homepage": "https://github.com/codecommission/dropstack-cli#readme",

yarn.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ ansi-styles@^2.2.1:
2121
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
2222

2323
ansi-styles@^3.1.0:
24-
version "3.1.0"
25-
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.1.0.tgz#09c202d5c917ec23188caa5c9cb9179cd9547750"
24+
version "3.2.0"
25+
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88"
2626
dependencies:
27-
color-convert "^1.0.0"
27+
color-convert "^1.9.0"
2828

2929
any-promise@^1.0.0, any-promise@^1.3.0:
3030
version "1.3.0"
@@ -53,8 +53,8 @@ block-stream@*:
5353
inherits "~2.0.0"
5454

5555
boxen@^1.0.0, boxen@^1.2.0:
56-
version "1.2.0"
57-
resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.2.0.tgz#03478d84be7fe02189b80904d81d6a80384368f1"
56+
version "1.2.1"
57+
resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.2.1.tgz#0f11e7fe344edb9397977fc13ede7f64d956481d"
5858
dependencies:
5959
ansi-align "^2.0.0"
6060
camelcase "^4.0.0"
@@ -105,7 +105,7 @@ code-point-at@^1.0.0:
105105
version "1.1.0"
106106
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
107107

108-
color-convert@^1.0.0:
108+
color-convert@^1.9.0:
109109
version "1.9.0"
110110
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a"
111111
dependencies:
@@ -138,8 +138,8 @@ concat-map@0.0.1:
138138
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
139139

140140
configstore@^3.0.0:
141-
version "3.1.0"
142-
resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.0.tgz#45df907073e26dfa1cf4b2d52f5b60545eaa11d1"
141+
version "3.1.1"
142+
resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.1.tgz#094ee662ab83fad9917678de114faaea8fcdca90"
143143
dependencies:
144144
dot-prop "^4.1.0"
145145
graceful-fs "^4.1.2"
@@ -211,8 +211,8 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
211211
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
212212

213213
eventsource@^1.0.4:
214-
version "1.0.4"
215-
resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-1.0.4.tgz#029450d04ebd34e4cf061788c595faa5f4c10843"
214+
version "1.0.5"
215+
resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-1.0.5.tgz#1f012c9df0bd8832fd6b1744fea00ccdd479f046"
216216
dependencies:
217217
original "^1.0.0"
218218

@@ -608,8 +608,8 @@ semver-diff@^2.0.0:
608608
semver "^5.0.3"
609609

610610
semver@^5.0.3, semver@^5.1.0:
611-
version "5.3.0"
612-
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
611+
version "5.4.1"
612+
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
613613

614614
shebang-command@^1.2.0:
615615
version "1.2.0"
@@ -642,8 +642,8 @@ string-width@^1.0.1:
642642
strip-ansi "^3.0.0"
643643

644644
string-width@^2.0.0:
645-
version "2.1.0"
646-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.0.tgz#030664561fc146c9423ec7d978fe2457437fe6d0"
645+
version "2.1.1"
646+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
647647
dependencies:
648648
is-fullwidth-code-point "^2.0.0"
649649
strip-ansi "^4.0.0"
@@ -673,8 +673,8 @@ supports-color@^2.0.0:
673673
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
674674

675675
supports-color@^4.0.0:
676-
version "4.2.0"
677-
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.0.tgz#ad986dc7eb2315d009b4d77c8169c2231a684037"
676+
version "4.2.1"
677+
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836"
678678
dependencies:
679679
has-flag "^2.0.0"
680680

0 commit comments

Comments
 (0)