Skip to content

Commit 2257c25

Browse files
committed
docs: Adicionar guia de publicação no npm
- Documentar fluxo completo: changeset → version → publish - Incluir instruções de consumo dos pacotes - Adicionar estratégia de versionamento e troubleshooting
1 parent 28fc449 commit 2257c25

1 file changed

Lines changed: 208 additions & 0 deletions

File tree

PUBLISHING.md

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# Publishing Guide
2+
3+
This guide covers how to version, publish, and consume the `@ybyra/*` packages.
4+
5+
## Prerequisites
6+
7+
### 1. npm account and organization
8+
9+
- Create an account at [npmjs.com](https://www.npmjs.com/signup) if you don't have one
10+
- You must be a member of the **[@ybyra](https://www.npmjs.com/org/ybyra)** organization
11+
- Log in locally:
12+
13+
```bash
14+
npm login
15+
```
16+
17+
### 2. Install dependencies
18+
19+
```bash
20+
pnpm install
21+
```
22+
23+
---
24+
25+
## Published Packages
26+
27+
These are the packages that will be published to npm:
28+
29+
| Package | Description |
30+
|---------|-------------|
31+
| `@ybyra/core` | Schema definition, field types, actions, groups, type system |
32+
| `@ybyra/react` | `useDataForm` / `useDataTable` hooks, validation, proxy |
33+
| `@ybyra/vue` | `useDataForm` / `useDataTable` composables for Vue |
34+
| `@ybyra/svelte` | `useDataForm` / `useDataTable` stores for Svelte |
35+
| `@ybyra/react-web` | Field renderers for React web apps |
36+
| `@ybyra/react-native` | Field renderers for React Native apps |
37+
| `@ybyra/vue-quasar` | Field renderers for Vue + Quasar |
38+
| `@ybyra/sveltekit` | Field renderers for SvelteKit |
39+
| `@ybyra/persistence` | Local and web persistence drivers |
40+
41+
> `@ybyra/demo` and all `@ybyra/playground-*` packages are **private** and won't be published.
42+
43+
---
44+
45+
## How It Works
46+
47+
This project uses [changesets](https://github.com/changesets/changesets) to manage versioning and publishing across the monorepo.
48+
49+
The workflow is:
50+
51+
```
52+
Make changes → Create changeset → Version packages → Publish to npm
53+
```
54+
55+
### Step 1: Make your changes
56+
57+
Develop normally. Commit your code.
58+
59+
### Step 2: Create a changeset
60+
61+
After making changes that should be released, run:
62+
63+
```bash
64+
pnpm changeset
65+
```
66+
67+
You'll be prompted to:
68+
69+
1. **Select packages** — choose which packages were affected by your changes
70+
2. **Choose bump type**`patch`, `minor`, or `major` for each package
71+
3. **Write a summary** — a short description of the change (this goes into the CHANGELOG)
72+
73+
This creates a markdown file in `.changeset/` describing the change. **Commit this file** along with your code.
74+
75+
#### Example
76+
77+
```
78+
🦋 Which packages would you like to include? · @ybyra/core, @ybyra/react
79+
🦋 Which packages should have a major bump? · No packages
80+
🦋 Which packages should have a minor bump? · @ybyra/core
81+
🦋 Summary · Added new CurrencyFieldDefinition with prefix and precision support
82+
```
83+
84+
This means `@ybyra/core` will get a minor bump (0.0.1 → 0.1.0) and `@ybyra/react` will get a patch bump (because it depends on core).
85+
86+
#### Tips
87+
88+
- You can create **multiple changesets** before releasing — they'll all be applied together
89+
- Each changeset is a small markdown file, easy to review in PRs
90+
- Internal dependencies (`workspace:*`) are automatically updated by changesets
91+
92+
### Step 3: Version packages
93+
94+
When you're ready to release, apply all pending changesets:
95+
96+
```bash
97+
pnpm version-packages
98+
```
99+
100+
This will:
101+
- Bump versions in all affected `package.json` files
102+
- Update `CHANGELOG.md` for each package
103+
- Remove the consumed changeset files from `.changeset/`
104+
105+
**Review the changes** and commit them:
106+
107+
```bash
108+
git add .
109+
git commit -m "chore: version packages"
110+
```
111+
112+
### Step 4: Publish to npm
113+
114+
```bash
115+
pnpm release
116+
```
117+
118+
This runs `pnpm build && changeset publish`, which:
119+
1. Builds all packages (generates `dist/`)
120+
2. Publishes each changed package to npm
121+
3. Creates git tags for each published version
122+
123+
After publishing, push the tags:
124+
125+
```bash
126+
git push --follow-tags
127+
```
128+
129+
---
130+
131+
## Consuming the Packages
132+
133+
### Installation
134+
135+
```bash
136+
# React
137+
pnpm add @ybyra/core @ybyra/react @ybyra/react-web
138+
139+
# Vue + Quasar
140+
pnpm add @ybyra/core @ybyra/vue @ybyra/vue-quasar
141+
142+
# SvelteKit
143+
pnpm add @ybyra/core @ybyra/svelte @ybyra/sveltekit
144+
145+
# React Native
146+
pnpm add @ybyra/core @ybyra/react @ybyra/react-native
147+
148+
# Persistence (optional)
149+
pnpm add @ybyra/persistence
150+
```
151+
152+
### Basic usage
153+
154+
```typescript
155+
import { schema, text, Text, date, toggle } from '@ybyra/core'
156+
import { useDataForm } from '@ybyra/react' // or @ybyra/vue or @ybyra/svelte
157+
158+
const PersonSchema = schema.create('person', {
159+
fields: {
160+
name: text().required().column(),
161+
email: text().kind(Text.Email).required().column(),
162+
birthDate: date(),
163+
active: toggle().default(true).column(),
164+
},
165+
})
166+
```
167+
168+
---
169+
170+
## Versioning Strategy
171+
172+
- **patch** (0.0.x) — bug fixes, documentation, internal changes
173+
- **minor** (0.x.0) — new features, new field types, new API additions
174+
- **major** (x.0.0) — breaking changes to the public API
175+
176+
### Dependency propagation
177+
178+
When `@ybyra/core` is bumped, all packages that depend on it (react, vue, svelte, etc.) will automatically get their dependency version updated. The `updateInternalDependencies: "patch"` setting in `.changeset/config.json` means dependents get at least a patch bump.
179+
180+
---
181+
182+
## Troubleshooting
183+
184+
### "You must be logged in to publish"
185+
186+
```bash
187+
npm login
188+
npm whoami # verify you're logged in
189+
```
190+
191+
### "402 Payment Required"
192+
193+
Scoped packages (`@ybyra/*`) are private by default on npm. All packages in this repo have `publishConfig.access: "public"` set, but if you see this error, check the package's `package.json`.
194+
195+
### "Changeset validation error about ignored packages"
196+
197+
If a new playground or private package is added that depends on an ignored package, add it to the `ignore` list in `.changeset/config.json`.
198+
199+
### Dry run
200+
201+
To see what would be published without actually publishing:
202+
203+
```bash
204+
pnpm build
205+
npx changeset publish --no-git-tag
206+
# Or check with npm directly:
207+
cd packages/core && npm pack --dry-run
208+
```

0 commit comments

Comments
 (0)