@moneymap/ui 0.0.3-alpha.1 → 0.0.4

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/README.md CHANGED
@@ -1,7 +1,443 @@
1
- # @moneymap/ui
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Running unit tests
6
-
7
- Run `nx test @moneymap/ui` to execute the unit tests via [Jest](https://jestjs.io).
1
+ # @moneymap/ui
2
+
3
+ > **⚠️ Tailwind CSS Required:** This library requires Tailwind CSS to be configured in your project. See [Setup](#setup-required) below.
4
+
5
+ ## Setup Required
6
+
7
+ ### Tailwind CSS v3 Setup
8
+
9
+ 1. **Install Tailwind CSS:**
10
+
11
+ ```bash
12
+ npm install -D tailwindcss postcss autoprefixer
13
+ npx tailwindcss init -p
14
+ ```
15
+
16
+ 2. **Configure Tailwind to scan the library** (`tailwind.config.js`):
17
+
18
+ ```javascript
19
+ /** @type {import('tailwindcss').Config} */
20
+ module.exports = {
21
+ content: [
22
+ './src/**/*.{js,jsx,ts,tsx}',
23
+ './node_modules/@moneymap/ui/**/*.{js,jsx,ts,tsx}', // Add this
24
+ ],
25
+ theme: {
26
+ extend: {
27
+ colors: {
28
+ border: 'hsl(var(--border))',
29
+ input: 'hsl(var(--input))',
30
+ ring: 'hsl(var(--ring))',
31
+ background: 'hsl(var(--background))',
32
+ foreground: 'hsl(var(--foreground))',
33
+ primary: {
34
+ DEFAULT: 'hsl(var(--primary))',
35
+ foreground: 'hsl(var(--primary-foreground))',
36
+ },
37
+ secondary: {
38
+ DEFAULT: 'hsl(var(--secondary))',
39
+ foreground: 'hsl(var(--secondary-foreground))',
40
+ },
41
+ destructive: {
42
+ DEFAULT: 'hsl(var(--destructive))',
43
+ foreground: 'hsl(var(--destructive-foreground))',
44
+ },
45
+ muted: {
46
+ DEFAULT: 'hsl(var(--muted))',
47
+ foreground: 'hsl(var(--muted-foreground))',
48
+ },
49
+ accent: {
50
+ DEFAULT: 'hsl(var(--accent))',
51
+ foreground: 'hsl(var(--accent-foreground))',
52
+ },
53
+ },
54
+ borderRadius: {
55
+ lg: 'var(--radius)',
56
+ md: 'calc(var(--radius) - 2px)',
57
+ sm: 'calc(var(--radius) - 4px)',
58
+ },
59
+ },
60
+ },
61
+ plugins: [],
62
+ };
63
+ ```
64
+
65
+ 3. **Add CSS variables to your global CSS** (e.g., `globals.css` or `index.css`):
66
+
67
+ ```css
68
+ @tailwind base;
69
+ @tailwind components;
70
+ @tailwind utilities;
71
+
72
+ @layer base {
73
+ :root {
74
+ --background: 0 0% 100%;
75
+ --foreground: 240 10% 3.9%;
76
+ --card: 0 0% 100%;
77
+ --card-foreground: 240 10% 3.9%;
78
+ --primary: 240 5.9% 10%;
79
+ --primary-foreground: 0 0% 98%;
80
+ --secondary: 240 4.8% 95.9%;
81
+ --secondary-foreground: 240 5.9% 10%;
82
+ --muted: 240 4.8% 95.9%;
83
+ --muted-foreground: 240 3.8% 46.1%;
84
+ --accent: 240 4.8% 95.9%;
85
+ --accent-foreground: 240 5.9% 10%;
86
+ --destructive: 0 84.2% 60.2%;
87
+ --destructive-foreground: 0 0% 98%;
88
+ --border: 240 5.9% 90%;
89
+ --input: 240 5.9% 90%;
90
+ --ring: 240 5.9% 10%;
91
+ --radius: 0.5rem;
92
+ }
93
+
94
+ .dark {
95
+ --background: 240 10% 3.9%;
96
+ --foreground: 0 0% 98%;
97
+ --card: 240 10% 3.9%;
98
+ --card-foreground: 0 0% 98%;
99
+ --primary: 0 0% 98%;
100
+ --primary-foreground: 240 5.9% 10%;
101
+ --secondary: 240 3.7% 15.9%;
102
+ --secondary-foreground: 0 0% 98%;
103
+ --muted: 240 3.7% 15.9%;
104
+ --muted-foreground: 240 5% 64.9%;
105
+ --accent: 240 3.7% 15.9%;
106
+ --accent-foreground: 0 0% 98%;
107
+ --destructive: 0 62.8% 30.6%;
108
+ --destructive-foreground: 0 0% 98%;
109
+ --border: 240 3.7% 15.9%;
110
+ --input: 240 3.7% 15.9%;
111
+ --ring: 240 4.9% 83.9%;
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### Tailwind CSS v4 Setup (Beta)
117
+
118
+ 1. **Install Tailwind CSS v4:**
119
+
120
+ ```bash
121
+ npm install tailwindcss@next @tailwindcss/postcss@next
122
+ ```
123
+
124
+ 2. **Configure PostCSS** (`postcss.config.js`):
125
+
126
+ ```javascript
127
+ module.exports = {
128
+ plugins: {
129
+ '@tailwindcss/postcss': {},
130
+ },
131
+ };
132
+ ```
133
+
134
+ 3. **Import Tailwind in your CSS:**
135
+
136
+ ```css
137
+ @import 'tailwindcss';
138
+
139
+ @theme {
140
+ --color-border: oklch(0.9 0 0);
141
+ --color-input: oklch(0.9 0 0);
142
+ --color-ring: oklch(0.2 0 0);
143
+ --color-background: oklch(1 0 0);
144
+ --color-foreground: oklch(0.15 0 0);
145
+ /* Add other custom colors */
146
+ }
147
+ ```
148
+
149
+ 4. **Scan the library** - Tailwind v4 auto-detects imports, but you can configure it in your CSS:
150
+
151
+ ```css
152
+ @source "../../node_modules/@moneymap/ui/**/*.{js,jsx,ts,tsx}";
153
+ ```
154
+
155
+ ---
156
+
157
+ # Maintainers
158
+
159
+ The sections below are for developers who need to build and publish the `@moneymap/ui` library to npm registry.
160
+
161
+ ## Prerequisites
162
+
163
+ - Node.js and pnpm installed
164
+ - npm account with access to publish to `@moneymap` scope
165
+ - Access to the MoneyMap monorepo
166
+
167
+ ## Project Structure
168
+
169
+ ```
170
+ libs/ui/
171
+ ├── src/ # Source components
172
+ ├── dist/ # Build output (generated)
173
+ ├── package.json # Package configuration
174
+ ├── rollup.config.cjs # Build configuration
175
+ └── README.md # This file
176
+ ```
177
+
178
+ ## Publishing Workflow
179
+
180
+ ### 1. Clean and Build
181
+
182
+ Reset Nx cache and build the library:
183
+
184
+ ```bash
185
+ # From workspace root
186
+ nx reset
187
+ nx build ui
188
+ ```
189
+
190
+ This generates the build output in `libs/ui/dist/`:
191
+
192
+ - `dist/index.esm.js` - Compiled JavaScript bundle
193
+ - `dist/index.d.ts` - TypeScript declarations
194
+ - `dist/src/` - Source files for `@moneymap/source` export
195
+
196
+ ### 2. Login to npm
197
+
198
+ Ensure you're logged into npm with an account that has publish access:
199
+
200
+ ```bash
201
+ npm login
202
+ ```
203
+
204
+ Verify your login:
205
+
206
+ ```bash
207
+ npm whoami
208
+ ```
209
+
210
+ ### 3. Test Package (Dry Run)
211
+
212
+ Preview what will be published without actually publishing:
213
+
214
+ ```bash
215
+ cd libs/ui
216
+ npm pack --dry-run
217
+ ```
218
+
219
+ **Expected output should include:**
220
+
221
+ - ✅ `dist/index.esm.js`
222
+ - ✅ `dist/index.d.ts`
223
+ - ✅ `dist/src/` (source files)
224
+ - ✅ `package.json`
225
+ - ✅ `README.md`
226
+ - ❌ No config files (`.babelrc`, `rollup.config.cjs`, `tsconfig.*`)
227
+
228
+ ### 4. Version Bump
229
+
230
+ **Important:** You must increment the version before publishing.
231
+
232
+ #### For Prerelease (Alpha/Beta)
233
+
234
+ ```bash
235
+ # From libs/ui/
236
+ npm version prerelease --preid=alpha
237
+ # Example: 0.0.1-alpha.0 → 0.0.1-alpha.1
238
+ # Example: 0.0.1-beta.0 → 0.0.1-beta.1
239
+ ```
240
+
241
+ #### For Patch Release
242
+
243
+ ```bash
244
+ npm version patch
245
+ # Example: 0.0.1 → 0.0.2
246
+ ```
247
+
248
+ #### For Minor Release
249
+
250
+ ```bash
251
+ npm version minor
252
+ # Example: 0.0.1 → 0.1.0
253
+ ```
254
+
255
+ #### For Major Release
256
+
257
+ ```bash
258
+ npm version major
259
+ # Example: 0.0.1 → 1.0.0
260
+ ```
261
+
262
+ #### Manual Version Update
263
+
264
+ Alternatively, edit `libs/ui/package.json` directly:
265
+
266
+ ```json
267
+ {
268
+ "version": "0.0.1"
269
+ }
270
+ ```
271
+
272
+ ### 5. Publish to npm
273
+
274
+ #### Publish Prerelease (Alpha/Beta)
275
+
276
+ ```bash
277
+ # From libs/ui/
278
+ npm publish --tag alpha --access public
279
+ ```
280
+
281
+ This publishes with the `alpha` tag, so it won't become the default `latest` version.
282
+
283
+ **Installing prerelease:**
284
+
285
+ ```bash
286
+ npm install @moneymap/ui@alpha
287
+ # or specific version
288
+ npm install @moneymap/ui@0.0.1-alpha.1
289
+ ```
290
+
291
+ #### Publish Stable Release
292
+
293
+ ```bash
294
+ # From libs/ui/
295
+ npm publish --access public
296
+ ```
297
+
298
+ This publishes with the `latest` tag (default).
299
+
300
+ **Installing stable:**
301
+
302
+ ```bash
303
+ npm install @moneymap/ui
304
+ ```
305
+
306
+ ### 6. Verify Publication
307
+
308
+ Check the published package:
309
+
310
+ ```bash
311
+ npm view @moneymap/ui
312
+
313
+ # Check all versions
314
+ npm view @moneymap/ui versions
315
+
316
+ # Check dist-tags
317
+ npm view @moneymap/ui dist-tags
318
+ ```
319
+
320
+ ## Quick Reference Commands
321
+
322
+ ```bash
323
+ # Full deployment workflow (stable release)
324
+ nx reset
325
+ nx build ui
326
+ cd libs/ui
327
+ npm pack --dry-run # Verify package contents
328
+ npm version patch # Bump version
329
+ npm publish --access public # Publish
330
+
331
+ # Full deployment workflow (prerelease)
332
+ nx reset
333
+ nx build ui
334
+ cd libs/ui
335
+ npm pack --dry-run
336
+ npm version prerelease --preid=alpha
337
+ npm publish --tag alpha --access public
338
+ ```
339
+
340
+ ## Troubleshooting
341
+
342
+ ### Cannot publish over previously published version
343
+
344
+ You're trying to publish a version that already exists. Bump the version number:
345
+
346
+ ```bash
347
+ npm version patch
348
+ ```
349
+
350
+ ### Package includes unwanted files
351
+
352
+ Check the `files` field in `libs/ui/package.json`:
353
+
354
+ ```json
355
+ {
356
+ "files": [
357
+ "dist",
358
+ "src/**/*.ts",
359
+ "src/**/*.tsx",
360
+ "!src/**/*.test.ts",
361
+ "!src/**/*.spec.ts"
362
+ ]
363
+ }
364
+ ```
365
+
366
+ Run `npm pack --dry-run` to preview before publishing.
367
+
368
+ ## Package Configuration
369
+
370
+ ### package.json
371
+
372
+ The `libs/ui/package.json` controls what gets published:
373
+
374
+ ```json
375
+ {
376
+ "name": "@moneymap/ui",
377
+ "version": "0.0.1",
378
+ "main": "./dist/index.esm.js",
379
+ "types": "./dist/index.d.ts",
380
+ "exports": {
381
+ ".": {
382
+ "@moneymap/source": "./src/index.ts",
383
+ "types": "./dist/index.d.ts",
384
+ "import": "./dist/index.esm.js"
385
+ }
386
+ },
387
+ "files": [
388
+ "dist",
389
+ "src/**/*.ts",
390
+ "src/**/*.tsx",
391
+ "!src/**/*.test.ts",
392
+ "!src/**/*.spec.ts"
393
+ ]
394
+ }
395
+ ```
396
+
397
+ ### rollup.config.cjs
398
+
399
+ The build configuration uses Rollup with SWC for fast compilation:
400
+
401
+ ```javascript
402
+ module.exports = withNx({
403
+ main: './src/index.ts',
404
+ outputPath: './dist',
405
+ compiler: 'swc',
406
+ format: ['esm'],
407
+ external: ['react', 'react-dom', 'react/jsx-runtime'],
408
+ assets: [
409
+ { input: '.', output: '.', glob: 'README.md' },
410
+ {
411
+ input: './src',
412
+ output: './src',
413
+ glob: '**/*.ts',
414
+ ignore: ['**/*.spec.ts', '**/*.test.ts'],
415
+ },
416
+ {
417
+ input: './src',
418
+ output: './src',
419
+ glob: '**/*.tsx',
420
+ ignore: ['**/*.spec.tsx', '**/*.test.tsx'],
421
+ },
422
+ ],
423
+ });
424
+ ```
425
+
426
+ ## Version Strategy
427
+
428
+ - **Prerelease (alpha/beta):** For testing new features
429
+ - Format: `0.0.1-alpha.0`, `0.0.1-beta.1`
430
+ - Publish with: `npm publish --tag alpha`
431
+
432
+ - **Patch (0.0.x):** Bug fixes and minor changes
433
+ - Command: `npm version patch`
434
+
435
+ - **Minor (0.x.0):** New features, backward compatible
436
+ - Command: `npm version minor`
437
+
438
+ - **Major (x.0.0):** Breaking changes
439
+ - Command: `npm version major`
440
+
441
+ ## Support
442
+
443
+ For questions or issues, contact the MoneyMap development team.