@regardio/dev 1.19.0 → 1.20.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.
- package/README.md +1 -0
- package/dist/bin/ship/hotfix.js +26 -1
- package/dist/bin/ship/production.js +26 -1
- package/dist/bin/ship/staging.js +1 -13
- package/package.json +2 -2
- package/src/bin/ship/hotfix.ts +34 -3
- package/src/bin/ship/production.ts +34 -3
- package/src/bin/ship/staging.ts +4 -26
- package/src/templates/release.yml +4 -4
package/README.md
CHANGED
|
@@ -67,6 +67,7 @@ Detailed documentation is organized by topic:
|
|
|
67
67
|
|
|
68
68
|
- [Biome](./docs/en/toolchain/biome.md) - Linting and formatting
|
|
69
69
|
- [Commitlint](./docs/en/toolchain/commitlint.md) - Commit message validation
|
|
70
|
+
- [Dependencies](./docs/en/toolchain/dependencies.md) - Safe dependency updates and supply-chain controls
|
|
70
71
|
- [Husky](./docs/en/toolchain/husky.md) - Git hooks
|
|
71
72
|
- [Markdownlint](./docs/en/toolchain/markdownlint.md) - Markdown quality
|
|
72
73
|
- [Playwright](./docs/en/toolchain/playwright.md) - End-to-end testing
|
package/dist/bin/ship/hotfix.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
2
3
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
4
|
import { join } from 'node:path';
|
|
4
5
|
import { branchExists, bumpVersion, git, gitRead, insertChangelog, runQualityChecks, runScript, } from './utils.js';
|
|
@@ -77,7 +78,31 @@ if (subcommand === 'finish') {
|
|
|
77
78
|
const today = new Date().toISOString().slice(0, 10);
|
|
78
79
|
insertChangelog(changelogPath, `## [${newVersion}] - ${today} (hotfix)\n\n${message}\n`);
|
|
79
80
|
try {
|
|
80
|
-
runScript('fix');
|
|
81
|
+
runScript('fix:pkg');
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
git('add', '-A');
|
|
87
|
+
const changedFiles = gitRead('diff', '--cached', '--name-only').split('\n').filter(Boolean);
|
|
88
|
+
for (const file of changedFiles) {
|
|
89
|
+
if (file.endsWith('.json')) {
|
|
90
|
+
try {
|
|
91
|
+
execSync(`npx biome check --write ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
for (const file of changedFiles) {
|
|
98
|
+
if (file.endsWith('.md')) {
|
|
99
|
+
try {
|
|
100
|
+
execSync(`npx markdownlint-cli2 --fix ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
81
106
|
}
|
|
82
107
|
catch {
|
|
83
108
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
2
3
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
4
|
import { join } from 'node:path';
|
|
4
5
|
import { branchExists, bumpVersion, confirm, git, gitRead, insertChangelog, runQualityChecks, runScript, } from './utils.js';
|
|
@@ -77,7 +78,31 @@ const changelogPath = join(process.cwd(), 'CHANGELOG.md');
|
|
|
77
78
|
const today = new Date().toISOString().slice(0, 10);
|
|
78
79
|
insertChangelog(changelogPath, `## [${newVersion}] - ${today}\n\n${changeBody}\n`);
|
|
79
80
|
try {
|
|
80
|
-
runScript('fix');
|
|
81
|
+
runScript('fix:pkg');
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
git('add', '-A');
|
|
87
|
+
const changedFiles = gitRead('diff', '--cached', '--name-only').split('\n').filter(Boolean);
|
|
88
|
+
for (const file of changedFiles) {
|
|
89
|
+
if (file.endsWith('.json')) {
|
|
90
|
+
try {
|
|
91
|
+
execSync(`npx biome check --write ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
for (const file of changedFiles) {
|
|
98
|
+
if (file.endsWith('.md')) {
|
|
99
|
+
try {
|
|
100
|
+
execSync(`npx markdownlint-cli2 --fix ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
81
106
|
}
|
|
82
107
|
catch {
|
|
83
108
|
}
|
package/dist/bin/ship/staging.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { branchExists, git, gitRead, runQualityChecks
|
|
5
|
-
const args = process.argv.slice(2);
|
|
6
|
-
const message = args.join(' ') || 'auto-fix formatting';
|
|
4
|
+
import { branchExists, git, gitRead, runQualityChecks } from './utils.js';
|
|
7
5
|
const currentBranch = gitRead('branch', '--show-current');
|
|
8
6
|
if (currentBranch !== 'main') {
|
|
9
7
|
console.error(`Must be on the main branch to release. Currently on: ${currentBranch}`);
|
|
@@ -42,16 +40,6 @@ catch {
|
|
|
42
40
|
process.exit(1);
|
|
43
41
|
}
|
|
44
42
|
console.log('✅ Quality checks passed');
|
|
45
|
-
try {
|
|
46
|
-
runScript('fix');
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
}
|
|
50
|
-
git('add', '-A');
|
|
51
|
-
const hasStagedChanges = gitRead('diff', '--cached', '--name-only') !== '';
|
|
52
|
-
if (hasStagedChanges) {
|
|
53
|
-
git('commit', '-m', `chore(staging): ${message}`);
|
|
54
|
-
}
|
|
55
43
|
console.log('\nMerging main into staging...');
|
|
56
44
|
git('checkout', 'staging');
|
|
57
45
|
git('merge', '--ff-only', 'main');
|
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.
|
|
4
|
+
"version": "1.20.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Regardio developer tooling for testing, linting, and build workflows",
|
|
7
7
|
"keywords": [
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@biomejs/biome": "2.4.10",
|
|
97
97
|
"@commitlint/cli": "20.5.0",
|
|
98
98
|
"@commitlint/config-conventional": "20.5.0",
|
|
99
|
-
"@playwright/test": "1.
|
|
99
|
+
"@playwright/test": "1.59.0",
|
|
100
100
|
"@testing-library/jest-dom": "6.9.1",
|
|
101
101
|
"@testing-library/react": "16.3.2",
|
|
102
102
|
"@total-typescript/ts-reset": "0.6.1",
|
package/src/bin/ship/hotfix.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* 7. Pushes all three branches, deletes the hotfix branch
|
|
23
23
|
* 8. Checks out main
|
|
24
24
|
*/
|
|
25
|
+
import { execSync } from 'node:child_process';
|
|
25
26
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
26
27
|
import { join } from 'node:path';
|
|
27
28
|
|
|
@@ -146,11 +147,41 @@ if (subcommand === 'finish') {
|
|
|
146
147
|
const today = new Date().toISOString().slice(0, 10);
|
|
147
148
|
insertChangelog(changelogPath, `## [${newVersion}] - ${today} (hotfix)\n\n${message}\n`);
|
|
148
149
|
|
|
149
|
-
// Fix formatting
|
|
150
|
+
// Fix formatting of modified files (package.json, CHANGELOG.md)
|
|
150
151
|
try {
|
|
151
|
-
runScript('fix');
|
|
152
|
+
runScript('fix:pkg');
|
|
152
153
|
} catch {
|
|
153
|
-
// fix may not exist
|
|
154
|
+
// fix:pkg may not exist
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Format modified files
|
|
158
|
+
try {
|
|
159
|
+
git('add', '-A');
|
|
160
|
+
const changedFiles = gitRead('diff', '--cached', '--name-only').split('\n').filter(Boolean);
|
|
161
|
+
|
|
162
|
+
// Format JSON files with biome
|
|
163
|
+
for (const file of changedFiles) {
|
|
164
|
+
if (file.endsWith('.json')) {
|
|
165
|
+
try {
|
|
166
|
+
execSync(`npx biome check --write ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
167
|
+
} catch {
|
|
168
|
+
// File might not need formatting or biome not available
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Format markdown files with markdownlint
|
|
174
|
+
for (const file of changedFiles) {
|
|
175
|
+
if (file.endsWith('.md')) {
|
|
176
|
+
try {
|
|
177
|
+
execSync(`npx markdownlint-cli2 --fix ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
178
|
+
} catch {
|
|
179
|
+
// File might not need formatting or markdownlint not available
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
} catch {
|
|
184
|
+
// Formatters not available
|
|
154
185
|
}
|
|
155
186
|
|
|
156
187
|
// Commit
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* 10. Merges production back into main to ensure consistency
|
|
24
24
|
* 11. Returns to main
|
|
25
25
|
*/
|
|
26
|
+
import { execSync } from 'node:child_process';
|
|
26
27
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
27
28
|
import { join } from 'node:path';
|
|
28
29
|
|
|
@@ -167,12 +168,42 @@ const today = new Date().toISOString().slice(0, 10);
|
|
|
167
168
|
insertChangelog(changelogPath, `## [${newVersion}] - ${today}\n\n${changeBody}\n`);
|
|
168
169
|
|
|
169
170
|
// ---------------------------------------------------------------------------
|
|
170
|
-
// Fix formatting
|
|
171
|
+
// Fix formatting of modified files (package.json, CHANGELOG.md)
|
|
171
172
|
// ---------------------------------------------------------------------------
|
|
172
173
|
try {
|
|
173
|
-
runScript('fix');
|
|
174
|
+
runScript('fix:pkg');
|
|
174
175
|
} catch {
|
|
175
|
-
// fix may not exist
|
|
176
|
+
// fix:pkg may not exist
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Format modified files
|
|
180
|
+
try {
|
|
181
|
+
git('add', '-A');
|
|
182
|
+
const changedFiles = gitRead('diff', '--cached', '--name-only').split('\n').filter(Boolean);
|
|
183
|
+
|
|
184
|
+
// Format JSON files with biome
|
|
185
|
+
for (const file of changedFiles) {
|
|
186
|
+
if (file.endsWith('.json')) {
|
|
187
|
+
try {
|
|
188
|
+
execSync(`npx biome check --write ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
189
|
+
} catch {
|
|
190
|
+
// File might not need formatting or biome not available
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Format markdown files with markdownlint
|
|
196
|
+
for (const file of changedFiles) {
|
|
197
|
+
if (file.endsWith('.md')) {
|
|
198
|
+
try {
|
|
199
|
+
execSync(`npx markdownlint-cli2 --fix ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
200
|
+
} catch {
|
|
201
|
+
// File might not need formatting or markdownlint not available
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
} catch {
|
|
206
|
+
// Formatters not available
|
|
176
207
|
}
|
|
177
208
|
|
|
178
209
|
// ---------------------------------------------------------------------------
|
package/src/bin/ship/staging.ts
CHANGED
|
@@ -19,18 +19,14 @@
|
|
|
19
19
|
* This script:
|
|
20
20
|
* 1. Ensures the current branch is main and the working tree is clean
|
|
21
21
|
* 2. Pulls latest main from origin
|
|
22
|
-
* 3. Runs quality checks locally (build, typecheck, tests)
|
|
23
|
-
* 4.
|
|
24
|
-
* 5.
|
|
25
|
-
* 6. Pushes main and returns so work can continue
|
|
22
|
+
* 3. Runs quality checks locally (build, lint, typecheck, tests)
|
|
23
|
+
* 4. Merges main into staging (fast-forward) and pushes
|
|
24
|
+
* 5. Pushes main and returns so work can continue
|
|
26
25
|
*/
|
|
27
26
|
import { existsSync, readFileSync } from 'node:fs';
|
|
28
27
|
import { join } from 'node:path';
|
|
29
28
|
|
|
30
|
-
import { branchExists, git, gitRead, runQualityChecks
|
|
31
|
-
|
|
32
|
-
const args = process.argv.slice(2);
|
|
33
|
-
const message = args.join(' ') || 'auto-fix formatting';
|
|
29
|
+
import { branchExists, git, gitRead, runQualityChecks } from './utils.js';
|
|
34
30
|
|
|
35
31
|
// ---------------------------------------------------------------------------
|
|
36
32
|
// Guard: must be on main
|
|
@@ -93,24 +89,6 @@ try {
|
|
|
93
89
|
}
|
|
94
90
|
console.log('✅ Quality checks passed');
|
|
95
91
|
|
|
96
|
-
// ---------------------------------------------------------------------------
|
|
97
|
-
// Fix formatting if available
|
|
98
|
-
// ---------------------------------------------------------------------------
|
|
99
|
-
try {
|
|
100
|
-
runScript('fix');
|
|
101
|
-
} catch {
|
|
102
|
-
// fix may not exist in all packages
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// ---------------------------------------------------------------------------
|
|
106
|
-
// Commit formatting fixes (if any)
|
|
107
|
-
// ---------------------------------------------------------------------------
|
|
108
|
-
git('add', '-A');
|
|
109
|
-
const hasStagedChanges = gitRead('diff', '--cached', '--name-only') !== '';
|
|
110
|
-
if (hasStagedChanges) {
|
|
111
|
-
git('commit', '-m', `chore(staging): ${message}`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
92
|
// ---------------------------------------------------------------------------
|
|
115
93
|
// Merge into staging
|
|
116
94
|
// ---------------------------------------------------------------------------
|
|
@@ -58,11 +58,11 @@ jobs:
|
|
|
58
58
|
Object.keys(pkg[depType]).forEach(key => {
|
|
59
59
|
if (pkg[depType][key].startsWith('workspace:')) {
|
|
60
60
|
try {
|
|
61
|
-
const version = execSync(
|
|
62
|
-
pkg[depType][key] =
|
|
63
|
-
console.log(
|
|
61
|
+
const version = execSync(`npm view ${key} version`, { encoding: 'utf8' }).trim();
|
|
62
|
+
pkg[depType][key] = version;
|
|
63
|
+
console.log(`Replaced ${key}@workspace:* with ${version}`);
|
|
64
64
|
} catch (e) {
|
|
65
|
-
console.error(
|
|
65
|
+
console.error(`Error: Could not find ${key} on npm. Publish it first.`);
|
|
66
66
|
process.exit(1);
|
|
67
67
|
}
|
|
68
68
|
}
|