Skip to content

Commit

Permalink
fix(cli:deploy): env deploy bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucharz committed Apr 7, 2018
1 parent 03ec3e0 commit bd484cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/socket-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class SocketAdd {
}
} else {
echo()
if(err.message) {
if (err.message) {
echo(`${format.red(err.message)}\n`)
} else {
echo(`${format.red(err)}\n`)
Expand Down
19 changes: 11 additions & 8 deletions packages/cli/src/utils/sockets/sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class Socket {
this.isProjectRegistryDependency = null
this.dependencies = []
this.dependencyOf = []
this.envIsNull = false

// that looks stupid
this.remote = {
Expand Down Expand Up @@ -557,8 +558,8 @@ class Socket {
}

isEmptyEnv () {
debug('isEmptyEnv', !fs.existsSync(this.getSocketEnvZip()))
return !fs.existsSync(this.getSocketEnvZip())
debug('isEmptyEnv', this.envIsNull)
return this.envIsNull
}

getSocketNodeModulesChecksum () {
Expand Down Expand Up @@ -821,11 +822,11 @@ class Socket {
archive.finalize()
} else {
fs.unlinkSync(this.getSocketEnvZip())
resolve()
resolve(false)
}

output.on('close', () => {
resolve()
resolve(true)
})
})
}
Expand Down Expand Up @@ -889,9 +890,11 @@ class Socket {
debug('updateEnv')
const resp = await this.socketEnvShouldBeUpdated()
if (resp) {
await this.createEnvZip()
if (!this.isEmptyEnv()) {
const zip = await this.createEnvZip()
if (zip) {
return this.updateEnvCall(resp)
} else {
this.envIsNull = true
}
}
return 'No need to update'
Expand Down Expand Up @@ -1026,7 +1029,7 @@ class Socket {
// Build registry socket.
try {
await this.build()
} catch(e) {
} catch (e) {
return reject(e)
}
return resolve()
Expand All @@ -1049,7 +1052,7 @@ class Socket {
args.split(' '),
{
cwd: this.getSocketPath(),
maxBuffer: 2048 * 1024,
maxBuffer: 2048 * 4096,
stdio: [process.stdio, 'pipe', 'pipe']
}
)
Expand Down

0 comments on commit bd484cc

Please sign in to comment.