@hook-sdk/template 0.1.1 → 0.1.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 +51 -0
- package/dist/index.cjs +297 -168
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -4
- package/dist/index.d.ts +27 -4
- package/dist/index.js +243 -114
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @hook-sdk/template
|
|
2
|
+
|
|
3
|
+
Primitivas do golden-path para apps Hook — `AppRoot`, providers internos, hooks headless de auth (`useLoginForm`, `useSignupForm`, `useForgotForm`), estado de paywall (`usePaywallState`) e escape hatch `useAuthPrimitives`.
|
|
4
|
+
|
|
5
|
+
Os apps consomem esse pacote via `import { AppRoot } from '@hook-sdk/template'` no `source.jsx`. Visual fica livre dentro de `screens/`; a lógica de auth/paywall/push é blindada por esses hooks.
|
|
6
|
+
|
|
7
|
+
## Uso básico
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { AppRoot } from '@hook-sdk/template';
|
|
11
|
+
import LoginScreen from './screens/Login';
|
|
12
|
+
import PaywallScreen from './screens/Paywall';
|
|
13
|
+
|
|
14
|
+
export default function App() {
|
|
15
|
+
return <AppRoot Login={LoginScreen} Paywall={PaywallScreen} />;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Spec
|
|
20
|
+
|
|
21
|
+
Estrutura técnica detalhada: `docs/19-golden-template.md` + `docs/adr/012-golden-template.md` (e amendment 2026-04-19).
|
|
22
|
+
|
|
23
|
+
## Comandos
|
|
24
|
+
|
|
25
|
+
- `bun run test` — Vitest unit suite
|
|
26
|
+
- `bun run build` — gera `dist/` (CJS + ESM + .d.ts) via tsup
|
|
27
|
+
- `bun run typecheck` — `tsc --noEmit`
|
|
28
|
+
|
|
29
|
+
## Release flow (maintainers)
|
|
30
|
+
|
|
31
|
+
CI publica via `.github/workflows/publish-packages.yml` quando uma release com tag `template-v*` é criada.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 1. Bump version
|
|
35
|
+
$EDITOR template/package.json # ex: 0.1.1 → 0.1.2
|
|
36
|
+
|
|
37
|
+
# 2. Commit + push
|
|
38
|
+
git commit -am "chore(template): bump to 0.1.2"
|
|
39
|
+
git push origin main
|
|
40
|
+
|
|
41
|
+
# 3. Tag release (workflow detecta tag, valida que template/package.json bate, publica)
|
|
42
|
+
gh release create template-v0.1.2 --generate-notes --title "template v0.1.2"
|
|
43
|
+
|
|
44
|
+
# 4. Confirma
|
|
45
|
+
gh run watch
|
|
46
|
+
npm view @hook-sdk/template@0.1.2
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Pré-requisitos: secret `NPM_TOKEN` no repo (granular `@hook-sdk` scope, "Allow bypassing 2FA" ✅). Workflow falha cedo se a versão na tag não bater com `template/package.json`.
|
|
50
|
+
|
|
51
|
+
> **Ordering note:** `template/package.json` declara `"@hook-sdk/sdk": "workspace:*"`. `bun publish` resolve isso para a versão SDK atualmente publicada na npm no momento do publish. Se você quer que um release de template use uma versão SDK específica, publique o SDK primeiro.
|