Skip to content

Commit aa79667

Browse files
author
Addon Stack
committed
docs: update README and CONTRIBUTING guidelines for clarity
- Expanded peer dependency details in README (including @types/react-dom). - Updated descriptions for `watch()` callbacks and `getAll()` behavior. - Clarified SecureStorage key formatting for namespaced storage. - Improved MonoStorage `watch()` explanation with deep comparison info. - Revised CONTRIBUTING.md to align with a Simplified GitFlow model. - Removed references to `release/*` and `hotfix/*` branches in release process.
1 parent fa3bbaa commit aa79667

2 files changed

Lines changed: 24 additions & 25 deletions

File tree

CONTRIBUTING.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Please also read and follow our [Code of Conduct](./CODE_OF_CONDUCT.md).
1212

1313
## Table of contents
1414
- Principles and workflow
15-
- Git branching model (GitFlow)
15+
- Git branching model (Simplified GitFlow)
1616
- Commit messages (Conventional Commits)
1717
- What affects versioning (SemVer policy)
1818
- Release process (release-it + GitHub Actions)
@@ -26,26 +26,22 @@ Please also read and follow our [Code of Conduct](./CODE_OF_CONDUCT.md).
2626

2727
## Principles and workflow
2828
We value clarity, automation, and a predictable release cadence. We use:
29-
- GitFlow for branching and release discipline.
29+
- Simplified GitFlow (no release/* or hotfix/* branches) for branching and release discipline.
3030
- Conventional Commits to generate CHANGELOG and calculate version bumps.
3131
- release-it to cut releases and publish to npm and GitHub.
3232
- Biome for formatting and linting; Jest for tests.
3333

34-
## Git branching model (GitFlow)
35-
We follow a pragmatic GitFlow variant:
36-
- `main` — production-ready branch. Commits here trigger a publish release.
37-
- `develop` — integration branch for upcoming work (default target for feature PRs).
34+
## Git branching model (Simplified GitFlow)
35+
We follow a simplified GitFlow:
36+
- `main` — production-ready branch. Merging a PR into `main` triggers a publish release.
37+
- `develop` — integration branch for upcoming work (default target for feature PRs). After each successful release, we merge `main` back into `develop` to keep versions and files in sync.
3838
- `feature/*` — feature branches cut from `develop`. Example: `feature/secure-storage-iv`.
39-
- `release/*` — release preparation branches cut from `develop`. Example: `release/0.4.0`.
40-
- `hotfix/*` — urgent fixes cut from `main`. Example: `hotfix/deserialize-crash`.
4139

4240
Typical flows:
4341
- New work: branch from `develop` into `feature/<name>`, open PR into `develop`.
44-
- Release: maintainers create `release/x.y.z` from `develop`, stabilize, then merge to `main`.
45-
- Hotfix: branch from `main` into `hotfix/<name>`, then merge back to `main` (and forward-merge into `develop`).
42+
- Release: open a pull request from the chosen base branch (typically `develop`) into `main`. After merge, CI publishes a new version and npm package. Then merge `main` back into `develop` to sync.
4643

47-
Note: Our CI includes a release preview for `release/*` and `hotfix/*` branches and performs a publish release on
48-
`main`.
44+
Note: We do not use `release/*` or `hotfix/*` branches.
4945

5046
## Commit messages (Conventional Commits)
5147
We enforce Conventional Commits via commitlint. The general format is:
@@ -75,7 +71,7 @@ Examples:
7571
- `fix(secure): handle invalid cipher text in decrypt()`
7672
- `perf(mono): reduce allocations in shallowEqual()`
7773
- `docs: expand README with React adapter examples`
78-
- `ci: run release preview on release/* branches`
74+
- `ci: update release pipeline`
7975

8076
Breaking changes:
8177
- Indicate with `!` after the type or include a `BREAKING CHANGE:` footer.
@@ -99,10 +95,10 @@ Notes:
9995
## Release process (release-it + GitHub Actions)
10096
We automate releases with [release-it](https://github.com/release-it/release-it) and GitHub Actions.
10197
102-
Branches:
103-
- `release/*` and `hotfix/*`: CI runs a Release Preview (no tag, no publish). This validates versioning and the
98+
Branches/Triggers:
99+
- Pull requests into `main`: CI runs checks and may run a release dry-run (no tag, no publish) to validate versioning and the
104100
generated notes.
105-
- `main`: CI runs a Release Publish that will:
101+
- `main` (on merge): CI runs a Release Publish that will:
106102
- determine the next version from commits (SemVer + Conventional Commits),
107103
- update `CHANGELOG.md`,
108104
- create a Git tag `vX.Y.Z` and a GitHub Release,
@@ -114,7 +110,9 @@ Local release commands (maintainers):
114110
115111
Important:
116112
- Do not manually edit `CHANGELOG.md` for released versions — it’s generated.
117-
- Ensure `develop` is up to date before cutting `release/*`.
113+
- Ensure the intended changes are in `develop` (or the chosen base branch) before opening a PR to `main`.
114+
- After a successful release, merge `main` back into `develop` to keep versions and files in sync.
115+
- We do not use `release/*` or `hotfix/*` branches.
118116
119117
## Code style and quality
120118
We use [Biome](https://biomejs.dev/) for formatting and linting. Key rules from `biome.json`:
@@ -160,7 +158,7 @@ Authoring tests:
160158
161159
## Pull requests
162160
Checklist for contributors:
163-
- [ ] Branch from `develop` (or `hotfix/*` from `main` for urgent fixes).
161+
- [ ] Branch from `develop`.
164162
- [ ] Follow code style and run locally:
165163
- `npm run format:check && npm run lint && npm run typecheck && npm test`
166164
- [ ] Write or update tests when applicable.

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pnpm add @addon-core/storage
2929
Requirements and environment:
3030

3131
- The library targets browser extension environments where chrome.storage is available.
32-
- For the React adapter, peer dependencies react and react-dom are required (optionally @types/react for TypeScript).
32+
- For the React adapter, peer dependencies react and react-dom are required (optionally @types/react and @types/react-dom for TypeScript).
3333
- SecureStorage relies on the Web Crypto API (crypto.subtle, AES‑GCM), available in modern browsers.
3434

3535
## Quick start
@@ -52,7 +52,7 @@ await storage.clear(); // clears only keys from the current namespace (if set)
5252
The package exports:
5353

5454
- Provider classes: `Storage`, `SecureStorage`, `MonoStorage`
55-
- Types: `StorageProvider`, `StorageState`, `StorageWatchOptions`
55+
- Types: `StorageProvider`, `StorageState`, `StorageWatchOptions`, `StorageWatchCallback`, `StorageWatchKeyCallback`
5656
- React adapter: `useStorage` from the submodule `@addon-core/storage/react`
5757

5858
### Creating a provider
@@ -84,7 +84,7 @@ const secure = SecureStorage.Local<{ token?: string }>({secureKey: "MyStrongKey"
8484
Provider options:
8585

8686
- `area?: "local" | "session" | "sync" | "managed"` — storage area (defaults to `local`)
87-
- `namespace?: string` — optional namespace; keys become `namespace:key`
87+
- `namespace?: string` — optional namespace; keys become `namespace:key` (for `SecureStorage`: `secure:namespace:key`)
8888
- For `SecureStorage`: additionally `secureKey?: string` — a string used to derive the encryption key.
8989

9090
### Provider methods
@@ -111,8 +111,8 @@ Where `StorageWatchOptions<T>` is either a map of per-key callbacks or a single
111111

112112
```ts
113113
// Option 1: a single handler for all changes
114-
const unsubscribe = storage.watch((next, prev) => {
115-
console.log("changed", {next, prev});
114+
const unsubscribe = storage.watch((next, prev, key) => {
115+
console.log("changed", {key, next, prev});
116116
});
117117

118118
// Option 2: specific handlers per key
@@ -131,7 +131,8 @@ un(); // unsubscribe
131131

132132
Notes:
133133

134-
- `getAll()` returns only keys that belong to the current provider (considering namespace and type).
134+
- `getAll()` returns entries (key–value pairs) scoped to the current provider (area, namespace, provider kind) and resolves to `Partial<T>`.
135+
- In the single-callback form of `watch()`, the third argument is the `key` that changed.
135136
- `SecureStorage` transparently encrypts/decrypts values. They are stored as strings, while you work with original types
136137
externally.
137138

@@ -168,7 +169,7 @@ await mono.set("a", 1);
168169
Highlights:
169170

170171
- When the last value in the “bucket” is removed, the top-level key is cleared entirely.
171-
- `watch()` in MonoStorage invokes callbacks only on actual value changes (shallow comparison).
172+
- `watch()` in MonoStorage invokes callbacks only on actual value changes (deep/structural comparison).
172173

173174
### SecureStorage — value encryption
174175

0 commit comments

Comments
 (0)