abw-react-starter 1.0.2 → 1.0.3
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/bin/create.js +26 -3
- package/package.json +1 -1
package/bin/create.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import inquirer from "inquirer";
|
|
@@ -187,8 +187,20 @@ async function mergeEnvFile(filePath, values) {
|
|
|
187
187
|
await fs.writeFile(filePath, content);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
async function commitAllIfNeeded(cwd, message) {
|
|
191
|
+
await run("git", ["add", "."], { cwd });
|
|
192
|
+
|
|
193
|
+
const status = await runCapture("git", ["status", "--porcelain"], { cwd });
|
|
194
|
+
if (!status) {
|
|
195
|
+
console.log("ℹ️ Nada novo para commitar");
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
await run("git", ["commit", "-m", message], { cwd });
|
|
200
|
+
}
|
|
201
|
+
|
|
190
202
|
/* =========================
|
|
191
|
-
Heroku Login
|
|
203
|
+
Heroku Login
|
|
192
204
|
========================= */
|
|
193
205
|
|
|
194
206
|
async function isHerokuLoggedIn() {
|
|
@@ -263,7 +275,7 @@ async function initGitRepo(cwd, message) {
|
|
|
263
275
|
}
|
|
264
276
|
|
|
265
277
|
/* =========================
|
|
266
|
-
|
|
278
|
+
S3 Setup
|
|
267
279
|
========================= */
|
|
268
280
|
|
|
269
281
|
async function configureBackendS3(projectDir, aws) {
|
|
@@ -395,6 +407,7 @@ async function createBackendLocal(projectDir) {
|
|
|
395
407
|
cwd: path.join(projectDir, "backend"),
|
|
396
408
|
});
|
|
397
409
|
|
|
410
|
+
console.log("\n=== BACKEND: git init/commit ===\n");
|
|
398
411
|
await initGitRepo(path.join(projectDir, "backend"), "Init Strapi backend");
|
|
399
412
|
}
|
|
400
413
|
|
|
@@ -451,6 +464,7 @@ module.exports = nextConfig;
|
|
|
451
464
|
await fs.writeFile(envLocalPath, "NEXT_PUBLIC_STRAPI_URL=http://localhost:1337\n");
|
|
452
465
|
}
|
|
453
466
|
|
|
467
|
+
console.log("\n=== FRONTEND: git init/commit ===\n");
|
|
454
468
|
await initGitRepo(feDir, "Init Next frontend");
|
|
455
469
|
}
|
|
456
470
|
|
|
@@ -518,6 +532,9 @@ async function deployBackendHeroku({ projectDir, backendApp, region }) {
|
|
|
518
532
|
}
|
|
519
533
|
}
|
|
520
534
|
|
|
535
|
+
console.log("\n=== BACKEND: garantir commit antes do deploy ===\n");
|
|
536
|
+
await commitAllIfNeeded(beDir, "Pre-deploy commit");
|
|
537
|
+
|
|
521
538
|
console.log("\n=== BACKEND: deploy ===\n");
|
|
522
539
|
await run("git", ["push", "heroku", "main"], { cwd: beDir });
|
|
523
540
|
|
|
@@ -555,6 +572,9 @@ async function deployFrontendHeroku({ projectDir, frontendApp, region, backendWe
|
|
|
555
572
|
cwd: feDir,
|
|
556
573
|
});
|
|
557
574
|
|
|
575
|
+
console.log("\n=== FRONTEND: garantir commit antes do deploy ===\n");
|
|
576
|
+
await commitAllIfNeeded(feDir, "Pre-deploy commit");
|
|
577
|
+
|
|
558
578
|
console.log("\n=== FRONTEND: deploy ===\n");
|
|
559
579
|
await run("git", ["push", "heroku", "main"], { cwd: feDir });
|
|
560
580
|
|
|
@@ -622,6 +642,9 @@ async function doCreate(projectDirArg, opts) {
|
|
|
622
642
|
|
|
623
643
|
if (useS3 && aws) {
|
|
624
644
|
await configureBackendS3(projectDir, aws);
|
|
645
|
+
|
|
646
|
+
console.log("\n=== BACKEND: commit configs S3 ===\n");
|
|
647
|
+
await commitAllIfNeeded(path.join(projectDir, "backend"), "Configure S3 upload");
|
|
625
648
|
}
|
|
626
649
|
|
|
627
650
|
await createFrontendLocal(projectDir, nodeVersion);
|