@@ -128,3 +128,105 @@ The PR preview is deployed to the `gh-pages` branch in a directory structure lik
128128```
129129/pr-preview/pr-[PR_NUMBER]/
130130```
131+
132+ ## Publishing
133+
134+ Releases are published manually from the command line. This ensures full control over the release process and avoids CI/CD token management issues.
135+
136+ ### Prerequisites
137+
138+ 1 . ** Ensure you're logged into npm:**
139+ ``` bash
140+ npm login
141+ ```
142+ You must be logged in as a user with publish permissions for the ` @lambdacurry ` organization.
143+
144+ 2 . ** Verify your npm credentials:**
145+ ``` bash
146+ npm whoami
147+ ```
148+
149+ 3 . ** Ensure you're on the ` main ` branch and up to date:**
150+ ``` bash
151+ git checkout main
152+ git pull origin main
153+ ```
154+
155+ ### Release Process
156+
157+ #### Step 1: Create Changesets (if needed)
158+
159+ If you have changes that need to be documented in the changelog, create a changeset:
160+
161+ ``` bash
162+ yarn changeset
163+ ```
164+
165+ Follow the prompts to:
166+ - Select which packages to include
167+ - Choose the version bump type (patch, minor, major)
168+ - Write a summary of the changes
169+
170+ #### Step 2: Version Packages
171+
172+ This updates package versions and generates the changelog:
173+
174+ ``` bash
175+ yarn changeset version
176+ ```
177+
178+ This will:
179+ - Update ` packages/components/package.json ` with the new version
180+ - Update ` packages/components/CHANGELOG.md ` with the new entries
181+ - Remove the consumed changeset files
182+
183+ #### Step 3: Build and Test
184+
185+ Before publishing, ensure everything builds and tests pass:
186+
187+ ``` bash
188+ yarn build
189+ yarn test
190+ ```
191+
192+ #### Step 4: Publish to npm
193+
194+ Publish the package to npm:
195+
196+ ``` bash
197+ yarn release
198+ ```
199+
200+ This command:
201+ - Runs ` yarn build ` (via ` prepublishOnly ` hook)
202+ - Publishes ` @lambdacurry/forms ` to npm using ` changeset publish `
203+
204+ #### Step 5: Commit and Push
205+
206+ After successful publishing, commit the version changes and push:
207+
208+ ``` bash
209+ git add .
210+ git commit -m " chore(release): publish vX.Y.Z"
211+ git push origin main
212+ ```
213+
214+ ### Quick Release (No Changesets)
215+
216+ If you just need to bump the version without changesets (e.g., for a hotfix), you can use npm directly:
217+
218+ ``` bash
219+ # From the packages/components directory
220+ cd packages/components
221+ npm version patch -m " chore: bump version to %s"
222+ cd ../..
223+ yarn install # Update yarn.lock
224+ yarn workspace @lambdacurry/forms build
225+ npm publish --workspace=packages/components
226+ ```
227+
228+ ### Troubleshooting
229+
230+ - ** "Not logged in" error** : Run ` npm login ` and verify with ` npm whoami `
231+ - ** "Permission denied"** : Ensure your npm user has publish permissions for ` @lambdacurry ` organization
232+ - ** Build fails** : Fix build errors before publishing. The ` prepublishOnly ` hook will prevent publishing if the build fails
0 commit comments