create-payload-app 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -53,7 +53,7 @@ function writeEnvFile(args) {
|
|
53
53
|
databaseUri = args.databaseUri, payloadSecret = args.payloadSecret, template = args.template, projectDir = args.projectDir;
|
54
54
|
_a.label = 1;
|
55
55
|
case 1:
|
56
|
-
_a.trys.push([1,
|
56
|
+
_a.trys.push([1, 7, , 8]);
|
57
57
|
if (!(template.type === 'starter' &&
|
58
58
|
fs_extra_1.default.existsSync(path_1.default.join(projectDir, '.env.example')))) return [3 /*break*/, 4];
|
59
59
|
return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.join(projectDir, '.env.example'), 'utf8')];
|
@@ -81,23 +81,25 @@ function writeEnvFile(args) {
|
|
81
81
|
case 3:
|
82
82
|
// Write new .env file
|
83
83
|
_a.sent();
|
84
|
-
|
84
|
+
return [3 /*break*/, 6];
|
85
85
|
case 4:
|
86
86
|
content = "MONGODB_URI=".concat(databaseUri, "\nPAYLOAD_SECRET=").concat(payloadSecret);
|
87
87
|
return [4 /*yield*/, fs_extra_1.default.outputFile("".concat(projectDir, "/.env"), content)];
|
88
88
|
case 5:
|
89
89
|
_a.sent();
|
90
|
-
|
91
|
-
return [3 /*break*/, 7];
|
90
|
+
_a.label = 6;
|
92
91
|
case 6:
|
92
|
+
(0, log_1.success)('.env file created');
|
93
|
+
return [3 /*break*/, 8];
|
94
|
+
case 7:
|
93
95
|
err_1 = _a.sent();
|
94
96
|
(0, log_1.error)('Unable to write .env file');
|
95
97
|
if (err_1 instanceof Error) {
|
96
98
|
(0, log_1.error)(err_1.message);
|
97
99
|
}
|
98
100
|
process.exit(1);
|
99
|
-
return [3 /*break*/,
|
100
|
-
case
|
101
|
+
return [3 /*break*/, 8];
|
102
|
+
case 8: return [2 /*return*/];
|
101
103
|
}
|
102
104
|
});
|
103
105
|
});
|