npm / npm/cli

Feature: Allow Arborist to configure node_modules and manifest locations independently

Open
#7,214 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Triage
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

This is not a bug report, but I didn't see a way to do a feature request.

For Arborist to generate a tree based on node_modules and a manifest, it currently expects them both in the same location and outputs its lockfile there. This is problematic for isolate-package, which wants to generate a pruned lockfile based on the node_modules from the monorepo root, plus an adapted manifest living in a different (isolate) directory.

To make things work, I need to temporarily move the node_modules folder into the isolate directory before running Arborist, and then move it back when finished.

Apart from it being an ugly hack, it prevents multiple processes from executing in parallel. This is a problem because in a monorepo it's likely you want to isolate and deploy multiple packages in parallel.

Generating pruned lockfiles for Yarn and PNPM is not so problematic, but for NPM this is currently the only way to do it AFAIK.

Here is a link to the code with the workaround:
https://github.com/0x80/isolate-package/blob/main/src/lib/lockfile/helpers/generate-npm-lockfile.ts

Expected Behavior

Make Arborist accept a separate configuration for locations of the node_modules and manifest files. Please? 🙏

Steps To Reproduce

No response

Environment

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the workaround in src/lib/lockfile/helpers/generate-npm-lockfile.ts from isolate-package and compare it with Arborist's current location assumptions. Done means Arborist can configure node_modules and manifest locations independently, generate the pruned lockfile in the intended location, and avoid moving directories so multiple isolation processes can run in parallel.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.