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

@coffeekraken/scripts-stack

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coffeekraken/scripts-stack - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

.resources/coffeekraken-logo.jpg

76

dist/index.js

@@ -32,4 +32,6 @@ "use strict";

const Script = require('./Script').default;
const pkgUp = require('pkg-up');
const Script = require('./Script');
class scriptsStack {

@@ -48,8 +50,29 @@ constructor(config) {

if (fs.existsSync(`${process.env.PWD}/package-scripts.js`)) {
this._packageScripts = require(`${process.env.PWD}/package-scripts.js`);
this._packageScripts;
if (fs.existsSync("".concat(process.env.PWD, "/package-scripts.js"))) {
this._packageScripts = require("".concat(process.env.PWD, "/package-scripts.js"));
} // check if we have a packageJson in an upper folder
this._packageUpJson;
const pkgUpPath = pkgUp.sync({
cwd: process.cwd() + "/../"
});
if (pkgUpPath) {
const packageUp = require(pkgUpPath);
if (packageUp) {
this._packageUpJson = packageUp;
}
} // set the process name
process.title = `scripts-stack.${this._packageJson.name}`;
process.title = "scripts-stack.".concat(this._packageJson.name); // save the scripts in a global variable
this._scriptsObj = {};
if (this._packageScripts && this._packageScripts.scripts) this._scriptsObj = this._packageScripts.scripts;
if (this._packageJson && this._packageJson.scripts) this._scriptsObj = this._packageJson.scripts;
if (this._packageUpJson && this._packageUpJson.scripts) this._scriptsObj = this._packageUpJson.scripts;
}

@@ -61,4 +84,6 @@

this._scriptsIds = Object.keys(flatten(this._packageScripts.scripts));
} else {
} else if (this._packageJson.scripts) {
this._scriptsIds = Object.keys(this._packageJson.scripts);
} else if (this._packageUpJson.scripts) {
this._scriptsIds = Object.keys(this._packageUpJson.scripts);
} // remove the ignored scripts

@@ -119,5 +144,7 @@

watchObj = this._packageJson.watch[scriptId];
} else if (this._packageUpJson.watch && this._packageUpJson.watch[scriptId]) {
watchObj = this._packageUpJson.watch[scriptId];
}
stack[scriptId] = new Script(scriptId, watchObj, this._packageScripts ? 'nps' : 'npm');
stack[scriptId] = new Script(scriptId, this._scriptsObj[scriptId], watchObj, 'npm');

@@ -176,10 +203,10 @@ if (this._config.watch) {

if (this._packageJson.license) {
headerContent.push(chalk.bold.white.bgBlack(` ${this._packageJson.license} `));
headerContent.push(chalk.bold.white.bgBlack(" ".concat(this._packageJson.license, " ")));
}
headerContent.push(`${chalk.black.bold(this._packageJson.name)} ${chalk.bgWhite.black(' ' + this._packageJson.version + ' ')}`);
headerContent.push("".concat(chalk.black.bold(this._packageJson.name), " ").concat(chalk.bgWhite.black(' ' + this._packageJson.version + ' ')));
screen.$headerBox = blessed.box({
parent: screen.$container,
width: '100%',
content: `\n ${headerContent.join(' ')}`,
content: "\n ".concat(headerContent.join(' ')),
height: 3,

@@ -253,3 +280,3 @@ style: {

width: '100%',
content: ``,
content: "",
height: 2,

@@ -334,3 +361,3 @@ bottom: 0,

['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].forEach(key => {
this.screen.key([`${key}`], (ch, key) => {
this.screen.key(["".concat(key)], (ch, key) => {
keys += key.full;

@@ -367,20 +394,20 @@ clearTimeout(keyTimeout);

const watchColorFn = currentScript.isWatched() ? chalk.bgBlue.black : chalk.bgWhite.black;
footerContent.push(`${chalk.bgWhite.black(' Run (r) ')}`);
footerContent.push(`${chalk.bgWhite.black(' Exit (e) ')}`);
footerContent.push(`${chalk.bgWhite.black(' Copy (c) ')}`);
footerContent.push("".concat(chalk.bgWhite.black(' Run (r) ')));
footerContent.push("".concat(chalk.bgWhite.black(' Exit (e) ')));
footerContent.push("".concat(chalk.bgWhite.black(' Copy (c) ')));
if (currentScript.isWatchable()) {
footerContent.push(`${watchColorFn(' Watch (w) ')}`);
footerContent.push("".concat(watchColorFn(' Watch (w) ')));
}
footerContent.push(`${switchColorFn(' Switch (s) ')}`); // footerContent.push(`${chalk.bgWhite.black(' Exit ')} ${chalk.bold.black('ctrl-c')} `)
footerContent.push("".concat(switchColorFn(' Switch (s) '))); // footerContent.push(`${chalk.bgWhite.black(' Exit ')} ${chalk.bold.black('ctrl-c')} `)
footerContent.push(`\n`);
footerContent.push("\n");
if (this._packageJson.homepage) {
footerContent.push(`${chalk.bgBlack.white(' Homepage ')} ${chalk.bold.black(this._packageJson.homepage)} `);
footerContent.push("".concat(chalk.bgBlack.white(' Homepage '), " ").concat(chalk.bold.black(this._packageJson.homepage), " "));
}
if (this._packageJson.author) {
footerContent.push(`${chalk.bgBlack.white(' Author ')} ${chalk.bold.black(this._packageJson.author)}`);
footerContent.push("".concat(chalk.bgBlack.white(' Author '), " ").concat(chalk.bold.black(this._packageJson.author)));
}

@@ -416,3 +443,3 @@

if (icon) {
iconToDisplay = `${icon} `;
iconToDisplay = "".concat(icon, " ");
}

@@ -427,3 +454,3 @@

let idx = pad(2, Object.keys(this._scriptsStack).indexOf(scriptId) + 1, '0');
return ` ${idx}. ${iconToDisplay}${readedIcon}${scriptId}`;
return " ".concat(idx, ". ").concat(iconToDisplay).concat(readedIcon).concat(scriptId);
}

@@ -519,3 +546,3 @@

const lastSplit = splitedScript[splitedScript.length - 1];
const icon = icons.indexOf(lastSplit) !== -1 ? `icon-${lastSplit}` : null;
const icon = icons.indexOf(lastSplit) !== -1 ? "icon-".concat(lastSplit) : null;

@@ -527,3 +554,3 @@ if (this._config.notifications) {

message: 'Completed successfuly',
icon: icon ? path.join(__dirname, `../.resources/${icon}.png`) : null,
icon: icon ? path.join(__dirname, "../.resources/".concat(icon, ".png")) : null,
sound: true,

@@ -578,2 +605,3 @@ timeout: 4

var _default = scriptsStack;
exports.default = _default;
exports.default = _default;
module.exports = exports.default;

@@ -20,5 +20,8 @@ "use strict";

const commandExistsSync = require('command-exists').sync;
class Script {
constructor(id, watchOpts = null, runner = 'npm') {
constructor(id, script, watchOpts = null, runner = 'npm') {
this._id = id;
this._script = script;
this._runner = runner;

@@ -38,3 +41,3 @@ this._stack = [];

// reset the stack
this._stack = [`press ${chalk.yellow.bold('r')} to run or ${chalk.red.bold('e')} to exit the ${chalk.bold(this.id)} script`];
this._stack = ["press ".concat(chalk.yellow.bold('r'), " to run or ").concat(chalk.red.bold('e'), " to exit the ").concat(chalk.bold(this.id), " script")];
}

@@ -54,5 +57,5 @@

this._stack.push(chalk.yellow(`${logSymbols.warning} Start ${chalk.bold(this.id)}\n`));
this._stack.push(chalk.yellow("".concat(logSymbols.warning, " Start ").concat(chalk.bold(this.id), "\n")));
this._stack.push(chalk.yellow(`----------------------------------------\n`)); // dispatch new data
this._stack.push(chalk.yellow("----------------------------------------\n")); // dispatch new data

@@ -66,11 +69,13 @@

this._isRunning = true; // build command stack
this._isRunning = true; // manage runner
if (commandExistsSync('ck')) this._runner = 'ck'; // build command stack
const commandArgs = [];
if (this._runner === 'npm') commandArgs.push('run');
commandArgs.push(this.id);
commandArgs.push('--silent'); // spawn a new process with the runner and commandArgs
if (this._runner === 'npm' || this._runner === 'ck') commandArgs.push('run');
commandArgs.push(this.id); // spawn a new process with the runner and commandArgs
this._childScript = spawn(this._runner, commandArgs, {
detached: true
detached: true,
cwd: process.cwd()
});

@@ -108,10 +113,10 @@

// append that the script has been launched
this._stack.push(chalk.green(`----------------------------------------\n`));
this._stack.push(chalk.green("----------------------------------------\n"));
this._stack.push(chalk.green(`${logSymbols.success} Completed ${chalk.bold(this.id)} in ${(endTime - startTime) / 1000}s\n`));
this._stack.push(chalk.green("".concat(logSymbols.success, " Completed ").concat(chalk.bold(this.id), " in ").concat((endTime - startTime) / 1000, "s\n")));
} else {
// append that the script has been launched
this._stack.push(chalk.red(`----------------------------------------\n`));
this._stack.push(chalk.red("----------------------------------------\n"));
this._stack.push(chalk.red(`${logSymbols.error} Error in ${chalk.bold(this.id)} after ${(endTime - startTime) / 1000}s\n`));
this._stack.push(chalk.red("".concat(logSymbols.error, " Error in ").concat(chalk.bold(this.id), " after ").concat((endTime - startTime) / 1000, "s\n")));
} // dispatch new data

@@ -248,2 +253,6 @@

get script() {
return this._script;
}
get stack() {

@@ -256,2 +265,3 @@ this.markAsRead();

exports.default = Script;
exports.default = Script;
module.exports = exports.default;
{
"name": "@coffeekraken/scripts-stack",
"version": "0.0.4",
"version": "0.0.5",
"description": "Nice terminal interface to handle npm/yarn scripts execution as well as watch and run automatically the wanted ones",
"homepage": "https://coffeekraken.io",
"bin": {
"coffeekraken-scripts-stack": "./bin/coffeekraken-scripts-stack"
"coffeekraken-scripts-stack": "./bin/coffeekraken-scripts-stack",
"ck-scripts-stack": "./bin/coffeekraken-scripts-stack"
},
"scripts": {
"start": "nps start"
},
"keywords": [

@@ -34,12 +32,5 @@ "coffee",

"devDependencies": {
"@babel/preset-env": "^7.0.0-beta.36",
"git-changelog": "^1.1.2",
"nps": "^5.9.5",
"nps-utils": "^1.7.0",
"standard": "^10.0.3"
},
"dependencies": {
"@babel/cli": "^7.0.0-beta.36",
"@babel/core": "^7.0.0-beta.36",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.36",
"ansi-styles": "^3.2.0",

@@ -50,2 +41,3 @@ "blessed": "^0.1.81",

"clipboardy": "^1.2.3",
"command-exists": "^1.2.8",
"commander": "^2.9.0",

@@ -57,2 +49,3 @@ "create-symlink": "^1.0.0",

"pad": "^2.0.3",
"pkg-up": "^3.1.0",
"remove-blank-lines": "^1.0.8",

@@ -62,3 +55,3 @@ "strip-ansi": "^4.0.0",

},
"gitHead": "2b8f8ee90dadff470f7743ca5266821e08e24d79"
"gitHead": "439d0eac5d23f6337d3a6afda31f42cefe3ae0ba"
}

Sorry, the diff of this file is not supported yet

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