lockfile-subset 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.mjs +2 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -100,6 +100,7 @@ Dev dependencies of each package are excluded from traversal. Optional dependenc
|
|
|
100
100
|
|
|
101
101
|
## Limitations
|
|
102
102
|
|
|
103
|
+
- **Lockfile v2/v3 only** — Requires npm 7+ (lockfile v2 or v3). The legacy v1 format (npm 5-6) is not supported.
|
|
103
104
|
- **npm only** — pnpm and yarn have different lockfile formats. pnpm users can use `pnpm deploy`; yarn users can use `yarn workspaces focus`.
|
|
104
105
|
- **Platform-specific optional deps** — Packages like `sharp` have OS/arch-specific optional dependencies (e.g., `@img/sharp-linux-x64`). If your lockfile was generated on macOS but you run `npm ci` on Linux (e.g., in Docker), those Linux-specific packages may be missing from the lockfile. In that case, generate the lockfile on the target platform, or use `npm install` instead of `npm ci`.
|
|
105
106
|
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,8 @@ import { mkdirSync, writeFileSync } from "fs";
|
|
|
7
7
|
//#region src/extract.ts
|
|
8
8
|
async function extractSubset({ projectPath, packageNames, includeOptional = true }) {
|
|
9
9
|
const tree = await new Arborist({ path: projectPath }).loadVirtual();
|
|
10
|
+
const originalLockfileVersion = tree.meta.originalLockfileVersion;
|
|
11
|
+
if (originalLockfileVersion < 2) throw new Error(`Lockfile version ${originalLockfileVersion} is not supported. Please upgrade to npm 7+ (lockfile v2/v3) by running: npm install --package-lock-only`);
|
|
10
12
|
const keep = /* @__PURE__ */ new Set();
|
|
11
13
|
for (const name of packageNames) {
|
|
12
14
|
const edge = tree.edgesOut.get(name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lockfile-subset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Extract a subset of package-lock.json for specified packages and their transitive dependencies",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"type": "git",
|
|
27
27
|
"url": "git+https://github.com/tmokmss/lockfile-subset.git"
|
|
28
28
|
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"provenance": true
|
|
31
|
+
},
|
|
29
32
|
"license": "MIT",
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@semantic-release/changelog": "^6.0.3",
|