New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ibm-functions/shell-local-plugin

Package Overview
Dependencies
Maintainers
6
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ibm-functions/shell-local-plugin - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

2

package.json
{
"name": "@ibm-functions/shell-local-plugin",
"version": "0.0.15",
"version": "0.0.16",
"description": "An IBM Cloud Functions Shell plugin that lets users run and debug actions locally in a docker container",

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

@@ -58,2 +58,5 @@ /*

/** which commands need no command line arguments? */
const needsNoArgs = [ 'kill', 'init' ]
let _container, _containerType, _containerCode, _imageDir, _image;

@@ -90,13 +93,14 @@

return new Promise((resolve, reject) => {
if(argvWithoutOptions[0] && argvWithoutOptions[0] != 'local'){
if (argvWithoutOptions[0] && argvWithoutOptions[0] !== 'local') {
// e.g. invoke => local invoke
argvWithoutOptions.unshift('local');
}
if(argvWithoutOptions.length === 1){
debug('args', argvWithoutOptions)
if (argvWithoutOptions.length === 1) {
resolve(printDocs());
}
else if(Object.keys(docs).indexOf(argvWithoutOptions[1]) < 1){
// missing wil be -1, 'overall' will be 0. so none of that
} else if (Object.keys(docs).indexOf(argvWithoutOptions[1]) < 1) {
// missing will be -1, 'overall' will be 0. so none of that
resolve(printDocs());
}
else if(argvWithoutOptions.length === 2){
} else if (argvWithoutOptions.length === 2 && !needsNoArgs.find(_ => _ === argvWithoutOptions[1])) {
resolve(printDocs(argvWithoutOptions[1]));

@@ -184,8 +188,6 @@ }

appendIncreContent('Stopping and removing the container', spinnerDiv);
kill(returnDiv)
.then(() => {
appendIncreContent('Done', spinnerDiv)
removeSpinner(returnDiv);
})
.catch(e => appendIncreContent(e, spinnerDiv, 'error'))
kill(spinnerDiv)
.then(() => resolve(true))
.catch(e => appendIncreContent(e, spinnerDiv, 'error'))
return // we will resolve the promise
}

@@ -252,21 +254,11 @@

// and left a container open
let rm = false;
repl.qexec('! docker kill shell-local')
.then(() => {
rm = true; // remove is what matters. cannot open two containers with the same name
return repl.qexec('! docker rm shell-local');
})
.then(() => {
resolve(true);
})
.catch((e) => {
if(!rm){
// if kill failed, try removing the container here again.
repl.qexec('! docker rm shell-local')
.then(() => resolve(true))
.catch((e) => reject(e));
}
else
reject(e);
});
const squash = err => {
console.error(err)
return true
}
docker.image.get('shell-local').status().catch(resolve)
.then(image => image.kill().catch(squash)
.then(() => image.remove().catch(squash)))
.then(() => resolve(true))
.catch(reject)
}

@@ -347,4 +339,4 @@ });

debug('checking to see if the image already exists locally')
if (imageList.find(({data}) => data.RepoTags.find(_ => _ === image))) {
debug('checking to see if the image already exists locally', imageList)
if (imageList.find(({data}) => data.RepoTags && data.RepoTags.find(_ => _ === image))) {
debug('skipping docker pull, as it is already local')

@@ -802,8 +794,13 @@ return Promise.all([image]);

if(error){
if (error) {
console.error(content)
// tell the spinner to change to an error icon
errorSpinner(div)
// format the error message
const err = content,
message = isUserError(err) ? ui.oopsMessage(err) : 'Internal Error'
// and then display it
$(div).find('.replay_output').append(`<div style='padding-top:0.25ex' class='red-text fake-in'>${message}</div>`);

@@ -831,13 +828,15 @@ }

/**
* Display an error icon in place of the spinner icon
* Display a given icon in place of the spinner icon
*
*/
const errorSpinner = spinnerDiv => {
const iconForSpinner = (spinnerDiv, icon, extraCSS) => {
const iconContainer = $(spinnerDiv).find('.replay_spinner')
$(iconContainer).css('animation', '')
$(iconContainer).css('color', '')
$(iconContainer).addClass('red-text')
if (extraCSS) $(iconContainer).addClass(extraCSS)
$(iconContainer).empty()
$(iconContainer).append('<i class="fas fa-exclamation-triangle"></i>')
$(iconContainer).append(`<i class="${icon}"></i>`)
}
const errorSpinner = spinnerDiv => iconForSpinner(spinnerDiv, 'fas fa-exclamation-triangle', 'red-text')
const okSpinner = spinnerDiv => iconForSpinner(spinnerDiv, 'fas fa-thumbs-up', 'green-text')

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