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

devlab

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devlab - npm Package Compare versions

Comparing version 3.3.5 to 3.4.0

src/tempdir.js

7

package.json
{
"name": "devlab",
"version": "3.3.5",
"version": "3.4.0",
"description": "Node utility for running containerized tasks",

@@ -54,2 +54,3 @@ "keywords": [

"nodemon": "^1.11.0",
"proxyquire": "^1.7.11",
"sinon": "^1.17.0",

@@ -67,2 +68,3 @@ "sinon-chai": "^2.8.0",

"ora": "^0.3.0",
"os-tmpdir": "^1.0.2",
"shortid": "^2.2.6"

@@ -83,5 +85,6 @@ },

"sinon",
"cwd"
"cwd",
"proxyquire"
]
}
}

@@ -28,2 +28,4 @@ [![CircleCI branch](https://img.shields.io/circleci/project/TechnologyAdvice/DevLab/master.svg?maxAge=2592000)]()

**Important Note**: In order to run the tasks, Devlab creates a temp file (`devlab.sh`). The tool will do its best to determine the best location (usually `/tmp`), but this can be explicitly set by specifying the environment variable `DEVLAB_TMP`.
## Usage

@@ -30,0 +32,0 @@

@@ -99,9 +99,10 @@ 'use strict'

* @param {string} name Container name
* @param {string} tmpdir Path to temp execution file
* @param {boolean} primary If this is primary, i.e. not a service container
* @returns {object|array} Arguments for docker command
*/
get: (cfg, name, primary = false) => {
get: (cfg, name, tmpdir, primary = false) => {
if (!cfg.from) throw new Error('Missing \'from\' property in config or argument')
const cwd = process.cwd()
let args = primary ? [ 'run', '--rm', '-it', '-v', `${cwd}:${cwd}`, '-w', cwd, '--privileged' ] : [ 'run', '-d', '--privileged' ]
let args = primary ? [ 'run', '--rm', '-it', '-v', `${cwd}:${cwd}`, '-v', `${tmpdir}:${tmpdir}`, '-w', cwd, '--privileged' ] : [ 'run', '-d', '--privileged' ]
args = args.concat(_.flatten([

@@ -112,3 +113,3 @@ command.getArgs(cfg),

cfg.from,
primary ? [ 'sh', 'devlab.sh' ] : []
primary ? [ 'sh', `${tmpdir}/devlab.sh` ] : []
]))

@@ -115,0 +116,0 @@ return primary ? { args, cmd: command.getExec(cfg) } : args

@@ -5,3 +5,3 @@ 'use strict'

const Promise = require('bluebird')
const fs = require('fs')
const fs = Promise.promisifyAll(require('fs'))
const args = require('./args')

@@ -15,3 +15,3 @@ const config = require('./config')

Promise.promisifyAll(fs)
const tmpdir = require('./tempdir')()

@@ -32,3 +32,3 @@ global.instanceId = require('shortid').generate()

const cfg = services.filterEnabled(_.merge(config.load(args.parse().configPath), args.parse()))
return { services: services.get(cfg), primary: command.get(cfg, 'primary', true) }
return { services: services.get(cfg), primary: command.get(cfg, 'primary', tmpdir, true) }
},

@@ -85,15 +85,14 @@ /**

// Write the primary command to tmp script
return fs.writeFileAsync(`${process.cwd()}/devlab.sh`, cfg.primary.cmd)
return fs.writeFileAsync(`${tmpdir}/devlab.sh`, cfg.primary.cmd)
.then(() => utils.checkOrphans())
.then(() => instance.startServices(cfg))
.then(instance.runCommand)
.then(() => fs.unlinkAsync(`${process.cwd()}/devlab.sh`))
.then(services.stop)
}).catch((e) => {
services.stop()
output.error(e.message || 'Process failed')
throw new Error('Process failed')
})
.catch((e) => {
services.stop()
output.error(e.message || 'Process failed')
throw new Error('Process failed')
})
}
module.exports = instance

@@ -51,3 +51,3 @@ 'use strict'

persist: value.persist || false,
args: command.get(value, name)
args: command.get(value, name, null)
})]), cfg.services),

@@ -54,0 +54,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