create-payload-app 0.5.1 → 1.0.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +10 -53
- package/dist/lib/configure-payload-config.js +97 -142
- package/dist/lib/create-project.js +101 -174
- package/dist/lib/create-project.spec.js +148 -168
- package/dist/lib/generate-secret.js +12 -44
- package/dist/lib/packages.js +52 -32
- package/dist/lib/parse-project-name.js +29 -67
- package/dist/lib/parse-template.js +42 -80
- package/dist/lib/select-db.js +62 -105
- package/dist/lib/templates.js +63 -97
- package/dist/lib/write-env-file.js +51 -106
- package/dist/main.js +118 -198
- package/dist/types.js +5 -1
- package/dist/utils/log.js +40 -19
- package/dist/utils/messages.js +71 -73
- package/package.json +8 -39
- package/.vscode/launch.json +0 -13
@@ -1,109 +1,54 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
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
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "writeEnvFile", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return writeEnvFile;
|
36
9
|
}
|
37
|
-
};
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
var log_1 = require("../utils/log");
|
46
|
-
/** Parse and swap .env.example values and write .env */
|
47
|
-
function writeEnvFile(args) {
|
48
|
-
return __awaiter(this, void 0, void 0, function () {
|
49
|
-
var databaseUri, payloadSecret, template, projectDir, envFile, envWithValues, content, err_1;
|
50
|
-
return __generator(this, function (_a) {
|
51
|
-
switch (_a.label) {
|
52
|
-
case 0:
|
53
|
-
databaseUri = args.databaseUri, payloadSecret = args.payloadSecret, template = args.template, projectDir = args.projectDir;
|
54
|
-
_a.label = 1;
|
55
|
-
case 1:
|
56
|
-
_a.trys.push([1, 7, , 8]);
|
57
|
-
if (!(template.type === 'starter' &&
|
58
|
-
fs_extra_1.default.existsSync(path_1.default.join(projectDir, '.env.example')))) return [3 /*break*/, 4];
|
59
|
-
return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.join(projectDir, '.env.example'), 'utf8')];
|
60
|
-
case 2:
|
61
|
-
envFile = _a.sent();
|
62
|
-
envWithValues = envFile
|
63
|
-
.split('\n')
|
64
|
-
.filter(function (e) { return e; })
|
65
|
-
.map(function (line) {
|
66
|
-
if (line.startsWith('#') || !line.includes('='))
|
67
|
-
return line;
|
68
|
-
var split = line.split('=');
|
69
|
-
var key = split[0];
|
70
|
-
var value = split[1];
|
71
|
-
if (key === 'MONGODB_URI' ||
|
72
|
-
key === 'MONGO_URL' ||
|
73
|
-
key === 'DATABASE_URI') {
|
74
|
-
value = databaseUri;
|
75
|
-
}
|
76
|
-
if (key === 'PAYLOAD_SECRET' || key === 'PAYLOAD_SECRET_KEY') {
|
77
|
-
value = payloadSecret;
|
78
|
-
}
|
79
|
-
return "".concat(key, "=").concat(value);
|
80
|
-
});
|
81
|
-
// Write new .env file
|
82
|
-
return [4 /*yield*/, fs_extra_1.default.writeFile(path_1.default.join(projectDir, '.env'), envWithValues.join('\n'))];
|
83
|
-
case 3:
|
84
|
-
// Write new .env file
|
85
|
-
_a.sent();
|
86
|
-
return [3 /*break*/, 6];
|
87
|
-
case 4:
|
88
|
-
content = "MONGODB_URI=".concat(databaseUri, "\nPAYLOAD_SECRET=").concat(payloadSecret);
|
89
|
-
return [4 /*yield*/, fs_extra_1.default.outputFile("".concat(projectDir, "/.env"), content)];
|
90
|
-
case 5:
|
91
|
-
_a.sent();
|
92
|
-
_a.label = 6;
|
93
|
-
case 6:
|
94
|
-
(0, log_1.success)('.env file created');
|
95
|
-
return [3 /*break*/, 8];
|
96
|
-
case 7:
|
97
|
-
err_1 = _a.sent();
|
98
|
-
(0, log_1.error)('Unable to write .env file');
|
99
|
-
if (err_1 instanceof Error) {
|
100
|
-
(0, log_1.error)(err_1.message);
|
101
|
-
}
|
102
|
-
process.exit(1);
|
103
|
-
return [3 /*break*/, 8];
|
104
|
-
case 8: return [2 /*return*/];
|
105
|
-
}
|
106
|
-
});
|
107
|
-
});
|
10
|
+
});
|
11
|
+
const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
13
|
+
const _log = require("../utils/log");
|
14
|
+
function _interop_require_default(obj) {
|
15
|
+
return obj && obj.__esModule ? obj : {
|
16
|
+
default: obj
|
17
|
+
};
|
108
18
|
}
|
109
|
-
|
19
|
+
async function writeEnvFile(args) {
|
20
|
+
const { databaseUri, payloadSecret, projectDir, template } = args;
|
21
|
+
try {
|
22
|
+
if (template.type === 'starter' && _fsextra.default.existsSync(_path.default.join(projectDir, '.env.example'))) {
|
23
|
+
// Parse .env file into key/value pairs
|
24
|
+
const envFile = await _fsextra.default.readFile(_path.default.join(projectDir, '.env.example'), 'utf8');
|
25
|
+
const envWithValues = envFile.split('\n').filter((e)=>e).map((line)=>{
|
26
|
+
if (line.startsWith('#') || !line.includes('=')) return line;
|
27
|
+
const split = line.split('=');
|
28
|
+
const key = split[0];
|
29
|
+
let value = split[1];
|
30
|
+
if (key === 'MONGODB_URI' || key === 'MONGO_URL' || key === 'DATABASE_URI') {
|
31
|
+
value = databaseUri;
|
32
|
+
}
|
33
|
+
if (key === 'PAYLOAD_SECRET' || key === 'PAYLOAD_SECRET_KEY') {
|
34
|
+
value = payloadSecret;
|
35
|
+
}
|
36
|
+
return `${key}=${value}`;
|
37
|
+
});
|
38
|
+
// Write new .env file
|
39
|
+
await _fsextra.default.writeFile(_path.default.join(projectDir, '.env'), envWithValues.join('\n'));
|
40
|
+
} else {
|
41
|
+
const content = `MONGODB_URI=${databaseUri}\nPAYLOAD_SECRET=${payloadSecret}`;
|
42
|
+
await _fsextra.default.outputFile(`${projectDir}/.env`, content);
|
43
|
+
}
|
44
|
+
(0, _log.success)('.env file created');
|
45
|
+
} catch (err) {
|
46
|
+
(0, _log.error)('Unable to write .env file');
|
47
|
+
if (err instanceof Error) {
|
48
|
+
(0, _log.error)(err.message);
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0JBQUUsQ0FBQ2tCLFVBQVUsQ0FBQyxDQUFDLEVBQUVyQixXQUFXLEtBQUssQ0FBQyxFQUFFb0I7UUFDNUM7UUFFQUUsSUFBQUEsWUFBTyxFQUFDO0lBQ1YsRUFBRSxPQUFPQyxLQUFjO1FBQ3JCQyxJQUFBQSxVQUFLLEVBQUM7UUFDTixJQUFJRCxlQUFlRSxPQUFPO1lBQ3hCRCxJQUFBQSxVQUFLLEVBQUNELElBQUlHLE9BQU87UUFDbkI7UUFDQUMsUUFBUUMsSUFBSSxDQUFDO0lBQ2Y7QUFDRiJ9
|
package/dist/main.js
CHANGED
@@ -1,214 +1,134 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
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
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "Main", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return Main;
|
36
9
|
}
|
37
|
-
};
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
10
|
+
});
|
11
|
+
const _slugify = /*#__PURE__*/ _interop_require_default(require("@sindresorhus/slugify"));
|
12
|
+
const _arg = /*#__PURE__*/ _interop_require_default(require("arg"));
|
13
|
+
const _commandexists = /*#__PURE__*/ _interop_require_default(require("command-exists"));
|
14
|
+
const _createproject = require("./lib/create-project");
|
15
|
+
const _generatesecret = require("./lib/generate-secret");
|
16
|
+
const _parseprojectname = require("./lib/parse-project-name");
|
17
|
+
const _parsetemplate = require("./lib/parse-template");
|
18
|
+
const _selectdb = require("./lib/select-db");
|
19
|
+
const _templates = require("./lib/templates");
|
20
|
+
const _writeenvfile = require("./lib/write-env-file");
|
21
|
+
const _log = require("./utils/log");
|
22
|
+
const _messages = require("./utils/messages");
|
23
|
+
function _interop_require_default(obj) {
|
24
|
+
return obj && obj.__esModule ? obj : {
|
25
|
+
default: obj
|
26
|
+
};
|
27
|
+
}
|
28
|
+
class Main {
|
29
|
+
args;
|
30
|
+
constructor(){
|
57
31
|
// @ts-expect-error bad typings
|
58
|
-
this.args = (0,
|
32
|
+
this.args = (0, _arg.default)({
|
33
|
+
'--db': String,
|
59
34
|
'--help': Boolean,
|
60
35
|
'--name': String,
|
61
|
-
'--template': String,
|
62
|
-
'--db': String,
|
63
36
|
'--secret': String,
|
37
|
+
'--template': String,
|
38
|
+
// Package manager
|
39
|
+
'--no-deps': Boolean,
|
64
40
|
'--use-npm': Boolean,
|
65
|
-
'--use-yarn': Boolean,
|
66
41
|
'--use-pnpm': Boolean,
|
67
|
-
'--
|
68
|
-
|
42
|
+
'--use-yarn': Boolean,
|
43
|
+
// Flags
|
69
44
|
'--beta': Boolean,
|
45
|
+
'--dry-run': Boolean,
|
46
|
+
// Aliases
|
70
47
|
'-d': '--db',
|
71
48
|
'-h': '--help',
|
72
49
|
'-n': '--name',
|
73
|
-
'-t': '--template'
|
74
|
-
}, {
|
50
|
+
'-t': '--template'
|
51
|
+
}, {
|
52
|
+
permissive: true
|
53
|
+
});
|
75
54
|
}
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
process.exit(0);
|
89
|
-
_e.label = 2;
|
90
|
-
case 2:
|
91
|
-
templateArg = this.args['--template'];
|
92
|
-
if (!templateArg) return [3 /*break*/, 5];
|
93
|
-
return [4 /*yield*/, (0, templates_1.validateTemplate)(templateArg)];
|
94
|
-
case 3:
|
95
|
-
valid = _e.sent();
|
96
|
-
if (!!valid) return [3 /*break*/, 5];
|
97
|
-
_d = (_c = console).log;
|
98
|
-
return [4 /*yield*/, (0, messages_1.helpMessage)()];
|
99
|
-
case 4:
|
100
|
-
_d.apply(_c, [_e.sent()]);
|
101
|
-
process.exit(1);
|
102
|
-
_e.label = 5;
|
103
|
-
case 5:
|
104
|
-
console.log(messages_1.welcomeMessage);
|
105
|
-
return [4 /*yield*/, (0, parse_project_name_1.parseProjectName)(this.args)];
|
106
|
-
case 6:
|
107
|
-
projectName = _e.sent();
|
108
|
-
return [4 /*yield*/, (0, templates_1.getValidTemplates)()];
|
109
|
-
case 7:
|
110
|
-
validTemplates = _e.sent();
|
111
|
-
return [4 /*yield*/, (0, parse_template_1.parseTemplate)(this.args, validTemplates)];
|
112
|
-
case 8:
|
113
|
-
template = _e.sent();
|
114
|
-
projectDir = projectName === '.' ? process.cwd() : "./".concat((0, slugify_1.default)(projectName));
|
115
|
-
return [4 /*yield*/, getPackageManager(this.args)];
|
116
|
-
case 9:
|
117
|
-
packageManager = _e.sent();
|
118
|
-
if (!(template.type !== 'plugin')) return [3 /*break*/, 15];
|
119
|
-
return [4 /*yield*/, (0, select_db_1.selectDb)(this.args, projectName)];
|
120
|
-
case 10:
|
121
|
-
dbDetails = _e.sent();
|
122
|
-
return [4 /*yield*/, (0, generate_secret_1.generateSecret)()];
|
123
|
-
case 11:
|
124
|
-
payloadSecret = _e.sent();
|
125
|
-
if (!!this.args['--dry-run']) return [3 /*break*/, 14];
|
126
|
-
return [4 /*yield*/, (0, create_project_1.createProject)({
|
127
|
-
cliArgs: this.args,
|
128
|
-
projectName: projectName,
|
129
|
-
projectDir: projectDir,
|
130
|
-
template: template,
|
131
|
-
packageManager: packageManager,
|
132
|
-
dbDetails: dbDetails,
|
133
|
-
})];
|
134
|
-
case 12:
|
135
|
-
_e.sent();
|
136
|
-
return [4 /*yield*/, (0, write_env_file_1.writeEnvFile)({
|
137
|
-
databaseUri: dbDetails.dbUri,
|
138
|
-
payloadSecret: payloadSecret,
|
139
|
-
template: template,
|
140
|
-
projectDir: projectDir,
|
141
|
-
})];
|
142
|
-
case 13:
|
143
|
-
_e.sent();
|
144
|
-
_e.label = 14;
|
145
|
-
case 14: return [3 /*break*/, 17];
|
146
|
-
case 15:
|
147
|
-
if (!!this.args['--dry-run']) return [3 /*break*/, 17];
|
148
|
-
return [4 /*yield*/, (0, create_project_1.createProject)({
|
149
|
-
cliArgs: this.args,
|
150
|
-
projectName: projectName,
|
151
|
-
projectDir: projectDir,
|
152
|
-
template: template,
|
153
|
-
packageManager: packageManager,
|
154
|
-
})];
|
155
|
-
case 16:
|
156
|
-
_e.sent();
|
157
|
-
_e.label = 17;
|
158
|
-
case 17:
|
159
|
-
(0, log_1.success)('Payload project successfully created');
|
160
|
-
console.log((0, messages_1.successMessage)(projectDir, packageManager));
|
161
|
-
return [3 /*break*/, 19];
|
162
|
-
case 18:
|
163
|
-
error_1 = _e.sent();
|
164
|
-
console.log(error_1);
|
165
|
-
return [3 /*break*/, 19];
|
166
|
-
case 19: return [2 /*return*/];
|
55
|
+
async init() {
|
56
|
+
try {
|
57
|
+
if (this.args['--help']) {
|
58
|
+
console.log((0, _messages.helpMessage)());
|
59
|
+
process.exit(0);
|
60
|
+
}
|
61
|
+
const templateArg = this.args['--template'];
|
62
|
+
if (templateArg) {
|
63
|
+
const valid = (0, _templates.validateTemplate)(templateArg);
|
64
|
+
if (!valid) {
|
65
|
+
console.log((0, _messages.helpMessage)());
|
66
|
+
process.exit(1);
|
167
67
|
}
|
168
|
-
});
|
169
|
-
});
|
170
|
-
};
|
171
|
-
return Main;
|
172
|
-
}());
|
173
|
-
exports.Main = Main;
|
174
|
-
function getPackageManager(args) {
|
175
|
-
return __awaiter(this, void 0, void 0, function () {
|
176
|
-
var packageManager, error_2;
|
177
|
-
return __generator(this, function (_a) {
|
178
|
-
switch (_a.label) {
|
179
|
-
case 0:
|
180
|
-
packageManager = 'npm';
|
181
|
-
if (!args['--use-npm']) return [3 /*break*/, 1];
|
182
|
-
packageManager = 'npm';
|
183
|
-
return [3 /*break*/, 9];
|
184
|
-
case 1:
|
185
|
-
if (!args['--use-yarn']) return [3 /*break*/, 2];
|
186
|
-
packageManager = 'yarn';
|
187
|
-
return [3 /*break*/, 9];
|
188
|
-
case 2:
|
189
|
-
if (!args['--use-pnpm']) return [3 /*break*/, 3];
|
190
|
-
packageManager = 'pnpm';
|
191
|
-
return [3 /*break*/, 9];
|
192
|
-
case 3:
|
193
|
-
_a.trys.push([3, 8, , 9]);
|
194
|
-
return [4 /*yield*/, (0, command_exists_1.default)('yarn')];
|
195
|
-
case 4:
|
196
|
-
if (!_a.sent()) return [3 /*break*/, 5];
|
197
|
-
packageManager = 'yarn';
|
198
|
-
return [3 /*break*/, 7];
|
199
|
-
case 5: return [4 /*yield*/, (0, command_exists_1.default)('pnpm')];
|
200
|
-
case 6:
|
201
|
-
if (_a.sent()) {
|
202
|
-
packageManager = 'pnpm';
|
203
|
-
}
|
204
|
-
_a.label = 7;
|
205
|
-
case 7: return [3 /*break*/, 9];
|
206
|
-
case 8:
|
207
|
-
error_2 = _a.sent();
|
208
|
-
packageManager = 'npm';
|
209
|
-
return [3 /*break*/, 9];
|
210
|
-
case 9: return [2 /*return*/, packageManager];
|
211
68
|
}
|
212
|
-
|
213
|
-
|
69
|
+
console.log(_messages.welcomeMessage);
|
70
|
+
const projectName = await (0, _parseprojectname.parseProjectName)(this.args);
|
71
|
+
const validTemplates = (0, _templates.getValidTemplates)();
|
72
|
+
const template = await (0, _parsetemplate.parseTemplate)(this.args, validTemplates);
|
73
|
+
const projectDir = projectName === '.' ? process.cwd() : `./${(0, _slugify.default)(projectName)}`;
|
74
|
+
const packageManager = await getPackageManager(this.args);
|
75
|
+
if (template.type !== 'plugin') {
|
76
|
+
const dbDetails = await (0, _selectdb.selectDb)(this.args, projectName);
|
77
|
+
const payloadSecret = (0, _generatesecret.generateSecret)();
|
78
|
+
if (!this.args['--dry-run']) {
|
79
|
+
await (0, _createproject.createProject)({
|
80
|
+
cliArgs: this.args,
|
81
|
+
dbDetails,
|
82
|
+
packageManager,
|
83
|
+
projectDir,
|
84
|
+
projectName,
|
85
|
+
template
|
86
|
+
});
|
87
|
+
await (0, _writeenvfile.writeEnvFile)({
|
88
|
+
databaseUri: dbDetails.dbUri,
|
89
|
+
payloadSecret,
|
90
|
+
projectDir,
|
91
|
+
template
|
92
|
+
});
|
93
|
+
}
|
94
|
+
} else {
|
95
|
+
if (!this.args['--dry-run']) {
|
96
|
+
await (0, _createproject.createProject)({
|
97
|
+
cliArgs: this.args,
|
98
|
+
packageManager,
|
99
|
+
projectDir,
|
100
|
+
projectName,
|
101
|
+
template
|
102
|
+
});
|
103
|
+
}
|
104
|
+
}
|
105
|
+
(0, _log.success)('Payload project successfully created');
|
106
|
+
console.log((0, _messages.successMessage)(projectDir, packageManager));
|
107
|
+
} catch (error) {
|
108
|
+
console.log(error);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
async function getPackageManager(args) {
|
113
|
+
let packageManager = 'npm';
|
114
|
+
if (args['--use-npm']) {
|
115
|
+
packageManager = 'npm';
|
116
|
+
} else if (args['--use-yarn']) {
|
117
|
+
packageManager = 'yarn';
|
118
|
+
} else if (args['--use-pnpm']) {
|
119
|
+
packageManager = 'pnpm';
|
120
|
+
} else {
|
121
|
+
try {
|
122
|
+
if (await (0, _commandexists.default)('yarn')) {
|
123
|
+
packageManager = 'yarn';
|
124
|
+
} else if (await (0, _commandexists.default)('pnpm')) {
|
125
|
+
packageManager = 'pnpm';
|
126
|
+
}
|
127
|
+
} catch (error) {
|
128
|
+
packageManager = 'npm';
|
129
|
+
}
|
130
|
+
}
|
131
|
+
return packageManager;
|
214
132
|
}
|
133
|
+
|
134
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9tYWluLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzbHVnaWZ5IGZyb20gJ0BzaW5kcmVzb3JodXMvc2x1Z2lmeSdcbmltcG9ydCBhcmcgZnJvbSAnYXJnJ1xuaW1wb3J0IGNvbW1hbmRFeGlzdHMgZnJvbSA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AnLS1zZWNyZXQnOiBTdHJpbmcsXG4gICAgICAgICctLXRlbXBsYXRlJzogU3RyaW5nLFxuXG4gICAgICAgIC8vIFBhY2thZ2UgbWFuYWdlclxuICAgICAgICAnLS1uby1kZXBzJzogQm9vbGVhbixcbiAgICAgICAgJy0tdXNlLW5wbSc6IEJvb2xlYW4sXG4gICAgICAgICctLXVzZS1wbnBtJzogQm9vbGVhbixcbiAgICAgICAgJy0tdXNlLXlhcm4nOiBCb29sZWFuLFxuXG4gICAgICAgIC8vIEZsYWdzXG4gICAgICAgICctLWJldGEnOiBCb29sZWFuLFxuICAgICAgICAnLS1kcnktcnVuJzogQm9vbGVhbixcblxuICAgICAgICAvLyBBbGlhc2VzXG4gICAgICAgICctZCc6ICctLWRiJyxcbiAgICAgICAgJy1oJzogJy0taGVscCcsXG4gICAgICAgICctbic6ICctLW5hbWUnLFxuICAgICAgICAnLXQnOiAnLS10ZW1wbGF0ZScsXG4gICAgICB9LFxuICAgICAgeyBwZXJtaXNzaXZlOiB0cnVlIH0sXG4gICAgKVxuICB9XG5cbiAgYXN5bmMgaW5pdCgpOiBQcm9taXNlPHZvaWQ+IHtcbiAgICB0cnkge1xuICAgICAgaWYgKHRoaXMuYXJnc1snLS1oZWxwJ10pIHtcbiAgICAgICAgY29uc29sZS5sb2coaGVscE1lc3NhZ2UoKSlcbiAgICAgICAgcHJvY2Vzcy5leGl0KDApXG4gICAgICB9XG4gICAgICBjb25zdCB0ZW1wbGF0ZUFyZyA9IHRoaXMuYXJnc1snLS10ZW1wbGF0ZSddXG4gICAgICBpZiAodGVtcGxhdGVBcmcpIHtcbiAgICAgICAgY29uc3QgdmFsaWQgPSB2YWxpZGF0ZVRlbXBsYXRlKHRlbXBsYXRlQXJnKVxuICAgICAgICBpZiAoIXZhbGlkKSB7XG4gICAgICAgICAgY29uc29sZS5sb2coaGVscE1lc3NhZ2UoKSlcbiAgICAgICAgICBwcm9jZXNzLmV4aXQoMSlcbiAgICAgICAgfVxuICAgICAg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VBQUU7b0JBQzNCLE1BQU1nQyxJQUFBQSw0QkFBYSxFQUFDO3dCQUNsQkMsU0FBUyxJQUFJLENBQUNqQyxJQUFJO3dCQUNsQnlCO3dCQUNBSDt3QkFDQU47d0JBQ0FJO29CQUNGO2dCQUNGO1lBQ0Y7WUFFQWlCLElBQUFBLFlBQU8sRUFBQztZQUNSOUIsUUFBUUMsR0FBRyxDQUFDOEIsSUFBQUEsd0JBQWMsRUFBQ2hCLFlBQVlHO1FBQ3pDLEVBQUUsT0FBT2MsT0FBZ0I7WUFDdkJoQyxRQUFRQyxHQUFHLENBQUMrQjtRQUNkO0lBQ0Y7QUFDRjtBQUVBLGVBQWViLGtCQUFrQjFCLElBQWE7SUFDNUMsSUFBSXlCLGlCQUFpQztJQUVyQyxJQUFJekIsSUFBSSxDQUFDLFlBQVksRUFBRTtRQUNyQnlCLGlCQUFpQjtJQUNuQixPQUFPLElBQUl6QixJQUFJLENBQUMsYUFBYSxFQUFFO1FBQzdCeUIsaUJBQWlCO0lBQ25CLE9BQU8sSUFBSXpCLElBQUksQ0FBQyxhQUFhLEVBQUU7UUFDN0J5QixpQkFBaUI7SUFDbkIsT0FBTztRQUNMLElBQUk7WUFDRixJQUFJLE1BQU1lLElBQUFBLHNCQUFhLEVBQUMsU0FBUztnQkFDL0JmLGlCQUFpQjtZQUNuQixPQUFPLElBQUksTUFBTWUsSUFBQUEsc0JBQWEsRUFBQyxTQUFTO2dCQUN0Q2YsaUJBQWlCO1lBQ25CO1FBQ0YsRUFBRSxPQUFPYyxPQUFnQjtZQUN2QmQsaUJBQWlCO1FBQ25CO0lBQ0Y7SUFDQSxPQUFPQTtBQUNUIn0=
|
package/dist/types.js
CHANGED
@@ -1,2 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
package/dist/utils/log.js
CHANGED
@@ -1,24 +1,45 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
success: function() {
|
13
|
+
return success;
|
14
|
+
},
|
15
|
+
warning: function() {
|
16
|
+
return warning;
|
17
|
+
},
|
18
|
+
info: function() {
|
19
|
+
return info;
|
20
|
+
},
|
21
|
+
error: function() {
|
22
|
+
return error;
|
23
|
+
}
|
24
|
+
});
|
25
|
+
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
26
|
+
const _figures = /*#__PURE__*/ _interop_require_default(require("figures"));
|
27
|
+
function _interop_require_default(obj) {
|
28
|
+
return obj && obj.__esModule ? obj : {
|
29
|
+
default: obj
|
30
|
+
};
|
31
|
+
}
|
32
|
+
const success = (message)=>{
|
33
|
+
console.log(`${_chalk.default.green(_figures.default.tick)} ${_chalk.default.bold(message)}`);
|
4
34
|
};
|
5
|
-
|
6
|
-
|
7
|
-
var chalk_1 = __importDefault(require("chalk"));
|
8
|
-
var figures_1 = __importDefault(require("figures"));
|
9
|
-
var success = function (message) {
|
10
|
-
console.log("".concat(chalk_1.default.green(figures_1.default.tick), " ").concat(chalk_1.default.bold(message)));
|
35
|
+
const warning = (message)=>{
|
36
|
+
console.log(_chalk.default.yellow('? ') + _chalk.default.bold(message));
|
11
37
|
};
|
12
|
-
|
13
|
-
|
14
|
-
console.log(chalk_1.default.yellow('? ') + chalk_1.default.bold(message));
|
38
|
+
const info = (message)=>{
|
39
|
+
console.log(`${_chalk.default.yellow(_figures.default.info)} ${_chalk.default.bold(message)}`);
|
15
40
|
};
|
16
|
-
|
17
|
-
|
18
|
-
console.log("".concat(chalk_1.default.yellow(figures_1.default.info), " ").concat(chalk_1.default.bold(message)));
|
41
|
+
const error = (message)=>{
|
42
|
+
console.log(`${_chalk.default.red(_figures.default.cross)} ${_chalk.default.bold(message)}`);
|
19
43
|
};
|
20
|
-
|
21
|
-
|
22
|
-
console.log("".concat(chalk_1.default.red(figures_1.default.cross), " ").concat(chalk_1.default.bold(message)));
|
23
|
-
};
|
24
|
-
exports.error = error;
|
44
|
+
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9sb2cudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNoYWxrIGZyb20gJ2NoYWxrJ1xuaW1wb3J0IGZpZ3VyZXMgZnJvbSAnZmlndXJlcydcblxuZXhwb3J0IGNvbnN0IHN1Y2Nlc3MgPSAobWVzc2FnZTogc3RyaW5nKTogdm9pZCA9PiB7XG4gIGNvbnNvbGUubG9nKGAke2NoYWxrLmdyZWVuKGZpZ3VyZXMudGljayl9ICR7Y2hhbGsuYm9sZChtZXNzYWdlKX1gKVxufVxuXG5leHBvcnQgY29uc3Qgd2FybmluZyA9IChtZXNzYWdlOiBzdHJpbmcpOiB2b2lkID0+IHtcbiAgY29uc29sZS5sb2coY2hhbGsueWVsbG93KCc/ICcpICsgY2hhbGsuYm9sZChtZXNzYWdlKSlcbn1cblxuZXhwb3J0IGNvbnN0IGluZm8gPSAobWVzc2FnZTogc3RyaW5nKTogdm9pZCA9PiB7XG4gIGNvbnNvbGUubG9nKGAke2NoYWxrLnllbGxvdyhmaWd1cmVzLmluZm8pfSAke2NoYWxrLmJvbGQobWVzc2FnZSl9YClcbn1cblxuZXhwb3J0IGNvbnN0IGVycm9yID0gKG1lc3NhZ2U6IHN0cmluZyk6IHZvaWQgPT4ge1xuICBjb25zb2xlLmxvZyh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