Skip to content

Commit 8f8360b

Browse files
committed
Merge remote-tracking branch 'origin/main' into add-lunaria-merging
# Conflicts: # lunaria/files/az-AZ.json # lunaria/files/bg-BG.json # lunaria/files/cs-CZ.json # lunaria/files/de-DE.json # lunaria/files/en-GB.json # lunaria/files/en-US.json # lunaria/files/es-419.json # lunaria/files/es-ES.json # lunaria/files/fr-FR.json # lunaria/files/hu-HU.json # lunaria/files/id-ID.json # lunaria/files/it-IT.json # lunaria/files/ja-JP.json # lunaria/files/pl-PL.json # lunaria/files/ru-RU.json # lunaria/files/uk-UA.json # lunaria/files/zh-CN.json # lunaria/files/zh-TW.json # package.json
2 parents 3f2dd7a + 40615d9 commit 8f8360b

267 files changed

Lines changed: 25238 additions & 3150 deletions

File tree

Some content is hidden

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

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#secure password, can use openssl rand -hex 32
2-
NUXT_SESSION_PASSWORD=""
2+
NUXT_SESSION_PASSWORD=""
3+
4+
#HMAC secret for image proxy URL signing, can use openssl rand -hex 32
5+
NUXT_IMAGE_PROXY_SECRET=""

.github/workflows/chromatic.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: chromatic
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
chromatic:
18+
name: 📚 Chromatic
19+
runs-on: ubuntu-24.04-arm
20+
21+
steps:
22+
- name: ☑️ Checkout
23+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
24+
with:
25+
fetch-depth: 0
26+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
27+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
28+
29+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
30+
with:
31+
node-version: lts/*
32+
33+
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
34+
name: 🟧 Install pnpm
35+
with:
36+
cache: true
37+
38+
- name: 📦 Install dependencies
39+
run: pnpm install
40+
41+
- name: 🧪 Run Chromatic Visual and Accessibility Tests
42+
uses: chromaui/action@a8ce9c58f59be5cc7090cadfc8f130fb08fcf0c3 # v15.1.0
43+
env:
44+
CHROMATIC_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}
45+
CHROMATIC_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
46+
CHROMATIC_SLUG: ${{ github.repository }}

.github/workflows/semantic-pull-requests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
with:
2525
scopes: |
2626
a11y
27+
blog
2728
deps
2829
docs
2930
cli

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,9 @@ file-tree-sprite.svg
4545

4646
# output
4747
.vercel
48+
49+
# Storybook
50+
*storybook.log
51+
storybook-static
52+
4853
.nvmrc

.storybook/main.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import type { StorybookConfig } from '@storybook-vue/nuxt'
2+
3+
const config = {
4+
stories: ['../app/**/*.stories.@(js|ts)'],
5+
addons: ['@storybook/addon-a11y', '@storybook/addon-docs', '@storybook/addon-themes'],
6+
framework: '@storybook-vue/nuxt',
7+
features: {
8+
backgrounds: false,
9+
},
10+
async viteFinal(config) {
11+
config.plugins ??= []
12+
13+
config.plugins.push({
14+
name: 'ignore-internals',
15+
transform(_, id) {
16+
if (id.includes('/app/pages/blog/') && id.endsWith('.md')) {
17+
return 'export default {}'
18+
}
19+
},
20+
})
21+
// Replace the built-in vue-docgen plugin with a fault-tolerant version.
22+
// vue-docgen-api can crash on components that import types from other
23+
// .vue files (it tries to parse the SFC with @babel/parser as plain TS).
24+
// This wrapper catches those errors so the build doesn't fail.
25+
const docgenPlugin = config.plugins?.find(
26+
(p): p is Extract<typeof p, { name: string }> =>
27+
!!p && typeof p === 'object' && 'name' in p && p.name === 'storybook:vue-docgen-plugin',
28+
)
29+
30+
if (docgenPlugin && 'transform' in docgenPlugin) {
31+
const hook = docgenPlugin.transform
32+
// Vite plugin hooks can be a function or an object with a `handler` property
33+
const originalFn = typeof hook === 'function' ? hook : hook?.handler
34+
if (originalFn) {
35+
const wrapped = async function (this: unknown, ...args: unknown[]) {
36+
try {
37+
return await originalFn.apply(this, args)
38+
} catch {
39+
return undefined
40+
}
41+
}
42+
if (typeof hook === 'function') {
43+
docgenPlugin.transform = wrapped as typeof hook
44+
} else if (hook) {
45+
hook.handler = wrapped as typeof hook.handler
46+
}
47+
}
48+
}
49+
50+
return config
51+
},
52+
} satisfies StorybookConfig
53+
54+
export default config

.storybook/preview.ts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import type { Preview } from '@storybook-vue/nuxt'
2+
import { withThemeByDataAttribute } from '@storybook/addon-themes'
3+
import { currentLocales } from '../config/i18n'
4+
import { fn } from 'storybook/test'
5+
import { ACCENT_COLORS } from '../shared/utils/constants'
6+
7+
// related: https://github.com/npmx-dev/npmx.dev/blob/1431d24be555bca5e1ae6264434d49ca15173c43/test/nuxt/setup.ts#L12-L26
8+
// Stub Nuxt specific globals
9+
// @ts-expect-error - dynamic global name
10+
globalThis['__NUXT_COLOR_MODE__'] ??= {
11+
preference: 'system',
12+
value: 'dark',
13+
getColorScheme: fn(() => 'dark'),
14+
addColorScheme: fn(),
15+
removeColorScheme: fn(),
16+
}
17+
// @ts-expect-error - dynamic global name
18+
globalThis.defineOgImageComponent = fn()
19+
20+
const preview: Preview = {
21+
parameters: {
22+
controls: {
23+
matchers: {
24+
color: /(background|color)$/i,
25+
date: /Date$/i,
26+
},
27+
},
28+
},
29+
// Provides toolbars to switch things like theming and language
30+
globalTypes: {
31+
locale: {
32+
name: 'Locale',
33+
description: 'UI language',
34+
defaultValue: 'en-US',
35+
toolbar: {
36+
icon: 'globe',
37+
dynamicTitle: true,
38+
items: [
39+
// English is at the top so it's easier to reset to it
40+
{ value: 'en-US', title: 'English (US)' },
41+
...currentLocales
42+
.filter(locale => locale.code !== 'en-US')
43+
.map(locale => ({ value: locale.code, title: locale.name })),
44+
],
45+
},
46+
},
47+
accentColor: {
48+
name: 'Accent Color',
49+
description: 'Accent color',
50+
toolbar: {
51+
icon: 'paintbrush',
52+
dynamicTitle: true,
53+
items: [
54+
...Object.keys(ACCENT_COLORS.light).map(color => ({
55+
value: color,
56+
title: color.charAt(0).toUpperCase() + color.slice(1),
57+
})),
58+
{ value: undefined, title: 'No Accent' },
59+
],
60+
},
61+
},
62+
},
63+
decorators: [
64+
withThemeByDataAttribute({
65+
themes: {
66+
Light: 'light',
67+
Dark: 'dark',
68+
},
69+
defaultTheme: 'Dark',
70+
attributeName: 'data-theme',
71+
}),
72+
(story, context) => {
73+
const { locale, accentColor } = context.globals as {
74+
locale: string
75+
accentColor?: string
76+
}
77+
78+
// Set accent color from globals
79+
if (accentColor) {
80+
document.documentElement.style.setProperty('--accent-color', `var(--swatch-${accentColor})`)
81+
} else {
82+
document.documentElement.style.removeProperty('--accent-color')
83+
}
84+
85+
return {
86+
template: '<story />',
87+
// Set locale from globals
88+
created() {
89+
if (this.$i18n) {
90+
this.$i18n.setLocale(locale)
91+
}
92+
},
93+
updated() {
94+
if (this.$i18n) {
95+
this.$i18n.setLocale(locale)
96+
}
97+
},
98+
}
99+
},
100+
],
101+
}
102+
103+
export default preview

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@
33
"editor.formatOnSave": true,
44
"i18n-ally.keystyle": "nested",
55
"i18n-ally.localesPaths": ["./i18n/locales"],
6-
"typescript.tsdk": "node_modules/typescript/lib"
6+
"typescript.tsdk": "node_modules/typescript/lib",
7+
"explorer.fileNesting.enabled": true,
8+
"explorer.fileNesting.patterns": {
9+
"*.vue": "${capture}.stories.ts"
10+
}
711
}

0 commit comments

Comments
 (0)