create-payload-app 0.5.0-beta.1 → 0.5.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -56,7 +56,7 @@ var packages_1 = require("./packages");
|
|
56
56
|
/** Update payload config with necessary imports and adapters */
|
57
57
|
function configurePayloadConfig(args) {
|
58
58
|
return __awaiter(this, void 0, void 0, function () {
|
59
|
-
var packageJsonPath, packageObj, dbPackage, bundlerPackage, err_1, possiblePaths, payloadConfigPath_1, configContent, configLines_1, dbReplacement_1, bundlerReplacement_1, dbConfigStartLineIndex_1, dbConfigEndLineIndex_1;
|
59
|
+
var packageJsonPath, packageObj, dbPackage, bundlerPackage, editorPackage, err_1, possiblePaths, payloadConfigPath_1, configContent, configLines_1, dbReplacement_1, bundlerReplacement_1, editorReplacement_1, dbConfigStartLineIndex_1, dbConfigEndLineIndex_1;
|
60
60
|
return __generator(this, function (_a) {
|
61
61
|
switch (_a.label) {
|
62
62
|
case 0:
|
@@ -72,8 +72,10 @@ function configurePayloadConfig(args) {
|
|
72
72
|
packageObj = _a.sent();
|
73
73
|
dbPackage = packages_1.dbPackages[args.dbDetails.type];
|
74
74
|
bundlerPackage = packages_1.bundlerPackages['webpack'];
|
75
|
+
editorPackage = packages_1.editorPackages['lexical'];
|
75
76
|
packageObj.dependencies[dbPackage.packageName] = 'latest';
|
76
77
|
packageObj.dependencies[bundlerPackage.packageName] = 'latest';
|
78
|
+
packageObj.dependencies[editorPackage.packageName] = 'latest';
|
77
79
|
return [4 /*yield*/, fs_extra_1.default.writeJson(packageJsonPath, packageObj, { spaces: 2 })];
|
78
80
|
case 3:
|
79
81
|
_a.sent();
|
@@ -101,6 +103,7 @@ function configurePayloadConfig(args) {
|
|
101
103
|
configLines_1 = configContent.split('\n');
|
102
104
|
dbReplacement_1 = packages_1.dbPackages[args.dbDetails.type];
|
103
105
|
bundlerReplacement_1 = packages_1.bundlerPackages['webpack'];
|
106
|
+
editorReplacement_1 = packages_1.editorPackages['lexical'];
|
104
107
|
configLines_1.forEach(function (l, i) {
|
105
108
|
if (l.includes('// database-adapter-import')) {
|
106
109
|
configLines_1[i] = dbReplacement_1.importReplacement;
|
@@ -111,6 +114,12 @@ function configurePayloadConfig(args) {
|
|
111
114
|
if (l.includes('// bundler-config')) {
|
112
115
|
configLines_1[i] = bundlerReplacement_1.configReplacement;
|
113
116
|
}
|
117
|
+
if (l.includes('// editor-import')) {
|
118
|
+
configLines_1[i] = editorReplacement_1.importReplacement;
|
119
|
+
}
|
120
|
+
if (l.includes('// editor-config')) {
|
121
|
+
configLines_1[i] = editorReplacement_1.configReplacement;
|
122
|
+
}
|
114
123
|
if (l.includes('// database-adapter-config-start')) {
|
115
124
|
dbConfigStartLineIndex_1 = i;
|
116
125
|
}
|
package/dist/lib/packages.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.bundlerPackages = exports.dbPackages = void 0;
|
3
|
+
exports.editorPackages = exports.bundlerPackages = exports.dbPackages = void 0;
|
4
4
|
var mongodbReplacement = {
|
5
5
|
packageName: '@payloadcms/db-mongodb',
|
6
6
|
importReplacement: "import { mongooseAdapter } from '@payloadcms/db-mongodb'",
|
@@ -41,3 +41,15 @@ exports.bundlerPackages = {
|
|
41
41
|
webpack: webpackReplacement,
|
42
42
|
vite: viteReplacement,
|
43
43
|
};
|
44
|
+
exports.editorPackages = {
|
45
|
+
slate: {
|
46
|
+
packageName: '@payloadcms/richtext-slate',
|
47
|
+
importReplacement: "import { slateEditor } from '@payloadcms/richtext-slate'",
|
48
|
+
configReplacement: ' editor: slateEditor({}),',
|
49
|
+
},
|
50
|
+
lexical: {
|
51
|
+
packageName: '@payloadcms/richtext-lexical',
|
52
|
+
importReplacement: "import { lexicalEditor } from '@payloadcms/richtext-lexical'",
|
53
|
+
configReplacement: ' editor: lexicalEditor({}),',
|
54
|
+
},
|
55
|
+
};
|