Skip to content

Commit 56ebc2c

Browse files
zip it up for mac
1 parent 2a50872 commit 56ebc2c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

scripts/build.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,35 @@ try {
111111
}
112112

113113
console.log('\x1b[32mBuild completed successfully!\x1b[0m');
114+
115+
// Post-build step: Create zip file for macOS
116+
if (process.platform === 'darwin') {
117+
console.log('\x1b[36mCreating macOS zip file...\x1b[0m');
118+
try {
119+
const distPath = path.join(__dirname, '..', 'dist');
120+
const macAppPath = path.join(distPath, 'mac', 'Sploder.app');
121+
const zipFileName = 'Sploder-macOS.zip';
122+
const zipFilePath = path.join(distPath, zipFileName);
123+
124+
// Check if the .app directory exists
125+
if (fs.existsSync(macAppPath)) {
126+
// Remove existing zip file if it exists
127+
if (fs.existsSync(zipFilePath)) {
128+
fs.unlinkSync(zipFilePath);
129+
console.log('\x1b[33mRemoved existing zip file\x1b[0m');
130+
}
131+
132+
// Create zip file using native zip command
133+
execSync(`cd "${distPath}" && zip -r "${zipFileName}" mac/Sploder.app`, { stdio: 'inherit' });
134+
console.log(`\x1b[32mmacOS zip file created: ${zipFilePath}\x1b[0m`);
135+
} else {
136+
console.log('\x1b[33mWarning: macOS .app directory not found, skipping zip creation\x1b[0m');
137+
}
138+
} catch (zipError) {
139+
console.warn(`\x1b[33mWarning: Could not create macOS zip file: ${zipError.message}\x1b[0m`);
140+
}
141+
}
142+
114143
} catch (error) {
115144
console.error('\x1b[31mBuild failed!\x1b[0m');
116145
process.exit(1);

0 commit comments

Comments
 (0)