@regardio/dev 1.16.3 → 1.17.1

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,9 +31,10 @@ if (!branchExists('production')) {
31
31
  + ' git checkout -b production && git push -u origin production');
32
32
  process.exit(1);
33
33
  }
34
- const ahead = gitRead('log', 'origin/production..origin/staging', '--oneline');
34
+ git('pull', '--ff-only', 'origin', 'main');
35
+ const ahead = gitRead('log', 'origin/production..HEAD', '--oneline');
35
36
  if (!ahead) {
36
- console.error('staging is already in sync with production. Nothing to ship.');
37
+ console.error('main is already in sync with production. Nothing to ship.');
37
38
  process.exit(1);
38
39
  }
39
40
  console.log('\nCommits to be shipped to production:');
@@ -48,16 +49,12 @@ if (!confirm(`\nShip ${packageName} as a ${bumpType} release?`)) {
48
49
  console.log('Aborted.');
49
50
  process.exit(0);
50
51
  }
51
- console.log('\nChecking out staging for quality checks...');
52
- git('checkout', 'staging');
53
- git('pull', '--ff-only', 'origin', 'staging');
54
- console.log('\nRunning quality checks on staging...');
52
+ console.log('\nRunning quality checks on main...');
55
53
  try {
56
54
  runQualityChecks();
57
55
  }
58
56
  catch {
59
- console.error('\nQuality checks failed on staging. Fix issues before shipping.');
60
- git('checkout', 'main');
57
+ console.error('\nQuality checks failed on main. Fix issues before shipping.');
61
58
  process.exit(1);
62
59
  }
63
60
  console.log('✅ Quality checks passed');
@@ -86,19 +83,17 @@ catch {
86
83
  }
87
84
  git('add', '-A');
88
85
  git('commit', '-m', `chore(release): ${packageName}@${newVersion}`, '-m', changeBody);
89
- console.log('\nMerging staging into production...');
86
+ console.log('\nMerging main into production...');
90
87
  git('checkout', 'production');
91
88
  git('pull', '--ff-only', 'origin', 'production');
92
- git('merge', '--ff-only', 'staging');
89
+ git('merge', '--ff-only', 'main');
93
90
  git('push', 'origin', 'production');
94
- console.log('\nSyncing version commit back to main...');
95
- git('checkout', 'main');
96
- git('pull', '--ff-only', 'origin', 'main');
97
- git('merge', '--ff-only', 'production');
98
- git('push', 'origin', 'main');
91
+ console.log('\nSyncing staging with production...');
99
92
  git('checkout', 'staging');
100
- git('merge', '--ff-only', 'main');
93
+ git('pull', '--ff-only', 'origin', 'staging');
94
+ git('merge', '--ff-only', 'production');
101
95
  git('push', 'origin', 'staging');
102
96
  git('checkout', 'main');
97
+ git('push', 'origin', 'main');
103
98
  console.log(`\n✅ Shipped ${packageName}@${newVersion} to production`);
104
99
  console.log('You are on main and ready to keep working.');
@@ -59,4 +59,5 @@ git('push', 'origin', 'staging');
59
59
  git('checkout', 'main');
60
60
  git('push', 'origin', 'main');
61
61
  console.log('\n✅ Changes deployed to staging');
62
- console.log('Run ship-production <patch|minor|major> when ready to promote to production.');
62
+ console.log('Run ship-production <patch|minor|major> when ready to ship to production.');
63
+ console.log('(Or ship directly from main to production without using ship-staging first.)');
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": "1.16.3",
4
+ "version": "1.17.1",
5
5
  "private": false,
6
6
  "description": "Regardio developer tooling for testing, linting, and build workflows",
7
7
  "keywords": [
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * ship-production: Version and promote staging to production following the GitLab workflow.
3
+ * ship-production: Version and promote main to production following the GitLab workflow.
4
4
  *
5
5
  * Usage: ship-production <patch|minor|major>
6
6
  *
7
7
  * GitLab workflow:
8
- * staging → (version bump commit) → production
8
+ * main → (version bump commit) → production → staging → main
9
9
  *
10
10
  * Versioning is intentionally deferred to this step so that version numbers
11
11
  * only ever correspond to production-verified code.
12
12
  *
13
13
  * This script:
14
14
  * 1. Ensures the current branch is main and the working tree is clean
15
- * 2. Verifies staging is ahead of production (there is something to ship)
16
- * 3. Runs quality checks on the staging branch
15
+ * 2. Verifies main is ahead of production (there is something to ship)
16
+ * 3. Runs quality checks on main
17
17
  * 4. Bumps the version in package.json
18
- * 5. Collects change descriptions from git log between production and staging
18
+ * 5. Collects change descriptions from git log between production and main
19
19
  * 6. Updates CHANGELOG.md
20
- * 7. Commits the version bump on staging
21
- * 8. Merges staging into production (fast-forward) and pushes
22
- * 9. Merges production back into main to carry the version commit forward
23
- * 10. Syncs staging with main so the next ship-staging can ff-merge cleanly
20
+ * 7. Commits the version bump on main
21
+ * 8. Merges main into production (fast-forward) and pushes
22
+ * 9. Merges production into staging to keep it in sync
23
+ * 10. Merges production back into main to ensure consistency
24
24
  * 11. Returns to main
25
25
  */
26
26
  import { existsSync, readFileSync, writeFileSync } from 'node:fs';
@@ -85,11 +85,12 @@ if (!branchExists('production')) {
85
85
  }
86
86
 
87
87
  // ---------------------------------------------------------------------------
88
- // Verify staging has commits not yet in production
88
+ // Verify main has commits not yet in production
89
89
  // ---------------------------------------------------------------------------
90
- const ahead = gitRead('log', 'origin/production..origin/staging', '--oneline');
90
+ git('pull', '--ff-only', 'origin', 'main');
91
+ const ahead = gitRead('log', 'origin/production..HEAD', '--oneline');
91
92
  if (!ahead) {
92
- console.error('staging is already in sync with production. Nothing to ship.');
93
+ console.error('main is already in sync with production. Nothing to ship.');
93
94
  process.exit(1);
94
95
  }
95
96
 
@@ -114,24 +115,19 @@ if (!confirm(`\nShip ${packageName} as a ${bumpType} release?`)) {
114
115
  }
115
116
 
116
117
  // ---------------------------------------------------------------------------
117
- // Quality checks on staging
118
+ // Quality checks on main
118
119
  // ---------------------------------------------------------------------------
119
- console.log('\nChecking out staging for quality checks...');
120
- git('checkout', 'staging');
121
- git('pull', '--ff-only', 'origin', 'staging');
122
-
123
- console.log('\nRunning quality checks on staging...');
120
+ console.log('\nRunning quality checks on main...');
124
121
  try {
125
122
  runQualityChecks();
126
123
  } catch {
127
- console.error('\nQuality checks failed on staging. Fix issues before shipping.');
128
- git('checkout', 'main');
124
+ console.error('\nQuality checks failed on main. Fix issues before shipping.');
129
125
  process.exit(1);
130
126
  }
131
127
  console.log('✅ Quality checks passed');
132
128
 
133
129
  // ---------------------------------------------------------------------------
134
- // Read version from staging package.json and bump
130
+ // Read version from main package.json and bump
135
131
  // ---------------------------------------------------------------------------
136
132
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {
137
133
  name: string;
@@ -180,36 +176,34 @@ try {
180
176
  }
181
177
 
182
178
  // ---------------------------------------------------------------------------
183
- // Commit version bump on staging
179
+ // Commit version bump on main
184
180
  // ---------------------------------------------------------------------------
185
181
  git('add', '-A');
186
182
  git('commit', '-m', `chore(release): ${packageName}@${newVersion}`, '-m', changeBody);
187
183
 
188
184
  // ---------------------------------------------------------------------------
189
- // Merge staging → production
185
+ // Merge main → production
190
186
  // ---------------------------------------------------------------------------
191
- console.log('\nMerging staging into production...');
187
+ console.log('\nMerging main into production...');
192
188
  git('checkout', 'production');
193
189
  git('pull', '--ff-only', 'origin', 'production');
194
- git('merge', '--ff-only', 'staging');
190
+ git('merge', '--ff-only', 'main');
195
191
  git('push', 'origin', 'production');
196
192
 
197
193
  // ---------------------------------------------------------------------------
198
- // Bring version commit back to main
194
+ // Sync staging with production
199
195
  // ---------------------------------------------------------------------------
200
- console.log('\nSyncing version commit back to main...');
201
- git('checkout', 'main');
202
- git('pull', '--ff-only', 'origin', 'main');
196
+ console.log('\nSyncing staging with production...');
197
+ git('checkout', 'staging');
198
+ git('pull', '--ff-only', 'origin', 'staging');
203
199
  git('merge', '--ff-only', 'production');
204
- git('push', 'origin', 'main');
200
+ git('push', 'origin', 'staging');
205
201
 
206
202
  // ---------------------------------------------------------------------------
207
- // Sync staging with main so the next flow-release can ff-merge cleanly
203
+ // Return to main and push
208
204
  // ---------------------------------------------------------------------------
209
- git('checkout', 'staging');
210
- git('merge', '--ff-only', 'main');
211
- git('push', 'origin', 'staging');
212
205
  git('checkout', 'main');
206
+ git('push', 'origin', 'main');
213
207
 
214
208
  console.log(`\n✅ Shipped ${packageName}@${newVersion} to production`);
215
209
  console.log('You are on main and ready to keep working.');
@@ -7,6 +7,12 @@
7
7
  * GitLab workflow:
8
8
  * main → staging (staging deploy, no version bump yet)
9
9
  *
10
+ * This script is OPTIONAL. You can ship directly to production using ship-production,
11
+ * which will automatically sync staging afterward.
12
+ *
13
+ * Use ship-staging when you want to test changes in a staging environment before
14
+ * shipping to production. Otherwise, skip this step and use ship-production directly.
15
+ *
10
16
  * Versioning happens at ship time (ship-production), not here.
11
17
  * This keeps version numbers reserved for production-verified code.
12
18
  *
@@ -120,4 +126,5 @@ git('checkout', 'main');
120
126
  git('push', 'origin', 'main');
121
127
 
122
128
  console.log('\n✅ Changes deployed to staging');
123
- console.log('Run ship-production <patch|minor|major> when ready to promote to production.');
129
+ console.log('Run ship-production <patch|minor|major> when ready to ship to production.');
130
+ console.log('(Or ship directly from main to production without using ship-staging first.)');