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

Feature request : support JSR syntax #1433

Open
1 task done
MarArMar opened this issue Jul 27, 2024 · 0 comments
Open
1 task done

Feature request : support JSR syntax #1433

MarArMar opened this issue Jul 27, 2024 · 0 comments

Comments

@MarArMar
Copy link

MarArMar commented Jul 27, 2024

Summary : packaged on JSR like "https://jsr.io/@ryoppippi/unplugin-typia" raise errors when ncu tries to check their upgrade and also they don't get upgraded


Steps to Reproduce

.ncurc: not used

Dependencies:

{
  "name": "example-jsr",
  "version": "0.0.1",
  "dependencies": {
    "@ryoppippi/unplugin-typia": "npm:@jsr/[email protected]",
  },
}

Steps:

npx jsr add -D @ryoppippi/unplugin-typia
# or 
bun x jsr add -D @ryoppippi/unplugin-typia
# then replace with an older verison like @0.6.8 then attempt to upgrade using : 
ncu --upgrade --target semver --packageManager bun

Current Behavior

 @ryoppippi/unplugin-typia  404 Not Found - GET https://registry.npmjs.org/@jsr%2fryoppippi__unplugin-typia. All 3 retry attempts failed. Either your internet connection is down, the registry is inaccessible, the authentication credentials are invalid, or the package does not exist. 

Expected Behavior

It would upgrade to

{
  "name": "example-jsr",
  "version": "0.0.1",
  "dependencies": {
    "@ryoppippi/unplugin-typia": "npm:@jsr/[email protected]",
  },
}

Workaround :

  output=$(ncu --upgrade --target "$ncu_update_method" --packageManager "$packageManager" 2>&1)

  if echo "$output" | grep -q "404 Not Found - GET https://registry.npmjs.org/@jsr"; then
    # Handles JSR : 404 Not Found - GET https://registry.npmjs.org/@jsr ... 
    jsr_url=$(echo "$output" | grep -o 'https://registry.npmjs.org/@jsr[^"]*' | sed 's|https://registry.npmjs.org/@jsr%2f|https://jsr.io/@|' | sed 's|__|/|')
    package_name=$(echo "$jsr_url" | sed 's|https://jsr.io/||' | cut -d'.' -f1)
    echo "JSR package detected: '$package_name'"
    bun_jsr_view=$(bun x jsr view "$package_name")
    version=$(echo "$bun_jsr_view" | grep -oP '@\K[0-9]+\.[0-9]+\.[0-9]+(?= \|)')
    echo "Trying to upgrade to '$package_name@$version'"
    bun x jsr add "$package_name@$version"
  else
    echo "$output"
  fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants