@stetcms/vite 0.1.0 → 0.2.0

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.
Files changed (2) hide show
  1. package/README.md +14 -6
  2. package/package.json +13 -6
package/README.md CHANGED
@@ -1,11 +1,17 @@
1
1
  # @stetcms/vite
2
2
 
3
- Vite plugin for products built on [Stet](https://github.com/jamiedavenport/stet). It does two jobs from one config file:
3
+ [![CI](https://github.com/jamiedavenport/stet/actions/workflows/ci.yml/badge.svg)](https://github.com/jamiedavenport/stet/actions/workflows/ci.yml)
4
+ [![Docs](https://img.shields.io/badge/docs-stetcms.com-black.svg)](https://docs.stetcms.com/reference/codegen)
5
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](./LICENSE)
6
+
7
+ Vite plugin for products built on [Stet](https://stetcms.com), the CMS where marketing owns the content model and engineering gets a typed client generated from it. It does two jobs from one config file:
4
8
 
5
9
  - **Generates a typed content client** before every build and dev-server start: the collections and maps your content team shapes in the Stet UI become `stet.<slug>.list()` / `.get()` calls your editor autocompletes. While the dev server runs it keeps watching, so a field added in the Stet UI reaches your types moments later without a restart.
6
10
  - **Publishes your analytics tracking plan**, so the events your code declares can be charted in Stet before anyone has fired one.
7
11
 
8
- Building without Vite? [`stet generate`](https://github.com/jamiedavenport/stet/tree/main/published/cli#stet-generate) and [`stet sync`](https://github.com/jamiedavenport/stet/tree/main/published/cli#stet-sync) run the same two jobs from the command line, for Next.js apps and CI.
12
+ Building without Vite? [`stet generate`](https://docs.stetcms.com/reference/cli#stet-generate) and [`stet sync`](https://docs.stetcms.com/reference/cli#stet-sync) run the same two jobs from the command line, for Next.js apps and CI.
13
+
14
+ New here? The [quickstart](https://docs.stetcms.com/quickstart) goes from an empty project to a typed content client in four steps.
9
15
 
10
16
  ## Install
11
17
 
@@ -26,7 +32,9 @@ export default defineConfig({
26
32
  });
27
33
  ```
28
34
 
29
- Everything is configured in `stet.config.ts` (see [`@stetcms/config`](https://github.com/jamiedavenport/stet/tree/main/published/config)), which the CLI reads too:
35
+ Frameworks that build on Vite need nothing extra — in Astro, the same plugin goes through `vite.plugins` in `astro.config.ts` and both jobs run unchanged.
36
+
37
+ Everything is configured in `stet.config.ts` (see [`@stetcms/config`](https://docs.stetcms.com/reference/configuration)), which the CLI reads too:
30
38
 
31
39
  ```ts
32
40
  // stet.config.ts
@@ -48,11 +56,11 @@ const landing = await stet.landing.get(); // a map
48
56
 
49
57
  The generated file never contains the key: at runtime the client reads `STET_API_KEY` from the environment again, so the file is safe to commit — and committing it keeps type checks working without a running Stet. It reads `STET_ORIGIN` at runtime too, falling back to the origin it was generated against, so one committed file works in every environment rather than pinning your deployment to whatever origin last regenerated it.
50
58
 
51
- Neither job can fail your build. Without a key, or with the API unreachable, the plugin warns and leaves the previous generated file in place, writing an empty model only when no file exists yet. A field deleted in the Stet UI keeps its key in the generated types, marked `@deprecated`: your editor strikes it through wherever you read it, and your build keeps passing while you migrate.
59
+ Neither job can fail your build. Without a key, or with the API unreachable, the plugin warns and leaves the previous generated file in place, writing an empty model only when no file exists yet. A field deleted or renamed in the Stet UI keeps its retired key in the generated types, marked `@deprecated`: your editor strikes it through wherever you read it, and your build keeps passing while you migrate.
52
60
 
53
61
  ## Analytics
54
62
 
55
- A config that declares `analytics` has its tracking plan published on every dev-server and build start, so the dashboard can offer an event before it has ever been recorded. Dropping an event from your code drops it from that list on the next sync, while anything already recorded under that name keeps its history. See [`@stetcms/analytics`](https://github.com/jamiedavenport/stet/tree/main/published/analytics) for the plan itself and the route it feeds.
63
+ A config that declares `analytics` has its tracking plan published on every dev-server and build start, so the dashboard can offer an event before it has ever been recorded. Dropping an event from your code drops it from that list on the next sync, while anything already recorded under that name keeps its history. See [`@stetcms/analytics`](https://docs.stetcms.com/reference/analytics) for the plan itself and the route it feeds.
56
64
 
57
65
  ## Options
58
66
 
@@ -66,7 +74,7 @@ Each option overrides the same key in `stet.config.ts`; leave them off and the c
66
74
  | `watch` | `true` | Regenerate every few seconds while the dev server runs. Never affects builds. |
67
75
  | `config` | auto-detected | Path to `stet.config.ts`, relative to root. |
68
76
 
69
- See [`examples/tanstack`](https://github.com/jamiedavenport/stet/tree/main/examples/tanstack) for a complete TanStack Start app built on the generated client.
77
+ See [`examples/tanstack`](https://github.com/jamiedavenport/stet/tree/main/examples/tanstack), [`examples/astro`](https://github.com/jamiedavenport/stet/tree/main/examples/astro) and [`examples/sveltekit`](https://github.com/jamiedavenport/stet/tree/main/examples/sveltekit) for complete TanStack Start, Astro and SvelteKit apps built on the generated client.
70
78
 
71
79
  ## License
72
80
 
package/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "name": "@stetcms/vite",
3
- "version": "0.1.0",
4
- "description": "Vite plugin for products built on Stet: typed options, a virtual config module, and a build-time codegen hook.",
3
+ "version": "0.2.0",
4
+ "description": "Vite plugin for Stet, the CMS for marketing and engineering: generates a typed content client and publishes your tracking plan.",
5
5
  "keywords": [
6
+ "cms",
7
+ "codegen",
8
+ "content",
9
+ "headless-cms",
6
10
  "plugin",
7
11
  "stet",
12
+ "stetcms",
13
+ "typegen",
14
+ "typescript",
8
15
  "vite",
9
16
  "vite-plugin"
10
17
  ],
11
- "homepage": "https://github.com/jamiedavenport/stet/tree/main/published/vite#readme",
18
+ "homepage": "https://docs.stetcms.com/reference/codegen",
12
19
  "bugs": "https://github.com/jamiedavenport/stet/issues",
13
20
  "license": "Apache-2.0",
14
21
  "author": "Jamie Davenport (https://jxd.dev)",
@@ -36,9 +43,9 @@
36
43
  },
37
44
  "dependencies": {
38
45
  "jiti": "^2.7.0",
39
- "@stetcms/client": "0.1.0",
40
- "@stetcms/analytics": "0.1.0",
41
- "@stetcms/config": "0.1.0"
46
+ "@stetcms/analytics": "0.2.0",
47
+ "@stetcms/client": "0.2.0",
48
+ "@stetcms/config": "0.1.1"
42
49
  },
43
50
  "devDependencies": {
44
51
  "@types/node": "^26.1.1",