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

compact-yarn-audit

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compact-yarn-audit - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

types/compact-yarn-audit.d.ts

33

package.json
{
"name": "compact-yarn-audit",
"version": "1.2.0",
"version": "1.2.1",
"description": "Presents output from yarn audit in a compact table",

@@ -26,5 +26,12 @@ "engines": {

"scripts": {
"check": "npm-run-all format lint test",
"format": "prettier --write src/**/*.js *.md",
"lint": "eslint src types --cache --cache-location node_modules/.cache/eslint/",
"lint:fix": "eslint src types --fix --cache --cache-location node_modules/.cache/eslint/",
"scm:stage": "git add .",
"test": "mocha src --exit",
"update-dependencies": "npm-run-all upem:update upem:install format test",
"upem-outdated": "npm outdated --json --long | upem --dry-run",
"upem:update": "npm outdated --json --long | upem | pbcopy && pbpaste",
"upem:install": "npm install",
"version": "npm-run-all test scm:stage"

@@ -37,3 +44,3 @@ },

"dependencies": {
"chalk": "^5.0.1",
"chalk": "^5.1.2",
"ndjson": "^2.0.0",

@@ -44,6 +51,19 @@ "strip-ansi": "^7.0.1",

"devDependencies": {
"chai": "^4.3.6",
"mocha": "^10.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2"
"@typescript-eslint/eslint-plugin": "5.40.0",
"@typescript-eslint/parser": "5.40.0",
"eslint": "8.25.0",
"eslint-config-moving-meadow": "4.0.2",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-budapestian": "5.0.1",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-mocha": "10.1.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-security": "1.5.0",
"eslint-plugin-unicorn": "44.0.2",
"mocha": "10.0.0",
"npm-run-all": "4.1.5",
"prettier": "2.7.1",
"typescript": "4.8.4",
"upem": "7.3.0"
},

@@ -53,2 +73,3 @@ "files": [

"!src/**/*.spec.js",
"types",
"package.json",

@@ -55,0 +76,0 @@ "README.md"

2

src/format.js

@@ -0,3 +1,3 @@

import { EOL } from "node:os";
import { terseAdvisoryLog2Table } from "./terse-advisory-to-table.js";
import { EOL } from "node:os";

@@ -4,0 +4,0 @@ /**

#!/usr/bin/env node
/* eslint-disable no-console, node/no-process-exit */
import ndjson from "ndjson";

@@ -6,3 +7,3 @@ import { TerseAdvisoryLog } from "./terse-advisory-log.js";

const lAdvisaryLog = new TerseAdvisoryLog();
const lAdvisoryLog = new TerseAdvisoryLog();

@@ -12,3 +13,3 @@ process.stdin

.on("data", (pLogEntry) => {
lAdvisaryLog.add(pLogEntry);
lAdvisoryLog.add(pLogEntry);
})

@@ -21,3 +22,3 @@ .on("error", (pError) => {

.on("end", () => {
console.log(format(lAdvisaryLog.get()));
console.log(format(lAdvisoryLog.get()));
});

@@ -5,7 +5,7 @@ import { createHash } from "node:crypto";

*
* @param {import("../types/compact-yarn-audit").ITerseEntry} pObject
* @param {import("../types/compact-yarn-audit").ITerseEntry} pEntry
* @returns {string}
*/
function hash(pObject) {
return createHash("md5").update(JSON.stringify(pObject)).digest("base64");
function hash(pEntry) {
return createHash("md5").update(JSON.stringify(pEntry)).digest("base64");
}

@@ -46,2 +46,3 @@

};
// eslint-disable-next-line security/detect-object-injection
return lSeverity2Order[pSeverity] || -1;

@@ -76,2 +77,6 @@ }

/**
*
* @param {import("../types/compact-yarn-audit").ITerseEntry} pEntry
*/
add(pEntry) {

@@ -82,3 +87,3 @@ if (pEntry.type === "auditAdvisory") {

// Some audit logs are several gigabytes long. Given that there'll
// be quite some duplicates, the overhead of the hash will be negligable
// be quite some duplicates, the overhead of the hash will be negligible
// compared to the amount of memory that'd normally be needed

@@ -85,0 +90,0 @@ this.log.set(hash(lUsefulAttributes), lUsefulAttributes);

@@ -17,3 +17,4 @@ import textTable from "text-table";

};
const lFunction = lSeverity2ChalkFunction[pSeverity] || ((x) => x);
// eslint-disable-next-line security/detect-object-injection
const lFunction = lSeverity2ChalkFunction[pSeverity] || ((pX) => pX);
return lFunction(pSeverity);

@@ -30,3 +31,3 @@ }

colorSeverity(pExtractedLogEntry.severity),
pExtractedLogEntry.title.substring(0, pMaxTitleWidth),
pExtractedLogEntry.title.slice(0, Math.max(0, pMaxTitleWidth)),
pExtractedLogEntry.module_name,

@@ -54,12 +55,15 @@ pExtractedLogEntry.via,

];
const lTableOpts = {
const lTableOptions = {
align: ["l", "l", "l", "l", "l", "l"],
stringLength: (pString) => stripAnsi(pString).length,
};
const lMaxTitleWidth = Math.round(pColumnsAvailable / 5);
const lTitleMagicDivisionFactor = 5;
const lMaxTitleWidth = Math.round(
pColumnsAvailable / lTitleMagicDivisionFactor
);
return textTable(
pTerseEntries.reduce(tableTheThing(lMaxTitleWidth), lTable),
lTableOpts
lTableOptions
);
}
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