create-payload-app 0.5.0-beta.9 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -67,19 +67,16 @@ function configurePayloadConfig(args) {
|
|
67
67
|
_a.label = 1;
|
68
68
|
case 1:
|
69
69
|
_a.trys.push([1, 4, , 5]);
|
70
|
-
return [4 /*yield*/, fs_extra_1.default.readJson(packageJsonPath)
|
71
|
-
// TODO: Likely revert this once we go to latest
|
72
|
-
];
|
70
|
+
return [4 /*yield*/, fs_extra_1.default.readJson(packageJsonPath)];
|
73
71
|
case 2:
|
74
72
|
packageObj = _a.sent();
|
75
|
-
|
76
|
-
packageObj.dependencies['payload'] = 'beta';
|
73
|
+
packageObj.dependencies['payload'] = '^2.0.0';
|
77
74
|
dbPackage = packages_1.dbPackages[args.dbDetails.type];
|
78
75
|
bundlerPackage = packages_1.bundlerPackages['webpack'];
|
79
76
|
editorPackage = packages_1.editorPackages['slate'];
|
80
|
-
packageObj.dependencies[dbPackage.packageName] =
|
81
|
-
packageObj.dependencies[bundlerPackage.packageName] =
|
82
|
-
packageObj.dependencies[editorPackage.packageName] =
|
77
|
+
packageObj.dependencies[dbPackage.packageName] = dbPackage.version;
|
78
|
+
packageObj.dependencies[bundlerPackage.packageName] = bundlerPackage.version;
|
79
|
+
packageObj.dependencies[editorPackage.packageName] = editorPackage.version;
|
83
80
|
return [4 /*yield*/, fs_extra_1.default.writeJson(packageJsonPath, packageObj, { spaces: 2 })];
|
84
81
|
case 3:
|
85
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:
|
@@ -137,7 +137,7 @@ describe('createProject', function () {
|
|
137
137
|
template = {
|
138
138
|
name: 'blank',
|
139
139
|
type: 'starter',
|
140
|
-
url: 'https://github.com/payloadcms/payload/templates/blank
|
140
|
+
url: 'https://github.com/payloadcms/payload/templates/blank',
|
141
141
|
description: 'Blank Template',
|
142
142
|
};
|
143
143
|
return [4 /*yield*/, (0, create_project_1.createProject)({
|
@@ -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[
|
162
|
-
expect(packageJson.dependencies[
|
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
|
});
|
package/dist/lib/packages.js
CHANGED
@@ -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,
|
@@ -30,12 +32,14 @@ var webpackReplacement = {
|
|
30
32
|
packageName: '@payloadcms/bundler-webpack',
|
31
33
|
importReplacement: "import { webpackBundler } from '@payloadcms/bundler-webpack'",
|
32
34
|
// Replacement of line containing `// bundler-config`
|
33
|
-
configReplacement: '
|
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/dist/lib/templates.js
CHANGED
@@ -64,19 +64,19 @@ function getValidTemplates() {
|
|
64
64
|
{
|
65
65
|
name: 'blank',
|
66
66
|
type: 'starter',
|
67
|
-
url: 'https://github.com/payloadcms/payload/templates/blank
|
67
|
+
url: 'https://github.com/payloadcms/payload/templates/blank',
|
68
68
|
description: 'Blank Template',
|
69
69
|
},
|
70
70
|
{
|
71
71
|
name: 'website',
|
72
72
|
type: 'starter',
|
73
|
-
url: 'https://github.com/payloadcms/payload/templates/website
|
73
|
+
url: 'https://github.com/payloadcms/payload/templates/website',
|
74
74
|
description: 'Website Template',
|
75
75
|
},
|
76
76
|
{
|
77
77
|
name: 'ecommerce',
|
78
78
|
type: 'starter',
|
79
|
-
url: 'https://github.com/payloadcms/payload/templates/ecommerce
|
79
|
+
url: 'https://github.com/payloadcms/payload/templates/ecommerce',
|
80
80
|
description: 'E-commerce Template',
|
81
81
|
},
|
82
82
|
{
|