@moneymap/ui 0.0.3-alpha.0 → 0.0.3

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,283 @@
1
1
  # @moneymap/ui
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ This guide explains how to build and publish the `@moneymap/ui` library to npm registry.
4
4
 
5
- ## Running unit tests
5
+ ## Prerequisites
6
6
 
7
- Run `nx test @moneymap/ui` to execute the unit tests via [Jest](https://jestjs.io).
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.