create-payload-app 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -70,13 +70,13 @@ function configurePayloadConfig(args) {
70
70
  return [4 /*yield*/, fs_extra_1.default.readJson(packageJsonPath)];
71
71
  case 2:
72
72
  packageObj = _a.sent();
73
- packageObj.dependencies['payload'] = 'latest';
73
+ packageObj.dependencies['payload'] = '^2.0.0';
74
74
  dbPackage = packages_1.dbPackages[args.dbDetails.type];
75
75
  bundlerPackage = packages_1.bundlerPackages['webpack'];
76
76
  editorPackage = packages_1.editorPackages['slate'];
77
- packageObj.dependencies[dbPackage.packageName] = 'latest';
78
- packageObj.dependencies[bundlerPackage.packageName] = 'latest';
79
- packageObj.dependencies[editorPackage.packageName] = 'latest';
77
+ packageObj.dependencies[dbPackage.packageName] = dbPackage.version;
78
+ packageObj.dependencies[bundlerPackage.packageName] = bundlerPackage.version;
79
+ packageObj.dependencies[editorPackage.packageName] = editorPackage.version;
80
80
  return [4 /*yield*/, fs_extra_1.default.writeJson(packageJsonPath, packageObj, { spaces: 2 })];
81
81
  case 3:
82
82
  _a.sent();
@@ -129,7 +129,7 @@ describe('createProject', function () {
129
129
  ['mongodb', 'webpack'],
130
130
  ['postgres', 'webpack'],
131
131
  ])('update config and deps: %s, %s', function (db, bundler) { return __awaiter(void 0, void 0, void 0, function () {
132
- var projectName, template, dbReplacement, bundlerReplacement, packageJsonPath, packageJson, payloadConfigPath, content;
132
+ var projectName, template, dbReplacement, bundlerReplacement, editorReplacement, packageJsonPath, packageJson, payloadConfigPath, content;
133
133
  return __generator(this, function (_a) {
134
134
  switch (_a.label) {
135
135
  case 0:
@@ -155,11 +155,14 @@ describe('createProject', function () {
155
155
  _a.sent();
156
156
  dbReplacement = packages_1.dbPackages[db];
157
157
  bundlerReplacement = packages_1.bundlerPackages[bundler];
158
+ editorReplacement = packages_1.editorPackages['slate'];
158
159
  packageJsonPath = path_1.default.resolve(projectDir, 'package.json');
159
160
  packageJson = fs_extra_1.default.readJsonSync(packageJsonPath);
160
161
  // Check deps
161
- expect(packageJson.dependencies[dbReplacement.packageName]).toBeDefined();
162
- expect(packageJson.dependencies[bundlerReplacement.packageName]).toBeDefined();
162
+ expect(packageJson.dependencies['payload']).toEqual('^2.0.0');
163
+ expect(packageJson.dependencies[dbReplacement.packageName]).toEqual(dbReplacement.version);
164
+ expect(packageJson.dependencies[bundlerReplacement.packageName]).toEqual(bundlerReplacement.version);
165
+ expect(packageJson.dependencies[editorReplacement.packageName]).toEqual(editorReplacement.version);
163
166
  payloadConfigPath = path_1.default.resolve(projectDir, 'src/payload.config.ts');
164
167
  content = fs_extra_1.default.readFileSync(payloadConfigPath, 'utf-8');
165
168
  // Check payload.config.ts
@@ -178,4 +181,8 @@ describe('createProject', function () {
178
181
  }); });
179
182
  });
180
183
  });
184
+ describe('Templates', function () {
185
+ it.todo('Verify that all templates are valid');
186
+ // Loop through all templates.ts that should have replacement comments, and verify that they are present
187
+ });
181
188
  });
@@ -10,6 +10,7 @@ var mongodbReplacement = {
10
10
  ' url: process.env.DATABASE_URI,',
11
11
  ' }),',
12
12
  ],
13
+ version: '^1.0.0',
13
14
  };
14
15
  var postgresReplacement = {
15
16
  packageName: '@payloadcms/db-postgres',
@@ -21,6 +22,7 @@ var postgresReplacement = {
21
22
  ' },',
22
23
  ' }),',
23
24
  ],
25
+ version: '^0.x', // up to, not including 1.0.0
24
26
  };
25
27
  exports.dbPackages = {
26
28
  mongodb: mongodbReplacement,
@@ -31,11 +33,13 @@ var webpackReplacement = {
31
33
  importReplacement: "import { webpackBundler } from '@payloadcms/bundler-webpack'",
32
34
  // Replacement of line containing `// bundler-config`
33
35
  configReplacement: ' bundler: webpackBundler(),',
36
+ version: '^1.0.0',
34
37
  };
35
38
  var viteReplacement = {
36
39
  packageName: '@payloadcms/bundler-vite',
37
40
  importReplacement: "import { viteBundler } from '@payloadcms/bundler-vite'",
38
41
  configReplacement: ' bundler: viteBundler(),',
42
+ version: '^0.x', // up to, not including 1.0.0
39
43
  };
40
44
  exports.bundlerPackages = {
41
45
  webpack: webpackReplacement,
@@ -46,10 +50,12 @@ exports.editorPackages = {
46
50
  packageName: '@payloadcms/richtext-slate',
47
51
  importReplacement: "import { slateEditor } from '@payloadcms/richtext-slate'",
48
52
  configReplacement: ' editor: slateEditor({}),',
53
+ version: '^1.0.0',
49
54
  },
50
55
  lexical: {
51
56
  packageName: '@payloadcms/richtext-lexical',
52
57
  importReplacement: "import { lexicalEditor } from '@payloadcms/richtext-lexical'",
53
58
  configReplacement: ' editor: lexicalEditor({}),',
59
+ version: '^0.x', // up to, not including 1.0.0
54
60
  },
55
61
  };
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "prompts": "^2.4.2",
38
38
  "terminal-link": "^2.1.1"
39
39
  },
40
- "version": "0.5.0",
40
+ "version": "0.5.1",
41
41
  "devDependencies": {
42
42
  "@types/command-exists": "^1.2.0",
43
43
  "@types/degit": "^2.8.3",