@publint/pack
Advanced tools
| // NOTE: | ||
| // 1. Deno is not supported as it doesn't have a pack command. | ||
| // 2. Nub and Aube are new and I don't have time to test and support it yet. | ||
| export const supportedPackageManagers = ['npm', 'yarn', 'pnpm', 'bun'] |
+2
-2
| { | ||
| "name": "@publint/pack", | ||
| "version": "0.1.5", | ||
| "version": "0.1.6", | ||
| "description": "Utilities for packing and unpacking npm packages", | ||
@@ -39,3 +39,3 @@ "type": "module", | ||
| "fs-fixture": "^2.14.0", | ||
| "vitest": "^4.1.9" | ||
| "vitest": "^4.1.10" | ||
| }, | ||
@@ -42,0 +42,0 @@ "scripts": { |
+2
-2
@@ -7,5 +7,5 @@ # @publint/pack | ||
| - npm (v9, v10, v11) | ||
| - npm (v9, v10, v11, v12) | ||
| - yarn (v3, v4) | ||
| - pnpm (v8, v9, v10) | ||
| - pnpm (v8, v9, v10, v11) | ||
| - bun | ||
@@ -12,0 +12,0 @@ |
@@ -18,1 +18,2 @@ export function pack() { | ||
| export { unpack } from './browser/unpack.js' | ||
| export { supportedPackageManagers } from './shared/constants.js' |
@@ -6,1 +6,2 @@ export { pack } from './node/pack.js' | ||
| export { unpack } from './node/unpack.js' | ||
| export { supportedPackageManagers } from './shared/constants.js' |
+6
-0
| export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | ||
| /** | ||
| * Package managers supported by `@publint/pack`. Useful to validate if a detected | ||
| * package manager works with this library. | ||
| */ | ||
| export const supportedPackageManagers: PackageManager[] | ||
| interface SharedPackOptions { | ||
@@ -4,0 +10,0 @@ /** |
@@ -74,3 +74,11 @@ import fs from 'node:fs/promises' | ||
| function parseNpmPackJson(stdoutJson) { | ||
| return stdoutJson[0].files.map((/** @type {any} */ file) => file.path) | ||
| // npm <=11 | ||
| if (Array.isArray(stdoutJson)) { | ||
| return stdoutJson[0].files.map((/** @type {any} */ file) => file.path) | ||
| } | ||
| // npm >=12 | ||
| else { | ||
| const key = Object.keys(stdoutJson)[0] | ||
| return stdoutJson[key].files.map((/** @type {any} */ file) => file.path) | ||
| } | ||
| } | ||
@@ -77,0 +85,0 @@ |
24331
3.2%16
6.67%514
3.84%