Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--install couldn't perform installation process for dependency packages that has name contains '-' #659

Closed
pillsilly opened this issue Aug 11, 2023 · 2 comments · Fixed by #663

Comments

@pillsilly
Copy link

Expected Behavior

--install shall install dependency packages from scripts.

Actual Behavior

--install couldn't perform installation process for dependency packages that has name contains '-'

Steps to Reproduce the Problem

  1. Given a script with content like below:

test.mjs

#!/usr/bin/env zx
import * as instant from 'instantly_http';

  1. zx --install test.mjs

Specifications

  • Version:7.2.3
  • Platform:Debian
@pillsilly
Copy link
Author

when debugging I found below command was performed

it seems the package name wasn't extracted correctly from the script content.

npm install --verbose --no-save --no-audit --no-fund --prefix=somepath instantly@latest

@pillsilly
Copy link
Author

pillsilly commented Aug 11, 2023

digging the code a little bit,

/^(?<name>(@[a-z0-9-]+\/)?[a-z0-9-.]+)\/?.*$/i.exec('instantly_http').groups.name
-> instantly

so the problem looks like to me that the regex went wrong when trying to extract the package name from a package full name which includes version syntax.

antongolub added a commit to antongolub/zx that referenced this issue Aug 13, 2023
antongolub added a commit to antongolub/zx that referenced this issue Aug 13, 2023
antongolub added a commit to antongolub/zx that referenced this issue Aug 15, 2023
antongolub added a commit to antongolub/zx that referenced this issue Aug 17, 2023
antonmedv pushed a commit that referenced this issue Aug 17, 2023
…ion (#663)

* fix: relax pkg name pattern

closes #659
closes #660

* test: check scoped pkg entry parsing with v declaration

* fix(deps): parse pre-relelease versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant