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

@antfu/install-pkg

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antfu/install-pkg - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

3

dist/index.d.ts

@@ -13,5 +13,4 @@ import { Agent } from 'package-manager-detector';

packageManager?: string;
packageManagerVersion?: string;
preferOffline?: boolean;
additionalArgs?: string[];
additionalArgs?: string[] | ((agent: string, detectedAgent: string) => string[] | undefined);
}

@@ -18,0 +17,0 @@ declare function installPackage(names: string | string[], options?: InstallPackageOptions): Promise<tinyexec.Output>;

// src/detect.ts
import process from "process";
import process from "node:process";
import { detect } from "package-manager-detector/detect";

@@ -16,5 +16,5 @@ async function detectPackageManager(cwd = process.cwd()) {

// src/install.ts
import { existsSync } from "fs";
import process2 from "process";
import { resolve } from "path";
import { existsSync } from "node:fs";
import { resolve } from "node:path";
import process2 from "node:process";
import { x } from "tinyexec";

@@ -26,3 +26,3 @@ async function installPackage(names, options = {}) {

names = [names];
const args = options.additionalArgs || [];
const args = (typeof options.additionalArgs === "function" ? options.additionalArgs(agent, detectedAgent) : options.additionalArgs) || [];
if (options.preferOffline) {

@@ -34,4 +34,12 @@ if (detectedAgent === "yarn@berry")

}
if (agent === "pnpm" && existsSync(resolve(options.cwd ?? process2.cwd(), "pnpm-workspace.yaml")))
args.unshift("-w");
if (agent === "pnpm" && existsSync(resolve(options.cwd ?? process2.cwd(), "pnpm-workspace.yaml"))) {
args.unshift(
"-w",
/**
* Prevent pnpm from removing installed devDeps while `NODE_ENV` is `production`
* @see https://pnpm.io/cli/install#--prod--p
*/
"--prod=false"
);
}
return x(

@@ -38,0 +46,0 @@ agent,

{
"name": "@antfu/install-pkg",
"type": "module",
"version": "0.4.1",
"version": "0.5.0",
"description": "Install package programmatically.",

@@ -38,15 +38,15 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"dependencies": {
"package-manager-detector": "^0.2.0",
"tinyexec": "^0.3.0"
"package-manager-detector": "^0.2.5",
"tinyexec": "^0.3.1"
},
"devDependencies": {
"@antfu/eslint-config": "^2.27.2",
"@antfu/ni": "^0.22.4",
"@types/node": "^22.5.0",
"bumpp": "^9.5.2",
"eslint": "^9.9.1",
"esno": "^4.7.0",
"publint": "^0.2.10",
"tsup": "^8.2.4",
"typescript": "^5.5.4"
"@antfu/eslint-config": "^3.10.0",
"@antfu/ni": "^0.23.1",
"@types/node": "^22.10.0",
"bumpp": "^9.8.1",
"eslint": "^9.15.0",
"esno": "^4.8.0",
"publint": "^0.2.12",
"tsup": "^8.3.5",
"typescript": "^5.7.2"
},

@@ -53,0 +53,0 @@ "scripts": {

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