spoko-design-system 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/README.md +41 -0
- package/.husky/pre-commit +12 -0
- package/CHANGELOG.md +12 -0
- package/package.json +4 -2
- package/src/components/ProductCodes.vue +48 -16
- package/src/pages/components/pr-code.mdx +4 -1
package/.husky/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Git Hooks with Husky
|
|
2
|
+
|
|
3
|
+
This directory contains Git hooks managed by [Husky](https://typicode.github.io/husky/).
|
|
4
|
+
|
|
5
|
+
## Pre-commit Hook
|
|
6
|
+
|
|
7
|
+
The pre-commit hook automatically runs before each commit to ensure code quality:
|
|
8
|
+
|
|
9
|
+
1. **Builds the project** (`pnpm run build`)
|
|
10
|
+
- Catches MDX syntax errors
|
|
11
|
+
- Validates Vue components
|
|
12
|
+
- Ensures all documentation examples work
|
|
13
|
+
|
|
14
|
+
If the build fails, the commit will be blocked until errors are fixed.
|
|
15
|
+
|
|
16
|
+
## Setup for Team Members
|
|
17
|
+
|
|
18
|
+
Hooks are automatically installed when running:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The `prepare` script in `package.json` handles this automatically.
|
|
25
|
+
|
|
26
|
+
## Benefits
|
|
27
|
+
|
|
28
|
+
✅ Prevents broken builds from being committed
|
|
29
|
+
✅ Catches errors early in development
|
|
30
|
+
✅ Maintains code quality across the team
|
|
31
|
+
✅ Reduces failed CI/CD builds
|
|
32
|
+
|
|
33
|
+
## Bypassing Hooks (Emergency Only)
|
|
34
|
+
|
|
35
|
+
If you absolutely need to bypass the pre-commit hook:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git commit --no-verify -m "your message"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Note:** Only use this in emergencies. Your commit may break the build.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
echo "🔍 Running pre-commit checks..."
|
|
2
|
+
|
|
3
|
+
# Run Astro build to catch MDX and component errors
|
|
4
|
+
echo "🏗️ Building project..."
|
|
5
|
+
pnpm run build
|
|
6
|
+
|
|
7
|
+
if [ $? -eq 0 ]; then
|
|
8
|
+
echo "✅ Build successful! Proceeding with commit..."
|
|
9
|
+
else
|
|
10
|
+
echo "❌ Build failed! Please fix errors before committing."
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [1.5.2](https://github.com/polo-blue/sds/compare/v1.5.1...v1.5.2) (2025-10-28)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* improve combined PR code display and color handling ([e9bb13d](https://github.com/polo-blue/sds/commit/e9bb13d5500ba5ef0be527bf79b75e14fc49e6fe))
|
|
6
|
+
|
|
7
|
+
## [1.5.1](https://github.com/polo-blue/sds/compare/v1.5.0...v1.5.1) (2025-10-27)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* remove deprecated Husky shebang for v10 compatibility ([c7addfb](https://github.com/polo-blue/sds/commit/c7addfb1834eb480ead83b3d275977b47683a94a))
|
|
12
|
+
|
|
1
13
|
## [1.5.0](https://github.com/polo-blue/sds/compare/v1.4.4...v1.5.0) (2025-10-27)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spoko-design-system",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./index.ts",
|
|
6
6
|
"module": "./index.ts",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"format:check": "prettier --check \"src/**/*.{js,ts,jsx,tsx,vue,astro,json,css,md}\"",
|
|
27
27
|
"lint": "eslint \"src/**/*.{js,ts,jsx,tsx,vue,astro}\"",
|
|
28
28
|
"lint:fix": "eslint \"src/**/*.{js,ts,jsx,tsx,vue,astro}\" --fix",
|
|
29
|
-
"check": "astro check"
|
|
29
|
+
"check": "astro check",
|
|
30
|
+
"prepare": "husky"
|
|
30
31
|
},
|
|
31
32
|
"repository": {
|
|
32
33
|
"type": "git",
|
|
@@ -126,6 +127,7 @@
|
|
|
126
127
|
"eslint": "^9.38.0",
|
|
127
128
|
"eslint-plugin-astro": "^1.4.0",
|
|
128
129
|
"eslint-plugin-vue": "^10.5.1",
|
|
130
|
+
"husky": "^9.1.7",
|
|
129
131
|
"prettier": "^3.6.2",
|
|
130
132
|
"prettier-plugin-astro": "^0.14.1",
|
|
131
133
|
"semantic-release": "^25.0.1",
|
|
@@ -22,6 +22,37 @@ const props = defineProps({
|
|
|
22
22
|
required: false,
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
|
+
|
|
26
|
+
// Static mapping of PR codes to variant categories
|
|
27
|
+
// Based on database migration from PR_CODE_REFACTORING_2025_10_27.md
|
|
28
|
+
const variantCategoryMap: Record<string, string> = {
|
|
29
|
+
// GTI
|
|
30
|
+
'2JD': 'GTI',
|
|
31
|
+
'1ZD': 'GTI',
|
|
32
|
+
'1KV': 'GTI',
|
|
33
|
+
'0NH': 'GTI',
|
|
34
|
+
'1ZR': 'GTI',
|
|
35
|
+
// WRC
|
|
36
|
+
'E5M': 'WRC',
|
|
37
|
+
'1KD': 'WRC',
|
|
38
|
+
'1ZP': 'WRC',
|
|
39
|
+
'2JQ': 'WRC',
|
|
40
|
+
'TA2': 'WRC',
|
|
41
|
+
// CROSS
|
|
42
|
+
'2JK': 'CROSS',
|
|
43
|
+
// BLUEGT
|
|
44
|
+
'2JE': 'BLUEGT',
|
|
45
|
+
// BLUEMOTION
|
|
46
|
+
'2JZ': 'BLUEMOTION',
|
|
47
|
+
'7L6': 'BLUEMOTION',
|
|
48
|
+
// R_LINE
|
|
49
|
+
'2JP': 'R_LINE',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Get variant category for a code (check map, fallback to passed value)
|
|
53
|
+
const getVariantCategory = (code: string, fallback?: string): string | undefined => {
|
|
54
|
+
return variantCategoryMap[code] || fallback;
|
|
55
|
+
};
|
|
25
56
|
</script>
|
|
26
57
|
|
|
27
58
|
<template>
|
|
@@ -30,28 +61,29 @@ const props = defineProps({
|
|
|
30
61
|
:key="prcode?.id || index"
|
|
31
62
|
class="not-last:mr-1"
|
|
32
63
|
>
|
|
33
|
-
<!-- Skip invalid entries -->
|
|
34
64
|
<template v-if="prcode?.code">
|
|
35
|
-
<!-- Handle normal PR codes -->
|
|
36
65
|
<PrCode
|
|
37
66
|
v-if="!prcode.code.includes('+')"
|
|
38
67
|
:prcode="prcode"
|
|
39
68
|
:isPdp="isPdp"
|
|
40
69
|
/>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
70
|
+
<span v-else class="inline-flex items-center gap-1">
|
|
71
|
+
<template v-for="(code, idx) in prcode.code.split('+')" :key="idx">
|
|
72
|
+
<span v-if="idx > 0" class="text-sm opacity-75 font-bold">+</span>
|
|
73
|
+
<span class="inline-flex items-center">
|
|
74
|
+
<span class="opacity-75">[</span>
|
|
75
|
+
<PrCode
|
|
76
|
+
:prcode="{
|
|
77
|
+
code: code.trim(),
|
|
78
|
+
group: prcode.group,
|
|
79
|
+
description: null,
|
|
80
|
+
variant_category: getVariantCategory(code.trim(), prcode.variant_category)
|
|
81
|
+
}"
|
|
82
|
+
:isPdp="isPdp"
|
|
83
|
+
/>
|
|
84
|
+
<span class="opacity-75">]</span>
|
|
85
|
+
</span>
|
|
86
|
+
</template>
|
|
55
87
|
</span>
|
|
56
88
|
</template>
|
|
57
89
|
</span>
|
|
@@ -198,12 +198,15 @@ When using data from the API, pass the `pr_codes` array directly:
|
|
|
198
198
|
- ✅ **Dark Mode**: Supports dark mode with appropriate color adjustments
|
|
199
199
|
- ✅ **Accessible**: Uses semantic HTML and proper ARIA attributes
|
|
200
200
|
- ✅ **Search Friendly**: Includes `data-pagefind-filter` for search indexing
|
|
201
|
-
- ✅ **Combination Support**: Handles combined PR codes like "
|
|
201
|
+
- ✅ **Combination Support**: Handles combined PR codes like "1AT+1ZR" with format `[1AT]+[1ZR]`
|
|
202
|
+
- ✅ **Individual Colors**: Each code in a combination gets its own color based on variant category
|
|
202
203
|
- ✅ **Defensive**: Gracefully handles invalid or malformed data
|
|
203
204
|
|
|
204
205
|
## Notes
|
|
205
206
|
|
|
206
207
|
- Hover over any PR code to see its full description
|
|
207
208
|
- Colors are based on semantic variant categories, not hardcoded per code
|
|
209
|
+
- Combined codes are displayed as `[CODE]+[CODE]` with each code colored independently
|
|
210
|
+
- The component uses a static mapping for variant categories to ensure consistent coloring
|
|
208
211
|
- The tooltip design matches the ProductEngine component style
|
|
209
212
|
- All 14,000+ PR codes in the database have English descriptions
|