New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

stackly

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stackly - npm Package Compare versions

Comparing version
0.0.1
to
1.0.0
.npmignore

Sorry, the diff of this file is not supported yet

+78
#! /usr/bin/env node
"use strict";
const path = require('path');
const fs = require('fs');
const readlineSync = require('readline-sync');
const stackFilePath = path.join(process.env.HOME, '.stackly.json');
var stack = new Array();
main();
function main() {
updateStackFromFile();
let args = process.argv.slice(2);
if (args.length === 0) {
printStack();
}
else if (args.length === 1) {
if (args[0] === 'push') {
stackAddCommand();
}
else if (args[0] === 'pop') {
stackPopCommand();
}
else if (args[0] === 'clean') {
}
else {
printCommandDidNotFound(args);
}
}
else {
printCommandDidNotFound(args);
}
}
;
function printCommandDidNotFound(args) {
console.log(`\n Stackly Error: "${args.join(' \u27E9 ')}" is not defined \n`);
}
function cleanTheStack() {
console.log('\n Stackly: Fully Cleaned\n');
stack = [];
storeStackFile();
}
function stackPopCommand() {
console.log(`\n \u2713 ${stack.pop()}\n`);
storeStackFile();
}
function stackAddCommand() {
let task = readlineSync.question(' Stackly: New Task: ');
stack.push(task);
storeStackFile();
}
function printStack() {
let stackCount = stack.length;
if (stackCount === 0) {
console.log('\n Stackly: No task found.\n');
return;
}
for (let index = stackCount; index > 0; index--) {
console.log(`\n ${stackCount - index + 1} \u2723 ${stack[index - 1]}`);
}
console.log('');
}
function updateStackFromFile() {
try {
stack = JSON.parse(fs.readFileSync(stackFilePath, 'utf8'));
return true;
}
catch (error) {
return false;
}
}
function storeStackFile() {
try {
fs.writeFileSync(stackFilePath, JSON.stringify(stack));
return true;
}
catch (error) {
return false;
}
}
+9
-3
{
"name": "stackly",
"version": "0.0.1",
"version": "1.0.0",
"description": "A stack based 'what you were doing' tool!",
"main": "bin/index.jx",
"bin": {
"stackly": "bin/index.js"
},
"scripts": {

@@ -18,3 +20,7 @@ "test": "echo \"Error: no test specified\" && exit 1"

},
"homepage": "https://github.com/pmkary/stackly#readme"
"homepage": "https://github.com/pmkary/stackly#readme",
"dependencies": {
"chalk": "^1.1.3",
"readline-sync": "^1.4.4"
}
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"sourceMap": false
},
"exclude": [
"node_modules"
]
}