create-payload-app 3.0.0-canary.f6e77b8 → 3.0.0-canary.fb04843

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/dist/index.js.map +1 -1
  2. package/dist/lib/configure-payload-config.d.ts +8 -2
  3. package/dist/lib/configure-payload-config.d.ts.map +1 -1
  4. package/dist/lib/configure-payload-config.js +74 -25
  5. package/dist/lib/configure-payload-config.js.map +1 -1
  6. package/dist/lib/constants.d.ts +2 -0
  7. package/dist/lib/constants.d.ts.map +1 -0
  8. package/dist/lib/constants.js +9 -0
  9. package/dist/lib/constants.js.map +1 -0
  10. package/dist/lib/create-project.d.ts.map +1 -1
  11. package/dist/lib/create-project.js +19 -9
  12. package/dist/lib/create-project.js.map +1 -1
  13. package/dist/lib/create-project.spec.js +27 -31
  14. package/dist/lib/create-project.spec.js.map +1 -1
  15. package/dist/lib/download-template.d.ts +7 -0
  16. package/dist/lib/download-template.d.ts.map +1 -0
  17. package/dist/lib/download-template.js +28 -0
  18. package/dist/lib/download-template.js.map +1 -0
  19. package/dist/lib/generate-secret.js.map +1 -1
  20. package/dist/lib/get-package-manager.d.ts +6 -0
  21. package/dist/lib/get-package-manager.d.ts.map +1 -0
  22. package/dist/lib/get-package-manager.js +50 -0
  23. package/dist/lib/get-package-manager.js.map +1 -0
  24. package/dist/lib/init-next.d.ts +8 -16
  25. package/dist/lib/init-next.d.ts.map +1 -1
  26. package/dist/lib/init-next.js +81 -58
  27. package/dist/lib/init-next.js.map +1 -1
  28. package/dist/lib/install-packages.d.ts +9 -0
  29. package/dist/lib/install-packages.d.ts.map +1 -0
  30. package/dist/lib/install-packages.js +43 -0
  31. package/dist/lib/install-packages.js.map +1 -0
  32. package/dist/lib/parse-project-name.d.ts.map +1 -1
  33. package/dist/lib/parse-project-name.js +9 -3
  34. package/dist/lib/parse-project-name.js.map +1 -1
  35. package/dist/lib/parse-template.d.ts.map +1 -1
  36. package/dist/lib/parse-template.js +3 -1
  37. package/dist/lib/parse-template.js.map +1 -1
  38. package/dist/lib/replacements.d.ts +27 -0
  39. package/dist/lib/replacements.d.ts.map +1 -0
  40. package/dist/lib/replacements.js +92 -0
  41. package/dist/lib/replacements.js.map +1 -0
  42. package/dist/lib/select-db.d.ts.map +1 -1
  43. package/dist/lib/select-db.js +23 -14
  44. package/dist/lib/select-db.js.map +1 -1
  45. package/dist/lib/templates.d.ts.map +1 -1
  46. package/dist/lib/templates.js +8 -25
  47. package/dist/lib/templates.js.map +1 -1
  48. package/dist/lib/update-payload-in-project.d.ts +6 -0
  49. package/dist/lib/update-payload-in-project.d.ts.map +1 -0
  50. package/dist/lib/update-payload-in-project.js +73 -0
  51. package/dist/lib/update-payload-in-project.js.map +1 -0
  52. package/dist/lib/wrap-next-config.d.ts +5 -5
  53. package/dist/lib/wrap-next-config.d.ts.map +1 -1
  54. package/dist/lib/wrap-next-config.js +120 -61
  55. package/dist/lib/wrap-next-config.js.map +1 -1
  56. package/dist/lib/wrap-next-config.spec.js +85 -34
  57. package/dist/lib/wrap-next-config.spec.js.map +1 -1
  58. package/dist/lib/write-env-file.d.ts +2 -1
  59. package/dist/lib/write-env-file.d.ts.map +1 -1
  60. package/dist/lib/write-env-file.js +31 -26
  61. package/dist/lib/write-env-file.js.map +1 -1
  62. package/dist/main.d.ts.map +1 -1
  63. package/dist/main.js +54 -34
  64. package/dist/main.js.map +1 -1
  65. package/dist/scripts/pack-template-files.js +3 -3
  66. package/dist/scripts/pack-template-files.js.map +1 -1
  67. package/dist/template/src/app/(payload)/admin/[[...segments]]/not-found.tsx +8 -6
  68. package/dist/template/src/app/(payload)/admin/[[...segments]]/page.tsx +8 -6
  69. package/dist/template/src/app/(payload)/admin/importMap.js +1 -0
  70. package/dist/template/src/app/(payload)/api/[...slug]/route.ts +11 -2
  71. package/dist/template/src/app/(payload)/api/graphql/route.ts +4 -2
  72. package/dist/template/src/app/(payload)/api/graphql-playground/route.ts +2 -1
  73. package/dist/template/src/app/(payload)/layout.tsx +19 -4
  74. package/dist/template/src/collections/Media.ts +16 -0
  75. package/dist/template/src/collections/Users.ts +1 -1
  76. package/dist/template/src/payload-types.ts +127 -0
  77. package/dist/template/src/payload.config.ts +13 -15
  78. package/dist/types.d.ts +15 -1
  79. package/dist/types.d.ts.map +1 -1
  80. package/dist/types.js.map +1 -1
  81. package/dist/utils/copy-recursive-sync.d.ts +3 -1
  82. package/dist/utils/copy-recursive-sync.d.ts.map +1 -1
  83. package/dist/utils/copy-recursive-sync.js +6 -1
  84. package/dist/utils/copy-recursive-sync.js.map +1 -1
  85. package/dist/utils/git.d.ts +4 -0
  86. package/dist/utils/git.d.ts.map +1 -0
  87. package/dist/utils/git.js +46 -0
  88. package/dist/utils/git.js.map +1 -0
  89. package/dist/utils/log.d.ts.map +1 -1
  90. package/dist/utils/log.js +1 -1
  91. package/dist/utils/log.js.map +1 -1
  92. package/dist/utils/messages.d.ts.map +1 -1
  93. package/dist/utils/messages.js +1 -0
  94. package/dist/utils/messages.js.map +1 -1
  95. package/license.md +22 -0
  96. package/package.json +34 -10
  97. package/dist/lib/packages.d.ts +0 -9
  98. package/dist/lib/packages.d.ts.map +0 -1
  99. package/dist/lib/packages.js +0 -27
  100. package/dist/lib/packages.js.map +0 -1
@@ -0,0 +1,127 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * This file was automatically generated by Payload.
5
+ * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
6
+ * and re-run `payload generate:types` to regenerate this file.
7
+ */
8
+
9
+ export interface Config {
10
+ auth: {
11
+ users: UserAuthOperations;
12
+ };
13
+ collections: {
14
+ users: User;
15
+ media: Media;
16
+ 'payload-preferences': PayloadPreference;
17
+ 'payload-migrations': PayloadMigration;
18
+ };
19
+ db: {
20
+ defaultIDType: string;
21
+ };
22
+ globals: {};
23
+ locale: null;
24
+ user: User & {
25
+ collection: 'users';
26
+ };
27
+ }
28
+ export interface UserAuthOperations {
29
+ forgotPassword: {
30
+ email: string;
31
+ password: string;
32
+ };
33
+ login: {
34
+ email: string;
35
+ password: string;
36
+ };
37
+ registerFirstUser: {
38
+ email: string;
39
+ password: string;
40
+ };
41
+ unlock: {
42
+ email: string;
43
+ password: string;
44
+ };
45
+ }
46
+ /**
47
+ * This interface was referenced by `Config`'s JSON-Schema
48
+ * via the `definition` "users".
49
+ */
50
+ export interface User {
51
+ id: string;
52
+ updatedAt: string;
53
+ createdAt: string;
54
+ email: string;
55
+ resetPasswordToken?: string | null;
56
+ resetPasswordExpiration?: string | null;
57
+ salt?: string | null;
58
+ hash?: string | null;
59
+ loginAttempts?: number | null;
60
+ lockUntil?: string | null;
61
+ password?: string | null;
62
+ }
63
+ /**
64
+ * This interface was referenced by `Config`'s JSON-Schema
65
+ * via the `definition` "media".
66
+ */
67
+ export interface Media {
68
+ id: string;
69
+ alt: string;
70
+ updatedAt: string;
71
+ createdAt: string;
72
+ url?: string | null;
73
+ thumbnailURL?: string | null;
74
+ filename?: string | null;
75
+ mimeType?: string | null;
76
+ filesize?: number | null;
77
+ width?: number | null;
78
+ height?: number | null;
79
+ focalX?: number | null;
80
+ focalY?: number | null;
81
+ }
82
+ /**
83
+ * This interface was referenced by `Config`'s JSON-Schema
84
+ * via the `definition` "payload-preferences".
85
+ */
86
+ export interface PayloadPreference {
87
+ id: string;
88
+ user: {
89
+ relationTo: 'users';
90
+ value: string | User;
91
+ };
92
+ key?: string | null;
93
+ value?:
94
+ | {
95
+ [k: string]: unknown;
96
+ }
97
+ | unknown[]
98
+ | string
99
+ | number
100
+ | boolean
101
+ | null;
102
+ updatedAt: string;
103
+ createdAt: string;
104
+ }
105
+ /**
106
+ * This interface was referenced by `Config`'s JSON-Schema
107
+ * via the `definition` "payload-migrations".
108
+ */
109
+ export interface PayloadMigration {
110
+ id: string;
111
+ name?: string | null;
112
+ batch?: number | null;
113
+ updatedAt: string;
114
+ createdAt: string;
115
+ }
116
+ /**
117
+ * This interface was referenced by `Config`'s JSON-Schema
118
+ * via the `definition` "auth".
119
+ */
120
+ export interface Auth {
121
+ [k: string]: unknown;
122
+ }
123
+
124
+
125
+ declare module 'payload' {
126
+ export interface GeneratedTypes extends Config {}
127
+ }
@@ -1,12 +1,13 @@
1
+ // storage-adapter-import-placeholder
1
2
  import { mongooseAdapter } from '@payloadcms/db-mongodb' // database-adapter-import
2
- // import { payloadCloud } from '@payloadcms/plugin-cloud'
3
3
  import { lexicalEditor } from '@payloadcms/richtext-lexical'
4
4
  import path from 'path'
5
- import { buildConfig } from 'payload/config'
6
- // import sharp from 'sharp'
5
+ import { buildConfig } from 'payload'
7
6
  import { fileURLToPath } from 'url'
7
+ import sharp from 'sharp'
8
8
 
9
9
  import { Users } from './collections/Users'
10
+ import { Media } from './collections/Media'
10
11
 
11
12
  const filename = fileURLToPath(import.meta.url)
12
13
  const dirname = path.dirname(filename)
@@ -14,10 +15,12 @@ const dirname = path.dirname(filename)
14
15
  export default buildConfig({
15
16
  admin: {
16
17
  user: Users.slug,
18
+ importMap: {
19
+ baseDir: path.resolve(dirname),
20
+ },
17
21
  },
18
- collections: [Users],
19
- editor: lexicalEditor({}),
20
- // plugins: [payloadCloud()], // TODO: Re-enable when cloud supports 3.0
22
+ collections: [Users, Media],
23
+ editor: lexicalEditor(),
21
24
  secret: process.env.PAYLOAD_SECRET || '',
22
25
  typescript: {
23
26
  outputFile: path.resolve(dirname, 'payload-types.ts'),
@@ -27,13 +30,8 @@ export default buildConfig({
27
30
  url: process.env.DATABASE_URI || '',
28
31
  }),
29
32
  // database-adapter-config-end
30
-
31
- // Sharp is now an optional dependency -
32
- // if you want to resize images, crop, set focal point, etc.
33
- // make sure to install it and pass it to the config.
34
-
35
- // This is temporary - we may make an adapter pattern
36
- // for this before reaching 3.0 stable
37
-
38
- // sharp,
33
+ sharp,
34
+ plugins: [
35
+ // storage-adapter-placeholder
36
+ ],
39
37
  })
package/dist/types.d.ts CHANGED
@@ -11,9 +11,11 @@ export interface Args extends arg.Spec {
11
11
  '--local-template': StringConstructor;
12
12
  '--name': StringConstructor;
13
13
  '--no-deps': BooleanConstructor;
14
+ '--no-git': BooleanConstructor;
14
15
  '--secret': StringConstructor;
15
16
  '--template': StringConstructor;
16
17
  '--template-branch': StringConstructor;
18
+ '--use-bun': BooleanConstructor;
17
19
  '--use-npm': BooleanConstructor;
18
20
  '--use-pnpm': BooleanConstructor;
19
21
  '--use-yarn': BooleanConstructor;
@@ -45,11 +47,23 @@ interface Template {
45
47
  type: ProjectTemplate['type'];
46
48
  }
47
49
  export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
48
- export type DbType = 'mongodb' | 'postgres';
50
+ export type DbType = 'mongodb' | 'postgres' | 'sqlite' | 'vercel-postgres';
49
51
  export type DbDetails = {
50
52
  dbUri: string;
51
53
  type: DbType;
52
54
  };
53
55
  export type EditorType = 'lexical' | 'slate';
56
+ export type NextAppDetails = {
57
+ hasTopLevelLayout: boolean;
58
+ isPayloadInstalled?: boolean;
59
+ isSrcDir: boolean;
60
+ isSupportedNextVersion: boolean;
61
+ nextAppDir?: string;
62
+ nextConfigPath?: string;
63
+ nextConfigType?: NextConfigType;
64
+ nextVersion: null | string;
65
+ };
66
+ export type NextConfigType = 'cjs' | 'esm' | 'ts';
67
+ export type StorageAdapterType = 'localDisk' | 'payloadCloud' | 'vercelBlobStorage';
54
68
  export {};
55
69
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAE1B,MAAM,WAAW,IAAK,SAAQ,GAAG,CAAC,IAAI;IACpC,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,MAAM,EAAE,iBAAiB,CAAA;IACzB,yBAAyB,EAAE,kBAAkB,CAAA;IAC7C,wBAAwB,EAAE,iBAAiB,CAAA;IAC3C,SAAS,EAAE,kBAAkB,CAAA;IAC7B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,QAAQ,EAAE,kBAAkB,CAAA;IAC5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E,MAAM,CAAA;CACZ;AAED,UAAU,QAAQ;IAChB,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,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,iBAAiB,CAAA;AAE1E,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA;AAE5C,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,WAAW,GAAG,cAAc,GAAG,mBAAmB,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type arg from 'arg'\n\nexport interface Args extends arg.Spec {\n '--beta': BooleanConstructor\n '--db': StringConstructor\n '--db-accept-recommended': BooleanConstructor\n '--db-connection-string': StringConstructor\n '--debug': BooleanConstructor\n '--dry-run': BooleanConstructor\n '--help': BooleanConstructor\n '--init-next': BooleanConstructor\n '--local-template': StringConstructor\n '--name': StringConstructor\n '--no-deps': BooleanConstructor\n '--secret': StringConstructor\n '--template': StringConstructor\n '--template-branch': StringConstructor\n '--use-npm': BooleanConstructor\n '--use-pnpm': BooleanConstructor\n '--use-yarn': BooleanConstructor\n\n // Aliases\n\n '-h': string\n '-n': string\n '-t': string\n}\n\nexport type CliArgs = arg.Result<Args>\n\nexport type ProjectTemplate = GitTemplate | PluginTemplate\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 description?: string\n name: string\n type: ProjectTemplate['type']\n}\n\nexport type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'\n\nexport type DbType = 'mongodb' | 'postgres'\n\nexport type DbDetails = {\n dbUri: string\n type: DbType\n}\n\nexport type EditorType = 'lexical' | 'slate'\n"],"names":[],"rangeMappings":"","mappings":"AAiEA,WAA4C"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type arg from 'arg'\n\nexport interface Args extends arg.Spec {\n '--beta': BooleanConstructor\n '--db': StringConstructor\n '--db-accept-recommended': BooleanConstructor\n '--db-connection-string': StringConstructor\n '--debug': BooleanConstructor\n '--dry-run': BooleanConstructor\n '--help': BooleanConstructor\n '--init-next': BooleanConstructor\n '--local-template': StringConstructor\n '--name': StringConstructor\n '--no-deps': BooleanConstructor\n '--no-git': BooleanConstructor\n '--secret': StringConstructor\n '--template': StringConstructor\n '--template-branch': StringConstructor\n '--use-bun': BooleanConstructor\n '--use-npm': BooleanConstructor\n '--use-pnpm': BooleanConstructor\n '--use-yarn': BooleanConstructor\n\n // Aliases\n\n '-h': string\n '-n': string\n '-t': string\n}\n\nexport type CliArgs = arg.Result<Args>\n\nexport type ProjectTemplate = GitTemplate | PluginTemplate\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 description?: string\n name: string\n type: ProjectTemplate['type']\n}\n\nexport type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'\n\nexport type DbType = 'mongodb' | 'postgres' | 'sqlite' | 'vercel-postgres'\n\nexport type DbDetails = {\n dbUri: string\n type: DbType\n}\n\nexport type EditorType = 'lexical' | 'slate'\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 = 'localDisk' | 'payloadCloud' | 'vercelBlobStorage'\n"],"names":[],"mappings":"AAkFA,WAAmF"}
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * Recursively copy files from src to dest
3
+ *
4
+ * @internal
3
5
  */
4
- export declare function copyRecursiveSync(src: string, dest: string, debug?: boolean): void;
6
+ export declare function copyRecursiveSync(src: string, dest: string, ignoreRegex?: string[]): void;
5
7
  //# sourceMappingURL=copy-recursive-sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"copy-recursive-sync.d.ts","sourceRoot":"","sources":["../../src/utils/copy-recursive-sync.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,QAY3E"}
1
+ {"version":3,"file":"copy-recursive-sync.d.ts","sourceRoot":"","sources":["../../src/utils/copy-recursive-sync.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAezF"}
@@ -2,7 +2,9 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  /**
4
4
  * Recursively copy files from src to dest
5
- */ export function copyRecursiveSync(src, dest, debug) {
5
+ *
6
+ * @internal
7
+ */ export function copyRecursiveSync(src, dest, ignoreRegex) {
6
8
  const exists = fs.existsSync(src);
7
9
  const stats = exists && fs.statSync(src);
8
10
  const isDirectory = exists && stats !== false && stats.isDirectory();
@@ -11,6 +13,9 @@ import path from 'path';
11
13
  recursive: true
12
14
  });
13
15
  fs.readdirSync(src).forEach((childItemName)=>{
16
+ if (ignoreRegex && ignoreRegex.some((regex)=>new RegExp(regex).test(childItemName))) {
17
+ return;
18
+ }
14
19
  copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
15
20
  });
16
21
  } else {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/copy-recursive-sync.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\n/**\n * Recursively copy files from src to dest\n */\nexport function copyRecursiveSync(src: string, dest: string, debug?: boolean) {\n const exists = fs.existsSync(src)\n const stats = exists && fs.statSync(src)\n const isDirectory = exists && stats !== false && stats.isDirectory()\n if (isDirectory) {\n fs.mkdirSync(dest, { recursive: true })\n fs.readdirSync(src).forEach((childItemName) => {\n copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName))\n })\n } else {\n fs.copyFileSync(src, dest)\n }\n}\n"],"names":["fs","path","copyRecursiveSync","src","dest","debug","exists","existsSync","stats","statSync","isDirectory","mkdirSync","recursive","readdirSync","forEach","childItemName","join","copyFileSync"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB;;CAEC,GACD,OAAO,SAASC,kBAAkBC,GAAW,EAAEC,IAAY,EAAEC,KAAe;IAC1E,MAAMC,SAASN,GAAGO,UAAU,CAACJ;IAC7B,MAAMK,QAAQF,UAAUN,GAAGS,QAAQ,CAACN;IACpC,MAAMO,cAAcJ,UAAUE,UAAU,SAASA,MAAME,WAAW;IAClE,IAAIA,aAAa;QACfV,GAAGW,SAAS,CAACP,MAAM;YAAEQ,WAAW;QAAK;QACrCZ,GAAGa,WAAW,CAACV,KAAKW,OAAO,CAAC,CAACC;YAC3Bb,kBAAkBD,KAAKe,IAAI,CAACb,KAAKY,gBAAgBd,KAAKe,IAAI,CAACZ,MAAMW;QACnE;IACF,OAAO;QACLf,GAAGiB,YAAY,CAACd,KAAKC;IACvB;AACF"}
1
+ {"version":3,"sources":["../../src/utils/copy-recursive-sync.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\n/**\n * Recursively copy files from src to dest\n *\n * @internal\n */\nexport function copyRecursiveSync(src: string, dest: string, ignoreRegex?: string[]): void {\n const exists = fs.existsSync(src)\n const stats = exists && fs.statSync(src)\n const isDirectory = exists && stats !== false && stats.isDirectory()\n if (isDirectory) {\n fs.mkdirSync(dest, { recursive: true })\n fs.readdirSync(src).forEach((childItemName) => {\n if (ignoreRegex && ignoreRegex.some((regex) => new RegExp(regex).test(childItemName))) {\n return\n }\n copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName))\n })\n } else {\n fs.copyFileSync(src, dest)\n }\n}\n"],"names":["fs","path","copyRecursiveSync","src","dest","ignoreRegex","exists","existsSync","stats","statSync","isDirectory","mkdirSync","recursive","readdirSync","forEach","childItemName","some","regex","RegExp","test","join","copyFileSync"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB;;;;CAIC,GACD,OAAO,SAASC,kBAAkBC,GAAW,EAAEC,IAAY,EAAEC,WAAsB;IACjF,MAAMC,SAASN,GAAGO,UAAU,CAACJ;IAC7B,MAAMK,QAAQF,UAAUN,GAAGS,QAAQ,CAACN;IACpC,MAAMO,cAAcJ,UAAUE,UAAU,SAASA,MAAME,WAAW;IAClE,IAAIA,aAAa;QACfV,GAAGW,SAAS,CAACP,MAAM;YAAEQ,WAAW;QAAK;QACrCZ,GAAGa,WAAW,CAACV,KAAKW,OAAO,CAAC,CAACC;YAC3B,IAAIV,eAAeA,YAAYW,IAAI,CAAC,CAACC,QAAU,IAAIC,OAAOD,OAAOE,IAAI,CAACJ,iBAAiB;gBACrF;YACF;YACAb,kBAAkBD,KAAKmB,IAAI,CAACjB,KAAKY,gBAAgBd,KAAKmB,IAAI,CAAChB,MAAMW;QACnE;IACF,OAAO;QACLf,GAAGqB,YAAY,CAAClB,KAAKC;IACvB;AACF"}
@@ -0,0 +1,4 @@
1
+ export declare function tryInitRepoAndCommit(args: {
2
+ cwd: string;
3
+ }): void;
4
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAuBhE"}
@@ -0,0 +1,46 @@
1
+ import { execSync } from 'child_process';
2
+ import { warning } from './log.js';
3
+ export function tryInitRepoAndCommit(args) {
4
+ const execOpts = {
5
+ cwd: args.cwd,
6
+ stdio: 'ignore'
7
+ };
8
+ try {
9
+ // Check if git is available
10
+ execSync('git -v', execOpts);
11
+ // Do nothing if already in a git repo
12
+ if (isGitRepo(execOpts)) {
13
+ return;
14
+ }
15
+ // Initialize
16
+ execSync('git init', execOpts);
17
+ if (!ensureHasDefaultBranch(execOpts)) {
18
+ execSync('git checkout -b main', execOpts);
19
+ }
20
+ // Add and commit files
21
+ execSync('git add -A', execOpts);
22
+ execSync('git commit -m "feat: initial commit"', execOpts);
23
+ } catch (_) {
24
+ warning('Failed to initialize git repository.');
25
+ }
26
+ }
27
+ function isGitRepo(opts) {
28
+ try {
29
+ execSync('git rev-parse --is-inside-work-tree', opts);
30
+ return true;
31
+ } catch (_) {
32
+ // Ignore errors
33
+ }
34
+ return false;
35
+ }
36
+ function ensureHasDefaultBranch(opts) {
37
+ try {
38
+ execSync(`git config init.defaultBranch`, opts);
39
+ return true;
40
+ } catch (_) {
41
+ // Ignore errros
42
+ }
43
+ return false;
44
+ }
45
+
46
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/git.ts"],"sourcesContent":["import type { ExecSyncOptions } from 'child_process'\n\nimport { execSync } from 'child_process'\n\nimport { warning } from './log.js'\n\nexport function tryInitRepoAndCommit(args: { cwd: string }): void {\n const execOpts: ExecSyncOptions = { cwd: args.cwd, stdio: 'ignore' }\n try {\n // Check if git is available\n execSync('git -v', execOpts)\n\n // Do nothing if already in a git repo\n if (isGitRepo(execOpts)) {\n return\n }\n\n // Initialize\n execSync('git init', execOpts)\n if (!ensureHasDefaultBranch(execOpts)) {\n execSync('git checkout -b main', execOpts)\n }\n\n // Add and commit files\n execSync('git add -A', execOpts)\n execSync('git commit -m \"feat: initial commit\"', execOpts)\n } catch (_) {\n warning('Failed to initialize git repository.')\n }\n}\n\nfunction isGitRepo(opts: ExecSyncOptions): boolean {\n try {\n execSync('git rev-parse --is-inside-work-tree', opts)\n return true\n } catch (_) {\n // Ignore errors\n }\n return false\n}\n\nfunction ensureHasDefaultBranch(opts: ExecSyncOptions): boolean {\n try {\n execSync(`git config init.defaultBranch`, opts)\n return true\n } catch (_) {\n // Ignore errros\n }\n return false\n}\n"],"names":["execSync","warning","tryInitRepoAndCommit","args","execOpts","cwd","stdio","isGitRepo","ensureHasDefaultBranch","_","opts"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,gBAAe;AAExC,SAASC,OAAO,QAAQ,WAAU;AAElC,OAAO,SAASC,qBAAqBC,IAAqB;IACxD,MAAMC,WAA4B;QAAEC,KAAKF,KAAKE,GAAG;QAAEC,OAAO;IAAS;IACnE,IAAI;QACF,4BAA4B;QAC5BN,SAAS,UAAUI;QAEnB,sCAAsC;QACtC,IAAIG,UAAUH,WAAW;YACvB;QACF;QAEA,aAAa;QACbJ,SAAS,YAAYI;QACrB,IAAI,CAACI,uBAAuBJ,WAAW;YACrCJ,SAAS,wBAAwBI;QACnC;QAEA,uBAAuB;QACvBJ,SAAS,cAAcI;QACvBJ,SAAS,wCAAwCI;IACnD,EAAE,OAAOK,GAAG;QACVR,QAAQ;IACV;AACF;AAEA,SAASM,UAAUG,IAAqB;IACtC,IAAI;QACFV,SAAS,uCAAuCU;QAChD,OAAO;IACT,EAAE,OAAOD,GAAG;IACV,gBAAgB;IAClB;IACA,OAAO;AACT;AAEA,SAASD,uBAAuBE,IAAqB;IACnD,IAAI;QACFV,SAAS,CAAC,6BAA6B,CAAC,EAAEU;QAC1C,OAAO;IACT,EAAE,OAAOD,GAAG;IACV,gBAAgB;IAClB;IACA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAIA,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,IAEvC,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,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,IAEvC,CAAA;AAED,eAAO,MAAM,GAAG,YAAa,MAAM,KAAG,IAErC,CAAA"}
package/dist/utils/log.js CHANGED
@@ -1,4 +1,4 @@
1
- /* eslint-disable no-console */ import * as p from '@clack/prompts';
1
+ import * as p from '@clack/prompts';
2
2
  import chalk from 'chalk';
3
3
  export const warning = (message)=>{
4
4
  p.log.warn(chalk.yellow('? ') + chalk.bold(message));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/log.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport * as p from '@clack/prompts'\nimport chalk from 'chalk'\n\nexport const warning = (message: string): void => {\n p.log.warn(chalk.yellow('? ') + chalk.bold(message))\n}\n\nexport const info = (message: string): void => {\n p.log.step(chalk.bold(message))\n}\n\nexport const error = (message: string): void => {\n p.log.error(chalk.bold(message))\n}\n\nexport const debug = (message: string): void => {\n p.log.step(`${chalk.bgGray('[DEBUG]')} ${chalk.gray(message)}`)\n}\n\nexport const log = (message: string): void => {\n p.log.message(message)\n}\n"],"names":["p","chalk","warning","message","log","warn","yellow","bold","info","step","error","debug","bgGray","gray"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA,6BAA6B,GAC7B,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,UAAU,CAACC;IACtBH,EAAEI,GAAG,CAACC,IAAI,CAACJ,MAAMK,MAAM,CAAC,QAAQL,MAAMM,IAAI,CAACJ;AAC7C,EAAC;AAED,OAAO,MAAMK,OAAO,CAACL;IACnBH,EAAEI,GAAG,CAACK,IAAI,CAACR,MAAMM,IAAI,CAACJ;AACxB,EAAC;AAED,OAAO,MAAMO,QAAQ,CAACP;IACpBH,EAAEI,GAAG,CAACM,KAAK,CAACT,MAAMM,IAAI,CAACJ;AACzB,EAAC;AAED,OAAO,MAAMQ,QAAQ,CAACR;IACpBH,EAAEI,GAAG,CAACK,IAAI,CAAC,CAAC,EAAER,MAAMW,MAAM,CAAC,WAAW,CAAC,EAAEX,MAAMY,IAAI,CAACV,SAAS,CAAC;AAChE,EAAC;AAED,OAAO,MAAMC,MAAM,CAACD;IAClBH,EAAEI,GAAG,CAACD,OAAO,CAACA;AAChB,EAAC"}
1
+ {"version":3,"sources":["../../src/utils/log.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport chalk from 'chalk'\n\nexport const warning = (message: string): void => {\n p.log.warn(chalk.yellow('? ') + chalk.bold(message))\n}\n\nexport const info = (message: string): void => {\n p.log.step(chalk.bold(message))\n}\n\nexport const error = (message: string): void => {\n p.log.error(chalk.bold(message))\n}\n\nexport const debug = (message: string): void => {\n p.log.step(`${chalk.bgGray('[DEBUG]')} ${chalk.gray(message)}`)\n}\n\nexport const log = (message: string): void => {\n p.log.message(message)\n}\n"],"names":["p","chalk","warning","message","log","warn","yellow","bold","info","step","error","debug","bgGray","gray"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,UAAU,CAACC;IACtBH,EAAEI,GAAG,CAACC,IAAI,CAACJ,MAAMK,MAAM,CAAC,QAAQL,MAAMM,IAAI,CAACJ;AAC7C,EAAC;AAED,OAAO,MAAMK,OAAO,CAACL;IACnBH,EAAEI,GAAG,CAACK,IAAI,CAACR,MAAMM,IAAI,CAACJ;AACxB,EAAC;AAED,OAAO,MAAMO,QAAQ,CAACP;IACpBH,EAAEI,GAAG,CAACM,KAAK,CAACT,MAAMM,IAAI,CAACJ;AACzB,EAAC;AAED,OAAO,MAAMQ,QAAQ,CAACR;IACpBH,EAAEI,GAAG,CAACK,IAAI,CAAC,CAAC,EAAER,MAAMW,MAAM,CAAC,WAAW,CAAC,EAAEX,MAAMY,IAAI,CAACV,SAAS,CAAC;AAChE,EAAC;AAED,OAAO,MAAMC,MAAM,CAACD;IAClBH,EAAEI,GAAG,CAACD,OAAO,CAACA;AAChB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAMjD,eAAO,MAAM,cAAc,QAE1B,CAAA;AAID,wBAAgB,WAAW,IAAI,IAAI,CA4BlC;AAQD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAsBzF;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,CA6BlC;AAQD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAsBzF;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"}
@@ -32,6 +32,7 @@ export function helpMessage() {
32
32
  --use-npm Use npm to install dependencies
33
33
  --use-yarn Use yarn to install dependencies
34
34
  --use-pnpm Use pnpm to install dependencies
35
+ --use-bun Use bun to install dependencies (experimental)
35
36
  --no-deps Do not install any dependencies
36
37
  -h Show help
37
38
  `);
@@ -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 { ProjectTemplate } from '../types.js'\nimport type { PackageManager } 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\n {dim Available templates: ${formatTemplates(validTemplates)}}\n\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 --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 - ${\n packageManager === 'npm' ? 'npm run' : packageManager\n } dev or follow directions in ${createTerminalLink(\n 'README.md',\n `file://${path.resolve(projectDir, 'README.md')}`,\n )}\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","resolve","successfulNextInit","moveMessage","args","relativeAppDir","nextAppDir","feedbackOutro","bgCyan","black","text","url","fallback"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,6BAA6B,GAC7B,OAAOA,WAAW,QAAO;AACzB,OAAOC,UAAU,OAAM;AACvB,OAAOC,kBAAkB,gBAAe;AAKxC,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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;wBAC1E,EAAE4B,eAAe;;;;;AAKzC,CAAC;AACD;AAEA,OAAO,SAASE;IACd,OAAO,CAAC,EAAEpC,MAAMqC,MAAM,CAACrC,MAAMsC,KAAK,CAAC,qBAAqB,aAAa,EAAET,mBAAmB,UAAU,yCAAyC,CAAC,CAAC;AACjJ;AAEA,8DAA8D;AAC9D,SAASA,mBAAmBU,IAAY,EAAEC,GAAW;IACnD,OAAOtC,aAAaqC,MAAMC,KAAK;QAC7BC,UAAU,CAACF,MAAMC,MAAQ,CAAC,EAAED,KAAK,EAAE,EAAEC,IAAI,CAAC;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\n {dim Available templates: ${formatTemplates(validTemplates)}}\n\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 - ${\n packageManager === 'npm' ? 'npm run' : packageManager\n } dev or follow directions in ${createTerminalLink(\n 'README.md',\n `file://${path.resolve(projectDir, 'README.md')}`,\n )}\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","resolve","successfulNextInit","moveMessage","args","relativeAppDir","n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AAEA,OAAO,SAASE;IACd,OAAO,CAAC,EAAE,EAAEF,mBACV,mBACA,+DACA;EACF,EAAEA,mBAAmB,iBAAiB,sDAAsD;AAC9F,CAAC;AACD;AAEA,OAAO,SAASG,YAAYC,IAAgD;IAC1E,MAAMC,iBAAiBjC,KAAKyB,QAAQ,CAACC,QAAQC,GAAG,IAAIK,KAAKE,UAAU;IACnE,OAAO,CAAC;AACV,EAAE/B,OAAO,eAAe;;;;AAIxB,EAAEJ,MAAMM,IAAI,CAAC,gBAAgB;;8BAEC,EAAE4B,eAAe,WAAW,EAAEA,eAAe,CAAC,EAAElC,MAAMM,IAAI,CAAC,SAAS;wBAC1E,EAAE4B,eAAe;;;;;AAKzC,CAAC;AACD;AAEA,OAAO,SAASE;IACd,OAAO,CAAC,EAAEpC,MAAMqC,MAAM,CAACrC,MAAMsC,KAAK,CAAC,qBAAqB,aAAa,EAAET,mBAAmB,UAAU,yCAAyC,CAAC,CAAC;AACjJ;AAEA,8DAA8D;AAC9D,SAASA,mBAAmBU,IAAY,EAAEC,GAAW;IACnD,OAAOtC,aAAaqC,MAAMC,KAAK;QAC7BC,UAAU,CAACF,MAAMC,MAAQ,CAAC,EAAED,KAAK,EAAE,EAAEC,IAAI,CAAC;IAC5C;AACF"}
package/license.md ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-payload-app",
3
- "version": "3.0.0-canary.f6e77b8",
3
+ "version": "3.0.0-canary.fb04843",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,12 +8,34 @@
8
8
  "directory": "packages/create-payload-app"
9
9
  },
10
10
  "license": "MIT",
11
+ "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
12
+ "maintainers": [
13
+ {
14
+ "name": "Payload",
15
+ "email": "info@payloadcms.com",
16
+ "url": "https://payloadcms.com"
17
+ }
18
+ ],
11
19
  "type": "module",
12
20
  "exports": {
21
+ "./types": {
22
+ "import": "./src/types.ts",
23
+ "require": "./src/types.ts"
24
+ },
13
25
  "./commands": {
14
26
  "import": "./src/lib/init-next.ts",
15
27
  "require": "./src/lib/init-next.ts",
16
28
  "types": "./src/lib/init-next.ts"
29
+ },
30
+ "./lib/*": {
31
+ "import": "./src/lib/*",
32
+ "require": "./src/lib/*",
33
+ "types": "./src/lib/*"
34
+ },
35
+ "./utils/*": {
36
+ "import": "./src/utils/*",
37
+ "require": "./src/utils/*",
38
+ "types": "./src/utils/*"
17
39
  }
18
40
  },
19
41
  "bin": {
@@ -27,32 +49,34 @@
27
49
  "dependencies": {
28
50
  "@clack/prompts": "^0.7.0",
29
51
  "@sindresorhus/slugify": "^1.1.0",
52
+ "@swc/core": "1.7.10",
30
53
  "arg": "^5.0.0",
31
54
  "chalk": "^4.1.0",
32
- "command-exists": "^1.2.9",
33
55
  "comment-json": "^4.2.3",
34
- "degit": "^2.8.4",
35
- "detect-package-manager": "^3.0.1",
36
56
  "esprima-next": "^6.0.3",
37
57
  "execa": "^5.0.0",
38
58
  "figures": "^6.1.0",
39
59
  "fs-extra": "^9.0.1",
40
60
  "globby": "11.1.0",
61
+ "tar": "^7.4.3",
41
62
  "terminal-link": "^2.1.1"
42
63
  },
43
64
  "devDependencies": {
44
- "@types/command-exists": "^1.2.0",
45
- "@types/degit": "^2.8.3",
46
65
  "@types/esprima": "^4.0.6",
47
66
  "@types/fs-extra": "^9.0.12",
48
- "@types/jest": "^27.0.3",
49
- "@types/node": "20.12.5"
67
+ "@types/jest": "29.5.12",
68
+ "@types/node": "22.5.4"
69
+ },
70
+ "engines": {
71
+ "node": "^18.20.2 || >=20.9.0"
50
72
  },
51
73
  "scripts": {
52
74
  "build": "pnpm pack-template-files && pnpm typecheck && pnpm build:swc",
53
- "build:swc": "swc ./src -d ./dist --config-file .swcrc",
75
+ "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
54
76
  "clean": "rimraf {dist,*.tsbuildinfo}",
55
- "pack-template-files": "tsx src/scripts/pack-template-files.ts",
77
+ "lint": "eslint .",
78
+ "lint:fix": "eslint . --fix",
79
+ "pack-template-files": "node --no-deprecation --import @swc-node/register/esm-register src/scripts/pack-template-files.ts",
56
80
  "test": "jest",
57
81
  "typecheck": "tsc"
58
82
  }
@@ -1,9 +0,0 @@
1
- import type { DbType } from '../types.js';
2
- type DbAdapterReplacement = {
3
- configReplacement: string[];
4
- importReplacement: string;
5
- packageName: string;
6
- };
7
- export declare const dbReplacements: Record<DbType, DbAdapterReplacement>;
8
- export {};
9
- //# sourceMappingURL=packages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../src/lib/packages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,KAAK,oBAAoB,GAAG;IAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAyBD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAG/D,CAAA"}
@@ -1,27 +0,0 @@
1
- const mongodbReplacement = {
2
- importReplacement: "import { mongooseAdapter } from '@payloadcms/db-mongodb'",
3
- packageName: '@payloadcms/db-mongodb',
4
- // Replacement between `// database-adapter-config-start` and `// database-adapter-config-end`
5
- configReplacement: [
6
- ' db: mongooseAdapter({',
7
- " url: process.env.DATABASE_URI || '',",
8
- ' }),'
9
- ]
10
- };
11
- const postgresReplacement = {
12
- configReplacement: [
13
- ' db: postgresAdapter({',
14
- ' pool: {',
15
- " connectionString: process.env.DATABASE_URI || '',",
16
- ' },',
17
- ' }),'
18
- ],
19
- importReplacement: "import { postgresAdapter } from '@payloadcms/db-postgres'",
20
- packageName: '@payloadcms/db-postgres'
21
- };
22
- export const dbReplacements = {
23
- mongodb: mongodbReplacement,
24
- postgres: postgresReplacement
25
- };
26
-
27
- //# sourceMappingURL=packages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/packages.ts"],"sourcesContent":["import type { DbType } from '../types.js'\n\ntype DbAdapterReplacement = {\n configReplacement: string[]\n importReplacement: string\n packageName: string\n}\n\nconst mongodbReplacement: DbAdapterReplacement = {\n importReplacement: \"import { mongooseAdapter } from '@payloadcms/db-mongodb'\",\n packageName: '@payloadcms/db-mongodb',\n // Replacement between `// database-adapter-config-start` and `// database-adapter-config-end`\n configReplacement: [\n ' db: mongooseAdapter({',\n \" url: process.env.DATABASE_URI || '',\",\n ' }),',\n ],\n}\n\nconst postgresReplacement: DbAdapterReplacement = {\n configReplacement: [\n ' db: postgresAdapter({',\n ' pool: {',\n \" connectionString: process.env.DATABASE_URI || '',\",\n ' },',\n ' }),',\n ],\n importReplacement: \"import { postgresAdapter } from '@payloadcms/db-postgres'\",\n packageName: '@payloadcms/db-postgres',\n}\n\nexport const dbReplacements: Record<DbType, DbAdapterReplacement> = {\n mongodb: mongodbReplacement,\n postgres: postgresReplacement,\n}\n"],"names":["mongodbReplacement","importReplacement","packageName","configReplacement","postgresReplacement","dbReplacements","mongodb","postgres"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAQA,MAAMA,qBAA2C;IAC/CC,mBAAmB;IACnBC,aAAa;IACb,8FAA8F;IAC9FC,mBAAmB;QACjB;QACA;QACA;KACD;AACH;AAEA,MAAMC,sBAA4C;IAChDD,mBAAmB;QACjB;QACA;QACA;QACA;QACA;KACD;IACDF,mBAAmB;IACnBC,aAAa;AACf;AAEA,OAAO,MAAMG,iBAAuD;IAClEC,SAASN;IACTO,UAAUH;AACZ,EAAC"}