Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

check uncommitted files #1

Carl-Gerhard Lindesvärd8415172328c8
diff --git a/tooling/publish/publish.ts b/tooling/publish/publish.ts
index b27dc0ceb..8bb65a91f 100644
--- a/tooling/publish/publish.ts
+++ b/tooling/publish/publish.ts
@@ -24,7 +24,24 @@ function exit(message: string, error?: unknown) {
process.exit(1);
}
+function checkUncommittedChanges() {
+ try {
+ const changedFiles = execSync('git ls-files --exclude-standard --others')
+ .toString()
+ .trim();
+ if (changedFiles !== '') {
+ throw new Error('Uncommitted changes');
+ }
+ execSync('git diff HEAD --exit-code');
+ console.log('✅ No uncommitted changes');
+ } catch (error) {
+ exit('Uncommitted changes', error);
+ }
+}
+
function main() {
+ checkUncommittedChanges();
+
const args = arg({
// Types
'--version': String,