2024-05-15 10:20:21 -03:00
|
|
|
import readline from 'readline';
|
2024-10-15 23:51:53 -03:00
|
|
|
import fs from 'fs/promises';
|
2024-05-15 10:20:21 -03:00
|
|
|
|
|
|
|
|
const removeOptions = { maxRetries: 3, recursive: true };
|
|
|
|
|
|
|
|
|
|
const rl = readline.createInterface({
|
|
|
|
|
input: process.stdin,
|
|
|
|
|
output: process.stdout,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const fossify = async () => {
|
|
|
|
|
console.log('Removing Premium Apps and Packages...');
|
2024-10-15 23:51:53 -03:00
|
|
|
await fs.rmdir('./ee', removeOptions);
|
2024-05-15 10:20:21 -03:00
|
|
|
|
|
|
|
|
console.log('Removing Premium code in the main app...');
|
2024-10-15 23:51:53 -03:00
|
|
|
await fs.rmdir('./apps/meteor/ee', removeOptions);
|
2024-05-15 10:20:21 -03:00
|
|
|
|
|
|
|
|
console.log('Replacing main files...');
|
2025-02-13 18:43:04 -03:00
|
|
|
await fs.unlink('./apps/meteor/startRocketChat.ts');
|
2024-05-15 10:20:21 -03:00
|
|
|
|
2025-02-13 18:43:04 -03:00
|
|
|
await fs.rename('./apps/meteor/startRocketChatFOSS.ts', './apps/meteor/startRocketChat.ts');
|
2024-05-15 10:20:21 -03:00
|
|
|
|
|
|
|
|
console.log('Done.');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
rl.question('Running this script will permanently delete files from the local directory. Proceed? (n,y) ', (answer) => {
|
|
|
|
|
rl.close();
|
|
|
|
|
|
|
|
|
|
if (answer.toLowerCase() !== 'y') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fossify().catch((e) => {
|
|
|
|
|
if (!e) {
|
|
|
|
|
console.error('Unknown error');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.error(e);
|
|
|
|
|
});
|
|
|
|
|
});
|