Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/cli/src/commands/socket-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export default class SocketAdd {
if (cmd.socket) {
// Socket dependency
this.socket = await this.Socket.get(cmd.socket)
return this.socket.addDependency(socketFromRegistry)
await this.socket.addDependency(socketFromRegistry)
} else {
// Project dependency
await this.Socket.add(socketFromRegistry)
}

// Project dependency
await this.Socket.add(socketFromRegistry)

const status = format.grey('socket added:')
const name = format.cyan(this.socketFromRegistry.name)
const version = format.dim(`(${this.socketFromRegistry.version})`)
Expand Down Expand Up @@ -61,7 +61,11 @@ export default class SocketAdd {
}
} else {
echo()
echo(`${format.red(err)}\n`)
if(err.message) {
echo(`${format.red(err.message)}\n`)
} else {
echo(`${format.red(err)}\n`)
}
echo()
}
}
Expand Down
16 changes: 11 additions & 5 deletions packages/cli/src/utils/sockets/sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,10 @@ class Socket {
debug(`Getting Socket: ${socketName}`)
const socket = Socket.getLocal(socketName)
const loadedSocket = await socket.loadRemote()
await loadedSocket.getDepsRegistrySockets()

if (!socket.existLocally) {
await socket.loadFromRegistry()
}
await loadedSocket.getDepsRegistrySockets()
return socket
}

Expand Down Expand Up @@ -564,7 +563,7 @@ class Socket {

getSocketNodeModulesChecksum () {
debug('getSocketNodeModulesChecksum')
return hashdirectory.sync(path.join(this.socketPath, '.dist', 'node_modules'))
return hashdirectory.sync(path.join(this.getSocketPath(), '.dist', 'node_modules'))
}

getSocketConfigFile () {
Expand Down Expand Up @@ -1021,9 +1020,16 @@ class Socket {
await new Promise((resolve, reject) => {
fs.createReadStream(fileName)
.pipe(unzip.Extract({ path: this.getSocketPath() }))
.on('close', () => {
.on('close', async () => {
debug('Unzip finished')
resolve()

// Build registry socket.
try {
await this.build()
} catch(e) {
return reject(e)
}
return resolve()
})
})
}
Expand Down