Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughThis pull request removes NPMS (npmjs.org) API integration from the application. It eliminates the NPMS mock endpoint from server cache, deletes four badge strategies (quality, popularity, maintenance, score) from the badge API endpoint, and removes the NPMS test fixture mock. It strips the score property from the npm search result type and removes associated score-based sort keys from preferences. All score-related UI components and columns across multiple Vue components are deleted, and score-related i18n translations are removed from all locale files. The PR also introduces new i18n translation keys for features like blog, error, profile, pds, and translation_status across multiple locales. Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
i think the e2e badge tests need updating 👀 |
|
Hmm, I discovered a lot more places where "popularity", "quality", "maintainence" and "score" are used, I'll push a commit that removes those as well, but they might not be neccessary to remove 🤔 |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
Okay, I might have missed many use cases of the four scores throughout the project. I am not totally sure if they all use npms, but they seems to show up everywhere. I'm not sure if we should maybe just remove them from custom badges, if the other occurances even use npms or what exactly to do here 🤔 Also I think a lot of i18n files would still need to be updated (remove the translations), but I didn't do it for now, because I wanted to get confirmation, whether I am doing the right thing (we are speaking of removing about 1000 lines 😅). We can always revert the last commit, but I'd like to get a little guidance here... |
|
if you can fix the type errors, looks good to me 👍 edit: ah and some conflicts with main |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (7)
i18n/locales/zh-TW.json (1)
887-890:⚠️ Potential issue | 🔴 CriticalRemove these orphaned sort option translations.
The
quality,popularity,maintenance, andscorekeys are no longer referenced in the codebase. TheSortKeytype definition inshared/types/preferences.tsonly includesdownloads-week,downloads-day,downloads-month,downloads-year, andupdated, and thePROVIDER_SORT_KEYSdefinition confirms these providers support onlyrelevance,downloads-week,updated, andname. These four translation entries are dead code and should be removed as part of this PR's cleanup.i18n/locales/ru-RU.json (1)
573-579:⚠️ Potential issue | 🟡 MinorNest
downloadunderpackage.sizeto match the intended key path.At Line 578,
downloadis currently created aspackage.downloadinstead ofpackage.size.download, which can leave the expected nested key unresolved for this locale.💡 Proposed fix
"size": { "b": "{size} байт", "kb": "{size} КБ", - "mb": "{size} МБ" - }, - "download": {} + "mb": "{size} МБ", + "download": {} + }i18n/locales/de-DE.json (1)
856-859:⚠️ Potential issue | 🟡 MinorRemove orphaned sort key translations from German locale.
Lines 856–859 contain translations for
quality,popularity,maintenance, andscoresort keys. These keys have been removed from the functional codebase—theSORT_KEYSconfiguration inshared/types/preferences.tsno longer includes them, and the code comment confirms "Neither provider returns useful quality/popularity/maintenance/score values". Remove these translations from the German locale to maintain consistency with the code changes.i18n/locales/bn-IN.json (1)
639-642:⚠️ Potential issue | 🟠 MajorRemove these non-functional sort option translations.
The
quality,popularity,maintenance, andscoresort keys at lines 639–642 are orphaned. They are not included inVALID_SORT_KEYSinshared/types/preferences.ts(which permits onlyrelevance,downloads-week,downloads-day,downloads-month,downloads-year,updated, andname). The codebase explicitly documents that these metrics "return useful values" from neither search provider—npm returns synthetic1values, and Algolia returns zeros. Any attempt to use these sort keys will fail validation and fall back todownloads-week-desc. Remove these orphaned translations from the i18n file.i18n/locales/cs-CZ.json (1)
868-871:⚠️ Potential issue | 🟠 MajorRemove unused sort option translations from all locale files.
The keys
quality,popularity,maintenance, andscoreunderfilters.sortare unused legacy entries from the npms provider. The codebase documents inshared/types/preferences.tsthat these return useless or synthetic values and explicitly excludes them fromPROVIDER_SORT_KEYS. The actual sorting implementation inapp/components/Package/ListToolbar.vuereferences only:relevance,downloads-week,downloads-day,downloads-month,downloads-year,published, andname.These unused keys remain across all 26+ locale files (including en.json, de-DE.json, ar.json, etc.) and should be removed as part of the npms cleanup to avoid maintaining dead translation strings.
i18n/locales/te-IN.json (1)
640-643:⚠️ Potential issue | 🟠 MajorRemove orphaned NPMS sort labels from translations.
Lines 640–643 contain translation entries for
quality,popularity,maintenance, andscoreunderfilters.sort. These sort options are not defined in the activeSortKeytype (shared/types/preferences.ts), which includes only:relevance,downloads-week,downloads-day,downloads-month,downloads-year,updated, andname. These four entries are unreferenced orphaned translations from the NPMS removal and should be deleted from this file and all other locale files.i18n/locales/hi-IN.json (1)
640-643:⚠️ Potential issue | 🟡 MinorDrop the leftover score-sort labels.
These are still the old NPMS-derived sort names. The corresponding score-based sort surface has been removed elsewhere in this PR, so keeping these translations behind leaves dead NPMS copy in
hi-IN.json.✂️ Proposed cleanup
"downloads_month": "डाउनलोड्स/महीना", "downloads_year": "डाउनलोड्स/वर्ष", - "name": "नाम", - "quality": "गुणवत्ता", - "popularity": "लोकप्रियता", - "maintenance": "रखरखाव", - "score": "स्कोर" + "name": "नाम"
🧹 Nitpick comments (3)
i18n/locales/pl-PL.json (1)
870-873: Consider removing orphaned sort keys once npms removal is confirmed.The
quality,popularity,maintenance, andscoresort translation keys at lines 870–873 may now be unused if the corresponding sort functionality has been removed with npms. Per the PR discussion, i18n removals are pending confirmation — this is a reminder to clean these up once the scope is finalised.i18n/locales/pt-BR.json (1)
1180-1180: Prefer omitting untranslated keys instead of adding empty objects.Using
{}placeholders for new message paths can produce empty sections or type mismatches at runtime, depending on how the key is read. It’s safer to omit these keys until translated and rely on fallback locale resolution.Suggested cleanup
- "version_invalid_url_format": {}, @@ - "translation_status": { - "table": {} - },Based on learnings: In this repository, non-English locale files are allowed to omit new or changed keys and translations are completed separately.
Also applies to: 1347-1349
i18n/locales/fr-FR.json (1)
599-599: Prefer omitting untranslated placeholder objects.Line 599 and Lines 1336-1339 add empty objects only. In this repo, untranslated non-English keys can be omitted, so removing these placeholders is usually cleaner until real French values are added.
Suggested cleanup
- "size": { - "b": "{size} o", - "kb": "{size} ko", - "mb": "{size} Mo" - }, - "download": {} + "size": { + "b": "{size} o", + "kb": "{size} ko", + "mb": "{size} Mo" + }- }, - "translation_status": { - "table": {} - }, - "action_bar": {} + }Based on learnings: In the npmx.dev project, new or changed entries in i18n translation files may be omitted from non-English languages, and missing non-English keys are acceptable.
Also applies to: 1336-1339
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 01f019a5-8f9d-4a38-bc10-9290a579b2c4
📒 Files selected for processing (32)
app/components/Package/TableRow.vueapp/pages/search.vuedocs/content/2.guide/6.badges.mdi18n/locales/ar.jsoni18n/locales/az-AZ.jsoni18n/locales/bg-BG.jsoni18n/locales/bn-IN.jsoni18n/locales/cs-CZ.jsoni18n/locales/de-DE.jsoni18n/locales/en.jsoni18n/locales/es.jsoni18n/locales/fr-FR.jsoni18n/locales/hi-IN.jsoni18n/locales/hu-HU.jsoni18n/locales/id-ID.jsoni18n/locales/it-IT.jsoni18n/locales/ja-JP.jsoni18n/locales/kn-IN.jsoni18n/locales/nb-NO.jsoni18n/locales/ne-NP.jsoni18n/locales/pl-PL.jsoni18n/locales/pt-BR.jsoni18n/locales/ru-RU.jsoni18n/locales/ta-IN.jsoni18n/locales/te-IN.jsoni18n/locales/tr-TR.jsoni18n/locales/uk-UA.jsoni18n/locales/zh-CN.jsoni18n/locales/zh-TW.jsoni18n/schema.jsonserver/api/registry/badge/[type]/[...pkg].get.tstest/nuxt/a11y.spec.ts
💤 Files with no reviewable changes (7)
- app/pages/search.vue
- docs/content/2.guide/6.badges.md
- app/components/Package/TableRow.vue
- i18n/schema.json
- server/api/registry/badge/[type]/[...pkg].get.ts
- test/nuxt/a11y.spec.ts
- i18n/locales/en.json
| "file_size_warning": "{size} müqayisə üçün 250KB limitini keçir", | ||
| "compare_versions": "fərq", | ||
| "compare_versions_title": "Versiyaları müqayisə et", | ||
| "version_invalid_url_format": {}, |
There was a problem hiding this comment.
Use a string (or omit the key) for compare.version_invalid_url_format.
Line 1149 sets this to {}, but this key is a user-facing message slot and should not be an object. Either provide a translated string or remove it to fall back to the base locale.
Suggested fix
- "version_invalid_url_format": {},Based on learnings: in this project, non-English locale files may omit keys that exist in English.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "version_invalid_url_format": {}, |
| }, | ||
| "download": {} |
There was a problem hiding this comment.
Likely mis-nested key: download is outside package.size.
Line 595 currently creates package.download, not package.size.download. If the UI expects the size namespace, this key will not be resolved as intended.
Suggested fix
"size": {
"b": "{size} B",
"kb": "{size} kB",
- "mb": "{size} MB"
- },
- "download": {}
+ "mb": "{size} MB",
+ "download": {}
+ }| }, | ||
| "download": {} |
There was a problem hiding this comment.
download is currently nested under package, not under package.size.
On Line 602, size is closed before Line 603, so this creates package.download instead of package.size.download. If consumers expect package.size.download, lookups will miss.
Suggested fix
- "mb": "{size} MB"
- },
- "download": {}
+ "mb": "{size} MB",
+ "download": {}
+ }| "deprecated_title": "{version} (நிறுத்தப்பட்டது)", | ||
| "view_all": "{count} பதிப்பைக் காண்க | அனைத்து {count} பதிப்புகளையும் காண்க" | ||
| "view_all": "{count} பதிப்பைக் காண்க | அனைத்து {count} பதிப்புகளையும் காண்க", | ||
| "copy_alt": {} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
TA_FILE="i18n/locales/ta-IN.json"
EN_FILE="$(fd -a '^en\.json$' i18n/locales | head -n1)"
if [ -z "${EN_FILE}" ]; then
echo "Could not find i18n/locales/en.json"
exit 1
fi
export TA_FILE EN_FILE
python - <<'PY'
import json, os
ta_file = os.environ["TA_FILE"]
en_file = os.environ["EN_FILE"]
with open(en_file, encoding="utf-8") as f:
en = json.load(f)
with open(ta_file, encoding="utf-8") as f:
ta = json.load(f)
paths = [
"package.versions.copy_alt",
"package.trends.copy_alt",
"package.download",
"compare.version_invalid_url_format",
"compare.file_filter_option",
]
def get_path(obj, path):
cur = obj
for part in path.split("."):
if isinstance(cur, dict) and part in cur:
cur = cur[part]
else:
return (False, None)
return (True, cur)
print(f"EN file: {en_file}")
print(f"TA file: {ta_file}")
for p in paths:
en_ok, en_val = get_path(en, p)
ta_ok, ta_val = get_path(ta, p)
en_type = type(en_val).__name__ if en_ok else "MISSING"
ta_type = type(ta_val).__name__ if ta_ok else "MISSING"
print(f"{p}: en={en_type}, ta={ta_type}")
PY
# Check where these keys are used as translation lookups.
rg -nP -t vue -t ts -t js -C2 \
"(['\"])(
package\\.versions\\.copy_alt|
package\\.trends\\.copy_alt|
package\\.download|
compare\\.version_invalid_url_format|
compare\\.file_filter_option
)\\1" .Repository: npmx-dev/npmx.dev
Length of output: 406
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find usage of the flagged keys in code (skip vue type to avoid rg error)
echo "=== Checking usage of flagged translation keys ==="
rg -n -t ts -t js -C3 \
"(package\.versions\.copy_alt|
package\.trends\.copy_alt|
package\.download|
compare\.version_invalid_url_format|
compare\.file_filter_option)" . --max-count=20Repository: npmx-dev/npmx.dev
Length of output: 320
🏁 Script executed:
#!/bin/bash
# Let's examine the actual structure of these keys in both files
echo "=== EN file structure for flagged keys ==="
jq '.package.versions.copy_alt, .package.trends.copy_alt, .package.download, .compare.version_invalid_url_format, .compare.file_filter_option' i18n/locales/en.json 2>/dev/null
echo ""
echo "=== TA file structure for flagged keys ==="
jq '.package.versions.copy_alt, .package.trends.copy_alt, .package.download, .compare.version_invalid_url_format, .compare.file_filter_option' i18n/locales/ta-IN.json 2>/dev/null
echo ""
echo "=== Check if these are nested keys (children) ==="
# For example, check what's inside package.versions
rg -n -U "\"copy_alt\"" i18n/locales/en.json | head -20Repository: npmx-dev/npmx.dev
Length of output: 2240
Omit empty translation objects from ta-IN.json pending completion of translations.
These keys—package.versions.copy_alt, package.trends.copy_alt, package.download, compare.version_invalid_url_format, compare.file_filter_option—are nested translation objects that contain multiple child keys in the English file but are completely empty ({}) in ta-IN.json. Empty object placeholders will prevent proper fallback to English translations. Per project convention, omit these keys from ta-IN.json until translations are available.
Affected lines
- Line 304:
package.versions.copy_alt - Line 359:
package.trends.copy_alt - Line 453:
package.download - Lines 996–998:
compare.version_invalid_url_format,compare.file_filter_option
| "mb": "{size} MB" | ||
| } | ||
| }, | ||
| "download": {} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Inspect Turkish/English locale files available.
fd -a '^(tr|tr-TR|en|en-US)\.json$' i18n/locales
# 2) Compare value types for the added keys across locale files.
python - <<'PY'
import json
from pathlib import Path
root = Path("i18n/locales")
targets = [
"package.download",
"compare.version_invalid_url_format",
"translation_status.table",
"action_bar",
]
def get_type(obj, path):
cur = obj
for part in path.split("."):
if not isinstance(cur, dict) or part not in cur:
return "<missing>"
cur = cur[part]
return type(cur).__name__
for p in sorted(root.glob("*.json")):
if p.name.startswith(("tr", "en")):
data = json.loads(p.read_text(encoding="utf-8"))
print(f"\n{p.name}")
for key in targets:
print(f" {key}: {get_type(data, key)}")
PY
# 3) Check how these keys are consumed (string lookup vs object lookup).
rg -nP --type=ts --type=js --type=vue \
'compare\.version_invalid_url_format|translation_status\.table|action_bar|package\.download'Repository: npmx-dev/npmx.dev
Length of output: 796
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Show the actual content of these keys in en.json and tr-TR.json
python - <<'PY'
import json
from pathlib import Path
files = {
"en.json": "i18n/locales/en.json",
"tr-TR.json": "i18n/locales/tr-TR.json",
}
keys = [
("package", "download"),
("compare", "version_invalid_url_format"),
("translation_status", "table"),
("action_bar",),
]
for fname, fpath in files.items():
print(f"\n{'='*60}")
print(f"{fname}")
print(f"{'='*60}")
data = json.loads(Path(fpath).read_text(encoding="utf-8"))
for key_path in keys:
cur = data
path_str = ".".join(key_path)
found = True
for key in key_path:
if isinstance(cur, dict) and key in cur:
cur = cur[key]
else:
found = False
break
if found:
print(f"\n{path_str}:")
print(f" Type: {type(cur).__name__}")
print(f" Content: {json.dumps(cur, ensure_ascii=False, indent=2)}")
else:
print(f"\n{path_str}: <NOT FOUND>")
PY
# 2) Search for usage of these keys in templates/components
echo -e "\n\n=== Usage in codebase ==="
rg -n --type ts --type js \
'(download|version_invalid_url_format|translation_status\.table|action_bar)' \
-i | head -30Repository: npmx-dev/npmx.dev
Length of output: 4041
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Search for i18n access patterns with these keys
rg -n "t\(['\"]" --type ts --type js | grep -E '(package\.download|compare\.version_invalid|translation_status\.table|action_bar)' | head -20
# 2) Also check Vue templates
rg -n '\{\{.*\$t\(' --type vue | head -20
# 3) Check i18n config for tr-TR locale setup
echo -e "\n=== i18n config for tr-TR ==="
rg -n -A 5 'tr-TR' config/i18n.ts 2>/dev/null || rg -n -A 5 'tr-TR' config/i18n.ts
# 4) Check if tr-TR is a country variant or standalone locale
echo -e "\n=== Locale configuration ==="
cat config/i18n.ts | head -80Repository: npmx-dev/npmx.dev
Length of output: 2236
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Read i18n config to see how tr-TR is set up
cat config/i18n.ts
# Also check if there's a base tr.json file
echo -e "\n=== Looking for tr.json base file ==="
fd -a '^tr\.json$' i18n/localesRepository: npmx-dev/npmx.dev
Length of output: 11448
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check for any fallback or default locale configuration
rg -n -B 3 -A 3 'fallback|defaultLocale' config/ --type ts
# Also check nuxt i18n plugin setup
rg -n -B 3 -A 3 'fallback|strategy' nuxt.config.ts app.config.ts 2>/dev/null | head -30Repository: npmx-dev/npmx.dev
Length of output: 43
Omit these empty objects from the translation file to allow proper fallback.
Since tr-TR.json is a standalone locale (not a variant overlay), defining keys as empty objects {} will prevent fallback to the English translations. This causes template lookups like $t('action_bar.title') to fail silently in affected components (ActionBar.vue, DownloadButton.vue, StatusByFile.vue, and the diff page). Remove the empty placeholders at lines 578, 1148, and 1314–1317 to restore fallback behaviour.
Suggested patch
@@
- "size": {
- "b": "{size} B",
- "kb": "{size} kB",
- "mb": "{size} MB"
- },
- "download": {}
+ "size": {
+ "b": "{size} B",
+ "kb": "{size} kB",
+ "mb": "{size} MB"
+ }
@@
- "version_invalid_url_format": {},
@@
- "translation_status": {
- "table": {}
- },
- "action_bar": {}|
Autofix seems to have run some i18n script which adds in empty translations. Feel free to commit here, I have to run 👋 |
🧭 Context
As discussed on Discord, we decided to remove all npms traces since the data is 4 years outdated.
📚 Description
https://npms.io uses and provides outdated data, like e.g. this Astro package, which is 4 years old:
The only place where npms is really used is custom badges, which provide SVGs via an API mainly for markdown in Readmes. We decided that no data is better than wrong data, therefore deleting all traces.