@moneymap/ui 0.0.3 → 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,283 +1,443 @@
1
- # @moneymap/ui
2
-
3
- This guide explains how to build and publish the `@moneymap/ui` library to npm registry.
4
-
5
- ## Prerequisites
6
-
7
- - Node.js and pnpm installed
8
- - npm account with access to publish to `@moneymap` scope
9
- - Access to the MoneyMap monorepo
10
-
11
- ## Project Structure
12
-
13
- ```
14
- libs/ui/
15
- ├── src/ # Source components
16
- ├── dist/ # Build output (generated)
17
- ├── package.json # Package configuration
18
- ├── rollup.config.cjs # Build configuration
19
- └── README.md # This file
20
- ```
21
-
22
- ## Publishing Workflow
23
-
24
- ### 1. Clean and Build
25
-
26
- Reset Nx cache and build the library:
27
-
28
- ```bash
29
- # From workspace root
30
- nx reset
31
- nx build ui
32
- ```
33
-
34
- This generates the build output in `libs/ui/dist/`:
35
- - `dist/index.esm.js` - Compiled JavaScript bundle
36
- - `dist/index.d.ts` - TypeScript declarations
37
- - `dist/src/` - Source files for `@moneymap/source` export
38
-
39
- ### 2. Login to npm
40
-
41
- Ensure you're logged into npm with an account that has publish access:
42
-
43
- ```bash
44
- npm login
45
- ```
46
-
47
- Verify your login:
48
-
49
- ```bash
50
- npm whoami
51
- ```
52
-
53
- ### 3. Test Package (Dry Run)
54
-
55
- Preview what will be published without actually publishing:
56
-
57
- ```bash
58
- cd libs/ui
59
- npm pack --dry-run
60
- ```
61
-
62
- **Expected output should include:**
63
- - ✅ `dist/index.esm.js`
64
- - ✅ `dist/index.d.ts`
65
- - `dist/src/` (source files)
66
- - ✅ `package.json`
67
- - ✅ `README.md`
68
- - ❌ No config files (`.babelrc`, `rollup.config.cjs`, `tsconfig.*`)
69
-
70
- ### 4. Version Bump
71
-
72
- **Important:** You must increment the version before publishing.
73
-
74
- #### For Prerelease (Alpha/Beta)
75
-
76
- ```bash
77
- # From libs/ui/
78
- npm version prerelease --preid=alpha
79
- # Example: 0.0.1-alpha.0 → 0.0.1-alpha.1
80
- # Example: 0.0.1-beta.0 → 0.0.1-beta.1
81
- ```
82
-
83
- #### For Patch Release
84
-
85
- ```bash
86
- npm version patch
87
- # Example: 0.0.1 → 0.0.2
88
- ```
89
-
90
- #### For Minor Release
91
-
92
- ```bash
93
- npm version minor
94
- # Example: 0.0.1 → 0.1.0
95
- ```
96
-
97
- #### For Major Release
98
-
99
- ```bash
100
- npm version major
101
- # Example: 0.0.3 → 1.0.0
102
- ```
103
-
104
- #### Manual Version Update
105
-
106
- Alternatively, edit `libs/ui/package.json` directly:
107
-
108
- ```json
109
- {
110
- "version": "0.0.1"
111
- }
112
- ```
113
-
114
- ### 5. Publish to npm
115
-
116
- #### Publish Prerelease (Alpha/Beta)
117
-
118
- ```bash
119
- # From libs/ui/
120
- npm publish --tag alpha --access public
121
- ```
122
-
123
- This publishes with the `alpha` tag, so it won't become the default `latest` version.
124
-
125
- **Installing prerelease:**
126
- ```bash
127
- npm install @moneymap/ui@alpha
128
- # or specific version
129
- npm install @moneymap/ui@0.0.3-alpha.1
130
- ```
131
-
132
- #### Publish Stable Release
133
-
134
- ```bash
135
- # From libs/ui/
136
- npm publish --access public
137
- ```
138
-
139
- This publishes with the `latest` tag (default).
140
-
141
- **Installing stable:**
142
- ```bash
143
- npm install @moneymap/ui
144
- ```
145
-
146
- ### 6. Verify Publication
147
-
148
- Check the published package:
149
-
150
- ```bash
151
- npm view @moneymap/ui
152
-
153
- # Check all versions
154
- npm view @moneymap/ui versions
155
-
156
- # Check dist-tags
157
- npm view @moneymap/ui dist-tags
158
- ```
159
-
160
- ## Quick Reference Commands
161
-
162
- ```bash
163
- # Full deployment workflow (stable release)
164
- nx reset
165
- nx build ui
166
- cd libs/ui
167
- npm pack --dry-run # Verify package contents
168
- npm version patch # Bump version
169
- npm publish --access public # Publish
170
-
171
- # Full deployment workflow (prerelease)
172
- nx reset
173
- nx build ui
174
- cd libs/ui
175
- npm pack --dry-run
176
- npm version prerelease --preid=alpha
177
- npm publish --tag alpha --access public
178
- ```
179
-
180
- ## Troubleshooting
181
-
182
- ### Cannot publish over previously published version
183
-
184
- You're trying to publish a version that already exists. Bump the version number:
185
-
186
- ```bash
187
- npm version patch
188
- ```
189
-
190
- ### Package includes unwanted files
191
-
192
- Check the `files` field in `libs/ui/package.json`:
193
-
194
- ```json
195
- {
196
- "files": [
197
- "dist",
198
- "src/**/*.ts",
199
- "src/**/*.tsx",
200
- "!src/**/*.test.ts",
201
- "!src/**/*.spec.ts"
202
- ]
203
- }
204
- ```
205
-
206
- Run `npm pack --dry-run` to preview before publishing.
207
-
208
- ## Package Configuration
209
-
210
- ### package.json
211
-
212
- The `libs/ui/package.json` controls what gets published:
213
-
214
- ```json
215
- {
216
- "name": "@moneymap/ui",
217
- "version": "0.0.1",
218
- "main": "./dist/index.esm.js",
219
- "types": "./dist/index.d.ts",
220
- "exports": {
221
- ".": {
222
- "@moneymap/source": "./src/index.ts",
223
- "types": "./dist/index.d.ts",
224
- "import": "./dist/index.esm.js"
225
- }
226
- },
227
- "files": [
228
- "dist",
229
- "src/**/*.ts",
230
- "src/**/*.tsx",
231
- "!src/**/*.test.ts",
232
- "!src/**/*.spec.ts"
233
- ]
234
- }
235
- ```
236
-
237
- ### rollup.config.cjs
238
-
239
- The build configuration uses Rollup with SWC for fast compilation:
240
-
241
- ```javascript
242
- module.exports = withNx({
243
- main: './src/index.ts',
244
- outputPath: './dist',
245
- compiler: 'swc',
246
- format: ['esm'],
247
- external: ['react', 'react-dom', 'react/jsx-runtime'],
248
- assets: [
249
- { input: '.', output: '.', glob: 'README.md' },
250
- {
251
- input: './src',
252
- output: './src',
253
- glob: '**/*.ts',
254
- ignore: ['**/*.spec.ts', '**/*.test.ts'],
255
- },
256
- {
257
- input: './src',
258
- output: './src',
259
- glob: '**/*.tsx',
260
- ignore: ['**/*.spec.tsx', '**/*.test.tsx'],
261
- },
262
- ]
263
- });
264
- ```
265
-
266
- ## Version Strategy
267
-
268
- - **Prerelease (alpha/beta):** For testing new features
269
- - Format: `0.0.1-alpha.0`, `0.0.1-beta.1`
270
- - Publish with: `npm publish --tag alpha`
271
-
272
- - **Patch (0.0.x):** Bug fixes and minor changes
273
- - Command: `npm version patch`
274
-
275
- - **Minor (0.x.0):** New features, backward compatible
276
- - Command: `npm version minor`
277
-
278
- - **Major (x.0.0):** Breaking changes
279
- - Command: `npm version major`
280
-
281
- ## Support
282
-
283
- For questions or issues, contact the MoneyMap development team.
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.