Skip to content

feat: added --linked-install#1

Open
Cxz324 wants to merge 300 commits into
nlf/optional-peer-dep-bugsfrom
fritzy/linked-install2
Open

feat: added --linked-install#1
Cxz324 wants to merge 300 commits into
nlf/optional-peer-dep-bugsfrom
fritzy/linked-install2

Conversation

@Cxz324

@Cxz324 Cxz324 commented Mar 2, 2025

Copy link
Copy Markdown
Owner

lukekarrys and others added 30 commits August 25, 2022 15:02
Also increase docs tests so they dont timeout when
rebuilding cmark-gfm
This also replaces the previous check for known broken versions of node
with an exception handler for syntax errors in order to try and give a
nicer error message when attempting to run npm on older node versions.

BREAKING CHANGE: `npm` is now compatible with the following semver range
for node: `^14.17.0 || ^16.13.0 || >=18.0.0`

Ref: npm/statusboard#519
Some of our tests were failing in windows after testing on node 18. The
reason was the inability to clean up the logs dir. This changes forces
a few tests to run in order and also cleans up any use of multiple
`t.testdir` calls in a single child test which can cause problems.
BREAKING CHANGE: this removes the `npm bin` command

The output of this command is misleading and incomplete.  The `.bin`
resolution of npm is much more nuanced than this command implies, and
the output of `npm bin` is not something end users should be dealing
with.  `npm` itself is responsible for running the `bin` entries of
modules, with the exception of global bins, which end up in the same
folder as `node` itself, presumably already in a user's path since they
can run node.

Closes npm/statusboard#537
BREAKING CHANGE: this changes the default value of `install-links` to
true

Closes npm/statusboard#510
lukekarrys and others added 27 commits December 7, 2022 15:41
 ### Refactor Config Reading During `exec`

This removes the previous workarounds that were required due to tests
setting configs that were not available in the constructor of the
commands.

This also made the fix for nodejs/node#45881
easier since the config checks for workspaces can now all be made in the
command. The fix was to move the package.json detection to
`@npmcli/config` and use that boolean instead of setting
`location=project` which affected all commands such as `config set`
saving to the wrong location.

Some notable changes from this refactor include:
-  `execWorkspaces` no longer being passed the raw workspace filters and
   instead requiring `this.setWorkspaces()` to be called which was
   already being done in most commands
- `static workspaces = [true|false]` on all commands to indicate
  workspaces support. This is used in docs generation and whether to
  throw when `execWorkspaces` is called or not.

 ### Drop `fakeMockNpm` and refactor `mockNpm`

This refactor also drops `fakeMockNpm` in favor of `realMockNpm` (now
just `mockNpm`), and adds new features to `mockNpm`.

Some new features of `mockNpm`:

- sets all configs via argv so they are parsed before `npm.load()`. This
  is the most important change as it more closely resembles real usage.
- automatically resets `process.exitCode`
- automatically puts global `node_modules` in correct testdir based on platform
- more helpful error messages when used in unsupported ways
- ability to preload a command for execution
- sets `cwd` automatically to `prefix` and sets `globalPrefix` to the
  specified testdir

Note that this commit does not include the actual test changes, which
are included in the following commits for readability reasons.

 ### Linting

This also removes some of the one off linting rules that were set in the
past to reduce churn and fixes all remaining errors.
Previously the `which` param in `npm fund` was validated incorrectly
leading to `EFUNDNUMBER` errors when used. This fixes that and does a
better job detecting when `which` is pointing to an incorrect array
bounds in the returned funding array.
This also refactors the test to use `mockNpm`
This also refactors the test to use `mockNpm`
This also uses more consistent snapshot cleaning where possible.

Note that this is an iterative step for our tests and does not implement
`MockRegistry` for them, so many of them still mock important
functionality that should be tested. This refactor to `mockNpm` should
make it easier to adopt `MockRegistry` as we see fit.
In links with fragments like `#checking-your-version-of-npm-and-node-js` the `node-js` portion doesn't work and should be `nodejs`. So for example, the following link currently on the site does NOT work (i.e. it won't scroll to relevant section):

> https://docs.npmjs.com/cli/v9/configuring-npm/install#checking-your-version-of-npm-and-node-js

...but this one (as implemented by this fix) DOES work:

> https://docs.npmjs.com/cli/v9/configuring-npm/install#checking-your-version-of-npm-and-nodejs
@Cxz324

Cxz324 commented Mar 2, 2025

Copy link
Copy Markdown
Owner Author

@Cxz324 Cxz324 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TimeoutError: locator.click: Timeout 30000ms exceeded.

@Cxz324
Cxz324 changed the base branch from latest to nlf/optional-peer-dep-bugs March 3, 2025 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.