Skip to content

Commit 0ec6f72

Browse files
committed
feat(radio): add staged changes check to bump script
1 parent 58a8b90 commit 0ec6f72

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/radio/scripts/bump.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ import simpleGit from 'simple-git';
77
const types = ['major', 'minor', 'patch'];
88

99
async function bump(type: ReleaseType = 'patch') {
10+
const git = simpleGit();
11+
12+
// Check for staged changes
13+
const status = await git.status();
14+
if (status.staged.length > 0) {
15+
console.error('Error: You have staged changes. Please commit or unstage them before bumping the version.');
16+
console.error('Staged files:');
17+
status.staged.forEach(file => console.error(` - ${file}`));
18+
process.exit(1);
19+
}
20+
1021
const packageFile = require.resolve('../package.json');
1122
const packageJSON = require(packageFile) as Required<PackageJson>;
1223

@@ -32,7 +43,6 @@ async function bump(type: ReleaseType = 'patch') {
3243
await writeFile(uiPackageFile, JSON.stringify(uiPackageJSON, null, 2) + '\n');
3344

3445
// Create git tag
35-
const git = simpleGit();
3646
const tagName = `radio@v${version}`;
3747

3848
await git.add([

0 commit comments

Comments
 (0)