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

@thetimes/nmkeep

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thetimes/nmkeep - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

19

fetch.js

@@ -16,3 +16,4 @@ #!/usr/bin/env node

getFile,
makeCacheDir
makeCacheDir,
getCompressedName
} = require("./utils");

@@ -23,2 +24,3 @@ const { createReadStream } = require("fs");

const glob = require("glob");
const lzma = require("lzma-native");

@@ -44,2 +46,3 @@ program

new Promise((res, rej) => {
const decompressor = lzma.createDecompressor();
const stream = createReadStream(src);

@@ -52,3 +55,3 @@

stream.pipe(
stream.pipe(decompressor).pipe(
tar.x({

@@ -86,3 +89,3 @@ strip: 1,

const unhoistedCache = pkgVersion.replace("/", "_");
const archive = path.join(cacheSrc, `${unhoistedCache}.tgz`);
const archive = path.join(cacheSrc, getCompressedName(unhoistedCache));

@@ -105,3 +108,5 @@ await access(archive);

cacheSrc,
`${makeBinDepKey(bins, { ...devDependencies, ...dependencies })}.tgz`
getCompressedName(
makeBinDepKey(bins, { ...devDependencies, ...dependencies })
)
);

@@ -164,5 +169,5 @@

await writeFile(path.join(cacheDir, `${key}.tgz`), file.Body);
await writeFile(path.join(cacheDir, getCompressedName(key)), file.Body);
logger.info(`${key}.tgz written to ${cacheDir}`);
logger.info(`${getCompressedName(key)} written to ${cacheDir}`);
}

@@ -183,3 +188,3 @@

logger,
path.join(cacheDir, `${nmId}.tgz`),
path.join(cacheDir, getCompressedName(nmId)),
path.join(process.cwd(), "node_modules")

@@ -186,0 +191,0 @@ );

{
"name": "@thetimes/nmkeep",
"version": "0.1.0",
"version": "0.2.0",
"description": "Caches node_modules for your yarn monorepo",

@@ -33,2 +33,3 @@ "scripts": {

"hash-files": "1.1.1",
"lzma-native": "3.0.8",
"tar": "4.4.2"

@@ -35,0 +36,0 @@ },

@@ -20,4 +20,6 @@ #!/usr/bin/env node

arrToMap,
makeCacheDir
makeCacheDir,
getCompressedName
} = require("./utils");
const lzma = require("lzma-native");

@@ -43,6 +45,7 @@ program

new Promise((res, rej) => {
const writer = createWriteStream(dest);
const compressor = lzma.createCompressor();
const output = createWriteStream(getCompressedName(dest));
writer.on("finish", res);
writer.on("error", rej);
output.on("close", res);
output.on("error", rej);

@@ -52,3 +55,2 @@ tar

{
gzip: true,
cwd

@@ -58,10 +60,11 @@ },

)
.pipe(writer);
.pipe(compressor)
.pipe(output);
});
const cacheModulesById = async (logger, dir, id, cwd = process.cwd()) => {
const archive = path.resolve(dir, `${id}.tgz`);
const archive = path.resolve(dir, id);
try {
await access(archive);
await access(getCompressedName(archive));

@@ -68,0 +71,0 @@ logger.info(`Archive already exists for ${path.join(cwd, "node_modules")}`);

@@ -10,2 +10,5 @@ const hashFiles = require("hash-files");

module.exports.getCompressedName = pathWithoutExtension =>
`${pathWithoutExtension}.tar.xz`;
module.exports.makeCacheDir = async (logger, cacheDir) => {

@@ -12,0 +15,0 @@ if (cacheDir) {

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