Skip to content

Commit f4506d4

Browse files
committed
feat(create)!: rename manifest field to createConfig.templates
BREAKING (unpublished feature): the org-create manifest now lives at `createConfig.templates` in `@org/create`'s package.json, replacing the Vite+-specific `vp.templates` location. Rationale (fengmk2 + cpojer, PR #1398 review): the manifest metadata is tool-neutral (names, descriptions, template specifiers) and belongs under a neutral field name. Following the precedent of npm's `publishConfig`, `createConfig` reads as "configuration used specifically when this package is consumed as a create initializer", leaving room for other scaffolding tools to adopt the same convention later. Vite+-specific behavior, if/when it's needed, can sit at `createConfig.vp.*` without further schema changes. Schema shape unchanged (name / description / template / keywords / monorepo). Validation error messages now reference `createConfig.templates[...]` instead of `vp.templates[...]`. Updated: org-manifest reader and schema validator, RegistryVersionMeta type, org-resolve info note, bin.ts help text, define-config JSDoc, RFC manifest schema + field reference + resolution flow sections, docs guide + config pages, root README, all 7 snap-test mock manifests (and the bundled-fixture tarball + integrity hash), and the unit-test regex that asserts the error path name.
1 parent 4e053a6 commit f4506d4

20 files changed

Lines changed: 83 additions & 78 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ vp create
153153
You can run `vp create` inside of a project to add new apps or libraries to your project.
154154

155155
Organizations can expose a curated set of templates under their npm scope by
156-
publishing `@org/create` with a `vp.templates` manifest in its `package.json`.
156+
publishing `@org/create` with a `createConfig.templates` manifest in its `package.json`.
157157
Once published, `vp create @org` opens an interactive picker over those
158158
templates, and setting `create: { defaultTemplate: '@org' }` in
159159
`vite.config.ts` makes it the default for bare `vp create`. See the

docs/config/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## `create.defaultTemplate`
66

7-
When `vp create` is invoked with no `TEMPLATE` argument, Vite+ uses this value as if the user had typed it. Typically set to an npm scope whose `@scope/create` package publishes a `vp.templates` manifest — so bare `vp create` drops into the org picker.
7+
When `vp create` is invoked with no `TEMPLATE` argument, Vite+ uses this value as if the user had typed it. Typically set to an npm scope whose `@scope/create` package publishes a `createConfig.templates` manifest — so bare `vp create` drops into the org picker.
88

99
```ts
1010
import { defineConfig } from 'vite-plus';

docs/guide/create.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ vp create https://github.com/user/template-repo
8989

9090
## Organization Templates
9191

92-
An organization can publish a curated set of templates under a single npm scope by shipping an `@org/create` package whose `package.json` carries a `vp.templates` manifest. Once published, `vp create @org` opens an interactive picker over those templates.
92+
An organization can publish a curated set of templates under a single npm scope by shipping an `@org/create` package whose `package.json` carries a `createConfig.templates` manifest. Once published, `vp create @org` opens an interactive picker over those templates.
9393

9494
### Pick from an org
9595

@@ -104,7 +104,7 @@ vp create @your-org/web
104104
vp create
105105
```
106106

107-
Behind the scenes, `vp create @org` maps to `@org/create` (the existing npm `create-*` convention). If that package has no `vp.templates` field, Vite+ falls back to running the package normally — so adopting the manifest is zero-risk for orgs that already publish `@org/create`.
107+
Behind the scenes, `vp create @org` maps to `@org/create` (the existing npm `create-*` convention). If that package has no `createConfig.templates` field, Vite+ falls back to running the package normally — so adopting the manifest is zero-risk for orgs that already publish `@org/create`.
108108

109109
### Authoring `@org/create`
110110

@@ -114,7 +114,7 @@ There are two common layouts. Pick the one that matches the org's template count
114114

115115
```
116116
@your-org/create/
117-
├── package.json # "vp": { "templates": [{ "template": "./templates/web" }, ...] }
117+
├── package.json # "createConfig": { "templates": [{ "template": "./templates/web" }, ...] }
118118
├── templates/
119119
│ ├── web/
120120
│ │ ├── package.json
@@ -127,7 +127,7 @@ There are two common layouts. Pick the one that matches the org's template count
127127

128128
```
129129
@your-org/create/
130-
├── package.json # "vp": { "templates": [{ "template": "@your-org/template-web" }, ...] }
130+
├── package.json # "createConfig": { "templates": [{ "template": "@your-org/template-web" }, ...] }
131131
└── README.md
132132
```
133133

@@ -137,13 +137,13 @@ Optionally, provide a `bin` script so `npm create @org` (the legacy path) keeps
137137

138138
### Manifest schema
139139

140-
The manifest lives at `vp.templates` in `@org/create`'s `package.json`:
140+
The manifest lives at `createConfig.templates` in `@org/create`'s `package.json`:
141141

142142
```json
143143
{
144144
"name": "@your-org/create",
145145
"version": "1.0.0",
146-
"vp": {
146+
"createConfig": {
147147
"templates": [
148148
{
149149
"name": "monorepo",
@@ -177,7 +177,7 @@ Each entry supports:
177177
| `keywords` | no | Filter terms for picker search. |
178178
| `monorepo` | no | If `true`, marks this entry as a monorepo-creating template. Hidden from the picker when `vp create` runs inside an existing monorepo, mirroring the built-in `vite:monorepo` filter. |
179179

180-
An invalid manifest is a hard error, not a silent fall-through — a maintainer who shipped a manifest should hear about the offending field, e.g. `@your-org/create: vp.templates[2].template must be a non-empty string`.
180+
An invalid manifest is a hard error, not a silent fall-through — a maintainer who shipped a manifest should hear about the offending field, e.g. `@your-org/create: createConfig.templates[2].template must be a non-empty string`.
181181

182182
### Bundled subdirectory templates
183183

@@ -224,7 +224,7 @@ Examples:
224224
### Publishing checklist
225225

226226
1. Create `@org/create` (scoped npm package) if you don't already have one.
227-
2. Add a `vp.templates` array to `package.json`. (Bundle the templates under `./templates/...` or point at external packages.)
227+
2. Add a `createConfig.templates` array to `package.json`. (Bundle the templates under `./templates/...` or point at external packages.)
228228
3. (Optional) Provide a `bin` launcher for `npm create @org` compatibility.
229229
4. Publish.
230230
5. Verify: `vp create @org --no-interactive` prints the manifest table; `vp create @org` opens the picker.

packages/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ vp create
151151
You can run `vp create` inside of a project to add new apps or libraries to your project.
152152

153153
Organizations can expose a curated set of templates under their npm scope by
154-
publishing `@org/create` with a `vp.templates` manifest in its `package.json`.
154+
publishing `@org/create` with a `createConfig.templates` manifest in its `package.json`.
155155
Once published, `vp create @org` opens an interactive picker over those
156156
templates, and setting `create: { defaultTemplate: '@org' }` in
157157
`vite.config.ts` makes it the default for bare `vp create`. See the

packages/cli/snap-tests/create-org-bundled-escape-check/mock-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"tarball": "{REGISTRY}/@your-org/create/-/create-1.0.0.tgz",
1010
"integrity": "sha512-fake"
1111
},
12-
"vp": {
12+
"createConfig": {
1313
"templates": [
1414
{
1515
"name": "escape",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[1]> node $SNAP_CASES_DIR/.shared/mock-npm-registry.mjs -- vp create @your-org --no-interactive # `../outside` path rejected at schema-validation, before any tarball fetch
22

3-
@your-org/create: vp.templates[0].template escapes the package root: ../outside
3+
@your-org/create: createConfig.templates[0].template escapes the package root: ../outside

packages/cli/snap-tests/create-org-bundled/mock-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"version": "1.0.0",
88
"dist": {
99
"tarball": "{REGISTRY}/@your-org/create/-/create-1.0.0.tgz",
10-
"integrity": "sha512-h4Q9x+aUa2RUJGBe7JCZnWpGMyd8VHXPfL9+EBxrA2EWRV8rlmMCP45B3woZ8xA2fmkE/jUy1W7OM2GCjoPWQA=="
10+
"integrity": "sha512-swwZCXG8RDBJNTmiw3zCOBCQx9bCg7wHqoW37aV7BgGYfBUU7n7c+efbSCg0+FpdLhgeUjEMP5IAO+8exmeFKg=="
1111
},
12-
"vp": {
12+
"createConfig": {
1313
"templates": [
1414
{
1515
"name": "demo",
Binary file not shown.

packages/cli/snap-tests/create-org-config-default/mock-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"tarball": "{REGISTRY}/@your-org/create/-/create-1.0.0.tgz",
1010
"integrity": "sha512-fake"
1111
},
12-
"vp": {
12+
"createConfig": {
1313
"templates": [
1414
{
1515
"name": "web",

packages/cli/snap-tests/create-org-invalid-manifest/mock-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"tarball": "{REGISTRY}/@your-org/create/-/create-1.0.0.tgz",
1010
"integrity": "sha512-fake"
1111
},
12-
"vp": {
12+
"createConfig": {
1313
"templates": [
1414
{
1515
"name": "broken-entry",

0 commit comments

Comments
 (0)