@react-spa-scaffold/mcp 0.3.0 → 1.1.0

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.
Files changed (83) hide show
  1. package/README.md +42 -20
  2. package/dist/features/registry.d.ts.map +1 -1
  3. package/dist/features/registry.js +59 -25
  4. package/dist/features/registry.js.map +1 -1
  5. package/dist/features/types.d.ts +1 -0
  6. package/dist/features/types.d.ts.map +1 -1
  7. package/dist/features/versions.json +1 -1
  8. package/dist/server.d.ts.map +1 -1
  9. package/dist/server.js +2 -1
  10. package/dist/server.js.map +1 -1
  11. package/dist/tools/get-example.d.ts +4 -6
  12. package/dist/tools/get-example.d.ts.map +1 -1
  13. package/dist/tools/get-example.js +2 -2
  14. package/dist/tools/get-example.js.map +1 -1
  15. package/dist/tools/get-scaffold.d.ts +3 -10
  16. package/dist/tools/get-scaffold.d.ts.map +1 -1
  17. package/dist/tools/get-scaffold.js +44 -20
  18. package/dist/tools/get-scaffold.js.map +1 -1
  19. package/dist/utils/examples.d.ts.map +1 -1
  20. package/dist/utils/examples.js +19 -16
  21. package/dist/utils/examples.js.map +1 -1
  22. package/dist/utils/paths.d.ts +2 -1
  23. package/dist/utils/paths.d.ts.map +1 -1
  24. package/dist/utils/paths.js +15 -2
  25. package/dist/utils/paths.js.map +1 -1
  26. package/dist/utils/scaffold.d.ts +6 -1
  27. package/dist/utils/scaffold.d.ts.map +1 -1
  28. package/dist/utils/scaffold.js +86 -13
  29. package/dist/utils/scaffold.js.map +1 -1
  30. package/package.json +2 -2
  31. package/templates/.env.example +21 -0
  32. package/templates/.github/PULL_REQUEST_TEMPLATE.md +24 -0
  33. package/templates/.github/actions/setup-node-deps/action.yml +32 -0
  34. package/templates/.github/dependabot.yml +104 -0
  35. package/templates/.github/workflows/ci.yml +156 -0
  36. package/templates/.husky/commit-msg +1 -0
  37. package/templates/.husky/pre-commit +2 -0
  38. package/templates/.nvmrc +1 -0
  39. package/templates/CLAUDE.md +4 -2
  40. package/templates/commitlint.config.js +1 -0
  41. package/templates/components.json +21 -0
  42. package/templates/docs/API_REFERENCE.md +0 -1
  43. package/templates/docs/INTERNATIONALIZATION.md +26 -0
  44. package/templates/e2e/fixtures/index.ts +10 -0
  45. package/templates/e2e/tests/home.spec.ts +42 -0
  46. package/templates/e2e/tests/language.spec.ts +42 -0
  47. package/templates/e2e/tests/navigation.spec.ts +18 -0
  48. package/templates/e2e/tests/theme.spec.ts +35 -0
  49. package/templates/eslint.config.js +42 -0
  50. package/templates/gitignore +33 -0
  51. package/templates/index.html +13 -0
  52. package/templates/lighthouse-budget.json +17 -0
  53. package/templates/lighthouserc.json +23 -0
  54. package/templates/lingui.config.js +18 -0
  55. package/templates/package.json +125 -0
  56. package/templates/playwright.config.ts +30 -0
  57. package/templates/prettier.config.js +1 -0
  58. package/templates/public/favicon.svg +4 -0
  59. package/templates/src/components/shared/RegisterForm/RegisterForm.tsx +91 -0
  60. package/templates/src/components/shared/RegisterForm/index.ts +1 -0
  61. package/templates/src/components/shared/index.ts +1 -0
  62. package/templates/src/components/ui/card.tsx +70 -0
  63. package/templates/src/components/ui/input.tsx +19 -0
  64. package/templates/src/components/ui/label.tsx +19 -0
  65. package/templates/src/hooks/index.ts +1 -1
  66. package/templates/src/hooks/useRegisterForm.ts +36 -0
  67. package/templates/src/lib/index.ts +1 -11
  68. package/templates/src/lib/validations.ts +6 -13
  69. package/templates/src/pages/Home.tsx +29 -10
  70. package/templates/tests/unit/components/RegisterForm.test.tsx +105 -0
  71. package/templates/tests/unit/hooks/useRegisterForm.test.tsx +153 -0
  72. package/templates/tests/unit/lib/validations.test.ts +22 -33
  73. package/templates/tests/unit/stores/preferencesStore.test.ts +81 -0
  74. package/templates/tsconfig.app.json +10 -0
  75. package/templates/tsconfig.json +11 -0
  76. package/templates/tsconfig.node.json +4 -0
  77. package/templates/vite.config.ts +54 -0
  78. package/templates/vitest.config.ts +38 -0
  79. package/templates/src/hooks/useContactForm.ts +0 -33
  80. package/templates/src/lib/constants.ts +0 -8
  81. package/templates/src/lib/format.ts +0 -119
  82. package/templates/tests/unit/hooks/useContactForm.test.ts +0 -60
  83. package/templates/tests/unit/lib/format.test.ts +0 -100
@@ -1,100 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import {
4
- formatBytes,
5
- formatCurrency,
6
- formatDate,
7
- formatDateTime,
8
- formatNumber,
9
- formatPercent,
10
- formatRelativeTime,
11
- } from '@/lib/format';
12
-
13
- describe('formatDate', () => {
14
- it('formats date objects and strings', () => {
15
- const date = new Date('2024-01-15T12:00:00Z');
16
- expect(formatDate(date, {}, 'en-US')).toContain('2024');
17
- expect(formatDate('2024-06-20', {}, 'en-US')).toContain('2024');
18
- });
19
-
20
- it('returns "Invalid date" for invalid input', () => {
21
- expect(formatDate('invalid')).toBe('Invalid date');
22
- });
23
-
24
- it('respects custom options', () => {
25
- const date = new Date('2024-01-15');
26
- expect(formatDate(date, { weekday: 'long' }, 'en-US')).toContain('Monday');
27
- });
28
- });
29
-
30
- describe('formatDateTime', () => {
31
- it('includes time in output', () => {
32
- const date = new Date('2024-01-15T14:30:00Z');
33
- expect(formatDateTime(date, {}, 'en-US')).toMatch(/\d{1,2}:\d{2}/);
34
- });
35
- });
36
-
37
- describe('formatRelativeTime', () => {
38
- it.each([
39
- { offset: -30 * 1000, unit: 'seconds', pattern: /second|now/i },
40
- { offset: -5 * 60 * 1000, unit: 'minutes', pattern: /minute/i },
41
- { offset: -60 * 60 * 1000, unit: 'hours', pattern: /hour|ago/i },
42
- { offset: 24 * 60 * 60 * 1000, unit: 'days (future)', pattern: /day|tomorrow/i },
43
- { offset: -45 * 24 * 60 * 60 * 1000, unit: 'months', pattern: /month/i },
44
- { offset: -400 * 24 * 60 * 60 * 1000, unit: 'years', pattern: /year/i },
45
- ])('formats $unit correctly', ({ offset, pattern }) => {
46
- const date = new Date(Date.now() + offset);
47
- expect(formatRelativeTime(date, 'en-US')).toMatch(pattern);
48
- });
49
-
50
- it('returns "Invalid date" for invalid input', () => {
51
- expect(formatRelativeTime('invalid')).toBe('Invalid date');
52
- });
53
-
54
- it('accepts timestamp numbers', () => {
55
- const timestamp = Date.now() - 60 * 60 * 1000;
56
- expect(formatRelativeTime(timestamp, 'en-US')).toMatch(/hour|ago/i);
57
- });
58
- });
59
-
60
- describe('formatNumber', () => {
61
- it.each([
62
- { value: 1234567.89, options: {}, expected: '1,234,567.89' },
63
- { value: 1234.5, options: { minimumFractionDigits: 2 }, expected: '1,234.50' },
64
- ])('formats $value with options', ({ value, options, expected }) => {
65
- expect(formatNumber(value, options, 'en-US')).toBe(expected);
66
- });
67
- });
68
-
69
- describe('formatCurrency', () => {
70
- it.each([
71
- { value: 99.99, currency: 'USD', locale: 'en-US', expected: '$99.99' },
72
- { value: 99.99, currency: 'EUR', locale: 'de-DE', contains: '€' },
73
- ])('formats $currency correctly', ({ value, currency, locale, expected, contains }) => {
74
- const result = formatCurrency(value, currency, locale);
75
- if (expected) expect(result).toBe(expected);
76
- if (contains) expect(result).toContain(contains);
77
- });
78
- });
79
-
80
- describe('formatPercent', () => {
81
- it.each([
82
- { value: 0.25, decimals: 0, expected: '25%' },
83
- { value: 0.2567, decimals: 2, expected: '25.67%' },
84
- ])('formats $value with $decimals decimals', ({ value, decimals, expected }) => {
85
- expect(formatPercent(value, decimals, 'en-US')).toBe(expected);
86
- });
87
- });
88
-
89
- describe('formatBytes', () => {
90
- it.each([
91
- { bytes: 0, expected: '0 Bytes' },
92
- { bytes: 1024, expected: '1 KB' },
93
- { bytes: 1024 * 1024, expected: '1 MB' },
94
- { bytes: 1024 * 1024 * 1024, expected: '1 GB' },
95
- { bytes: 1536, decimals: 1, expected: '1.5 KB' },
96
- { bytes: 1536, decimals: 0, expected: '2 KB' },
97
- ])('formats $bytes bytes', ({ bytes, decimals, expected }) => {
98
- expect(formatBytes(bytes, decimals)).toBe(expected);
99
- });
100
- });