create-payload-app 0.5.0-beta.1 → 0.5.0-beta.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +1 -1
- package/dist/lib/configure-payload-config.js +16 -3
- package/dist/lib/create-project.js +1 -1
- package/dist/lib/create-project.test.js +2 -2
- package/dist/lib/generate-secret.js +1 -1
- package/dist/lib/packages.js +14 -2
- package/dist/lib/parse-project-name.js +1 -1
- package/dist/lib/parse-template.js +1 -1
- package/dist/lib/select-db.js +3 -3
- package/dist/lib/templates.js +4 -4
- package/dist/lib/write-env-file.js +1 -1
- package/dist/main.js +2 -1
- package/dist/utils/messages.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
@@ -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:
|
@@ -67,13 +67,19 @@ 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)
|
70
|
+
return [4 /*yield*/, fs_extra_1.default.readJson(packageJsonPath)
|
71
|
+
// TODO: Likely revert this once we go to latest
|
72
|
+
];
|
71
73
|
case 2:
|
72
74
|
packageObj = _a.sent();
|
75
|
+
// TODO: Likely revert this once we go to latest
|
76
|
+
packageObj.dependencies['payload'] = 'beta';
|
73
77
|
dbPackage = packages_1.dbPackages[args.dbDetails.type];
|
74
78
|
bundlerPackage = packages_1.bundlerPackages['webpack'];
|
79
|
+
editorPackage = packages_1.editorPackages['slate'];
|
75
80
|
packageObj.dependencies[dbPackage.packageName] = 'latest';
|
76
81
|
packageObj.dependencies[bundlerPackage.packageName] = 'latest';
|
82
|
+
packageObj.dependencies[editorPackage.packageName] = 'latest';
|
77
83
|
return [4 /*yield*/, fs_extra_1.default.writeJson(packageJsonPath, packageObj, { spaces: 2 })];
|
78
84
|
case 3:
|
79
85
|
_a.sent();
|
@@ -101,6 +107,7 @@ function configurePayloadConfig(args) {
|
|
101
107
|
configLines_1 = configContent.split('\n');
|
102
108
|
dbReplacement_1 = packages_1.dbPackages[args.dbDetails.type];
|
103
109
|
bundlerReplacement_1 = packages_1.bundlerPackages['webpack'];
|
110
|
+
editorReplacement_1 = packages_1.editorPackages['slate'];
|
104
111
|
configLines_1.forEach(function (l, i) {
|
105
112
|
if (l.includes('// database-adapter-import')) {
|
106
113
|
configLines_1[i] = dbReplacement_1.importReplacement;
|
@@ -111,6 +118,12 @@ function configurePayloadConfig(args) {
|
|
111
118
|
if (l.includes('// bundler-config')) {
|
112
119
|
configLines_1[i] = bundlerReplacement_1.configReplacement;
|
113
120
|
}
|
121
|
+
if (l.includes('// editor-import')) {
|
122
|
+
configLines_1[i] = editorReplacement_1.importReplacement;
|
123
|
+
}
|
124
|
+
if (l.includes('// editor-config')) {
|
125
|
+
configLines_1[i] = editorReplacement_1.configReplacement;
|
126
|
+
}
|
114
127
|
if (l.includes('// database-adapter-config-start')) {
|
115
128
|
dbConfigStartLineIndex_1 = i;
|
116
129
|
}
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[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)({
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
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'",
|
@@ -16,7 +16,7 @@ var postgresReplacement = {
|
|
16
16
|
importReplacement: "import { postgresAdapter } from '@payloadcms/db-postgres'",
|
17
17
|
configReplacement: [
|
18
18
|
' db: postgresAdapter({',
|
19
|
-
'
|
19
|
+
' pool: {',
|
20
20
|
' connectionString: process.env.DATABASE_URI,',
|
21
21
|
' },',
|
22
22
|
' }),',
|
@@ -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
|
+
};
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
package/dist/lib/select-db.js
CHANGED
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
@@ -50,7 +50,7 @@ var dbChoiceRecord = {
|
|
50
50
|
},
|
51
51
|
postgres: {
|
52
52
|
value: 'postgres',
|
53
|
-
title: 'PostgreSQL',
|
53
|
+
title: 'PostgreSQL (beta)',
|
54
54
|
dbConnectionPrefix: 'postgres://127.0.0.1:5432/',
|
55
55
|
},
|
56
56
|
};
|
@@ -94,7 +94,7 @@ function selectDb(args, projectName) {
|
|
94
94
|
return [4 /*yield*/, (0, prompts_1.default)({
|
95
95
|
type: 'text',
|
96
96
|
name: 'value',
|
97
|
-
message: "Enter ".concat(dbChoice.title, " connection string"),
|
97
|
+
message: "Enter ".concat(dbChoice.title.split(' ')[0], " connection string"),
|
98
98
|
initial: "".concat(dbChoice.dbConnectionPrefix).concat(projectName === '.'
|
99
99
|
? "payload-".concat(getRandomDigitSuffix())
|
100
100
|
: (0, slugify_1.default)(projectName)),
|
package/dist/lib/templates.js
CHANGED
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
@@ -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
|
{
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
package/dist/main.js
CHANGED
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
15
|
function step(op) {
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
20
|
switch (op[0]) {
|
@@ -67,6 +67,7 @@ var Main = /** @class */ (function () {
|
|
67
67
|
'--no-deps': Boolean,
|
68
68
|
'--dry-run': Boolean,
|
69
69
|
'--beta': Boolean,
|
70
|
+
'-d': '--db',
|
70
71
|
'-h': '--help',
|
71
72
|
'-n': '--name',
|
72
73
|
'-t': '--template',
|
package/dist/utils/messages.js
CHANGED
@@ -18,7 +18,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
18
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
19
19
|
function step(op) {
|
20
20
|
if (f) throw new TypeError("Generator is already executing.");
|
21
|
-
while (_) try {
|
21
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
22
22
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
23
23
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
24
24
|
switch (op[0]) {
|