create-payload-app 0.3.32 → 0.3.34-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/create-project.js +2 -2
- package/dist/lib/templates.js +10 -2
- package/dist/main.js +21 -13
- package/dist/utils/messages.js +2 -2
- package/package.json +1 -1
@@ -166,8 +166,8 @@ function createProject(args, projectDir, template, packageManager) {
|
|
166
166
|
case 0: return [4 /*yield*/, createOrFindProjectDir(projectDir)];
|
167
167
|
case 1:
|
168
168
|
_a.sent();
|
169
|
-
console.log("\n Creating
|
170
|
-
if (!(
|
169
|
+
console.log("\n Creating project in ".concat(chalk_1.default.green(path_1.default.resolve(projectDir)), "\n"));
|
170
|
+
if (!('url' in template)) return [3 /*break*/, 3];
|
171
171
|
emitter = (0, degit_1.default)(template.url);
|
172
172
|
return [4 /*yield*/, emitter.clone(projectDir)];
|
173
173
|
case 2:
|
package/dist/lib/templates.js
CHANGED
@@ -68,7 +68,7 @@ function validateTemplate(templateName) {
|
|
68
68
|
exports.validateTemplate = validateTemplate;
|
69
69
|
function getValidTemplates() {
|
70
70
|
return __awaiter(this, void 0, void 0, function () {
|
71
|
-
var templates, starters;
|
71
|
+
var templates, starters, pluginTemplates;
|
72
72
|
return __generator(this, function (_a) {
|
73
73
|
templates = [
|
74
74
|
{
|
@@ -122,7 +122,15 @@ function getValidTemplates() {
|
|
122
122
|
description: 'E-commerce template for Payload Cloud',
|
123
123
|
},
|
124
124
|
];
|
125
|
-
|
125
|
+
pluginTemplates = [
|
126
|
+
{
|
127
|
+
name: 'plugin',
|
128
|
+
type: 'plugin',
|
129
|
+
url: 'https://github.com/payloadcms/payload-plugin-template',
|
130
|
+
description: 'Template for creating a Payload plugin',
|
131
|
+
},
|
132
|
+
];
|
133
|
+
return [2 /*return*/, __spreadArray(__spreadArray(__spreadArray([], templates, true), starters, true), pluginTemplates, true)];
|
126
134
|
});
|
127
135
|
});
|
128
136
|
}
|
package/dist/main.js
CHANGED
@@ -72,11 +72,11 @@ var Main = /** @class */ (function () {
|
|
72
72
|
}
|
73
73
|
Main.prototype.init = function () {
|
74
74
|
return __awaiter(this, void 0, void 0, function () {
|
75
|
-
var _a, _b, templateArg, valid, _c, _d, projectName, validTemplates, template,
|
75
|
+
var _a, _b, templateArg, valid, _c, _d, projectName, validTemplates, template, projectDir, packageManager, databaseUri, payloadSecret, error_1;
|
76
76
|
return __generator(this, function (_e) {
|
77
77
|
switch (_e.label) {
|
78
78
|
case 0:
|
79
|
-
_e.trys.push([0,
|
79
|
+
_e.trys.push([0, 18, , 19]);
|
80
80
|
if (!this.args['--help']) return [3 /*break*/, 2];
|
81
81
|
_b = (_a = console).log;
|
82
82
|
return [4 /*yield*/, (0, messages_1.helpMessage)()];
|
@@ -108,16 +108,17 @@ var Main = /** @class */ (function () {
|
|
108
108
|
return [4 /*yield*/, (0, parse_template_1.parseTemplate)(this.args, validTemplates)];
|
109
109
|
case 8:
|
110
110
|
template = _e.sent();
|
111
|
-
|
111
|
+
projectDir = projectName === '.' ? process.cwd() : "./".concat((0, slugify_1.default)(projectName));
|
112
|
+
return [4 /*yield*/, getPackageManager(this.args)];
|
112
113
|
case 9:
|
114
|
+
packageManager = _e.sent();
|
115
|
+
if (!(template.type !== 'plugin')) return [3 /*break*/, 15];
|
116
|
+
return [4 /*yield*/, (0, get_db_connection_1.getDatabaseConnection)(this.args, projectName)];
|
117
|
+
case 10:
|
113
118
|
databaseUri = _e.sent();
|
114
119
|
return [4 /*yield*/, (0, generate_secret_1.generateSecret)()];
|
115
|
-
case 10:
|
116
|
-
payloadSecret = _e.sent();
|
117
|
-
projectDir = projectName === '.' ? process.cwd() : "./".concat((0, slugify_1.default)(projectName));
|
118
|
-
return [4 /*yield*/, getPackageManager(this.args)];
|
119
120
|
case 11:
|
120
|
-
|
121
|
+
payloadSecret = _e.sent();
|
121
122
|
if (!!this.args['--dry-run']) return [3 /*break*/, 14];
|
122
123
|
return [4 /*yield*/, (0, create_project_1.createProject)(this.args, projectDir, template, packageManager)];
|
123
124
|
case 12:
|
@@ -131,15 +132,22 @@ var Main = /** @class */ (function () {
|
|
131
132
|
case 13:
|
132
133
|
_e.sent();
|
133
134
|
_e.label = 14;
|
134
|
-
case 14:
|
135
|
+
case 14: return [3 /*break*/, 17];
|
136
|
+
case 15:
|
137
|
+
if (!!this.args['--dry-run']) return [3 /*break*/, 17];
|
138
|
+
return [4 /*yield*/, (0, create_project_1.createProject)(this.args, projectDir, template, packageManager)];
|
139
|
+
case 16:
|
140
|
+
_e.sent();
|
141
|
+
_e.label = 17;
|
142
|
+
case 17:
|
135
143
|
(0, log_1.success)('Payload project successfully created');
|
136
144
|
console.log((0, messages_1.successMessage)(projectDir, packageManager));
|
137
|
-
return [3 /*break*/,
|
138
|
-
case
|
145
|
+
return [3 /*break*/, 19];
|
146
|
+
case 18:
|
139
147
|
error_1 = _e.sent();
|
140
148
|
console.log(error_1);
|
141
|
-
return [3 /*break*/,
|
142
|
-
case
|
149
|
+
return [3 /*break*/, 19];
|
150
|
+
case 19: return [2 /*return*/];
|
143
151
|
}
|
144
152
|
});
|
145
153
|
});
|
package/dist/utils/messages.js
CHANGED
@@ -61,7 +61,7 @@ function helpMessage() {
|
|
61
61
|
case 0: return [4 /*yield*/, (0, templates_1.getValidTemplates)()];
|
62
62
|
case 1:
|
63
63
|
validTemplates = _a.sent();
|
64
|
-
return [2 /*return*/, (0, chalk_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n {bold USAGE}\n\n {dim $} {bold npx create-payload-app}\n {dim $} {bold npx create-payload-app} my-project\n {dim $} {bold npx create-payload-app} -n my-project -t blog\n\n {bold OPTIONS}\n\n -n {underline my-payload-app}
|
64
|
+
return [2 /*return*/, (0, chalk_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n {bold USAGE}\n\n {dim $} {bold npx create-payload-app}\n {dim $} {bold npx create-payload-app} my-project\n {dim $} {bold npx create-payload-app} -n my-project -t blog\n\n {bold OPTIONS}\n\n -n {underline my-payload-app} Set project name\n -t {underline template_name} Choose specific template\n\n {dim Available templates: ", "}\n\n --use-npm Use npm to install dependencies\n --no-deps Do not install any dependencies\n -h Show help\n"], ["\n {bold USAGE}\n\n {dim $} {bold npx create-payload-app}\n {dim $} {bold npx create-payload-app} my-project\n {dim $} {bold npx create-payload-app} -n my-project -t blog\n\n {bold OPTIONS}\n\n -n {underline my-payload-app} Set project name\n -t {underline template_name} Choose specific template\n\n {dim Available templates: ", "}\n\n --use-npm Use npm to install dependencies\n --no-deps Do not install any dependencies\n -h Show help\n"])), formatTemplates(validTemplates))];
|
65
65
|
}
|
66
66
|
});
|
67
67
|
});
|
@@ -69,7 +69,7 @@ function helpMessage() {
|
|
69
69
|
exports.helpMessage = helpMessage;
|
70
70
|
function formatTemplates(templates) {
|
71
71
|
return "\n\n".concat(spacer).concat(templates
|
72
|
-
.map(function (t) { return "".concat(t.name).concat(' '.repeat(
|
72
|
+
.map(function (t) { return "".concat(t.name).concat(' '.repeat(28 - t.name.length)).concat(t.description); })
|
73
73
|
.join("\n".concat(spacer)));
|
74
74
|
}
|
75
75
|
function successMessage(projectDir, packageManager) {
|