create-payload-app 0.4.0 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -125,7 +125,7 @@ function updatePackageJSONName(args) {
125
125
  exports.updatePackageJSONName = updatePackageJSONName;
126
126
  function createProject(args) {
127
127
  return __awaiter(this, void 0, void 0, function () {
128
- var cliArgs, projectName, projectDir, template, packageManager, emitter, spinner, result;
128
+ var cliArgs, projectName, projectDir, template, packageManager, emitter, spinner, lockPath, result;
129
129
  return __generator(this, function (_a) {
130
130
  switch (_a.label) {
131
131
  case 0:
@@ -142,12 +142,21 @@ function createProject(args) {
142
142
  _a.label = 3;
143
143
  case 3:
144
144
  spinner = (0, ora_1.default)('Checking latest Payload version...').start();
145
- return [4 /*yield*/, updatePackageJSONName({ projectName: projectName, projectDir: projectDir })];
145
+ return [4 /*yield*/, updatePackageJSONName({ projectName: projectName, projectDir: projectDir })
146
+ // Remove yarn.lock file. This is only desired in Payload Cloud.
147
+ ];
146
148
  case 4:
147
149
  _a.sent();
150
+ lockPath = path_1.default.resolve(projectDir, 'yarn.lock');
151
+ if (!fs_extra_1.default.existsSync(lockPath)) return [3 /*break*/, 6];
152
+ return [4 /*yield*/, fs_extra_1.default.remove(lockPath)];
153
+ case 5:
154
+ _a.sent();
155
+ _a.label = 6;
156
+ case 6:
148
157
  spinner.text = 'Installing dependencies...';
149
158
  return [4 /*yield*/, installDeps({ cliArgs: cliArgs, projectDir: projectDir, packageManager: packageManager })];
150
- case 5:
159
+ case 7:
151
160
  result = _a.sent();
152
161
  spinner.stop();
153
162
  spinner.clear();
@@ -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, 6, , 7]);
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
- _a.label = 4;
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
- (0, log_1.success)('.env file created');
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*/, 7];
100
- case 7: return [2 /*return*/];
101
+ return [3 /*break*/, 8];
102
+ case 8: return [2 /*return*/];
101
103
  }
102
104
  });
103
105
  });
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "prompts": "^2.4.2",
38
38
  "terminal-link": "^2.1.1"
39
39
  },
40
- "version": "0.4.0",
40
+ "version": "0.4.2",
41
41
  "devDependencies": {
42
42
  "@types/command-exists": "^1.2.0",
43
43
  "@types/degit": "^2.8.3",