Skip to content

Commit 7835ef2

Browse files
committed
Merge branch 'main' into feat/atproto-blog-fe
2 parents a4039c2 + 8274fa1 commit 7835ef2

File tree

165 files changed

+8350
-900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+8350
-900
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#secure password, can use openssl rand --hex 32
2+
NUXT_SESSION_PASSWORD=""

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* text eol=lf
1+
* text=auto eol=lf

.github/workflows/autofix.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,25 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
21-
- run: corepack enable
21+
2222
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
2323
with:
2424
node-version: lts/*
25-
cache: 'pnpm'
25+
26+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
27+
name: Install pnpm
28+
with:
29+
cache: true
2630

2731
- name: 📦 Install dependencies
2832
run: pnpm install
2933

3034
- name: 📦 Install browsers
3135
run: pnpm playwright install
3236

37+
- name: 🌐 Compare translations
38+
run: pnpm i18n:check
39+
3340
- name: 🌍 Update lunaria data
3441
run: pnpm build:lunaria
3542

.github/workflows/ci.yml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
23-
- run: corepack enable
23+
2424
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
2525
with:
2626
node-version: lts/*
27-
cache: pnpm
27+
28+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
29+
name: Install pnpm
30+
with:
31+
cache: true
2832

2933
- name: 📦 Install dependencies
3034
run: pnpm install
@@ -37,11 +41,15 @@ jobs:
3741

3842
steps:
3943
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
40-
- run: corepack enable
44+
4145
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
4246
with:
4347
node-version: lts/*
44-
cache: pnpm
48+
49+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
50+
name: Install pnpm
51+
with:
52+
cache: true
4553

4654
- name: 📦 Install dependencies
4755
run: pnpm install
@@ -65,11 +73,15 @@ jobs:
6573

6674
steps:
6775
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
68-
- run: corepack enable
76+
6977
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
7078
with:
7179
node-version: lts/*
72-
cache: pnpm
80+
81+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
82+
name: Install pnpm
83+
with:
84+
cache: true
7385

7486
- name: 📦 Install dependencies
7587
run: pnpm install
@@ -82,11 +94,15 @@ jobs:
8294

8395
steps:
8496
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
85-
- run: corepack enable
97+
8698
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
8799
with:
88100
node-version: lts/*
89-
cache: pnpm
101+
102+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
103+
name: Install pnpm
104+
with:
105+
cache: true
90106

91107
- name: 📦 Install dependencies
92108
run: pnpm install
@@ -104,11 +120,15 @@ jobs:
104120

105121
steps:
106122
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
107-
- run: corepack enable
123+
108124
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
109125
with:
110126
node-version: lts/*
111-
cache: pnpm
127+
128+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
129+
name: Install pnpm
130+
with:
131+
cache: true
112132

113133
- name: 📦 Install dependencies
114134
run: pnpm install

.github/workflows/lunaria.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ jobs:
2828
# Makes the action clone the entire git history
2929
fetch-depth: 0
3030

31-
- run: corepack enable
3231
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
3332
with:
3433
node-version: lts/*
35-
cache: pnpm
34+
35+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
36+
name: Install pnpm
37+
with:
38+
cache: true
3639

3740
- name: 📦 Install dependencies
3841
run: pnpm install

.github/workflows/provenance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci
1+
name: provenance
22

33
on:
44
push:

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ This Code of Conduct applies within all project spaces, and it also applies when
3434

3535
## Enforcement
3636

37-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [daniel@roe.dev](mailto:daniel@roe.dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38-
39-
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project stewards (`@danielroe` and `@patak.dev`) by DM in our [community chat](https://chat.npmx.dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The stewards are obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
4038

4139
## Attribution
4240

CONTRIBUTING.md

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -256,31 +256,63 @@ The [config/i18n.ts](./config/i18n.ts) configuration file will be used to regist
256256
- `locales` object will be used to link the supported locales (country and single one)
257257
- `buildLocales` function will build the target locales
258258

259-
To register a new locale:
259+
To add a new locale:
260+
261+
1. Create a new JSON file in [`i18n/locales/`](./i18n/locales) with the locale code as the filename (e.g., `uk-UA.json`, `de-DE.json`)
262+
2. Copy [`en.json`](./i18n/locales/en.json) and translate the strings
263+
3. Add the locale to the `locales` array in [config/i18n.ts](./config/i18n.ts):
260264

261-
- for a single country, your JSON file should include the language and the country in the name (for example, `pl-PL.json`) and register the info at `locales` object
262-
- for multiple country variants, you need to add the default language JSON file (for example for Spanish, `es.json`) and one of the country variants (for example for Spanish for Spain, `es-ES.json`); register the language at `countryLocaleVariants` object adding the country variants with the JSON country file and register the language at `locales` object using the language JSON file (check how we register `es`, `es-ES` and `es-419` in [config/i18n.ts](./config/i18n.ts))
265+
```typescript
266+
{
267+
code: 'uk-UA', // Must match the filename (without .json)
268+
file: 'uk-UA.json',
269+
name: 'Українська', // Native name of the language
270+
},
271+
```
263272

264-
The country file should contain will contain only the translations that differ from the language JSON file, Vue I18n will merge the messages for us.
273+
4. Copy your translation file to `lunaria/files/` for translation tracking:
265274

266-
To add a new locale:
275+
```bash
276+
cp i18n/locales/uk-UA.json lunaria/files/uk-UA.json
277+
```
278+
279+
> [!IMPORTANT]
280+
> This file must be committed. Lunaria uses git history to track translation progress, so the build will fail if this file is missing.
267281
268-
1. Add a new file at [locales](./i18n/locales) folder with the language code as the filename.
269-
2. Copy [en](./i18n/locales/en.json) and translate the strings
270-
3. Add the language to the `locales` array in [config/i18n.ts](./config/i18n.ts), below `en` and `ar`:
271-
- If your language has multiple country variants, add the generic one for language only (only if there are a lot of common entries, you can always add it as a new one)
272-
- Add all country variants in [country variants object](./config/i18n.ts)
273-
- Add all country variants files with empty `messages` object: `{}`
274-
- Translate the strings in the generic language file
275-
- Later, when anyone wants to add the corresponding translations for the country variant, just override any entry in the corresponding file: you can see an example with `es` variants.
276-
- If the generic language already exists:
277-
- If the translation doesn't differ from the generic language, then add the corresponding translations in the corresponding file
278-
- If the translation differs from the generic language, then add the corresponding translations in the corresponding file and remove it from the country variants entry
279-
4. If the language is `right-to-left`, add `dir` option with `rtl` value, for example, for [ar](./config/i18n.ts)
280-
5. If the language requires special pluralization rules, add `pluralRule` callback option, for example, for [ar](./config/i18n.ts)
282+
5. If the language is `right-to-left`, add `dir: 'rtl'` (see `ar-EG` in config for example)
283+
6. If the language requires special pluralization rules, add a `pluralRule` callback (see `ar-EG` or `ru-RU` in config for examples)
281284

282285
Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essentials/pluralization.html#custom-pluralization) for more info.
283286

287+
### Update translation
288+
289+
We track the current progress of translations with [Lunaria](https://lunaria.dev/) on this site: https://i18n.npmx.dev/
290+
If you see any outdated translations in your language, feel free to update the keys to match then English version.
291+
292+
In order to make sure you have everything up-to-date, you can run:
293+
294+
```bash
295+
pnpm i18n:check <country-code>
296+
```
297+
298+
For example to check if all Japanese translation keys are up-to-date, run:
299+
300+
```bash
301+
pnpm i18n:check ja-JP
302+
```
303+
304+
#### Country variants (advanced)
305+
306+
Most languages only need a single locale file. Country variants are only needed when you want to support regional differences (e.g., `es-ES` for Spain vs `es-419` for Latin America).
307+
308+
If you need country variants:
309+
310+
1. Create a base language file (e.g., `es.json`) with all translations
311+
2. Create country variant files (e.g., `es-ES.json`, `es-419.json`) with only the differing translations
312+
3. Register the base language in `locales` and add variants to `countryLocaleVariants`
313+
314+
See how `es`, `es-ES`, and `es-419` are configured in [config/i18n.ts](./config/i18n.ts) for a complete example.
315+
284316
### Adding translations
285317

286318
1. Add your translation key to `i18n/locales/en.json` first (American English is the source of truth)

GOVERNANCE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Governance
2+
3+
This document outlines the governance model for npmx. This includes descriptions of different roles, nomination processes, code review processes, and Code of Conduct enforcement.
4+
5+
**All community members must follow the [Code of Conduct (CoC)](CODE_OF_CONDUCT.md).**
6+
7+
## Get Involved
8+
9+
**Anything that supports the npmx community is a valuable contribution!**
10+
11+
All types of contribution are meaningful. This can include code changes, type fixes, Discord activity, and even posting about npmx to your personal blog. No contribution is too small!
12+
13+
Anyone can become an npmx contributor. Engineering ability is not required. Our goal is to recognize all contributors to the project regardless of skill, experience or background.
14+
15+
## Roles
16+
17+
Each contributor role comes with a set of privileges and responsibilities, and they are granted for as long as the individual wishes to engage with the project. Contributors can voluntarily leave the project at any time.
18+
19+
### Contributor
20+
21+
Have you done something (big or small) to contribute to the health, success, or growth of npmx? Congratulations, you're officially recognized as a **Contributor** to the project! Examples of recognized contributions are helping on the repo, chat, and social. But also blogging, podcasting, and livestreaming about npmx.
22+
23+
This role does not require any extra responsibilities nor time commitment. We hope you stick around and keep participating in our community!
24+
25+
### Maintainer
26+
27+
The **Maintainer** role is available to contributors who want to join the team and take part in the long-term maintenance and growth of npmx. This role is critical to the long-term health of npmx. Maintainers act as the first line of defense when it comes to new issues, pull requests and chat activity.
28+
29+
Maintainers are not required to write code! Some Maintainers spend most of their time inside of our chat, maintaining a healthy community there. Others work on technical documentation, support, or design. There is no strict minimum number of contributions needed to reach this level, as long as you can show sustained involvement over time.
30+
31+
### Core
32+
33+
The **Core** role is available to community members who have a larger-than-usual impact on the npmx project and community. They are seen as leaders in the project and are listened to by the wider npmx community, often before they have even reached this level. A Core member is recognized for contributing a significant amount of time and energy to the project through issues, pull requests, bug fixes, implementing advanced features, or actively posting on our chat.
34+
35+
Not every contributor will reach this level, and that's okay! Maintainers still have significant responsibility and privileges within our community.
36+
37+
### Project Steward
38+
39+
**Stewards** control and maintain sensitive project asset and assist in shaping the direction and vision of the project. We aim to act with consensus within the core team, but stewards can resolve disagreements when needed. Stewards act in the project's best interest and should be an example for the rest of the community. New Stewards are added based on a unanimous vote by the existing Stewards.
40+
41+
The npmx project Stewards are currently:
42+
43+
- **Daniel Roe** ([website](https://roe.dev), [social](https://bsky.app/profile/danielroe.dev), [github](https://github.com/danielroe), [@danielroe](https://chat.npmx.dev))
44+
- **Matias Capeletto** ([website](https://patak.dev), [social](https://bsky.app/profile/patak.dev), [github](https://github.com/patak-dev), [@patak.dev](https://chat.npmx.dev))
45+
46+
---
47+
48+
Inspired by [Astro](https://github.com/withastro/.github/blob/main/GOVERNANCE.md), [ESLint](https://eslint.org/docs/6.0.0/maintainer-guide/governance), [Rome](https://github.com/rome/tools/blob/203b8efaf3ff087e82b97c484dedc5b5c5f15bcd/GOVERNANCE.md) and [Blitz](https://blitzjs.com/docs/maintainers).

app/app.vue

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const { locale, locales } = useI18n()
1010
initPreferencesOnPrehydrate()
1111
1212
const isHomepage = computed(() => route.name === 'index')
13+
const showKbdHints = shallowRef(false)
1314
1415
const localeMap = locales.value.reduce(
1516
(acc, l) => {
@@ -21,8 +22,9 @@ const localeMap = locales.value.reduce(
2122
2223
useHead({
2324
htmlAttrs: {
24-
lang: () => locale.value,
25-
dir: () => localeMap[locale.value] ?? 'ltr',
25+
'lang': () => locale.value,
26+
'dir': () => localeMap[locale.value] ?? 'ltr',
27+
'data-kbd-hints': () => showKbdHints.value,
2628
},
2729
titleTemplate: titleChunk => {
2830
return titleChunk ? titleChunk : 'npmx - Better npm Package Browser'
@@ -33,16 +35,16 @@ if (import.meta.server) {
3335
setJsonLd(createWebSiteSchema())
3436
}
3537
36-
// Global keyboard shortcut: "/" focuses search or navigates to search page
38+
// Global keyboard shortcut:
39+
// "/" focuses search or navigates to search page
40+
// "?" highlights all keyboard shortcut elements
3741
function handleGlobalKeydown(e: KeyboardEvent) {
3842
const target = e.target as HTMLElement
3943
4044
const isEditableTarget =
4145
target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable
4246
43-
if (isEditableTarget) {
44-
return
45-
}
47+
if (isEditableTarget) return
4648
4749
if (e.key === '/') {
4850
e.preventDefault()
@@ -59,15 +61,26 @@ function handleGlobalKeydown(e: KeyboardEvent) {
5961
6062
router.push('/search')
6163
}
64+
65+
if (e.key === '?') {
66+
e.preventDefault()
67+
showKbdHints.value = true
68+
}
69+
}
70+
71+
function handleGlobalKeyup() {
72+
showKbdHints.value = false
6273
}
6374
6475
if (import.meta.client) {
6576
useEventListener(document, 'keydown', handleGlobalKeydown)
77+
useEventListener(document, 'keyup', handleGlobalKeyup)
6678
}
6779
</script>
6880

6981
<template>
7082
<div class="min-h-screen flex flex-col bg-bg text-fg">
83+
<NuxtPwaAssets />
7184
<a href="#main-content" class="skip-link font-mono">{{ $t('common.skip_link') }}</a>
7285

7386
<AppHeader :show-logo="!isHomepage" />
@@ -81,3 +94,25 @@ if (import.meta.client) {
8194
<ScrollToTop />
8295
</div>
8396
</template>
97+
98+
<style>
99+
/* Keyboard shortcut highlight on "?" key press */
100+
kbd {
101+
position: relative;
102+
}
103+
104+
kbd::before {
105+
content: '';
106+
position: absolute;
107+
inset: 0;
108+
border-radius: inherit;
109+
box-shadow: 0 0 4px 2px var(--accent);
110+
opacity: 0;
111+
transition: opacity 200ms ease-out;
112+
pointer-events: none;
113+
}
114+
115+
html[data-kbd-hints='true'] kbd::before {
116+
opacity: 1;
117+
}
118+
</style>

0 commit comments

Comments
 (0)