@regardio/dev 2.6.1 → 2.6.2

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.
@@ -31,11 +31,15 @@ function runShipHotfix(subcommand, subArgs, cwd = process.cwd()) {
31
31
  console.log("\nFetching latest state from origin...");
32
32
  git("fetch", "origin");
33
33
  if (!branchExists("production")) {
34
- console.error("Branch \"production\" does not exist. Create it first:\n git checkout -b production && git push -u origin production");
35
- process.exit(1);
34
+ console.log("Creating production branch...");
35
+ git("checkout", "-b", "production");
36
+ git("push", "-u", "origin", "production");
37
+ git("checkout", "main");
36
38
  }
37
39
  git("checkout", "production");
38
- git("pull", "--ff-only", "origin", "production");
40
+ try {
41
+ git("pull", "--ff-only", "origin", "production");
42
+ } catch {}
39
43
  git("checkout", "-b", hotfixBranch);
40
44
  console.log(`\n✅ Hotfix branch "${hotfixBranch}" created from production.`);
41
45
  console.log("Apply your fix using conventional commits, then run:");
@@ -80,12 +84,22 @@ function runShipHotfix(subcommand, subArgs, cwd = process.cwd()) {
80
84
  } else console.log("No packages configured for versioning — skipping.");
81
85
  console.log("\nMerging hotfix into production...");
82
86
  git("checkout", "production");
83
- git("pull", "--ff-only", "origin", "production");
87
+ try {
88
+ git("pull", "--ff-only", "origin", "production");
89
+ } catch {}
84
90
  git("merge", "--no-ff", currentBranch, "-m", `chore(hotfix): merge ${currentBranch} into production`);
85
91
  git("push", "origin", "production");
86
92
  console.log("\nPropagating hotfix to staging...");
93
+ if (!branchExists("staging")) {
94
+ console.log("Creating staging branch...");
95
+ git("checkout", "-b", "staging");
96
+ git("push", "-u", "origin", "staging");
97
+ git("checkout", "production");
98
+ }
87
99
  git("checkout", "staging");
88
- git("pull", "--ff-only", "origin", "staging");
100
+ try {
101
+ git("pull", "--ff-only", "origin", "staging");
102
+ } catch {}
89
103
  git("merge", "--no-ff", "production", "-m", "chore(hotfix): merge production into staging");
90
104
  git("push", "origin", "staging");
91
105
  console.log("\nPropagating hotfix to main...");
@@ -27,15 +27,24 @@ function runShipProduction(cwd = process.cwd()) {
27
27
  console.log("\nFetching latest state from origin...");
28
28
  git("fetch", "origin");
29
29
  if (!branchExists("staging")) {
30
- console.error("Branch \"staging\" does not exist. Create it first:\n git checkout -b staging && git push -u origin staging");
31
- process.exit(1);
30
+ console.log("Creating staging branch...");
31
+ git("checkout", "-b", "staging");
32
+ git("push", "-u", "origin", "staging");
33
+ git("checkout", "main");
32
34
  }
33
35
  if (!branchExists("production")) {
34
- console.error("Branch \"production\" does not exist. Create it first:\n git checkout -b production && git push -u origin production");
35
- process.exit(1);
36
+ console.log("Creating production branch...");
37
+ git("checkout", "-b", "production");
38
+ git("push", "-u", "origin", "production");
39
+ git("checkout", "main");
36
40
  }
37
41
  git("pull", "--ff-only", "origin", "main");
38
- const ahead = gitRead("log", "origin/production..HEAD", "--oneline");
42
+ let ahead;
43
+ try {
44
+ ahead = gitRead("log", "origin/production..HEAD", "--oneline");
45
+ } catch {
46
+ ahead = gitRead("log", "--oneline");
47
+ }
39
48
  if (!ahead) {
40
49
  console.error("main is already in sync with production. Nothing to ship.");
41
50
  process.exit(1);
@@ -72,7 +81,9 @@ function runShipProduction(cwd = process.cwd()) {
72
81
  } else if (!confirm("\nNo packages configured for versioning — ship commits to production?\n")) process.exit(0);
73
82
  console.log("\nMerging main into production...");
74
83
  git("checkout", "production");
75
- git("pull", "--ff-only", "origin", "production");
84
+ try {
85
+ git("pull", "--ff-only", "origin", "production");
86
+ } catch {}
76
87
  git("merge", "--ff-only", "main");
77
88
  git("push", "origin", "production");
78
89
  console.log("\nSyncing staging with production...");
@@ -42,8 +42,10 @@ function runShipStaging(cwd = process.cwd()) {
42
42
  process.exit(1);
43
43
  }
44
44
  if (!branchExists("staging")) {
45
- console.error("Branch \"staging\" does not exist locally or on origin. Create it first:\n git checkout -b staging && git push -u origin staging");
46
- process.exit(1);
45
+ console.log("Creating staging branch...");
46
+ git("checkout", "-b", "staging");
47
+ git("push", "-u", "origin", "staging");
48
+ git("checkout", "main");
47
49
  }
48
50
  console.log("\nRunning quality checks...");
49
51
  try {
@@ -176,7 +176,9 @@ Every `.versionrc.json` must include `"gitRawCommitsOpts": { "path": "." }` to f
176
176
 
177
177
  For a single-package repo, place `.versionrc.json` at the root instead.
178
178
 
179
- ### 3. Create the branches
179
+ ### 3. Create the branches (optional)
180
+
181
+ The ship scripts auto-create `staging` and `production` branches if they don't exist. You only need to create them manually if you prefer to set them up ahead of time:
180
182
 
181
183
  ```bash
182
184
  git checkout -b staging && git push -u origin staging
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package.json",
3
3
  "name": "@regardio/dev",
4
- "version": "2.6.1",
4
+ "version": "2.6.2",
5
5
  "private": false,
6
6
  "description": "Regardio development presets: biome, typescript, commitlint, markdownlint, vitest, playwright, sqlfluff, husky, and GitLab-flow ship tooling",
7
7
  "keywords": [