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

@pnpm/fs.hard-link-dir

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

@pnpm/fs.hard-link-dir - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

20

lib/index.js

@@ -9,2 +9,3 @@ "use strict";

const fs_1 = require("fs");
const logger_1 = require("@pnpm/logger");
async function hardLinkDir(src, destDirs) {

@@ -15,3 +16,17 @@ if (destDirs.length === 0)

destDirs = destDirs.filter((destDir) => path_1.default.relative(destDir, src) !== '');
const files = await fs_1.promises.readdir(src);
await _hardLinkDir(src, destDirs, true);
}
exports.hardLinkDir = hardLinkDir;
async function _hardLinkDir(src, destDirs, isRoot) {
let files = [];
try {
files = await fs_1.promises.readdir(src);
}
catch (err) { // eslint-disable-line
if (!isRoot || err.code !== 'ENOENT')
throw err;
(0, logger_1.globalWarn)(`Source directory not found when creating hardLinks for: ${src}. Creating destinations as empty: ${destDirs.join(', ')}`);
await Promise.all(destDirs.map((dir) => fs_1.promises.mkdir(dir, { recursive: true })));
return;
}
await Promise.all(files.map(async (file) => {

@@ -33,3 +48,3 @@ if (file === 'node_modules')

}));
await hardLinkDir(srcFile, destSubdirs);
await _hardLinkDir(srcFile, destSubdirs);
return;

@@ -52,3 +67,2 @@ }

}
exports.hardLinkDir = hardLinkDir;
async function linkOrCopyFile(srcFile, destFile) {

@@ -55,0 +69,0 @@ try {

7

package.json
{
"name": "@pnpm/fs.hard-link-dir",
"version": "2.0.0",
"version": "2.0.1",
"description": "Hard link (or copy if linking fails) all files from a directory to several target directories.",

@@ -26,4 +26,7 @@ "main": "lib/index.js",

"funding": "https://opencollective.com/pnpm",
"peerDependencies": {
"@pnpm/logger": "^5.0.0"
},
"devDependencies": {
"@pnpm/fs.hard-link-dir": "2.0.0",
"@pnpm/fs.hard-link-dir": "2.0.1",
"@pnpm/prepare": "0.0.65"

@@ -30,0 +33,0 @@ },

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