create-payload-app 1.0.0-beta.0 → 3.0.0-alpha.50

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +3 -3
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/configure-payload-config.d.ts +11 -0
  7. package/dist/lib/configure-payload-config.d.ts.map +1 -0
  8. package/dist/lib/configure-payload-config.js +15 -53
  9. package/dist/lib/configure-payload-config.js.map +1 -0
  10. package/dist/lib/create-project.d.ts +14 -0
  11. package/dist/lib/create-project.d.ts.map +1 -0
  12. package/dist/lib/create-project.js +84 -24
  13. package/dist/lib/create-project.js.map +1 -0
  14. package/dist/lib/create-project.spec.d.ts +2 -0
  15. package/dist/lib/create-project.spec.d.ts.map +1 -0
  16. package/dist/lib/create-project.spec.js +30 -75
  17. package/dist/lib/create-project.spec.js.map +1 -0
  18. package/dist/lib/generate-secret.d.ts +2 -0
  19. package/dist/lib/generate-secret.d.ts.map +1 -0
  20. package/dist/lib/generate-secret.js +1 -1
  21. package/dist/lib/generate-secret.js.map +1 -0
  22. package/dist/lib/init-next.d.ts +29 -0
  23. package/dist/lib/init-next.d.ts.map +1 -0
  24. package/dist/lib/init-next.js +285 -0
  25. package/dist/lib/init-next.js.map +1 -0
  26. package/dist/lib/packages.d.ts +9 -0
  27. package/dist/lib/packages.d.ts.map +1 -0
  28. package/dist/lib/packages.js +8 -52
  29. package/dist/lib/packages.js.map +1 -0
  30. package/dist/lib/parse-project-name.d.ts +3 -0
  31. package/dist/lib/parse-project-name.d.ts.map +1 -0
  32. package/dist/lib/parse-project-name.js +53 -12
  33. package/dist/lib/parse-project-name.js.map +1 -0
  34. package/dist/lib/parse-template.d.ts +3 -0
  35. package/dist/lib/parse-template.d.ts.map +1 -0
  36. package/dist/lib/parse-template.js +50 -20
  37. package/dist/lib/parse-template.js.map +1 -0
  38. package/dist/lib/select-db.d.ts +3 -0
  39. package/dist/lib/select-db.d.ts.map +1 -0
  40. package/dist/lib/select-db.js +72 -31
  41. package/dist/lib/select-db.js.map +1 -0
  42. package/dist/lib/templates.d.ts +4 -0
  43. package/dist/lib/templates.d.ts.map +1 -0
  44. package/dist/lib/templates.js +17 -11
  45. package/dist/lib/templates.js.map +1 -0
  46. package/dist/lib/wrap-next-config.d.ts +12 -0
  47. package/dist/lib/wrap-next-config.d.ts.map +1 -0
  48. package/dist/lib/wrap-next-config.js +110 -0
  49. package/dist/lib/wrap-next-config.js.map +1 -0
  50. package/dist/lib/wrap-next-config.spec.d.ts +2 -0
  51. package/dist/lib/wrap-next-config.spec.d.ts.map +1 -0
  52. package/dist/lib/wrap-next-config.spec.js +98 -0
  53. package/dist/lib/wrap-next-config.spec.js.map +1 -0
  54. package/dist/lib/write-env-file.d.ts +10 -0
  55. package/dist/lib/write-env-file.d.ts.map +1 -0
  56. package/dist/lib/write-env-file.js +9 -6
  57. package/dist/lib/write-env-file.js.map +1 -0
  58. package/dist/main.d.ts +7 -0
  59. package/dist/main.d.ts.map +1 -0
  60. package/dist/main.js +176 -60
  61. package/dist/main.js.map +1 -0
  62. package/dist/scripts/pack-template-files.d.ts +2 -0
  63. package/dist/scripts/pack-template-files.d.ts.map +1 -0
  64. package/dist/scripts/pack-template-files.js +43 -0
  65. package/dist/scripts/pack-template-files.js.map +1 -0
  66. package/dist/template/src/app/(payload)/admin/[[...segments]]/page.tsx +17 -0
  67. package/dist/template/src/app/(payload)/api/[...slug]/route.ts +9 -0
  68. package/dist/template/src/app/(payload)/api/graphql/route.ts +6 -0
  69. package/dist/template/src/app/(payload)/api/graphql-playground/route.ts +6 -0
  70. package/dist/template/src/app/(payload)/custom.scss +0 -0
  71. package/dist/template/src/app/(payload)/layout.tsx +16 -0
  72. package/dist/template/src/app/my-route/route.ts +14 -0
  73. package/dist/template/src/collections/Users.ts +13 -0
  74. package/dist/template/src/payload.config.ts +38 -0
  75. package/dist/types.d.ts +55 -0
  76. package/dist/types.d.ts.map +1 -0
  77. package/dist/types.js +1 -1
  78. package/dist/types.js.map +1 -0
  79. package/dist/utils/copy-recursive-sync.d.ts +5 -0
  80. package/dist/utils/copy-recursive-sync.d.ts.map +1 -0
  81. package/dist/utils/copy-recursive-sync.js +34 -0
  82. package/dist/utils/copy-recursive-sync.js.map +1 -0
  83. package/dist/utils/log.d.ts +6 -0
  84. package/dist/utils/log.d.ts.map +1 -0
  85. package/dist/utils/log.js +62 -15
  86. package/dist/utils/log.js.map +1 -0
  87. package/dist/utils/messages.d.ts +11 -0
  88. package/dist/utils/messages.d.ts.map +1 -0
  89. package/dist/utils/messages.js +47 -16
  90. package/dist/utils/messages.js.map +1 -0
  91. package/package.json +27 -10
package/README.md CHANGED
@@ -10,7 +10,7 @@ CLI for easily starting new Payload project
10
10
 
11
11
  $ npx create-payload-app
12
12
  $ npx create-payload-app my-project
13
- $ npx create-payload-app -n my-project -t blog
13
+ $ npx create-payload-app -n my-project -t website
14
14
 
15
15
  OPTIONS
16
16
 
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _main = require("./main");
6
- const _log = require("./utils/log");
5
+ const _main = require("./main.js");
6
+ const _log = require("./utils/log.js");
7
7
  async function main() {
8
8
  await new _main.Main().init();
9
9
  }
10
10
  main().catch((e)=>(0, _log.error)(`An error has occurred: ${e instanceof Error ? e.message : e}`));
11
11
 
12
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBNYWluIH0gZnJvbSAnLi9tYWluJ1xuaW1wb3J0IHsgZXJyb3IgfSBmcm9tICcuL3V0aWxzL2xvZydcblxuYXN5bmMgZnVuY3Rpb24gbWFpbigpOiBQcm9taXNlPHZvaWQ+IHtcbiAgYXdhaXQgbmV3IE1haW4oKS5pbml0KClcbn1cblxubWFpbigpLmNhdGNoKChlKSA9PiBlcnJvcihgQW4gZXJyb3IgaGFzIG9jY3VycmVkOiAke2UgaW5zdGFuY2VvZiBFcnJvciA/IGUubWVzc2FnZSA6IGV9YCkpXG4iXSwibmFtZXMiOlsibWFpbiIsIk1haW4iLCJpbml0IiwiY2F0Y2giLCJlIiwiZXJyb3IiLCJFcnJvciIsIm1lc3NhZ2UiXSwibWFwcGluZ3MiOiI7Ozs7c0JBQXFCO3FCQUNDO0FBRXRCLGVBQWVBO0lBQ2IsTUFBTSxJQUFJQyxVQUFJLEdBQUdDLElBQUk7QUFDdkI7QUFFQUYsT0FBT0csS0FBSyxDQUFDLENBQUNDLElBQU1DLElBQUFBLFVBQUssRUFBQyxDQUFDLHVCQUF1QixFQUFFRCxhQUFhRSxRQUFRRixFQUFFRyxPQUFPLEdBQUdILEVBQUUsQ0FBQyJ9
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Main } from './main.js'\nimport { error } from './utils/log.js'\n\nasync function main(): Promise<void> {\n await new Main().init()\n}\n\nmain().catch((e) => error(`An error has occurred: ${e instanceof Error ? e.message : e}`))\n"],"names":["main","Main","init","catch","e","error","Error","message"],"mappings":";;;;sBAAqB;qBACC;AAEtB,eAAeA;IACb,MAAM,IAAIC,UAAI,GAAGC,IAAI;AACvB;AAEAF,OAAOG,KAAK,CAAC,CAACC,IAAMC,IAAAA,UAAK,EAAC,CAAC,uBAAuB,EAAED,aAAaE,QAAQF,EAAEG,OAAO,GAAGH,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { DbDetails } from '../types.js';
2
+ /** Update payload config with necessary imports and adapters */
3
+ export declare function configurePayloadConfig(args: {
4
+ dbDetails: DbDetails | undefined;
5
+ projectDirOrConfigPath: {
6
+ payloadConfigPath: string;
7
+ } | {
8
+ projectDir: string;
9
+ };
10
+ }): Promise<void>;
11
+ //# sourceMappingURL=configure-payload-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-payload-config.d.ts","sourceRoot":"","sources":["../../src/lib/configure-payload-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAK5C,gEAAgE;AAChE,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,SAAS,EAAE,SAAS,GAAG,SAAS,CAAA;IAChC,sBAAsB,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/E,GAAG,OAAO,CAAC,IAAI,CAAC,CA6DhB"}
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "configurePayloadConfig", {
9
9
  }
10
10
  });
11
11
  const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
12
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
- const _log = require("../utils/log");
14
- const _packages = require("./packages");
12
+ const _globby = /*#__PURE__*/ _interop_require_default(require("globby"));
13
+ const _log = require("../utils/log.js");
14
+ const _packages = require("./packages.js");
15
15
  function _interop_require_default(obj) {
16
16
  return obj && obj.__esModule ? obj : {
17
17
  default: obj
@@ -21,67 +21,29 @@ async function configurePayloadConfig(args) {
21
21
  if (!args.dbDetails) {
22
22
  return;
23
23
  }
24
- // Update package.json
25
- const packageJsonPath = _path.default.resolve(args.projectDir, 'package.json');
26
24
  try {
27
- const packageObj = await _fsextra.default.readJson(packageJsonPath);
28
- packageObj.dependencies['payload'] = '^2.0.0';
29
- const dbPackage = _packages.dbPackages[args.dbDetails.type];
30
- const bundlerPackage = _packages.bundlerPackages['webpack'];
31
- const editorPackage = _packages.editorPackages['slate'];
32
- // Delete all other db adapters
33
- Object.values(_packages.dbPackages).forEach((p)=>{
34
- if (p.packageName !== dbPackage.packageName) {
35
- delete packageObj.dependencies[p.packageName];
36
- }
37
- });
38
- packageObj.dependencies[dbPackage.packageName] = dbPackage.version;
39
- packageObj.dependencies[bundlerPackage.packageName] = bundlerPackage.version;
40
- packageObj.dependencies[editorPackage.packageName] = editorPackage.version;
41
- await _fsextra.default.writeJson(packageJsonPath, packageObj, {
42
- spaces: 2
43
- });
44
- } catch (err) {
45
- (0, _log.warning)('Unable to update name in package.json');
46
- }
47
- try {
48
- const possiblePaths = [
49
- _path.default.resolve(args.projectDir, 'src/payload.config.ts'),
50
- _path.default.resolve(args.projectDir, 'src/payload/payload.config.ts')
51
- ];
52
25
  let payloadConfigPath;
53
- possiblePaths.forEach((p)=>{
54
- if (_fsextra.default.pathExistsSync(p) && !payloadConfigPath) {
55
- payloadConfigPath = p;
56
- }
57
- });
26
+ if (!('payloadConfigPath' in args.projectDirOrConfigPath)) {
27
+ payloadConfigPath = (await (0, _globby.default)('**/payload.config.ts', {
28
+ absolute: true,
29
+ cwd: args.projectDirOrConfigPath.projectDir
30
+ }))?.[0];
31
+ } else {
32
+ payloadConfigPath = args.projectDirOrConfigPath.payloadConfigPath;
33
+ }
58
34
  if (!payloadConfigPath) {
59
- (0, _log.warning)('Unable to update payload.config.ts with plugins');
35
+ (0, _log.warning)('Unable to update payload.config.ts with plugins. Could not find payload.config.ts.');
60
36
  return;
61
37
  }
62
38
  const configContent = _fsextra.default.readFileSync(payloadConfigPath, 'utf-8');
63
39
  const configLines = configContent.split('\n');
64
- const dbReplacement = _packages.dbPackages[args.dbDetails.type];
65
- const bundlerReplacement = _packages.bundlerPackages['webpack'];
66
- const editorReplacement = _packages.editorPackages['slate'];
40
+ const dbReplacement = _packages.dbReplacements[args.dbDetails.type];
67
41
  let dbConfigStartLineIndex;
68
42
  let dbConfigEndLineIndex;
69
43
  configLines.forEach((l, i)=>{
70
44
  if (l.includes('// database-adapter-import')) {
71
45
  configLines[i] = dbReplacement.importReplacement;
72
46
  }
73
- if (l.includes('// bundler-import')) {
74
- configLines[i] = bundlerReplacement.importReplacement;
75
- }
76
- if (l.includes('// bundler-config')) {
77
- configLines[i] = bundlerReplacement.configReplacement;
78
- }
79
- if (l.includes('// editor-import')) {
80
- configLines[i] = editorReplacement.importReplacement;
81
- }
82
- if (l.includes('// editor-config')) {
83
- configLines[i] = editorReplacement.configReplacement;
84
- }
85
47
  if (l.includes('// database-adapter-config-start')) {
86
48
  dbConfigStartLineIndex = i;
87
49
  }
@@ -97,8 +59,8 @@ async function configurePayloadConfig(args) {
97
59
  }
98
60
  _fsextra.default.writeFileSync(payloadConfigPath, configLines.join('\n'));
99
61
  } catch (err) {
100
- (0, _log.warning)('Unable to update payload.config.ts with plugins');
62
+ (0, _log.warning)(`Unable to update payload.config.ts with plugins: ${err instanceof Error ? err.message : ''}`);
101
63
  }
102
64
  }
103
65
 
104
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvY29uZmlndXJlLXBheWxvYWQtY29uZmlnLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBmc2UgZnJvbSAnZnMtZXh0cmEnXG5pbXBvcnQgcGF0aCBmcm9tICdwYXRoJ1xuXG5pbXBvcnQgdHlwZSB7IERiRGV0YWlscyB9IGZyb20gJy4uL3R5cGVzJ1xuXG5pbXBvcnQgeyB3YXJuaW5nIH0gZnJvbSAnLi4vdXRpbHMvbG9nJ1xuaW1wb3J0IHsgYnVuZGxlclBhY2thZ2VzLCBkYlBhY2thZ2VzLCBlZGl0b3JQYWNrYWdlcyB9IGZyb20gJy4vcGFja2FnZXMnXG5cbi8qKiBVcGRhdGUgcGF5bG9hZCBjb25maWcgd2l0aCBuZWNlc3NhcnkgaW1wb3J0cyBhbmQgYWRhcHRlcnMgKi9cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBjb25maWd1cmVQYXlsb2FkQ29uZm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0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/configure-payload-config.ts"],"sourcesContent":["import fse from 'fs-extra'\nimport globby from 'globby'\n\nimport type { DbDetails } from '../types.js'\n\nimport { warning } from '../utils/log.js'\nimport { dbReplacements } from './packages.js'\n\n/** Update payload config with necessary imports and adapters */\nexport async function configurePayloadConfig(args: {\n dbDetails: DbDetails | undefined\n projectDirOrConfigPath: { payloadConfigPath: string } | { projectDir: string }\n}): Promise<void> {\n if (!args.dbDetails) {\n return\n }\n\n try {\n let payloadConfigPath: string | undefined\n if (!('payloadConfigPath' in args.projectDirOrConfigPath)) {\n payloadConfigPath = (\n await globby('**/payload.config.ts', {\n absolute: true,\n cwd: args.projectDirOrConfigPath.projectDir,\n })\n )?.[0]\n } else {\n payloadConfigPath = args.projectDirOrConfigPath.payloadConfigPath\n }\n\n if (!payloadConfigPath) {\n warning('Unable to update payload.config.ts with plugins. Could not find payload.config.ts.')\n return\n }\n\n const configContent = fse.readFileSync(payloadConfigPath, 'utf-8')\n const configLines = configContent.split('\\n')\n\n const dbReplacement = dbReplacements[args.dbDetails.type]\n\n let dbConfigStartLineIndex: number | undefined\n let dbConfigEndLineIndex: number | undefined\n\n configLines.forEach((l, i) => {\n if (l.includes('// database-adapter-import')) {\n configLines[i] = dbReplacement.importReplacement\n }\n\n if (l.includes('// database-adapter-config-start')) {\n dbConfigStartLineIndex = i\n }\n if (l.includes('// database-adapter-config-end')) {\n dbConfigEndLineIndex = i\n }\n })\n\n if (!dbConfigStartLineIndex || !dbConfigEndLineIndex) {\n warning('Unable to update payload.config.ts with database adapter import')\n } else {\n // Replaces lines between `// database-adapter-config-start` and `// database-adapter-config-end`\n configLines.splice(\n dbConfigStartLineIndex,\n dbConfigEndLineIndex - dbConfigStartLineIndex + 1,\n ...dbReplacement.configReplacement,\n )\n }\n\n fse.writeFileSync(payloadConfigPath, configLines.join('\\n'))\n } catch (err: unknown) {\n warning(\n `Unable to update payload.config.ts with plugins: ${err instanceof Error ? err.message : ''}`,\n )\n }\n}\n"],"names":["configurePayloadConfig","args","dbDetails","payloadConfigPath","projectDirOrConfigPath","globby","absolute","cwd","projectDir","warning","configContent","fse","readFileSync","configLines","split","dbReplacement","dbReplacements","type","dbConfigStartLineIndex","dbConfigEndLineIndex","forEach","l","i","includes","importReplacement","splice","configReplacement","writeFileSync","join","err","Error","message"],"mappings":";;;;+BASsBA;;;eAAAA;;;gEATN;+DACG;qBAIK;0BACO;;;;;;AAGxB,eAAeA,uBAAuBC,IAG5C;IACC,IAAI,CAACA,KAAKC,SAAS,EAAE;QACnB;IACF;IAEA,IAAI;QACF,IAAIC;QACJ,IAAI,CAAE,CAAA,uBAAuBF,KAAKG,sBAAsB,AAAD,GAAI;YACzDD,oBACE,CAAA,MAAME,IAAAA,eAAM,EAAC,wBAAwB;gBACnCC,UAAU;gBACVC,KAAKN,KAAKG,sBAAsB,CAACI,UAAU;YAC7C,EAAC,GACA,CAAC,EAAE;QACR,OAAO;YACLL,oBAAoBF,KAAKG,sBAAsB,CAACD,iBAAiB;QACnE;QAEA,IAAI,CAACA,mBAAmB;YACtBM,IAAAA,YAAO,EAAC;YACR;QACF;QAEA,MAAMC,gBAAgBC,gBAAG,CAACC,YAAY,CAACT,mBAAmB;QAC1D,MAAMU,cAAcH,cAAcI,KAAK,CAAC;QAExC,MAAMC,gBAAgBC,wBAAc,CAACf,KAAKC,SAAS,CAACe,IAAI,CAAC;QAEzD,IAAIC;QACJ,IAAIC;QAEJN,YAAYO,OAAO,CAAC,CAACC,GAAGC;YACtB,IAAID,EAAEE,QAAQ,CAAC,+BAA+B;gBAC5CV,WAAW,CAACS,EAAE,GAAGP,cAAcS,iBAAiB;YAClD;YAEA,IAAIH,EAAEE,QAAQ,CAAC,qCAAqC;gBAClDL,yBAAyBI;YAC3B;YACA,IAAID,EAAEE,QAAQ,CAAC,mCAAmC;gBAChDJ,uBAAuBG;YACzB;QACF;QAEA,IAAI,CAACJ,0BAA0B,CAACC,sBAAsB;YACpDV,IAAAA,YAAO,EAAC;QACV,OAAO;YACL,iGAAiG;YACjGI,YAAYY,MAAM,CAChBP,wBACAC,uBAAuBD,yBAAyB,MAC7CH,cAAcW,iBAAiB;QAEtC;QAEAf,gBAAG,CAACgB,aAAa,CAACxB,mBAAmBU,YAAYe,IAAI,CAAC;IACxD,EAAE,OAAOC,KAAc;QACrBpB,IAAAA,YAAO,EACL,CAAC,iDAAiD,EAAEoB,eAAeC,QAAQD,IAAIE,OAAO,GAAG,GAAG,CAAC;IAEjG;AACF"}
@@ -0,0 +1,14 @@
1
+ import type { CliArgs, DbDetails, PackageManager, ProjectTemplate } from '../types.js';
2
+ export declare function createProject(args: {
3
+ cliArgs: CliArgs;
4
+ dbDetails?: DbDetails;
5
+ packageManager: PackageManager;
6
+ projectDir: string;
7
+ projectName: string;
8
+ template: ProjectTemplate;
9
+ }): Promise<void>;
10
+ export declare function updatePackageJSON(args: {
11
+ projectDir: string;
12
+ projectName: string;
13
+ }): Promise<void>;
14
+ //# sourceMappingURL=create-project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../src/lib/create-project.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AA2CtF,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,cAAc,EAAE,cAAc,CAAA;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,eAAe,CAAA;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDhB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhB"}
@@ -16,19 +16,63 @@ _export(exports, {
16
16
  return updatePackageJSON;
17
17
  }
18
18
  });
19
+ const _prompts = /*#__PURE__*/ _interop_require_wildcard(require("@clack/prompts"));
19
20
  const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
20
21
  const _degit = /*#__PURE__*/ _interop_require_default(require("degit"));
21
22
  const _execa = /*#__PURE__*/ _interop_require_default(require("execa"));
22
23
  const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
23
- const _ora = /*#__PURE__*/ _interop_require_default(require("ora"));
24
+ const _nodeurl = require("node:url");
24
25
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
25
- const _log = require("../utils/log");
26
- const _configurepayloadconfig = require("./configure-payload-config");
26
+ const _log = require("../utils/log.js");
27
+ const _configurepayloadconfig = require("./configure-payload-config.js");
27
28
  function _interop_require_default(obj) {
28
29
  return obj && obj.__esModule ? obj : {
29
30
  default: obj
30
31
  };
31
32
  }
33
+ function _getRequireWildcardCache(nodeInterop) {
34
+ if (typeof WeakMap !== "function") return null;
35
+ var cacheBabelInterop = new WeakMap();
36
+ var cacheNodeInterop = new WeakMap();
37
+ return (_getRequireWildcardCache = function(nodeInterop) {
38
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
39
+ })(nodeInterop);
40
+ }
41
+ function _interop_require_wildcard(obj, nodeInterop) {
42
+ if (!nodeInterop && obj && obj.__esModule) {
43
+ return obj;
44
+ }
45
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
46
+ return {
47
+ default: obj
48
+ };
49
+ }
50
+ var cache = _getRequireWildcardCache(nodeInterop);
51
+ if (cache && cache.has(obj)) {
52
+ return cache.get(obj);
53
+ }
54
+ var newObj = {
55
+ __proto__: null
56
+ };
57
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
58
+ for(var key in obj){
59
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
60
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
61
+ if (desc && (desc.get || desc.set)) {
62
+ Object.defineProperty(newObj, key, desc);
63
+ } else {
64
+ newObj[key] = obj[key];
65
+ }
66
+ }
67
+ }
68
+ newObj.default = obj;
69
+ if (cache) {
70
+ cache.set(obj, newObj);
71
+ }
72
+ return newObj;
73
+ }
74
+ const filename = (0, _nodeurl.fileURLToPath)(require("url").pathToFileURL(__filename).toString());
75
+ const dirname = _path.default.dirname(filename);
32
76
  async function createOrFindProjectDir(projectDir) {
33
77
  const pathExists = await _fsextra.default.pathExists(projectDir);
34
78
  if (!pathExists) {
@@ -52,46 +96,62 @@ async function installDeps(args) {
52
96
  });
53
97
  return true;
54
98
  } catch (err) {
55
- console.log({
56
- err
57
- });
99
+ (0, _log.error)(`Error installing dependencies${err instanceof Error ? `: ${err.message}` : ''}.`);
58
100
  return false;
59
101
  }
60
102
  }
61
103
  async function createProject(args) {
62
104
  const { cliArgs, dbDetails, packageManager, projectDir, projectName, template } = args;
105
+ if (cliArgs['--dry-run']) {
106
+ (0, _log.debug)(`Dry run: Creating project in ${_chalk.default.green(projectDir)}`);
107
+ return;
108
+ }
63
109
  await createOrFindProjectDir(projectDir);
64
- console.log(`\n Creating project in ${_chalk.default.green(_path.default.resolve(projectDir))}\n`);
65
- if ('url' in template) {
66
- const emitter = (0, _degit.default)(template.url);
110
+ if (cliArgs['--local-template']) {
111
+ // Copy template from local path. For development purposes.
112
+ const localTemplate = _path.default.resolve(dirname, '../../../../templates/', cliArgs['--local-template']);
113
+ await _fsextra.default.copy(localTemplate, projectDir);
114
+ } else if ('url' in template) {
115
+ let templateUrl = template.url;
116
+ if (cliArgs['--template-branch']) {
117
+ templateUrl = `${template.url}#${cliArgs['--template-branch']}`;
118
+ (0, _log.debug)(`Using template url: ${templateUrl}`);
119
+ }
120
+ const emitter = (0, _degit.default)(templateUrl);
67
121
  await emitter.clone(projectDir);
68
122
  }
69
- const spinner = (0, _ora.default)('Checking latest Payload version...').start();
123
+ const spinner = _prompts.spinner();
124
+ spinner.start('Checking latest Payload version...');
70
125
  await updatePackageJSON({
71
126
  projectDir,
72
127
  projectName
73
128
  });
129
+ spinner.message('Configuring Payload...');
74
130
  await (0, _configurepayloadconfig.configurePayloadConfig)({
75
131
  dbDetails,
76
- projectDir
132
+ projectDirOrConfigPath: {
133
+ projectDir
134
+ }
77
135
  });
78
136
  // Remove yarn.lock file. This is only desired in Payload Cloud.
79
137
  const lockPath = _path.default.resolve(projectDir, 'yarn.lock');
80
138
  if (_fsextra.default.existsSync(lockPath)) {
81
139
  await _fsextra.default.remove(lockPath);
82
140
  }
83
- spinner.text = 'Installing dependencies...';
84
- const result = await installDeps({
85
- cliArgs,
86
- packageManager,
87
- projectDir
88
- });
89
- spinner.stop();
90
- spinner.clear();
91
- if (result) {
92
- (0, _log.success)('Dependencies installed');
141
+ if (!cliArgs['--no-deps']) {
142
+ spinner.message('Installing dependencies...');
143
+ const result = await installDeps({
144
+ cliArgs,
145
+ packageManager,
146
+ projectDir
147
+ });
148
+ if (result) {
149
+ spinner.stop('Successfully installed Payload and dependencies');
150
+ } else {
151
+ spinner.stop('Error installing dependencies', 1);
152
+ }
93
153
  } else {
94
- (0, _log.error)('Error installing dependencies');
154
+ spinner.stop('Dependency installation skipped');
95
155
  }
96
156
  }
97
157
  async function updatePackageJSON(args) {
@@ -104,8 +164,8 @@ async function updatePackageJSON(args) {
104
164
  spaces: 2
105
165
  });
106
166
  } catch (err) {
107
- (0, _log.warning)('Unable to update name in package.json');
167
+ (0, _log.warning)(`Unable to update name in package.json. ${err instanceof Error ? err.message : ''}`);
108
168
  }
109
169
  }
110
170
 
111
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvY3JlYXRlLXByb2plY3QudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNoYWxrIGZyb20gJ2NoYWxrJ1xuaW1wb3J0IGRlZ2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NiLElBQUlGLFFBQVE7UUFDVkcsSUFBQUEsWUFBTyxFQUFDO0lBQ1YsT0FBTztRQUNMQyxJQUFBQSxVQUFLLEVBQUM7SUFDUjtBQUNGO0FBRU8sZUFBZXhDLGtCQUFrQk8sSUFHdkM7SUFDQyxNQUFNLEVBQUVMLFVBQVUsRUFBRWtCLFdBQVcsRUFBRSxHQUFHYjtJQUNwQyxNQUFNa0Msa0JBQWtCM0IsYUFBSSxDQUFDQyxPQUFPLENBQUNiLFlBQVk7SUFDakQsSUFBSTtRQUNGLE1BQU13QyxhQUFhLE1BQU10QyxnQkFBRyxDQUFDdUMsUUFBUSxDQUFDRjtRQUN0Q0MsV0FBV0UsSUFBSSxHQUFHeEI7UUFDbEIsTUFBTWhCLGdCQUFHLENBQUN5QyxTQUFTLENBQUNKLGlCQUFpQkMsWUFBWTtZQUFFSSxRQUFRO1FBQUU7SUFDL0QsRUFBRSxPQUFPOUIsS0FBYztRQUNyQitCLElBQUFBLFlBQU8sRUFBQztJQUNWO0FBQ0YifQ==
171
+ //# sourceMappingURL=create-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/create-project.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport chalk from 'chalk'\nimport degit from 'degit'\nimport execa from 'execa'\nimport fse from 'fs-extra'\nimport { fileURLToPath } from 'node:url'\nimport path from 'path'\n\nimport type { CliArgs, DbDetails, PackageManager, ProjectTemplate } from '../types.js'\n\nimport { debug, error, warning } from '../utils/log.js'\nimport { configurePayloadConfig } from './configure-payload-config.js'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\nasync function createOrFindProjectDir(projectDir: string): Promise<void> {\n const pathExists = await fse.pathExists(projectDir)\n if (!pathExists) {\n await fse.mkdir(projectDir)\n }\n}\n\nasync function installDeps(args: {\n cliArgs: CliArgs\n packageManager: PackageManager\n projectDir: string\n}): Promise<boolean> {\n const { cliArgs, packageManager, projectDir } = args\n if (cliArgs['--no-deps']) {\n return true\n }\n let installCmd = 'npm install --legacy-peer-deps'\n\n if (packageManager === 'yarn') {\n installCmd = 'yarn'\n } else if (packageManager === 'pnpm') {\n installCmd = 'pnpm install'\n }\n\n try {\n await execa.command(installCmd, {\n cwd: path.resolve(projectDir),\n })\n return true\n } catch (err: unknown) {\n error(`Error installing dependencies${err instanceof Error ? `: ${err.message}` : ''}.`)\n return false\n }\n}\n\nexport async function createProject(args: {\n cliArgs: CliArgs\n dbDetails?: DbDetails\n packageManager: PackageManager\n projectDir: string\n projectName: string\n template: ProjectTemplate\n}): Promise<void> {\n const { cliArgs, dbDetails, packageManager, projectDir, projectName, template } = args\n\n if (cliArgs['--dry-run']) {\n debug(`Dry run: Creating project in ${chalk.green(projectDir)}`)\n return\n }\n\n await createOrFindProjectDir(projectDir)\n\n if (cliArgs['--local-template']) {\n // Copy template from local path. For development purposes.\n const localTemplate = path.resolve(\n dirname,\n '../../../../templates/',\n cliArgs['--local-template'],\n )\n await fse.copy(localTemplate, projectDir)\n } else if ('url' in template) {\n let templateUrl = template.url\n if (cliArgs['--template-branch']) {\n templateUrl = `${template.url}#${cliArgs['--template-branch']}`\n debug(`Using template url: ${templateUrl}`)\n }\n const emitter = degit(templateUrl)\n await emitter.clone(projectDir)\n }\n\n const spinner = p.spinner()\n spinner.start('Checking latest Payload version...')\n\n await updatePackageJSON({ projectDir, projectName })\n spinner.message('Configuring Payload...')\n await configurePayloadConfig({ dbDetails, projectDirOrConfigPath: { projectDir } })\n\n // Remove yarn.lock file. This is only desired in Payload Cloud.\n const lockPath = path.resolve(projectDir, 'yarn.lock')\n if (fse.existsSync(lockPath)) {\n await fse.remove(lockPath)\n }\n\n if (!cliArgs['--no-deps']) {\n spinner.message('Installing dependencies...')\n const result = await installDeps({ cliArgs, packageManager, projectDir })\n if (result) {\n spinner.stop('Successfully installed Payload and dependencies')\n } else {\n spinner.stop('Error installing dependencies', 1)\n }\n } else {\n spinner.stop('Dependency installation skipped')\n }\n}\n\nexport async function updatePackageJSON(args: {\n projectDir: string\n projectName: string\n}): Promise<void> {\n const { projectDir, projectName } = args\n const packageJsonPath = path.resolve(projectDir, 'package.json')\n try {\n const packageObj = await fse.readJson(packageJsonPath)\n packageObj.name = projectName\n await fse.writeJson(packageJsonPath, packageObj, { spaces: 2 })\n } catch (err: unknown) {\n warning(`Unable to update name in package.json. ${err instanceof Error ? err.message : ''}`)\n }\n}\n"],"names":["createProject","updatePackageJSON","filename","fileURLToPath","dirname","path","createOrFindProjectDir","projectDir","pathExists","fse","mkdir","installDeps","args","cliArgs","packageManager","installCmd","execa","command","cwd","resolve","err","error","Error","message","dbDetails","projectName","template","debug","chalk","green","localTemplate","copy","templateUrl","url","emitter","degit","clone","spinner","p","start","configurePayloadConfig","projectDirOrConfigPath","lockPath","existsSync","remove","result","stop","packageJsonPath","packageObj","readJson","name","writeJson","spaces","warning"],"mappings":";;;;;;;;;;;IAmDsBA,aAAa;eAAbA;;IA6DAC,iBAAiB;eAAjBA;;;iEAhHH;8DACD;8DACA;8DACA;gEACF;yBACc;6DACb;qBAIqB;wCACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvC,MAAMC,WAAWC,IAAAA,sBAAa,EAAC;AAC/B,MAAMC,UAAUC,aAAI,CAACD,OAAO,CAACF;AAE7B,eAAeI,uBAAuBC,UAAkB;IACtD,MAAMC,aAAa,MAAMC,gBAAG,CAACD,UAAU,CAACD;IACxC,IAAI,CAACC,YAAY;QACf,MAAMC,gBAAG,CAACC,KAAK,CAACH;IAClB;AACF;AAEA,eAAeI,YAAYC,IAI1B;IACC,MAAM,EAAEC,OAAO,EAAEC,cAAc,EAAEP,UAAU,EAAE,GAAGK;IAChD,IAAIC,OAAO,CAAC,YAAY,EAAE;QACxB,OAAO;IACT;IACA,IAAIE,aAAa;IAEjB,IAAID,mBAAmB,QAAQ;QAC7BC,aAAa;IACf,OAAO,IAAID,mBAAmB,QAAQ;QACpCC,aAAa;IACf;IAEA,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O,CAAC;IAChB,MAAMiB,IAAAA,8CAAsB,EAAC;QAAEhB;QAAWiB,wBAAwB;YAAElC;QAAW;IAAE;IAEjF,gEAAgE;IAChE,MAAMmC,WAAWrC,aAAI,CAACc,OAAO,CAACZ,YAAY;IAC1C,IAAIE,gBAAG,CAACkC,UAAU,CAACD,WAAW;QAC5B,MAAMjC,gBAAG,CAACmC,MAAM,CAACF;IACnB;IAEA,IAAI,CAAC7B,OAAO,CAAC,YAAY,EAAE;QACzBwB,QAAQd,OAAO,CAAC;QAChB,MAAMsB,SAAS,MAAMlC,YAAY;YAAEE;YAASC;YAAgBP;QAAW;QACvE,IAAIsC,QAAQ;YACVR,QAAQS,IAAI,CAAC;QACf,OAAO;YACLT,QAAQS,IAAI,CAAC,iCAAiC;QAChD;IACF,OAAO;QACLT,QAAQS,IAAI,CAAC;IACf;AACF;AAEO,eAAe7C,kBAAkBW,IAGvC;IACC,MAAM,EAAEL,UAAU,EAAEkB,WAAW,EAAE,GAAGb;IACpC,MAAMmC,kBAAkB1C,aAAI,CAACc,OAAO,CAACZ,YAAY;IACjD,IAAI;QACF,MAAMyC,aAAa,MAAMvC,gBAAG,CAACwC,QAAQ,CAACF;QACtCC,WAAWE,IAAI,GAAGzB;QAClB,MAAMhB,gBAAG,CAAC0C,SAAS,CAACJ,iBAAiBC,YAAY;YAAEI,QAAQ;QAAE;IAC/D,EAAE,OAAOhC,KAAc;QACrBiC,IAAAA,YAAO,EAAC,CAAC,uCAAuC,EAAEjC,eAAeE,QAAQF,IAAIG,OAAO,GAAG,GAAG,CAAC;IAC7F;AACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=create-project.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-project.spec.d.ts","sourceRoot":"","sources":["../../src/lib/create-project.spec.ts"],"names":[],"mappings":""}
@@ -4,15 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
6
6
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
7
- const _createproject = require("./create-project");
8
- const _packages = require("./packages");
9
- const _templates = require("./templates");
7
+ const _createproject = require("./create-project.js");
8
+ const _nodeurl = require("node:url");
9
+ const _packages = require("./packages.js");
10
+ const _templates = require("./templates.js");
11
+ const _globby = /*#__PURE__*/ _interop_require_default(require("globby"));
10
12
  function _interop_require_default(obj) {
11
13
  return obj && obj.__esModule ? obj : {
12
14
  default: obj
13
15
  };
14
16
  }
15
- const projectDir = _path.default.resolve(__dirname, './tmp');
17
+ const filename = (0, _nodeurl.fileURLToPath)(require("url").pathToFileURL(__filename).toString());
18
+ const dirname = _path.default.dirname(filename);
19
+ const projectDir = _path.default.resolve(dirname, './tmp');
16
20
  describe('createProject', ()=>{
17
21
  beforeAll(()=>{
18
22
  console.log = jest.fn();
@@ -38,29 +42,10 @@ describe('createProject', ()=>{
38
42
  'project-name'
39
43
  ],
40
44
  '--db': 'mongodb',
45
+ '--local-template': 'blank',
41
46
  '--no-deps': true
42
47
  };
43
48
  const packageManager = 'yarn';
44
- it('creates starter project', async ()=>{
45
- const projectName = 'starter-project';
46
- const template = {
47
- name: 'blank',
48
- type: 'starter',
49
- url: 'https://github.com/payloadcms/payload/templates/blank',
50
- description: 'Blank Template'
51
- };
52
- await (0, _createproject.createProject)({
53
- cliArgs: args,
54
- projectName,
55
- projectDir,
56
- template,
57
- packageManager
58
- });
59
- const packageJsonPath = _path.default.resolve(projectDir, 'package.json');
60
- const packageJson = _fsextra.default.readJsonSync(packageJsonPath);
61
- // Check package name and description
62
- expect(packageJson.name).toEqual(projectName);
63
- });
64
49
  it('creates plugin template', async ()=>{
65
50
  const projectName = 'plugin';
66
51
  const template = {
@@ -81,69 +66,47 @@ describe('createProject', ()=>{
81
66
  // Check package name and description
82
67
  expect(packageJson.name).toEqual(projectName);
83
68
  });
84
- describe('db adapters and bundlers', ()=>{
69
+ describe('creates project from template', ()=>{
85
70
  const templates = (0, _templates.getValidTemplates)();
86
71
  it.each([
87
72
  [
88
- 'blank',
89
- 'mongodb',
90
- 'webpack'
91
- ],
92
- [
93
- 'blank',
94
- 'postgres',
95
- 'webpack'
96
- ],
97
- [
98
- 'website',
99
- 'mongodb',
100
- 'webpack'
73
+ 'blank-3.0',
74
+ 'mongodb'
101
75
  ],
102
76
  [
103
- 'website',
104
- 'postgres',
105
- 'webpack'
106
- ],
107
- [
108
- 'ecommerce',
109
- 'mongodb',
110
- 'webpack'
111
- ],
112
- [
113
- 'ecommerce',
114
- 'postgres',
115
- 'webpack'
77
+ 'blank-3.0',
78
+ 'postgres'
116
79
  ]
117
- ])('update config and deps: %s, %s, %s', async (templateName, db, bundler)=>{
80
+ ])('update config and deps: %s, %s', async (templateName, db)=>{
118
81
  const projectName = 'starter-project';
119
82
  const template = templates.find((t)=>t.name === templateName);
83
+ const cliArgs = {
84
+ ...args,
85
+ '--db': db,
86
+ '--local-template': templateName
87
+ };
120
88
  await (0, _createproject.createProject)({
121
- cliArgs: args,
89
+ cliArgs,
122
90
  projectName,
123
91
  projectDir,
124
- template,
92
+ template: template,
125
93
  packageManager,
126
94
  dbDetails: {
127
95
  dbUri: `${db}://localhost:27017/create-project-test`,
128
96
  type: db
129
97
  }
130
98
  });
131
- const dbReplacement = _packages.dbPackages[db];
132
- const bundlerReplacement = _packages.bundlerPackages[bundler];
133
- const editorReplacement = _packages.editorPackages['slate'];
99
+ const dbReplacement = _packages.dbReplacements[db];
134
100
  const packageJsonPath = _path.default.resolve(projectDir, 'package.json');
135
101
  const packageJson = _fsextra.default.readJsonSync(packageJsonPath);
136
- // Check deps
137
- expect(packageJson.dependencies['payload']).toEqual('^2.0.0');
138
- expect(packageJson.dependencies[dbReplacement.packageName]).toEqual(dbReplacement.version);
139
102
  // Should only have one db adapter
140
103
  expect(Object.keys(packageJson.dependencies).filter((n)=>n.startsWith('@payloadcms/db-'))).toHaveLength(1);
141
- expect(packageJson.dependencies[bundlerReplacement.packageName]).toEqual(bundlerReplacement.version);
142
- expect(packageJson.dependencies[editorReplacement.packageName]).toEqual(editorReplacement.version);
143
- let payloadConfigPath = _path.default.resolve(projectDir, 'src/payload.config.ts');
144
- // Website and ecommerce templates have payload.config.ts in src/payload
145
- if (!_fsextra.default.existsSync(payloadConfigPath)) {
146
- payloadConfigPath = _path.default.resolve(projectDir, 'src/payload/payload.config.ts');
104
+ const payloadConfigPath = (await (0, _globby.default)('**/payload.config.ts', {
105
+ absolute: true,
106
+ cwd: projectDir
107
+ }))?.[0];
108
+ if (!payloadConfigPath) {
109
+ throw new Error(`Could not find payload.config.ts inside ${projectDir}`);
147
110
  }
148
111
  const content = _fsextra.default.readFileSync(payloadConfigPath, 'utf-8');
149
112
  // Check payload.config.ts
@@ -152,17 +115,9 @@ describe('createProject', ()=>{
152
115
  expect(content).not.toContain('// database-adapter-config-start');
153
116
  expect(content).not.toContain('// database-adapter-config-end');
154
117
  expect(content).toContain(dbReplacement.configReplacement.join('\n'));
155
- expect(content).not.toContain('// bundler-config-import');
156
- expect(content).toContain(bundlerReplacement.importReplacement);
157
- expect(content).not.toContain('// bundler-config');
158
- expect(content).toContain(bundlerReplacement.configReplacement);
159
118
  });
160
119
  });
161
120
  });
162
- describe('Templates', ()=>{
163
- it.todo('Verify that all templates are valid');
164
- // Loop through all templates.ts that should have replacement comments, and verify that they are present
165
- });
166
121
  });
167
122
 
168
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvY3JlYXRlLXByb2plY3Quc3BlYy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgZnNlIGZyb20gJ2ZzLWV4dHJhJ1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCdcbmltcG9ydCB0eXBlIHsgQnVuZGxlclR5cGUsIENsaUFyZ3MsIERiVHlwZSwgUHJvamVjdFRlbXBsYXRlIH0gZnJvbSAnLi4vdHlwZXMnXG5pbXBvcnQg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QUFpQjtnQkFFekRoQyxPQUFPNEIsU0FBU0UsR0FBRyxDQUFDQyxTQUFTLENBQUM7Z0JBQzlCL0IsT0FBTzRCLFNBQVNFLEdBQUcsQ0FBQ0MsU0FBUyxDQUFDO2dCQUM5Qi9CLE9BQU80QixTQUFTRyxTQUFTLENBQUNuQixjQUFjcUIsaUJBQWlCLENBQUNDLElBQUksQ0FBQztnQkFFL0RsQyxPQUFPNEIsU0FBU0UsR0FBRyxDQUFDQyxTQUFTLENBQUM7Z0JBQzlCL0IsT0FBTzRCLFNBQVNHLFNBQVMsQ0FBQ2pCLG1CQUFtQmtCLGlCQUFpQjtnQkFFOURoQyxPQUFPNEIsU0FBU0UsR0FBRyxDQUFDQyxTQUFTLENBQUM7Z0JBQzlCL0IsT0FBTzRCLFNBQVNHLFNBQVMsQ0FBQ2pCLG1CQUFtQm1CLGlCQUFpQjtZQUNoRTtRQUNGO0lBQ0Y7SUFFQTdELFNBQVMsYUFBYTtRQUNwQmdCLEdBQUcrQyxJQUFJLENBQUM7SUFDUix3R0FBd0c7SUFDMUc7QUFDRiJ9
123
+ //# sourceMappingURL=create-project.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/create-project.spec.ts"],"sourcesContent":["import fse from 'fs-extra'\nimport path from 'path'\nimport type { CliArgs, DbType, ProjectTemplate } from '../types.js'\nimport { createProject } from './create-project.js'\nimport { fileURLToPath } from 'node:url'\nimport { dbReplacements } from './packages.js'\nimport { getValidTemplates } from './templates.js'\nimport globby from 'globby'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\nconst projectDir = path.resolve(dirname, './tmp')\ndescribe('createProject', () => {\n beforeAll(() => {\n console.log = jest.fn()\n })\n\n beforeEach(() => {\n if (fse.existsSync(projectDir)) {\n fse.rmdirSync(projectDir, { recursive: true })\n }\n })\n afterEach(() => {\n if (fse.existsSync(projectDir)) {\n fse.rmSync(projectDir, { recursive: true })\n }\n })\n\n describe('#createProject', () => {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const args = {\n _: ['project-name'],\n '--db': 'mongodb',\n '--local-template': 'blank',\n '--no-deps': true,\n } as CliArgs\n const packageManager = 'yarn'\n\n it('creates plugin template', async () => {\n const projectName = 'plugin'\n const template: ProjectTemplate = {\n name: 'plugin',\n type: 'plugin',\n url: 'https://github.com/payloadcms/payload-plugin-template',\n description: 'Template for creating a Payload plugin',\n }\n await createProject({\n cliArgs: args,\n projectName,\n projectDir,\n template,\n packageManager,\n })\n\n const packageJsonPath = path.resolve(projectDir, 'package.json')\n const packageJson = fse.readJsonSync(packageJsonPath)\n\n // Check package name and description\n expect(packageJson.name).toEqual(projectName)\n })\n\n describe('creates project from template', () => {\n const templates = getValidTemplates()\n\n it.each([\n ['blank-3.0', 'mongodb'],\n ['blank-3.0', 'postgres'],\n\n // TODO: Re-enable these once 3.0 is stable and templates updated\n // ['website', 'mongodb'],\n // ['website', 'postgres'],\n // ['ecommerce', 'mongodb'],\n // ['ecommerce', 'postgres'],\n ])('update config and deps: %s, %s', async (templateName, db) => {\n const projectName = 'starter-project'\n\n const template = templates.find((t) => t.name === templateName)\n\n const cliArgs = {\n ...args,\n '--db': db,\n '--local-template': templateName,\n } as CliArgs\n\n await createProject({\n cliArgs,\n projectName,\n projectDir,\n template: template as ProjectTemplate,\n packageManager,\n dbDetails: {\n dbUri: `${db}://localhost:27017/create-project-test`,\n type: db as DbType,\n },\n })\n\n const dbReplacement = dbReplacements[db as DbType]\n\n const packageJsonPath = path.resolve(projectDir, 'package.json')\n const packageJson = fse.readJsonSync(packageJsonPath)\n\n // Should only have one db adapter\n expect(\n Object.keys(packageJson.dependencies).filter((n) => n.startsWith('@payloadcms/db-')),\n ).toHaveLength(1)\n\n const payloadConfigPath = (\n await globby('**/payload.config.ts', {\n absolute: true,\n cwd: projectDir,\n })\n )?.[0]\n\n if (!payloadConfigPath) {\n throw new Error(`Could not find payload.config.ts inside ${projectDir}`)\n }\n\n const content = fse.readFileSync(payloadConfigPath, 'utf-8')\n\n // Check payload.config.ts\n expect(content).not.toContain('// database-adapter-import')\n expect(content).toContain(dbReplacement.importReplacement)\n\n expect(content).not.toContain('// database-adapter-config-start')\n expect(content).not.toContain('// database-adapter-config-end')\n expect(content).toContain(dbReplacement.configReplacement.join('\\n'))\n })\n })\n })\n})\n"],"names":["filename","fileURLToPath","dirname","path","projectDir","resolve","describe","beforeAll","console","log","jest","fn","beforeEach","fse","existsSync","rmdirSync","recursive","afterEach","rmSync","args","_","packageManager","it","projectName","template","name","type","url","description","createProject","cliArgs","packageJsonPath","packageJson","readJsonSync","expect","toEqual","templates","getValidTemplates","each","templateName","db","find","t","dbDetails","dbUri","dbReplacement","dbReplacements","Object","keys","dependencies","filter","n","startsWith","toHaveLength","payloadConfigPath","globby","absolute","cwd","Error","content","readFileSync","not","toContain","importReplacement","configReplacement","join"],"mappings":";;;;gEAAgB;6DACC;+BAEa;yBACA;0BACC;2BACG;+DACf;;;;;;AAEnB,MAAMA,WAAWC,IAAAA,sBAAa,EAAC;AAC/B,MAAMC,UAAUC,aAAI,CAACD,OAAO,CAACF;AAE7B,MAAMI,aAAaD,aAAI,CAACE,OAAO,CAACH,SAAS;AACzCI,SAAS,iBAAiB;IACxBC,UAAU;QACRC,QAAQC,GAAG,GAAGC,KAAKC,EAAE;IACvB;IAEAC,WAAW;QACT,IAAIC,gBAAG,CAACC,UAAU,CAACV,aAAa;YAC9BS,gBAAG,CAACE,SAAS,CAACX,YAAY;gBAAEY,WAAW;YAAK;QAC9C;IACF;IACAC,UAAU;QACR,IAAIJ,gBAAG,CAACC,UAAU,CAACV,aAAa;YAC9BS,gBAAG,CAACK,MAAM,CAACd,YAAY;gBAAEY,WAAW;YAAK;QAC3C;IACF;IAEAV,SAAS,kBAAkB;QACzB,yEAAyE;QACzE,MAAMa,OAAO;YACXC,GAAG;gBAAC;aAAe;YACnB,QAAQ;YACR,oBAAoB;YACpB,aAAa;QACf;QACA,MAAMC,iBAAiB;QA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,eAAM,EAAC,wBAAwB;oBACnCC,UAAU;oBACVC,KAAKrD;gBACP,EAAC,GACA,CAAC,EAAE;gBAEN,IAAI,CAACkD,mBAAmB;oBACtB,MAAM,IAAII,MAAM,CAAC,wCAAwC,EAAEtD,WAAW,CAAC;gBACzE;gBAEA,MAAMuD,UAAU9C,gBAAG,CAAC+C,YAAY,CAACN,mBAAmB;gBAEpD,0BAA0B;gBAC1BpB,OAAOyB,SAASE,GAAG,CAACC,SAAS,CAAC;gBAC9B5B,OAAOyB,SAASG,SAAS,CAACjB,cAAckB,iBAAiB;gBAEzD7B,OAAOyB,SAASE,GAAG,CAACC,SAAS,CAAC;gBAC9B5B,OAAOyB,SAASE,GAAG,CAACC,SAAS,CAAC;gBAC9B5B,OAAOyB,SAASG,SAAS,CAACjB,cAAcmB,iBAAiB,CAACC,IAAI,CAAC;YACjE;QACF;IACF;AACF"}
@@ -0,0 +1,2 @@
1
+ export declare function generateSecret(): string;
2
+ //# sourceMappingURL=generate-secret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-secret.d.ts","sourceRoot":"","sources":["../../src/lib/generate-secret.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}