@nanocollective/json-up
Advanced tools
+1
-1
| { | ||
| "name": "@nanocollective/json-up", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "A TypeScript JSON migration tool with Zod schema validation", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+25
-29
@@ -1,7 +0,13 @@ | ||
| # @nanocollective/json-up | ||
| # json-up | ||
| Transform & migrate JSON data to new schemas, with type-safe validation using Zod. | ||
| A fast, type-safe JSON migration tool with Zod schema validation. | ||
| Useful for local JSON that evolves over time, like app settings, saved documents, or cached data. | ||
| ## Features | ||
| - **Type-safe migrations for JSON** with full TypeScript inference | ||
| - **Zod schema validation** at every step | ||
| - **Fluent builder API** for migration chains | ||
| - **Automatic version tracking** | ||
| - **Zero runtime dependencies** (only Zod as peer) | ||
| ## Installation | ||
@@ -13,22 +19,4 @@ | ||
| [Docs](./docs/index.md) | [Getting Started](./docs/getting-started.md) | [API Reference](./docs/api-reference.md) | ||
| ## Quick Start | ||
| ## What is a migration? | ||
| A migration is a step that transforms your data from one version to the next. | ||
| When your data structure changes over time, migrations let you upgrade old | ||
| data to match your current format. | ||
| ## Example | ||
| Imagine you have user profiles stored as JSON, saved to a file. | ||
| Originally, you stored a single `name` field. | ||
| Now, in your latest app, you want to split it into `firstName` and `lastName`. | ||
| You could write `if` statements, but this gets risky as more changes come along. | ||
| So how can you safely update the state? | ||
| ```typescript | ||
@@ -38,3 +26,2 @@ import { createMigrations, migrate } from "@nanocollective/json-up"; | ||
| // Define your migrations | ||
| const migrations = createMigrations() | ||
@@ -56,7 +43,4 @@ .add({ | ||
| // Migrate old data to the latest version | ||
| const old = { _version: 1, name: "Jane Doe" } | ||
| const result = migrate({ | ||
| state: old, | ||
| state: { _version: 1, name: "Jane Doe" }, | ||
| migrations, | ||
@@ -69,5 +53,17 @@ }); | ||
| ## Documentation | ||
| ## License | ||
| For full documentation, see [docs/index.md](docs/index.md): | ||
| MIT | ||
| - [Getting Started](docs/getting-started.md) | ||
| - [API Reference](docs/api-reference.md) | ||
| - [Error Handling](docs/error-handling.md) | ||
| - [Examples](docs/examples.md) | ||
| ## Community | ||
| We're a small community-led team building local and privacy-first AI solutions under the [Nano Collective](https://nanocollective.org). | ||
| - [Contributing Guide](CONTRIBUTING.md) | ||
| - [Discord Server](https://discord.gg/ktPDV6rekE) | ||
| - [GitHub Issues](https://github.com/nanocollective/json-up/issues) |
22425
-0.32%66
-5.71%