-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathzip.js
45 lines (37 loc) · 1.14 KB
/
zip.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
38
39
40
41
42
43
44
45
const fs = require('fs');
const archiver = require('archiver-promise');
const emailTemplates = [
'account_confirmation',
'deposit_confirmation',
'account_low_balance_3',
'account_low_balance_5',
'account_low_balance_custom',
'auto_charge',
'auto_charge_failed',
'alert_servers_stopped',
'alert_servers_deleted',
'forgot_password',
'invite_user',
];
async function main() {
// Verify we have all required email templates
console.log('Checking for required email templates...\n');
emailTemplates.forEach(async (template) => {
if (fs.existsSync(`./content/email/${template}.html`)) {
console.log(`✅ Found ${template}.html`);
} else {
console.log(
`❌ Missing ${template}.html - please add it to the email folder!`
);
process.exit(1);
}
});
console.log('\nAll required email templates found!');
// Zip `content` folder
console.log('\nCreating a new ZIP file...');
const archive = archiver('content.zip', { zlib: { level: 9 } });
archive.directory('content/', false);
await archive.finalize();
console.log('🎉 ZIP file "content.zip" created successfully!');
}
main();