-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathprepare-release.js
37 lines (34 loc) · 1.18 KB
/
prepare-release.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* eslint-disable no-console */
import { exec } from 'node:child_process';
console.log('> git status --porcelain');
exec('git status --porcelain', (err, stdout, stderr) => {
if (err) {
console.error(`Error executing git status: ${stderr}`);
return;
}
if (stdout) {
console.log(
' Found changes:',
'\n - ' + stdout.split('\n').filter(Boolean).join('\n - ')
);
console.log('> git add .');
exec('git add .', (err, stdout, stderr) => {
if (err) {
console.error(`Error executing git add: ${stderr}`);
return;
}
console.log('> git commit -n -m "prepare-release changes"');
exec('git commit -n -m "prepare-release changes"', (err, stdout, stderr) => {
if (err) {
console.error(`Error executing git commit: ${stderr}`);
return;
} else {
console.log('✅ Changes committed successfully.');
}
});
});
} else {
console.log('✅ No untracked files to commit.');
}
});
/* eslint-enable no-console */