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" | ||
| ] | ||
| } |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2573
275.07%3
50%78
680%1
-50%0
-100%2
Infinity%2
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added