create-payload-app 4.0.0-internal.d28e9fb → 4.0.0-internal.fa345ef

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 (53) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/lib/ast/payload-config.js +1 -1
  3. package/dist/lib/ast/payload-config.js.map +1 -1
  4. package/dist/lib/ast/types.d.ts +1 -1
  5. package/dist/lib/ast/types.d.ts.map +1 -1
  6. package/dist/lib/ast/types.js.map +1 -1
  7. package/dist/lib/configure-plugin-project.d.ts.map +1 -1
  8. package/dist/lib/configure-pnpm-builds.d.ts +20 -0
  9. package/dist/lib/configure-pnpm-builds.d.ts.map +1 -0
  10. package/dist/lib/configure-pnpm-builds.js +100 -0
  11. package/dist/lib/configure-pnpm-builds.js.map +1 -0
  12. package/dist/lib/create-project.d.ts.map +1 -1
  13. package/dist/lib/create-project.js +13 -50
  14. package/dist/lib/create-project.js.map +1 -1
  15. package/dist/lib/init-next.d.ts +1 -1
  16. package/dist/lib/init-next.d.ts.map +1 -1
  17. package/dist/lib/init-next.js +20 -4
  18. package/dist/lib/init-next.js.map +1 -1
  19. package/dist/lib/update-payload-in-project.d.ts +1 -1
  20. package/dist/lib/update-payload-in-project.d.ts.map +1 -1
  21. package/dist/lib/update-payload-in-project.js +6 -5
  22. package/dist/lib/update-payload-in-project.js.map +1 -1
  23. package/dist/lib/wrap-next-config.d.ts.map +1 -1
  24. package/dist/main.d.ts.map +1 -1
  25. package/dist/main.js +6 -5
  26. package/dist/main.js.map +1 -1
  27. package/dist/template/src/app/(frontend)/page.tsx +5 -2
  28. package/dist/template/src/app/(payload)/admin/importMap.js +15 -2
  29. package/dist/template/src/collections/Folders.ts +16 -0
  30. package/dist/template/src/collections/Media.ts +4 -0
  31. package/dist/template/src/collections/Tags.ts +16 -0
  32. package/dist/template/src/collections/Users.ts +1 -0
  33. package/dist/template/src/payload-types.ts +63 -9
  34. package/dist/template/src/payload.config.ts +10 -2
  35. package/dist/types.d.ts +1 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js.map +1 -1
  38. package/dist/utils/casing.d.ts.map +1 -1
  39. package/dist/utils/log.d.ts.map +1 -1
  40. package/dist/utils/messages.d.ts.map +1 -1
  41. package/dist/utils/messages.js +1 -0
  42. package/dist/utils/messages.js.map +1 -1
  43. package/dist/utils/resolvePackageVersion.d.ts +29 -0
  44. package/dist/utils/resolvePackageVersion.d.ts.map +1 -0
  45. package/dist/utils/resolvePackageVersion.js +41 -0
  46. package/dist/utils/resolvePackageVersion.js.map +1 -0
  47. package/dist/utils/resolvePackageVersion.spec.js +77 -0
  48. package/dist/utils/resolvePackageVersion.spec.js.map +1 -0
  49. package/package.json +2 -2
  50. package/dist/utils/getLatestPackageVersion.d.ts +0 -17
  51. package/dist/utils/getLatestPackageVersion.d.ts.map +0 -1
  52. package/dist/utils/getLatestPackageVersion.js +0 -20
  53. package/dist/utils/getLatestPackageVersion.js.map +0 -1
@@ -69,6 +69,8 @@ export interface Config {
69
69
  collections: {
70
70
  users: User;
71
71
  media: Media;
72
+ folders: Folder;
73
+ tags: Tag;
72
74
  'payload-kv': PayloadKv;
73
75
  'payload-locked-documents': PayloadLockedDocument;
74
76
  'payload-preferences': PayloadPreference;
@@ -78,6 +80,8 @@ export interface Config {
78
80
  collectionsSelect: {
79
81
  users: UsersSelect<false> | UsersSelect<true>;
80
82
  media: MediaSelect<false> | MediaSelect<true>;
83
+ folders: FoldersSelect<false> | FoldersSelect<true>;
84
+ tags: TagsSelect<false> | TagsSelect<true>;
81
85
  'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
82
86
  'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
83
87
  'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
@@ -86,10 +90,10 @@ export interface Config {
86
90
  db: {
87
91
  defaultIDType: string;
88
92
  };
89
- fallbackLocale: null;
93
+ fallbackLocale: ('false' | 'none' | 'null') | false | null | 'en' | 'en'[];
90
94
  globals: {};
91
95
  globalsSelect: {};
92
- locale: null;
96
+ locale: 'en';
93
97
  widgets: {
94
98
  collections: CollectionsWidget;
95
99
  };
@@ -117,10 +121,6 @@ export interface UserAuthOperations {
117
121
  password: string;
118
122
  };
119
123
  }
120
- /**
121
- * This interface was referenced by `Config`'s JSON-Schema
122
- * via the `definition` "users".
123
- */
124
124
  export interface User {
125
125
  id: string;
126
126
  updatedAt: string;
@@ -149,6 +149,8 @@ export interface User {
149
149
  export interface Media {
150
150
  id: string;
151
151
  alt: string;
152
+ _h_folders?: (string | null) | Folder;
153
+ _h_tags?: (string | Tag)[] | null;
152
154
  updatedAt: string;
153
155
  createdAt: string;
154
156
  url?: string | null;
@@ -163,8 +165,30 @@ export interface Media {
163
165
  }
164
166
  /**
165
167
  * This interface was referenced by `Config`'s JSON-Schema
166
- * via the `definition` "payload-kv".
168
+ * via the `definition` "folders".
167
169
  */
170
+ export interface Folder {
171
+ id: string;
172
+ _h_folders?: (string | null) | Folder;
173
+ name: string;
174
+ updatedAt: string;
175
+ createdAt: string;
176
+ _h_slugPath?: string | null;
177
+ _h_titlePath?: string | null;
178
+ }
179
+ /**
180
+ * This interface was referenced by `Config`'s JSON-Schema
181
+ * via the `definition` "tags".
182
+ */
183
+ export interface Tag {
184
+ id: string;
185
+ _h_tags?: (string | null) | Tag;
186
+ name: string;
187
+ updatedAt: string;
188
+ createdAt: string;
189
+ _h_slugPath?: string | null;
190
+ _h_titlePath?: string | null;
191
+ }
168
192
  export interface PayloadKv {
169
193
  id: string;
170
194
  key: string;
@@ -192,6 +216,14 @@ export interface PayloadLockedDocument {
192
216
  | ({
193
217
  relationTo: 'media';
194
218
  value: string | Media;
219
+ } | null)
220
+ | ({
221
+ relationTo: 'folders';
222
+ value: string | Folder;
223
+ } | null)
224
+ | ({
225
+ relationTo: 'tags';
226
+ value: string | Tag;
195
227
  } | null);
196
228
  globalSlug?: string | null;
197
229
  user: {
@@ -263,6 +295,8 @@ export interface UsersSelect<T extends boolean = true> {
263
295
  */
264
296
  export interface MediaSelect<T extends boolean = true> {
265
297
  alt?: T;
298
+ _h_folders?: T;
299
+ _h_tags?: T;
266
300
  updatedAt?: T;
267
301
  createdAt?: T;
268
302
  url?: T;
@@ -277,8 +311,28 @@ export interface MediaSelect<T extends boolean = true> {
277
311
  }
278
312
  /**
279
313
  * This interface was referenced by `Config`'s JSON-Schema
280
- * via the `definition` "payload-kv_select".
314
+ * via the `definition` "folders_select".
281
315
  */
316
+ export interface FoldersSelect<T extends boolean = true> {
317
+ _h_folders?: T;
318
+ name?: T;
319
+ updatedAt?: T;
320
+ createdAt?: T;
321
+ _h_slugPath?: T;
322
+ _h_titlePath?: T;
323
+ }
324
+ /**
325
+ * This interface was referenced by `Config`'s JSON-Schema
326
+ * via the `definition` "tags_select".
327
+ */
328
+ export interface TagsSelect<T extends boolean = true> {
329
+ _h_tags?: T;
330
+ name?: T;
331
+ updatedAt?: T;
332
+ createdAt?: T;
333
+ _h_slugPath?: T;
334
+ _h_titlePath?: T;
335
+ }
282
336
  export interface PayloadKvSelect<T extends boolean = true> {
283
337
  key?: T;
284
338
  data?: T;
@@ -336,4 +390,4 @@ export interface Auth {
336
390
 
337
391
  declare module 'payload' {
338
392
  export interface GeneratedTypes extends Config {}
339
- }
393
+ }
@@ -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,C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AAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;AAE5D,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3D,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;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":"casing.d.ts","sourceRoot":"","sources":["../../src/utils/casing.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAS,MAAM,WAMtC,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD"}
1
+ {"version":3,"file":"casing.d.ts","sourceRoot":"","sources":["../../src/utils/casing.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,WAMtC,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,YAAa,MAAM,KAAG,IAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,KAAG,IAEtC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAIvC,CAAA;AAED,eAAO,MAAM,GAAG,YAAa,MAAM,KAAG,IAErC,CAAA"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,KAAG,IAEzC,CAAA;AAED,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,KAAG,IAEtC,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,SAAS,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,SAAS,MAAM,KAAG,IAIvC,CAAA;AAED,eAAO,MAAM,GAAG,GAAI,SAAS,MAAM,KAAG,IAErC,CAAA"}
@@ -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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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"}
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","nextApp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,SAASE,YAAYC,IAAgD;IAC1E,MAAMC,iBAAiBhC,KAAKyB,QAAQ,CAACC,QAAQC,GAAG,IAAII,KAAKE,UAAU;IACnE,OAAO,CAAC;AACV,EAAE9B,OAAO,eAAe;;;;AAIxB,EAAEJ,MAAMM,IAAI,CAAC,gBAAgB;;8BAEC,EAAE2B,eAAe,WAAW,EAAEA,eAAe,CAAC,EAAEjC,MAAMM,IAAI,CAAC,SAAS;wBAC1E,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.d28e9fb",
3
+ "version": "4.0.0-internal.fa345ef",
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
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/getLatestPackageVersion.ts"],"sourcesContent":["/**\n * Fetches the latest version of a package from the NPM registry.\n *\n * Used in determining the latest version of Payload to use in the generated templates.\n */\nexport async function getLatestPackageVersion({\n debug = false,\n packageName = 'payload',\n}: {\n debug?: boolean\n /**\n * Package name to fetch the latest version for based on the NPM registry URL\n *\n * Eg. for `'payload'`, it will fetch the version from `https://registry.npmjs.org/payload`\n *\n * @default 'payload'\n */\n packageName?: string\n}) {\n try {\n const response = await fetch(`https://registry.npmjs.org/${packageName}`)\n const data = (await response.json()) as { 'dist-tags': { latest: string } }\n const latestVersion = data['dist-tags'].latest\n\n if (debug) {\n console.log(`Found latest version of ${packageName}: ${latestVersion}`)\n }\n\n return latestVersion\n } catch (error) {\n console.error('Error fetching Payload version:', error)\n throw error\n }\n}\n"],"names":["getLatestPackageVersion","debug","packageName","response","fetch","data","json","latestVersion","latest","console","log","error"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,eAAeA,wBAAwB,EAC5CC,QAAQ,KAAK,EACbC,cAAc,SAAS,EAWxB;IACC,IAAI;QACF,MAAMC,WAAW,MAAMC,MAAM,CAAC,2BAA2B,EAAEF,aAAa;QACxE,MAAMG,OAAQ,MAAMF,SAASG,IAAI;QACjC,MAAMC,gBAAgBF,IAAI,CAAC,YAAY,CAACG,MAAM;QAE9C,IAAIP,OAAO;YACTQ,QAAQC,GAAG,CAAC,CAAC,wBAAwB,EAAER,YAAY,EAAE,EAAEK,eAAe;QACxE;QAEA,OAAOA;IACT,EAAE,OAAOI,OAAO;QACdF,QAAQE,KAAK,CAAC,mCAAmCA;QACjD,MAAMA;IACR;AACF"}