create-payload-app 4.0.0-internal.5f0cd13 → 4.0.0-internal.688c4d0

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 (39) hide show
  1. package/dist/lib/create-project.d.ts.map +1 -1
  2. package/dist/lib/create-project.js +8 -50
  3. package/dist/lib/create-project.js.map +1 -1
  4. package/dist/lib/init-next.d.ts +1 -1
  5. package/dist/lib/init-next.d.ts.map +1 -1
  6. package/dist/lib/init-next.js +15 -4
  7. package/dist/lib/init-next.js.map +1 -1
  8. package/dist/lib/update-payload-in-project.d.ts +1 -1
  9. package/dist/lib/update-payload-in-project.d.ts.map +1 -1
  10. package/dist/lib/update-payload-in-project.js +6 -5
  11. package/dist/lib/update-payload-in-project.js.map +1 -1
  12. package/dist/main.d.ts.map +1 -1
  13. package/dist/main.js +6 -5
  14. package/dist/main.js.map +1 -1
  15. package/dist/template/src/app/(frontend)/page.tsx +5 -2
  16. package/dist/template/src/app/(payload)/admin/importMap.js +17 -2
  17. package/dist/template/src/collections/Folders.ts +16 -0
  18. package/dist/template/src/collections/Media.ts +4 -0
  19. package/dist/template/src/collections/Tags.ts +16 -0
  20. package/dist/template/src/collections/Users.ts +1 -0
  21. package/dist/template/src/payload-types.ts +171 -11
  22. package/dist/template/src/payload.config.ts +10 -2
  23. package/dist/types.d.ts +1 -0
  24. package/dist/types.d.ts.map +1 -1
  25. package/dist/types.js.map +1 -1
  26. package/dist/utils/messages.d.ts.map +1 -1
  27. package/dist/utils/messages.js +1 -0
  28. package/dist/utils/messages.js.map +1 -1
  29. package/dist/utils/resolvePackageVersion.d.ts +29 -0
  30. package/dist/utils/resolvePackageVersion.d.ts.map +1 -0
  31. package/dist/utils/resolvePackageVersion.js +41 -0
  32. package/dist/utils/resolvePackageVersion.js.map +1 -0
  33. package/dist/utils/resolvePackageVersion.spec.js +77 -0
  34. package/dist/utils/resolvePackageVersion.spec.js.map +1 -0
  35. package/package.json +2 -2
  36. package/dist/utils/getLatestPackageVersion.d.ts +0 -17
  37. package/dist/utils/getLatestPackageVersion.d.ts.map +0 -1
  38. package/dist/utils/getLatestPackageVersion.js +0 -20
  39. package/dist/utils/getLatestPackageVersion.js.map +0 -1
@@ -1,5 +1,7 @@
1
1
  import type { CollectionConfig } from 'payload'
2
2
 
3
+ import { createFolderField, createTagField } from 'payload'
4
+
3
5
  export const Media: CollectionConfig = {
4
6
  slug: 'media',
5
7
  access: {
@@ -11,6 +13,8 @@ export const Media: CollectionConfig = {
11
13
  type: 'text',
12
14
  required: true,
13
15
  },
16
+ createFolderField({ relationTo: 'folders' }),
17
+ createTagField({ relationTo: 'tags' }),
14
18
  ],
15
19
  upload: true,
16
20
  }
@@ -0,0 +1,16 @@
1
+ import type { CollectionConfig } from 'payload'
2
+
3
+ export const Tags: CollectionConfig = {
4
+ slug: 'tags',
5
+ admin: {
6
+ useAsTitle: 'name',
7
+ },
8
+ tags: true,
9
+ fields: [
10
+ {
11
+ name: 'name',
12
+ type: 'text',
13
+ required: true,
14
+ },
15
+ ],
16
+ }
@@ -10,4 +10,5 @@ export const Users: CollectionConfig = {
10
10
  // Email added by default
11
11
  // Add more fields as needed
12
12
  ],
13
+ versions: false,
13
14
  }
@@ -64,11 +64,15 @@ export type SupportedTimezones =
64
64
  export interface Config {
65
65
  auth: {
66
66
  users: UserAuthOperations;
67
+ 'payload-mcp-api-keys': PayloadMcpApiKeyAuthOperations;
67
68
  };
68
69
  blocks: {};
69
70
  collections: {
70
71
  users: User;
71
72
  media: Media;
73
+ folders: Folder;
74
+ tags: Tag;
75
+ 'payload-mcp-api-keys': PayloadMcpApiKey;
72
76
  'payload-kv': PayloadKv;
73
77
  'payload-locked-documents': PayloadLockedDocument;
74
78
  'payload-preferences': PayloadPreference;
@@ -78,6 +82,9 @@ export interface Config {
78
82
  collectionsSelect: {
79
83
  users: UsersSelect<false> | UsersSelect<true>;
80
84
  media: MediaSelect<false> | MediaSelect<true>;
85
+ folders: FoldersSelect<false> | FoldersSelect<true>;
86
+ tags: TagsSelect<false> | TagsSelect<true>;
87
+ 'payload-mcp-api-keys': PayloadMcpApiKeysSelect<false> | PayloadMcpApiKeysSelect<true>;
81
88
  'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
82
89
  'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
83
90
  'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
@@ -86,14 +93,14 @@ export interface Config {
86
93
  db: {
87
94
  defaultIDType: string;
88
95
  };
89
- fallbackLocale: null;
96
+ fallbackLocale: ('false' | 'none' | 'null') | false | null | 'en' | 'en'[];
90
97
  globals: {};
91
98
  globalsSelect: {};
92
- locale: null;
99
+ locale: 'en';
93
100
  widgets: {
94
101
  collections: CollectionsWidget;
95
102
  };
96
- user: User;
103
+ user: User | PayloadMcpApiKey;
97
104
  jobs: {
98
105
  tasks: unknown;
99
106
  workflows: unknown;
@@ -117,6 +124,24 @@ export interface UserAuthOperations {
117
124
  password: string;
118
125
  };
119
126
  }
127
+ export interface PayloadMcpApiKeyAuthOperations {
128
+ forgotPassword: {
129
+ email: string;
130
+ password: string;
131
+ };
132
+ login: {
133
+ email: string;
134
+ password: string;
135
+ };
136
+ registerFirstUser: {
137
+ email: string;
138
+ password: string;
139
+ };
140
+ unlock: {
141
+ email: string;
142
+ password: string;
143
+ };
144
+ }
120
145
  /**
121
146
  * This interface was referenced by `Config`'s JSON-Schema
122
147
  * via the `definition` "users".
@@ -149,6 +174,8 @@ export interface User {
149
174
  export interface Media {
150
175
  id: string;
151
176
  alt: string;
177
+ _h_folders?: (string | null) | Folder;
178
+ _h_tags?: (string | Tag)[] | null;
152
179
  updatedAt: string;
153
180
  createdAt: string;
154
181
  url?: string | null;
@@ -161,6 +188,75 @@ export interface Media {
161
188
  focalX?: number | null;
162
189
  focalY?: number | null;
163
190
  }
191
+ /**
192
+ * This interface was referenced by `Config`'s JSON-Schema
193
+ * via the `definition` "folders".
194
+ */
195
+ export interface Folder {
196
+ id: string;
197
+ _h_folders?: (string | null) | Folder;
198
+ name: string;
199
+ updatedAt: string;
200
+ createdAt: string;
201
+ _h_slugPath?: string | null;
202
+ _h_titlePath?: string | null;
203
+ }
204
+ /**
205
+ * This interface was referenced by `Config`'s JSON-Schema
206
+ * via the `definition` "tags".
207
+ */
208
+ export interface Tag {
209
+ id: string;
210
+ _h_tags?: (string | null) | Tag;
211
+ name: string;
212
+ updatedAt: string;
213
+ createdAt: string;
214
+ _h_slugPath?: string | null;
215
+ _h_titlePath?: string | null;
216
+ }
217
+ /**
218
+ * API keys control which collections, resources, tools, and prompts MCP clients can access
219
+ *
220
+ * This interface was referenced by `Config`'s JSON-Schema
221
+ * via the `definition` "payload-mcp-api-keys".
222
+ */
223
+ export interface PayloadMcpApiKey {
224
+ id: string;
225
+ /**
226
+ * The user that the API key is associated with.
227
+ */
228
+ user: string | User;
229
+ /**
230
+ * A useful label for the API key.
231
+ */
232
+ label?: string | null;
233
+ /**
234
+ * The purpose of the API key.
235
+ */
236
+ description?: string | null;
237
+ /**
238
+ * When checked, this key bypasses Payload access control on every operation it performs. Leave unchecked unless you have a specific reason.
239
+ */
240
+ overrideAccess?: boolean | null;
241
+ /**
242
+ * Access for this API key — uncheck to revoke individual tools.
243
+ */
244
+ access?:
245
+ | {
246
+ [k: string]: unknown;
247
+ }
248
+ | unknown[]
249
+ | string
250
+ | number
251
+ | boolean
252
+ | null;
253
+ updatedAt: string;
254
+ createdAt: string;
255
+ enableAPIKey?: boolean | null;
256
+ apiKey?: string | null;
257
+ apiKeyIndex?: string | null;
258
+ collection: 'payload-mcp-api-keys';
259
+ }
164
260
  /**
165
261
  * This interface was referenced by `Config`'s JSON-Schema
166
262
  * via the `definition` "payload-kv".
@@ -192,12 +288,29 @@ export interface PayloadLockedDocument {
192
288
  | ({
193
289
  relationTo: 'media';
194
290
  value: string | Media;
291
+ } | null)
292
+ | ({
293
+ relationTo: 'folders';
294
+ value: string | Folder;
295
+ } | null)
296
+ | ({
297
+ relationTo: 'tags';
298
+ value: string | Tag;
299
+ } | null)
300
+ | ({
301
+ relationTo: 'payload-mcp-api-keys';
302
+ value: string | PayloadMcpApiKey;
195
303
  } | null);
196
304
  globalSlug?: string | null;
197
- user: {
198
- relationTo: 'users';
199
- value: string | User;
200
- };
305
+ user:
306
+ | {
307
+ relationTo: 'users';
308
+ value: string | User;
309
+ }
310
+ | {
311
+ relationTo: 'payload-mcp-api-keys';
312
+ value: string | PayloadMcpApiKey;
313
+ };
201
314
  updatedAt: string;
202
315
  createdAt: string;
203
316
  }
@@ -207,10 +320,15 @@ export interface PayloadLockedDocument {
207
320
  */
208
321
  export interface PayloadPreference {
209
322
  id: string;
210
- user: {
211
- relationTo: 'users';
212
- value: string | User;
213
- };
323
+ user:
324
+ | {
325
+ relationTo: 'users';
326
+ value: string | User;
327
+ }
328
+ | {
329
+ relationTo: 'payload-mcp-api-keys';
330
+ value: string | PayloadMcpApiKey;
331
+ };
214
332
  key?: string | null;
215
333
  value?:
216
334
  | {
@@ -263,6 +381,8 @@ export interface UsersSelect<T extends boolean = true> {
263
381
  */
264
382
  export interface MediaSelect<T extends boolean = true> {
265
383
  alt?: T;
384
+ _h_folders?: T;
385
+ _h_tags?: T;
266
386
  updatedAt?: T;
267
387
  createdAt?: T;
268
388
  url?: T;
@@ -275,6 +395,46 @@ export interface MediaSelect<T extends boolean = true> {
275
395
  focalX?: T;
276
396
  focalY?: T;
277
397
  }
398
+ /**
399
+ * This interface was referenced by `Config`'s JSON-Schema
400
+ * via the `definition` "folders_select".
401
+ */
402
+ export interface FoldersSelect<T extends boolean = true> {
403
+ _h_folders?: T;
404
+ name?: T;
405
+ updatedAt?: T;
406
+ createdAt?: T;
407
+ _h_slugPath?: T;
408
+ _h_titlePath?: T;
409
+ }
410
+ /**
411
+ * This interface was referenced by `Config`'s JSON-Schema
412
+ * via the `definition` "tags_select".
413
+ */
414
+ export interface TagsSelect<T extends boolean = true> {
415
+ _h_tags?: T;
416
+ name?: T;
417
+ updatedAt?: T;
418
+ createdAt?: T;
419
+ _h_slugPath?: T;
420
+ _h_titlePath?: T;
421
+ }
422
+ /**
423
+ * This interface was referenced by `Config`'s JSON-Schema
424
+ * via the `definition` "payload-mcp-api-keys_select".
425
+ */
426
+ export interface PayloadMcpApiKeysSelect<T extends boolean = true> {
427
+ user?: T;
428
+ label?: T;
429
+ description?: T;
430
+ overrideAccess?: T;
431
+ access?: T;
432
+ updatedAt?: T;
433
+ createdAt?: T;
434
+ enableAPIKey?: T;
435
+ apiKey?: T;
436
+ apiKeyIndex?: T;
437
+ }
278
438
  /**
279
439
  * This interface was referenced by `Config`'s JSON-Schema
280
440
  * via the `definition` "payload-kv_select".
@@ -1,4 +1,5 @@
1
1
  import { mongooseAdapter } from '@payloadcms/db-mongodb'
2
+ import { mcpPlugin } from '@payloadcms/plugin-mcp'
2
3
  import { lexicalEditor } from '@payloadcms/richtext-lexical'
3
4
  import path from 'path'
4
5
  import { buildConfig } from 'payload'
@@ -7,6 +8,8 @@ import sharp from 'sharp'
7
8
 
8
9
  import { Users } from './collections/Users'
9
10
  import { Media } from './collections/Media'
11
+ import { Folders } from './collections/Folders'
12
+ import { Tags } from './collections/Tags'
10
13
 
11
14
  const filename = fileURLToPath(import.meta.url)
12
15
  const dirname = path.dirname(filename)
@@ -18,7 +21,7 @@ export default buildConfig({
18
21
  baseDir: path.resolve(dirname),
19
22
  },
20
23
  },
21
- collections: [Users, Media],
24
+ collections: [Users, Media, Folders, Tags],
22
25
  editor: lexicalEditor(),
23
26
  secret: process.env.PAYLOAD_SECRET || '',
24
27
  typescript: {
@@ -28,5 +31,10 @@ export default buildConfig({
28
31
  url: process.env.DATABASE_URL || '',
29
32
  }),
30
33
  sharp,
31
- plugins: [],
34
+ localization: {
35
+ locales: ['en'],
36
+ fallback: true,
37
+ defaultLocale: 'en',
38
+ },
39
+ plugins: [mcpPlugin({})],
32
40
  })
package/dist/types.d.ts CHANGED
@@ -18,6 +18,7 @@ export interface Args extends arg.Spec {
18
18
  '--no-agent': BooleanConstructor;
19
19
  '--no-deps': BooleanConstructor;
20
20
  '--no-git': BooleanConstructor;
21
+ '--payload-version': StringConstructor;
21
22
  '--secret': StringConstructor;
22
23
  '--template': StringConstructor;
23
24
  '--use-bun': BooleanConstructor;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAErF,MAAM,WAAW,IAAK,SAAQ,GAAG,CAAC,IAAI;IACpC,SAAS,EAAE,iBAAiB,CAAA;IAC5B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,MAAM,EAAE,iBAAiB,CAAA;IACzB,yBAAyB,EAAE,kBAAkB,CAAA;IAC7C,wBAAwB,EAAE,iBAAiB,CAAA;IAC3C,SAAS,EAAE,kBAAkB,CAAA;IAC7B,WAAW,EAAE,kBAAkB,CAAA;IAE/B,WAAW,EAAE,iBAAiB,CAAA;IAC9B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,aAAa,EAAE,kBAAkB,CAAA;IACjC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,kBAAkB,EAAE,iBAAiB,CAAA;IACrC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,YAAY,EAAE,kBAAkB,CAAA;IAChC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,UAAU,EAAE,kBAAkB,CAAA;IAC9B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,YAAY,EAAE,iBAAiB,CAAA;IAC/B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,YAAY,EAAE,kBAAkB,CAAA;IAChC,YAAY,EAAE,kBAAkB,CAAA;IAIhC,IAAI,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AAA;CACb,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,iBAAiB,EAAE,OAAO,CAAA;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,EAAE,OAAO,CAAA;IACjB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,WAAW,EAAE,IAAI,GAAG,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;AAEjD,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtE,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type arg from 'arg'\n\nimport type { ALL_DATABASE_ADAPTERS, ALL_STORAGE_ADAPTERS } from './lib/ast/types.js'\n\nexport interface Args extends arg.Spec {\n '--agent': StringConstructor\n '--beta': BooleanConstructor\n '--branch': StringConstructor\n '--db': StringConstructor\n '--db-accept-recommended': BooleanConstructor\n '--db-connection-string': StringConstructor\n '--debug': BooleanConstructor\n '--dry-run': BooleanConstructor\n\n '--example': StringConstructor\n '--help': BooleanConstructor\n '--init-next': BooleanConstructor\n '--local-example': StringConstructor\n '--local-template': StringConstructor\n '--name': StringConstructor\n '--no-agent': BooleanConstructor\n '--no-deps': BooleanConstructor\n '--no-git': BooleanConstructor\n '--secret': StringConstructor\n '--template': StringConstructor\n '--use-bun': BooleanConstructor\n '--use-npm': BooleanConstructor\n '--use-pnpm': BooleanConstructor\n '--use-yarn': BooleanConstructor\n\n // Aliases\n\n '-a': string\n '-e': string\n '-h': string\n '-n': string\n '-t': string\n}\n\nexport type CliArgs = arg.Result<Args>\n\nexport type ProjectTemplate = GitTemplate | PluginTemplate\n\nexport type ProjectExample = {\n name: string\n url: string\n}\n\n/**\n * Template that is cloned verbatim from a git repo\n * Performs .env manipulation based upon input\n */\nexport interface GitTemplate extends Template {\n type: 'starter'\n url: string\n}\n\n/**\n * Type specifically for the plugin template\n * No .env manipulation is done\n */\nexport interface PluginTemplate extends Template {\n type: 'plugin'\n url: string\n}\n\ninterface Template {\n dbType?: DbType\n description?: string\n name: string\n type: ProjectTemplate['type']\n}\n\nexport type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'\n\nexport type DbType = (typeof ALL_DATABASE_ADAPTERS)[number]\n\nexport type DbDetails = {\n dbUri?: string\n type: DbType\n}\n\nexport type NextAppDetails = {\n hasTopLevelLayout: boolean\n isPayloadInstalled?: boolean\n isSrcDir: boolean\n isSupportedNextVersion: boolean\n nextAppDir?: string\n nextConfigPath?: string\n nextConfigType?: NextConfigType\n nextVersion: null | string\n}\n\nexport type NextConfigType = 'cjs' | 'esm' | 'ts'\n\nexport type StorageAdapterType = (typeof ALL_STORAGE_ADAPTERS)[number]\n\nexport type AgentType = 'claude' | 'codex' | 'cursor'\n"],"names":[],"mappings":"AAiGA,WAAqD"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type arg from 'arg'\n\nimport type { ALL_DATABASE_ADAPTERS, ALL_STORAGE_ADAPTERS } from './lib/ast/types.js'\n\nexport interface Args extends arg.Spec {\n '--agent': StringConstructor\n '--beta': BooleanConstructor\n '--branch': StringConstructor\n '--db': StringConstructor\n '--db-accept-recommended': BooleanConstructor\n '--db-connection-string': StringConstructor\n '--debug': BooleanConstructor\n '--dry-run': BooleanConstructor\n\n '--example': StringConstructor\n '--help': BooleanConstructor\n '--init-next': BooleanConstructor\n '--local-example': StringConstructor\n '--local-template': StringConstructor\n '--name': StringConstructor\n '--no-agent': BooleanConstructor\n '--no-deps': BooleanConstructor\n '--no-git': BooleanConstructor\n '--payload-version': StringConstructor\n '--secret': StringConstructor\n '--template': StringConstructor\n '--use-bun': BooleanConstructor\n '--use-npm': BooleanConstructor\n '--use-pnpm': BooleanConstructor\n '--use-yarn': BooleanConstructor\n\n // Aliases\n\n '-a': string\n '-e': string\n '-h': string\n '-n': string\n '-t': string\n}\n\nexport type CliArgs = arg.Result<Args>\n\nexport type ProjectTemplate = GitTemplate | PluginTemplate\n\nexport type ProjectExample = {\n name: string\n url: string\n}\n\n/**\n * Template that is cloned verbatim from a git repo\n * Performs .env manipulation based upon input\n */\nexport interface GitTemplate extends Template {\n type: 'starter'\n url: string\n}\n\n/**\n * Type specifically for the plugin template\n * No .env manipulation is done\n */\nexport interface PluginTemplate extends Template {\n type: 'plugin'\n url: string\n}\n\ninterface Template {\n dbType?: DbType\n description?: string\n name: string\n type: ProjectTemplate['type']\n}\n\nexport type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'\n\nexport type DbType = (typeof ALL_DATABASE_ADAPTERS)[number]\n\nexport type DbDetails = {\n dbUri?: string\n type: DbType\n}\n\nexport type NextAppDetails = {\n hasTopLevelLayout: boolean\n isPayloadInstalled?: boolean\n isSrcDir: boolean\n isSupportedNextVersion: boolean\n nextAppDir?: string\n nextConfigPath?: string\n nextConfigType?: NextConfigType\n nextVersion: null | string\n}\n\nexport type NextConfigType = 'cjs' | 'esm' | 'ts'\n\nexport type StorageAdapterType = (typeof ALL_STORAGE_ADAPTERS)[number]\n\nexport type AgentType = 'claude' | 'codex' | 'cursor'\n"],"names":[],"mappings":"AAkGA,WAAqD"}
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,aAAa,CAAA;AAMlE,eAAO,MAAM,cAAc,QAE1B,CAAA;AAID,wBAAgB,WAAW,IAAI,IAAI,CAmClC;AAQD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBzF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgBpF;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,aAAa,CAAA;AAMlE,eAAO,MAAM,cAAc,QAE1B,CAAA;AAID,wBAAgB,WAAW,IAAI,IAAI,CAoClC;AAQD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBzF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgBpF;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
@@ -40,6 +40,7 @@ export function helpMessage() {
40
40
  --use-pnpm Use pnpm to install dependencies
41
41
  --use-bun Use bun to install dependencies (experimental)
42
42
  --no-deps Do not install any dependencies
43
+ --payload-version {underline value} Install a specific Payload version or npm dist-tag (default: canary)
43
44
  -h Show help
44
45
  `);
45
46
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/messages.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport chalk from 'chalk'\nimport path from 'path'\nimport terminalLink from 'terminal-link'\n\nimport type { PackageManager, ProjectTemplate } from '../types.js'\n\nimport { getValidTemplates } from '../lib/templates.js'\n\nconst header = (message: string): string => chalk.bold(message)\n\nexport const welcomeMessage = chalk`\n {green Welcome to Payload. Let's create a project! }\n`\n\nconst spacer = ' '.repeat(8)\n\nexport function helpMessage(): void {\n const validTemplates = getValidTemplates()\n console.log(chalk`\n {bold USAGE}\n\n {dim Inside of an existing Next.js project}\n\n {dim $} {bold npx create-payload-app}\n\n {dim Create a new project from scratch}\n\n {dim $} {bold npx create-payload-app}\n {dim $} {bold npx create-payload-app} my-project\n {dim $} {bold npx create-payload-app} -n my-project -t template-name\n\n {bold OPTIONS}\n\n -n {underline my-payload-app} Set project name\n -t {underline template_name} Choose specific template\n -e {underline example_name} Choose specific example\n\n {dim Available templates: ${formatTemplates(validTemplates)}}\n\n -a {underline agent_name} Set coding agent (claude, codex, cursor)\n\n {dim Installs the Payload skill for the selected agent}\n\n --no-agent Skip agent skill installation\n --use-npm Use npm to install dependencies\n --use-yarn Use yarn to install dependencies\n --use-pnpm Use pnpm to install dependencies\n --use-bun Use bun to install dependencies (experimental)\n --no-deps Do not install any dependencies\n -h Show help\n`)\n}\n\nfunction formatTemplates(templates: ProjectTemplate[]) {\n return `\\n\\n${spacer}${templates\n .map((t) => `${t.name}${' '.repeat(28 - t.name.length)}${t.description}`)\n .join(`\\n${spacer}`)}`\n}\n\nexport function successMessage(projectDir: string, packageManager: PackageManager): string {\n const relativePath = path.relative(process.cwd(), projectDir)\n return `\n${header('Launch Application:')}\n\n - cd ./${relativePath}\n - ${packageManager === 'npm' ? 'npm run' : packageManager} dev or follow directions in README.md\n\n${header('Documentation:')}\n\n - ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n - ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n\n`\n}\n\nexport function successfulNextInit(): string {\n return `- ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n`\n}\n\nexport function moveMessage(args: { nextAppDir: string; projectDir: string }): string {\n const relativeAppDir = path.relative(process.cwd(), args.nextAppDir)\n return `\n${header('Next Steps:')}\n\nPayload does not support a top-level layout.tsx file in the app directory.\n\n${chalk.bold('To continue:')}\n\n- Create a new directory in ./${relativeAppDir} such as ./${relativeAppDir}/${chalk.bold('(app)')}\n- Move all files from ./${relativeAppDir} into that directory\n\nIt is recommended to do this from your IDE if your app has existing file references.\n\nOnce moved, rerun the create-payload-app command again.\n`\n}\n\nexport function feedbackOutro(): string {\n return `${chalk.bgCyan(chalk.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`\n}\n\n// Create terminalLink with fallback for unsupported terminals\nfunction createTerminalLink(text: string, url: string) {\n return terminalLink(text, url, {\n fallback: (text, url) => `${text}: ${url}`,\n })\n}\n"],"names":["chalk","path","terminalLink","getValidTemplates","header","message","bold","welcomeMessage","spacer","repeat","helpMessage","validTemplates","console","log","formatTemplates","templates","map","t","name","length","description","join","successMessage","projectDir","packageManager","relativePath","relative","process","cwd","createTerminalLink","successfulNextInit","moveMessage","args","relativeAppDir","nextAppDir","feedbackOutro","bgCyan","black","text","url","fallback"],"mappings":"AAAA,6BAA6B,GAC7B,OAAOA,WAAW,QAAO;AACzB,OAAOC,UAAU,OAAM;AACvB,OAAOC,kBAAkB,gBAAe;AAIxC,SAASC,iBAAiB,QAAQ,sBAAqB;AAEvD,MAAMC,SAAS,CAACC,UAA4BL,MAAMM,IAAI,CAACD;AAEvD,OAAO,MAAME,iBAAiBP,KAAK,CAAC;;AAEpC,CAAC,CAAA;AAED,MAAMQ,SAAS,IAAIC,MAAM,CAAC;AAE1B,OAAO,SAASC;IACd,MAAMC,iBAAiBR;IACvBS,QAAQC,GAAG,CAACb,KAAK,CAAC;;;;;;;;;;;;;;;;;;;kCAmBc,EAAEc,gBAAgBH,gBAAgB;;;;;;;;;;;;;AAapE,CAAC;AACD;AAEA,SAASG,gBAAgBC,SAA4B;IACnD,OAAO,CAAC,IAAI,EAAEP,SAASO,UACpBC,GAAG,CAAC,CAACC,IAAM,GAAGA,EAAEC,IAAI,GAAG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K;IAC5C;AACF"}
1
+ {"version":3,"sources":["../../src/utils/messages.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport chalk from 'chalk'\nimport path from 'path'\nimport terminalLink from 'terminal-link'\n\nimport type { PackageManager, ProjectTemplate } from '../types.js'\n\nimport { getValidTemplates } from '../lib/templates.js'\n\nconst header = (message: string): string => chalk.bold(message)\n\nexport const welcomeMessage = chalk`\n {green Welcome to Payload. Let's create a project! }\n`\n\nconst spacer = ' '.repeat(8)\n\nexport function helpMessage(): void {\n const validTemplates = getValidTemplates()\n console.log(chalk`\n {bold USAGE}\n\n {dim Inside of an existing Next.js project}\n\n {dim $} {bold npx create-payload-app}\n\n {dim Create a new project from scratch}\n\n {dim $} {bold npx create-payload-app}\n {dim $} {bold npx create-payload-app} my-project\n {dim $} {bold npx create-payload-app} -n my-project -t template-name\n\n {bold OPTIONS}\n\n -n {underline my-payload-app} Set project name\n -t {underline template_name} Choose specific template\n -e {underline example_name} Choose specific example\n\n {dim Available templates: ${formatTemplates(validTemplates)}}\n\n -a {underline agent_name} Set coding agent (claude, codex, cursor)\n\n {dim Installs the Payload skill for the selected agent}\n\n --no-agent Skip agent skill installation\n --use-npm Use npm to install dependencies\n --use-yarn Use yarn to install dependencies\n --use-pnpm Use pnpm to install dependencies\n --use-bun Use bun to install dependencies (experimental)\n --no-deps Do not install any dependencies\n --payload-version {underline value} Install a specific Payload version or npm dist-tag (default: canary)\n -h Show help\n`)\n}\n\nfunction formatTemplates(templates: ProjectTemplate[]) {\n return `\\n\\n${spacer}${templates\n .map((t) => `${t.name}${' '.repeat(28 - t.name.length)}${t.description}`)\n .join(`\\n${spacer}`)}`\n}\n\nexport function successMessage(projectDir: string, packageManager: PackageManager): string {\n const relativePath = path.relative(process.cwd(), projectDir)\n return `\n${header('Launch Application:')}\n\n - cd ./${relativePath}\n - ${packageManager === 'npm' ? 'npm run' : packageManager} dev or follow directions in README.md\n\n${header('Documentation:')}\n\n - ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n - ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n\n`\n}\n\nexport function successfulNextInit(): string {\n return `- ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n`\n}\n\nexport function moveMessage(args: { nextAppDir: string; projectDir: string }): string {\n const relativeAppDir = path.relative(process.cwd(), args.nextAppDir)\n return `\n${header('Next Steps:')}\n\nPayload does not support a top-level layout.tsx file in the app directory.\n\n${chalk.bold('To continue:')}\n\n- Create a new directory in ./${relativeAppDir} such as ./${relativeAppDir}/${chalk.bold('(app)')}\n- Move all files from ./${relativeAppDir} into that directory\n\nIt is recommended to do this from your IDE if your app has existing file references.\n\nOnce moved, rerun the create-payload-app command again.\n`\n}\n\nexport function feedbackOutro(): string {\n return `${chalk.bgCyan(chalk.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`\n}\n\n// Create terminalLink with fallback for unsupported terminals\nfunction createTerminalLink(text: string, url: string) {\n return terminalLink(text, url, {\n fallback: (text, url) => `${text}: ${url}`,\n })\n}\n"],"names":["chalk","path","terminalLink","getValidTemplates","header","message","bold","welcomeMessage","spacer","repeat","helpMessage","validTemplates","console","log","formatTemplates","templates","map","t","name","length","description","join","successMessage","projectDir","packageManager","relativePath","relative","process","cwd","createTerminalLink","successfulNextInit","moveMessage","args","relativeAppDir","nextAppDir","feedbackOutro","bgCyan","black","text","url","fallback"],"mappings":"AAAA,6BAA6B,GAC7B,OAAOA,WAAW,QAAO;AACzB,OAAOC,UAAU,OAAM;AACvB,OAAOC,kBAAkB,gBAAe;AAIxC,SAASC,iBAAiB,QAAQ,sBAAqB;AAEvD,MAAMC,SAAS,CAACC,UAA4BL,MAAMM,IAAI,CAACD;AAEvD,OAAO,MAAME,iBAAiBP,KAAK,CAAC;;AAEpC,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C1E,EAAE2B,eAAe;;;;;AAKzC,CAAC;AACD;AAEA,OAAO,SAASE;IACd,OAAO,GAAGnC,MAAMoC,MAAM,CAACpC,MAAMqC,KAAK,CAAC,qBAAqB,aAAa,EAAER,mBAAmB,UAAU,yCAAyC,CAAC,CAAC;AACjJ;AAEA,8DAA8D;AAC9D,SAASA,mBAAmBS,IAAY,EAAEC,GAAW;IACnD,OAAOrC,aAAaoC,MAAMC,KAAK;QAC7BC,UAAU,CAACF,MAAMC,MAAQ,GAAGD,KAAK,EAAE,EAAEC,KAAK;IAC5C;AACF"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Default npm dist-tag used by the create-payload-app CLI when no
3
+ * `--payload-version` is provided. The CLI scaffolds against canary by default.
4
+ */
5
+ export declare const DEFAULT_PAYLOAD_VERSION_TAG = "canary";
6
+ /**
7
+ * Resolves a package version from either an npm dist-tag (e.g. `canary`) or an
8
+ * explicit version number (e.g. `3.40.0`).
9
+ *
10
+ * A value matching a published dist-tag resolves to that tag's concrete version.
11
+ * Any other value is treated as an explicit version and verified to exist on the
12
+ * registry. Throws if neither a matching tag nor a published version is found.
13
+ */
14
+ export declare function resolvePackageVersion({ debug, packageName, versionOrTag, }: {
15
+ debug?: boolean;
16
+ /**
17
+ * Package name to resolve against the npm registry.
18
+ *
19
+ * @default 'payload'
20
+ */
21
+ packageName?: string;
22
+ /**
23
+ * An npm dist-tag (e.g. `latest`, `canary`) or an explicit version (e.g. `3.40.0`).
24
+ *
25
+ * @default 'latest'
26
+ */
27
+ versionOrTag?: string;
28
+ }): Promise<string>;
29
+ //# sourceMappingURL=resolvePackageVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvePackageVersion.d.ts","sourceRoot":"","sources":["../../src/utils/resolvePackageVersion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,2BAA2B,WAAW,CAAA;AAEnD;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,KAAa,EACb,WAAuB,EACvB,YAAuB,GACxB,EAAE;IACD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBlB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Default npm dist-tag used by the create-payload-app CLI when no
3
+ * `--payload-version` is provided. The CLI scaffolds against canary by default.
4
+ */ export const DEFAULT_PAYLOAD_VERSION_TAG = 'canary';
5
+ /**
6
+ * Resolves a package version from either an npm dist-tag (e.g. `canary`) or an
7
+ * explicit version number (e.g. `3.40.0`).
8
+ *
9
+ * A value matching a published dist-tag resolves to that tag's concrete version.
10
+ * Any other value is treated as an explicit version and verified to exist on the
11
+ * registry. Throws if neither a matching tag nor a published version is found.
12
+ */ export async function resolvePackageVersion({ debug = false, packageName = 'payload', versionOrTag = 'latest' }) {
13
+ const distTags = await fetchDistTags(packageName);
14
+ const taggedVersion = distTags[versionOrTag];
15
+ if (taggedVersion) {
16
+ if (debug) {
17
+ console.log(`Resolved ${packageName}@${versionOrTag} to ${taggedVersion}`);
18
+ }
19
+ return taggedVersion;
20
+ }
21
+ await verifyVersionExists({
22
+ packageName,
23
+ version: versionOrTag
24
+ });
25
+ if (debug) {
26
+ console.log(`Using ${packageName}@${versionOrTag}`);
27
+ }
28
+ return versionOrTag;
29
+ }
30
+ async function fetchDistTags(packageName) {
31
+ const response = await fetch(`https://registry.npmjs.org/-/package/${packageName}/dist-tags`);
32
+ return await response.json();
33
+ }
34
+ async function verifyVersionExists({ packageName, version }) {
35
+ const response = await fetch(`https://registry.npmjs.org/${packageName}/${version}`);
36
+ if (response.status !== 200) {
37
+ throw new Error(`No version or tag "${version}" found for package: ${packageName}`);
38
+ }
39
+ }
40
+
41
+ //# sourceMappingURL=resolvePackageVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/resolvePackageVersion.ts"],"sourcesContent":["/**\n * Default npm dist-tag used by the create-payload-app CLI when no\n * `--payload-version` is provided. The CLI scaffolds against canary by default.\n */\nexport const DEFAULT_PAYLOAD_VERSION_TAG = 'canary'\n\n/**\n * Resolves a package version from either an npm dist-tag (e.g. `canary`) or an\n * explicit version number (e.g. `3.40.0`).\n *\n * A value matching a published dist-tag resolves to that tag's concrete version.\n * Any other value is treated as an explicit version and verified to exist on the\n * registry. Throws if neither a matching tag nor a published version is found.\n */\nexport async function resolvePackageVersion({\n debug = false,\n packageName = 'payload',\n versionOrTag = 'latest',\n}: {\n debug?: boolean\n /**\n * Package name to resolve against the npm registry.\n *\n * @default 'payload'\n */\n packageName?: string\n /**\n * An npm dist-tag (e.g. `latest`, `canary`) or an explicit version (e.g. `3.40.0`).\n *\n * @default 'latest'\n */\n versionOrTag?: string\n}): Promise<string> {\n const distTags = await fetchDistTags(packageName)\n\n const taggedVersion = distTags[versionOrTag]\n if (taggedVersion) {\n if (debug) {\n console.log(`Resolved ${packageName}@${versionOrTag} to ${taggedVersion}`)\n }\n return taggedVersion\n }\n\n await verifyVersionExists({ packageName, version: versionOrTag })\n\n if (debug) {\n console.log(`Using ${packageName}@${versionOrTag}`)\n }\n return versionOrTag\n}\n\nasync function fetchDistTags(packageName: string): Promise<Record<string, string>> {\n const response = await fetch(`https://registry.npmjs.org/-/package/${packageName}/dist-tags`)\n return (await response.json()) as Record<string, string>\n}\n\nasync function verifyVersionExists({\n packageName,\n version,\n}: {\n packageName: string\n version: string\n}): Promise<void> {\n const response = await fetch(`https://registry.npmjs.org/${packageName}/${version}`)\n if (response.status !== 200) {\n throw new Error(`No version or tag \"${version}\" found for package: ${packageName}`)\n }\n}\n"],"names":["DEFAULT_PAYLOAD_VERSION_TAG","resolvePackageVersion","debug","packageName","versionOrTag","distTags","fetchDistTags","taggedVersion","console","log","verifyVersionExists","version","response","fetch","json","status","Error"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,8BAA8B,SAAQ;AAEnD;;;;;;;CAOC,GACD,OAAO,eAAeC,sBAAsB,EAC1CC,QAAQ,KAAK,EACbC,cAAc,SAAS,EACvBC,eAAe,QAAQ,EAexB;IACC,MAAMC,WAAW,MAAMC,cAAcH;IAErC,MAAMI,gBAAgBF,QAAQ,CAACD,aAAa;IAC5C,IAAIG,eAAe;QACjB,IAAIL,OAAO;YACTM,QAAQC,GAAG,CAAC,CAAC,SAAS,EAAEN,YAAY,CAAC,EAAEC,aAAa,IAAI,EAAEG,eAAe;QAC3E;QACA,OAAOA;IACT;IAEA,MAAMG,oBAAoB;QAAEP;QAAaQ,SAASP;IAAa;IAE/D,IAAIF,OAAO;QACTM,QAAQC,GAAG,CAAC,CAAC,MAAM,EAAEN,YAAY,CAAC,EAAEC,cAAc;IACpD;IACA,OAAOA;AACT;AAEA,eAAeE,cAAcH,WAAmB;IAC9C,MAAMS,WAAW,MAAMC,MAAM,CAAC,qCAAqC,EAAEV,YAAY,UAAU,CAAC;IAC5F,OAAQ,MAAMS,SAASE,IAAI;AAC7B;AAEA,eAAeJ,oBAAoB,EACjCP,WAAW,EACXQ,OAAO,EAIR;IACC,MAAMC,WAAW,MAAMC,MAAM,CAAC,2BAA2B,EAAEV,YAAY,CAAC,EAAEQ,SAAS;IACnF,IAAIC,SAASG,MAAM,KAAK,KAAK;QAC3B,MAAM,IAAIC,MAAM,CAAC,mBAAmB,EAAEL,QAAQ,qBAAqB,EAAER,aAAa;IACpF;AACF"}
@@ -0,0 +1,77 @@
1
+ import { afterEach, describe, expect, it, vi } from 'vitest';
2
+ import { DEFAULT_PAYLOAD_VERSION_TAG, resolvePackageVersion } from './resolvePackageVersion.js';
3
+ const mockRegistry = ({ distTags, validVersions = [] })=>vi.stubGlobal('fetch', vi.fn((url)=>{
4
+ if (url.endsWith('/dist-tags')) {
5
+ return Promise.resolve({
6
+ json: ()=>Promise.resolve(distTags)
7
+ });
8
+ }
9
+ const version = url.split('/').pop() ?? '';
10
+ return Promise.resolve({
11
+ status: validVersions.includes(version) ? 200 : 404
12
+ });
13
+ }));
14
+ describe('resolvePackageVersion', ()=>{
15
+ afterEach(()=>{
16
+ vi.unstubAllGlobals();
17
+ vi.restoreAllMocks();
18
+ });
19
+ it('should resolve a dist-tag to its concrete version', async ()=>{
20
+ mockRegistry({
21
+ distTags: {
22
+ canary: '3.0.0-canary.abc',
23
+ latest: '2.9.0'
24
+ }
25
+ });
26
+ const version = await resolvePackageVersion({
27
+ packageName: 'payload',
28
+ versionOrTag: 'canary'
29
+ });
30
+ expect(version).toBe('3.0.0-canary.abc');
31
+ });
32
+ it('should default to the latest tag when no value is provided', async ()=>{
33
+ mockRegistry({
34
+ distTags: {
35
+ canary: '3.0.0-canary.abc',
36
+ latest: '2.9.0'
37
+ }
38
+ });
39
+ const version = await resolvePackageVersion({
40
+ packageName: 'payload'
41
+ });
42
+ expect(version).toBe('2.9.0');
43
+ });
44
+ it('should return an explicit version when it exists on the registry', async ()=>{
45
+ mockRegistry({
46
+ distTags: {
47
+ latest: '2.9.0'
48
+ },
49
+ validVersions: [
50
+ '3.1.0'
51
+ ]
52
+ });
53
+ const version = await resolvePackageVersion({
54
+ packageName: 'payload',
55
+ versionOrTag: '3.1.0'
56
+ });
57
+ expect(version).toBe('3.1.0');
58
+ });
59
+ it('should throw a clear error when neither a tag nor a version is found', async ()=>{
60
+ mockRegistry({
61
+ distTags: {
62
+ latest: '2.9.0'
63
+ }
64
+ });
65
+ await expect(resolvePackageVersion({
66
+ packageName: 'payload',
67
+ versionOrTag: 'nope'
68
+ })).rejects.toThrow('No version or tag "nope" found for package: payload');
69
+ });
70
+ });
71
+ describe('DEFAULT_PAYLOAD_VERSION_TAG', ()=>{
72
+ it('should export DEFAULT_PAYLOAD_VERSION_TAG as "canary"', ()=>{
73
+ expect(DEFAULT_PAYLOAD_VERSION_TAG).toBe('canary');
74
+ });
75
+ });
76
+
77
+ //# sourceMappingURL=resolvePackageVersion.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/resolvePackageVersion.spec.ts"],"sourcesContent":["import { afterEach, describe, expect, it, vi } from 'vitest'\n\nimport { DEFAULT_PAYLOAD_VERSION_TAG, resolvePackageVersion } from './resolvePackageVersion.js'\n\nconst mockRegistry = ({\n distTags,\n validVersions = [],\n}: {\n distTags: Record<string, string>\n validVersions?: string[]\n}) =>\n vi.stubGlobal(\n 'fetch',\n vi.fn((url: string) => {\n if (url.endsWith('/dist-tags')) {\n return Promise.resolve({ json: () => Promise.resolve(distTags) })\n }\n\n const version = url.split('/').pop() ?? ''\n return Promise.resolve({ status: validVersions.includes(version) ? 200 : 404 })\n }),\n )\n\ndescribe('resolvePackageVersion', () => {\n afterEach(() => {\n vi.unstubAllGlobals()\n vi.restoreAllMocks()\n })\n\n it('should resolve a dist-tag to its concrete version', async () => {\n mockRegistry({ distTags: { canary: '3.0.0-canary.abc', latest: '2.9.0' } })\n\n const version = await resolvePackageVersion({ packageName: 'payload', versionOrTag: 'canary' })\n\n expect(version).toBe('3.0.0-canary.abc')\n })\n\n it('should default to the latest tag when no value is provided', async () => {\n mockRegistry({ distTags: { canary: '3.0.0-canary.abc', latest: '2.9.0' } })\n\n const version = await resolvePackageVersion({ packageName: 'payload' })\n\n expect(version).toBe('2.9.0')\n })\n\n it('should return an explicit version when it exists on the registry', async () => {\n mockRegistry({ distTags: { latest: '2.9.0' }, validVersions: ['3.1.0'] })\n\n const version = await resolvePackageVersion({ packageName: 'payload', versionOrTag: '3.1.0' })\n\n expect(version).toBe('3.1.0')\n })\n\n it('should throw a clear error when neither a tag nor a version is found', async () => {\n mockRegistry({ distTags: { latest: '2.9.0' } })\n\n await expect(\n resolvePackageVersion({ packageName: 'payload', versionOrTag: 'nope' }),\n ).rejects.toThrow('No version or tag \"nope\" found for package: payload')\n })\n})\n\ndescribe('DEFAULT_PAYLOAD_VERSION_TAG', () => {\n it('should export DEFAULT_PAYLOAD_VERSION_TAG as \"canary\"', () => {\n expect(DEFAULT_PAYLOAD_VERSION_TAG).toBe('canary')\n })\n})\n"],"names":["afterEach","describe","expect","it","vi","DEFAULT_PAYLOAD_VERSION_TAG","resolvePackageVersion","mockRegistry","distTags","validVersions","stubGlobal","fn","url","endsWith","Promise","resolve","json","version","split","pop","status","includes","unstubAllGlobals","restoreAllMocks","canary","latest","packageName","versionOrTag","toBe","rejects","toThrow"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,SAAQ;AAE5D,SAASC,2BAA2B,EAAEC,qBAAqB,QAAQ,6BAA4B;AAE/F,MAAMC,eAAe,CAAC,EACpBC,QAAQ,EACRC,gBAAgB,EAAE,EAInB,GACCL,GAAGM,UAAU,CACX,SACAN,GAAGO,EAAE,CAAC,CAACC;QACL,IAAIA,IAAIC,QAAQ,CAAC,eAAe;YAC9B,OAAOC,QAAQC,OAAO,CAAC;gBAAEC,MAAM,IAAMF,QAAQC,OAAO,CAACP;YAAU;QACjE;QAEA,MAAMS,UAAUL,IAAIM,KAAK,CAAC,KAAKC,GAAG,MAAM;QACxC,OAAOL,QAAQC,OAAO,CAAC;YAAEK,QAAQX,cAAcY,QAAQ,CAACJ,WAAW,MAAM;QAAI;IAC/E;AAGJhB,SAAS,yBAAyB;IAChCD,UAAU;QACRI,GAAGkB,gBAAgB;QACnBlB,GAAGmB,eAAe;IACpB;IAEApB,GAAG,qDAAqD;QACtDI,aAAa;YAAEC,UAAU;gBAAEgB,QAAQ;gBAAoBC,QAAQ;YAAQ;QAAE;QAEzE,MAAMR,UAAU,MAAMX,sBAAsB;YAAEoB,aAAa;YAAWC,cAAc;QAAS;QAE7FzB,OAAOe,SAASW,IAAI,CAAC;IACvB;IAEAzB,GAAG,8DAA8D;QAC/DI,aAAa;YAAEC,UAAU;gBAAEgB,QAAQ;gBAAoBC,QAAQ;YAAQ;QAAE;QAEzE,MAAMR,UAAU,MAAMX,sBAAsB;YAAEoB,aAAa;QAAU;QAErExB,OAAOe,SAASW,IAAI,CAAC;IACvB;IAEAzB,GAAG,oEAAoE;QACrEI,aAAa;YAAEC,UAAU;gBAAEiB,QAAQ;YAAQ;YAAGhB,eAAe;gBAAC;aAAQ;QAAC;QAEvE,MAAMQ,UAAU,MAAMX,sBAAsB;YAAEoB,aAAa;YAAWC,cAAc;QAAQ;QAE5FzB,OAAOe,SAASW,IAAI,CAAC;IACvB;IAEAzB,GAAG,wEAAwE;QACzEI,aAAa;YAAEC,UAAU;gBAAEiB,QAAQ;YAAQ;QAAE;QAE7C,MAAMvB,OACJI,sBAAsB;YAAEoB,aAAa;YAAWC,cAAc;QAAO,IACrEE,OAAO,CAACC,OAAO,CAAC;IACpB;AACF;AAEA7B,SAAS,+BAA+B;IACtCE,GAAG,yDAAyD;QAC1DD,OAAOG,6BAA6BuB,IAAI,CAAC;IAC3C;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-payload-app",
3
- "version": "4.0.0-internal.5f0cd13",
3
+ "version": "4.0.0-internal.688c4d0",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -80,7 +80,7 @@
80
80
  "lint": "eslint .",
81
81
  "lint:fix": "eslint . --fix",
82
82
  "pack-template-files": "node --no-deprecation --import @swc-node/register/esm-register src/scripts/pack-template-files.ts",
83
- "test": "jest",
83
+ "test": "vitest --run",
84
84
  "typecheck": "tsc"
85
85
  }
86
86
  }
@@ -1,17 +0,0 @@
1
- /**
2
- * Fetches the latest version of a package from the NPM registry.
3
- *
4
- * Used in determining the latest version of Payload to use in the generated templates.
5
- */
6
- export declare function getLatestPackageVersion({ debug, packageName, }: {
7
- debug?: boolean;
8
- /**
9
- * Package name to fetch the latest version for based on the NPM registry URL
10
- *
11
- * Eg. for `'payload'`, it will fetch the version from `https://registry.npmjs.org/payload`
12
- *
13
- * @default 'payload'
14
- */
15
- packageName?: string;
16
- }): Promise<string>;
17
- //# sourceMappingURL=getLatestPackageVersion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getLatestPackageVersion.d.ts","sourceRoot":"","sources":["../../src/utils/getLatestPackageVersion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,KAAa,EACb,WAAuB,GACxB,EAAE;IACD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,mBAeA"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Fetches the latest version of a package from the NPM registry.
3
- *
4
- * Used in determining the latest version of Payload to use in the generated templates.
5
- */ export async function getLatestPackageVersion({ debug = false, packageName = 'payload' }) {
6
- try {
7
- const response = await fetch(`https://registry.npmjs.org/${packageName}`);
8
- const data = await response.json();
9
- const latestVersion = data['dist-tags'].latest;
10
- if (debug) {
11
- console.log(`Found latest version of ${packageName}: ${latestVersion}`);
12
- }
13
- return latestVersion;
14
- } catch (error) {
15
- console.error('Error fetching Payload version:', error);
16
- throw error;
17
- }
18
- }
19
-
20
- //# sourceMappingURL=getLatestPackageVersion.js.map