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

copypack

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copypack - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

dist/copypack.d.ts

@@ -1,2 +0,2 @@

export declare function run(context: string, relativeProjectPath: string, sourcePackagesFilter: string[]): void;
export declare function run(context: string, targetProjectRelativePath: string, sourcePackagesFilter: string[]): void;
//# sourceMappingURL=copypack.d.ts.map
import ts from "typescript";
import fs from "node:fs";
import path from "node:path";
export function run(context, relativeProjectPath, sourcePackagesFilter) {
const targetProjectPath = path.join(context, relativeProjectPath);
export function run(context, targetProjectRelativePath, sourcePackagesFilter) {
const targetProjectPath = path.join(context, targetProjectRelativePath);
const targetNodeModulesPath = validateProjectNoduleModules(targetProjectPath);

@@ -14,5 +14,4 @@ const packageJsonPaths = ts.sys.readDirectory(context, undefined, undefined, sourcePackagesFilter);

const pkg = JSON.parse(ts.sys.readFile(filePath) || "null");
if (pkg) {
const dir = path.dirname(filePath);
console.log(pkg.name, dir);
if (pkg && pkg.name) {
const currentPackageDirPath = path.dirname(filePath);
const targetPackageLocation = path.join(targetNodeModulesPath, pkg.name);

@@ -23,15 +22,17 @@ if (fs.existsSync(targetPackageLocation) &&

fs.mkdirSync(targetPackageLocation, { recursive: true });
fs.cpSync(dir, targetPackageLocation, { recursive: true });
console.log("COPIED", pkg.name, "to target node_modules");
fs.cpSync(currentPackageDirPath, targetPackageLocation, {
recursive: true,
});
console.log(`COPIED: ${pkg.name}`);
}
else {
console.log("SKIP", pkg.name, "does not exist in target node_modules");
console.log(`SKIPPED: ${pkg.name} (does not exist in target node_modules)`);
}
}
else {
throw new Error(`package.json is empty`);
console.log(`SKIPPED: ${filePath} (no package name)`);
}
}
catch (e) {
console.warn(`error while copying package: ${filePath}\n${e}\n\nSKIPPING.`, filePath, e);
console.log(`SKIPPED: ${filePath} (error while copying package)\n${e}`);
}

@@ -38,0 +39,0 @@ }

{
"name": "copypack",
"version": "1.0.4",
"version": "1.0.5",
"description": "like links but copies",

@@ -5,0 +5,0 @@ "type": "module",

@@ -7,6 +7,6 @@ import ts from "typescript";

context: string,
relativeProjectPath: string,
targetProjectRelativePath: string,
sourcePackagesFilter: string[]
) {
const targetProjectPath = path.join(context, relativeProjectPath);
const targetProjectPath = path.join(context, targetProjectRelativePath);
const targetNodeModulesPath = validateProjectNoduleModules(targetProjectPath);

@@ -21,3 +21,5 @@ const packageJsonPaths = ts.sys.readDirectory(

if (packageJsonPaths.length === 0) {
throw new Error(`No package.json files found for the given pattern [${sourcePackagesFilter}]`);
throw new Error(
`No package.json files found for the given pattern [${sourcePackagesFilter}]`
);
}

@@ -28,5 +30,4 @@

const pkg = JSON.parse(ts.sys.readFile(filePath) || "null");
if (pkg) {
const dir = path.dirname(filePath);
console.log(pkg.name, dir);
if (pkg && pkg.name) {
const currentPackageDirPath = path.dirname(filePath);
const targetPackageLocation = path.join(

@@ -42,20 +43,16 @@ targetNodeModulesPath,

fs.mkdirSync(targetPackageLocation, { recursive: true });
fs.cpSync(dir, targetPackageLocation, { recursive: true });
console.log("COPIED", pkg.name, "to target node_modules");
fs.cpSync(currentPackageDirPath, targetPackageLocation, {
recursive: true,
});
console.log(`COPIED: ${pkg.name}`);
} else {
console.log(
"SKIP",
pkg.name,
"does not exist in target node_modules"
`SKIPPED: ${pkg.name} (does not exist in target node_modules)`
);
}
} else {
throw new Error(`package.json is empty`);
console.log(`SKIPPED: ${filePath} (no package name)`);
}
} catch (e) {
console.warn(
`error while copying package: ${filePath}\n${e}\n\nSKIPPING.`,
filePath,
e
);
console.log(`SKIPPED: ${filePath} (error while copying package)\n${e}`);
}

@@ -62,0 +59,0 @@ }

Sorry, the diff of this file is not supported yet

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