Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@architect/hydrate

Package Overview
Dependencies
Maintainers
7
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@architect/hydrate - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

2

package.json
{
"name": "@architect/hydrate",
"version": "1.1.1",
"version": "1.2.0",
"description": "Architect dependency hydrator and shared file manager",

@@ -5,0 +5,0 @@ "main": "index.js",

let chalk = require('chalk')
function start (cwd, cmd) {
function start (params) {
let {cwd, cmd, quiet} = params
let indicator = chalk.green.dim('⚬')
let status = chalk.grey('Hydrating dependencies:')
let path = chalk.cyan(cwd.replace(process.cwd(), '').substr(1))
let path = chalk.cyan(cwd.replace(process.cwd(), ''))
let command = chalk.cyan.dim(`[${cmd}]`)
console.log(`${indicator} ${status} ${path} ${command}`)
let info = `${indicator} ${status} ${path} ${command}`
if (!quiet) console.log(info)
return info
}
function done (err, stdout, stderr, callback) {
let print = input => console.log(input.split('\n').map(l => ` ${chalk.grey('|')} ${l}`).join('\n'))
// Prints and passes along the result (in both raw and terminal (ANSI) formats)
function done (params, callback) {
let {err, stdout, stderr, start, quiet} = params
let result = {
raw: {},
term: {}
}
let format = input => input.split('\n').map(l => ` ${chalk.grey('|')} ${l}`).join('\n')
if (err) {
print(chalk.red.bold(err.message.trim()))
result.raw.err = err
result.term.err = format(chalk.red.bold(err.message.trim()))
if (!quiet) console.err(err)
}
if (stdout && stdout.length > 0) {
print(chalk.grey(stdout.trim()))
result.raw.stdout = stdout
result.term.stdout = `${start}\n${format(chalk.grey(stdout.trim()))}`
if (!quiet) console.log(stdout)
}
if (stderr && stderr.length > 0) {
print(chalk.yellow.dim(stderr.trim()))
result.raw.stderr = stderr
result.term.stderr = format(chalk.yellow.dim(stderr.trim()))
if (!quiet) console.log(stderr)
}
if (err) callback(Error('hydration_error'))
else callback()
if (err) callback(Error('hydration_error'), result)
else callback(null, result)
}

@@ -25,0 +42,0 @@

@@ -15,3 +15,6 @@ let glob = require('glob')

*/
module.exports = function install(basepath='src', callback) {
module.exports = function install(params={}, callback) {
let {basepath, env, quiet, shell, timeout} = params
basepath = basepath || 'src'
// eslint-disable-next-line

@@ -30,14 +33,15 @@ let pattern = `${basepath}/**/@(package\.json|requirements\.txt|Gemfile)`

let cwd = path.dirname(file)
let options = {cwd}
let options = {cwd, env, shell, timeout}
return function hydration(callback) {
let start
// printer function
// Prints and executes the command
function exec(cmd, opts, callback) {
print.start(cwd, cmd)
start = print.start({cwd, cmd, quiet})
child.exec(cmd, opts, callback)
}
// also a printer function
// Prints the result
function done(err, stdout, stderr) {
print.done(err, stdout, stderr, callback)
print.done({err, stdout, stderr, start, quiet}, callback)
}

@@ -68,6 +72,3 @@

series(ops, function done(err) {
if (err) callback(err)
else callback()
})
series(ops, callback)
}

@@ -11,3 +11,6 @@ let glob = require('glob')

*/
module.exports = function update(basepath='src', callback) {
module.exports = function update(params={}, callback) {
let {basepath, env, quiet, shell, timeout} = params
basepath = basepath || 'src'
// eslint-disable-next-line

@@ -26,3 +29,3 @@ let pattern = `${basepath}/**/@(package\.json|requirements\.txt|Gemfile)`

let cwd = path.dirname(file)
let options = {cwd}
let options = {cwd, env, shell, timeout}
return function updation(callback) {

@@ -32,3 +35,3 @@

function exec(cmd, opts, callback) {
print.start(cwd, cmd)
print.start({cwd, cmd, quiet})
child.exec(cmd, opts, callback)

@@ -39,3 +42,3 @@ }

function done(err, stdout, stderr) {
print.done(err, stdout, stderr, callback)
print.done({err, stdout, stderr, quiet}, callback)
}

@@ -42,0 +45,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc