You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+75-19Lines changed: 75 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,38 +6,65 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
6
6
7
7
Nuxt SmartScript is a Nuxt 3 module that performs automatic typography transformations in the browser. It transforms patterns like (TM) → ™, ordinals (1st, 2nd), chemical formulas (H2O), and mathematical notation (x^2, x_n) using client-side DOM manipulation.
8
8
9
+
**Current Version**: 0.3.0 (broken) → 0.3.1 (ready for release)
10
+
11
+
## Critical Implementation Details
12
+
13
+
### Hybrid Element Approach (v0.3.1+)
14
+
-**SPAN elements**: Used for TM/R symbols - allows CSS `position: relative` control
15
+
-**SUP/SUB elements**: Used for math/chemicals - semantic HTML
16
+
-**Why**: Browser limitation - SUP/SUB elements ignore `position: relative`
17
+
18
+
## Build System
19
+
20
+
This module uses **@nuxt/module-builder** - the official Nuxt module build system. This provides:
21
+
-**Automatic type generation** for `#imports` and other virtual modules
22
+
-**Stub builds** for faster development iteration
23
+
-**Proper TypeScript configuration** that extends `.nuxt/tsconfig.json`
24
+
-**Compatibility** with the Nuxt ecosystem standards
25
+
26
+
### Why Module Builder?
27
+
Before adopting module-builder, we struggled with TypeScript errors for virtual modules like `#imports`. The module-builder solves this by:
28
+
1. Generating proper type definitions in `.nuxt/` directory
29
+
2. Providing the `dev:prepare` script that creates stubs and types
30
+
3. Ensuring our module follows Nuxt best practices
31
+
4. Handling the complex build pipeline automatically
32
+
9
33
## Commands
10
34
11
35
### Development
12
36
```bash
13
37
# Install dependencies
14
38
pnpm install
15
39
40
+
# Prepare development environment (IMPORTANT: Run this first!)
41
+
# This generates .nuxt/tsconfig.json with proper types
42
+
pnpm dev:prepare
43
+
16
44
# Run development playground
17
45
pnpm dev
18
46
19
47
# Build module for production
20
48
pnpm prepack
21
-
22
-
# Prepare development environment (stub builds)
23
-
pnpm dev:prepare
24
49
```
25
50
26
51
### Testing
27
52
```bash
28
-
# Run all tests
53
+
# Run all tests (227 tests across all categories)
29
54
pnpm test
30
55
31
56
# Run tests in watch mode
32
57
pnpm test:watch
33
58
34
-
# Run a specific test file
35
-
pnpm test typography
36
-
pnpm test edge-cases
37
-
pnpm test integration
59
+
# Run specific test categories
60
+
npx vitest run test/unit
61
+
npx vitest run test/integration
62
+
npx vitest run test/e2e
63
+
npx vitest run test/performance
64
+
npx vitest run test/unit/regression
38
65
39
-
#Check for test failures
40
-
pnpm test2>&1| grep "×"
66
+
#Run specific test file
67
+
npx vitest run positioning.test.ts
41
68
42
69
# Type checking
43
70
pnpm test:types
@@ -77,6 +104,20 @@ pnpm release
77
104
-**Commit signatures**: Use `Authored by: Aaron Lippold<lippold@gmail.com>`
78
105
-**NO Claude signatures** in commits
79
106
107
+
## Test Structure
108
+
109
+
```
110
+
test/
111
+
├── unit/ # Unit tests for individual functions
112
+
│ └── regression/ # Regression tests for fixed bugs
Copy file name to clipboardExpand all lines: README.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,19 +124,24 @@ We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for de
124
124
125
125
### Development
126
126
127
+
This module is built using [@nuxt/module-builder](https://github.com/nuxt/module-builder) for proper TypeScript support and Nuxt ecosystem compatibility.
0 commit comments