Skip to content
Snippets Groups Projects
Unverified Commit f9e39a8d authored by Pierre Lehnen's avatar Pierre Lehnen Committed by GitHub
Browse files

chore: add script to remove all non-FOSS code (#32275)

parent ee5cdfc3
No related branches found
No related tags found
No related merge requests found
export { startLicense } from '../ee/app/license/server/startup';
export { registerEEBroker } from '../ee/server';
// This file is used in FOSS builds of Rocket.Chat to replace the default ee.ts file with mocked functions
export const startLicense = async () => undefined;
export const registerEEBroker = async () => undefined;
......@@ -7,10 +7,9 @@ import './models/startup';
import './settings';
import '../app/lib/server/startup';
import { startLicense } from '../ee/app/license/server/startup';
import { registerEEBroker } from '../ee/server';
import { configureLoginServices } from './configuration';
import { configureLogLevel } from './configureLogLevel';
import { startLicense, registerEEBroker } from './ee';
import { registerServices } from './services/startup';
import { startup } from './startup';
import './importPackages';
......
......@@ -13,12 +13,14 @@
"dsv": "turbo run dsv --filter=@rocket.chat/meteor...",
"lint": "turbo run lint",
"storybook": "yarn workspace @rocket.chat/meteor run storybook",
"fuselage": "./fuselage.sh"
"fuselage": "./fuselage.sh",
"fossify": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' ts-node scripts/fossify.ts"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@types/chart.js": "^2.9.39",
"@types/js-yaml": "^4.0.8",
"ts-node": "^10.9.2",
"turbo": "^1.12.4"
},
"workspaces": [
......
import readline from 'readline';
import fs from 'fs';
import { promisify } from 'util';
const rmdir = promisify(fs.rmdir);
const unlink = promisify(fs.unlink);
const rename = promisify(fs.rename);
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...');
await rmdir('./ee', removeOptions);
console.log('Removing Premium code in the main app...');
await rmdir('./apps/meteor/ee', removeOptions);
console.log('Replacing main files...');
await unlink('./apps/meteor/server/ee.ts');
await rename('./apps/meteor/server/foss.ts', './apps/meteor/server/ee.ts');
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);
});
});
......@@ -36844,6 +36844,7 @@ __metadata:
"@types/chart.js": ^2.9.39
"@types/js-yaml": ^4.0.8
node-gyp: ^9.4.1
ts-node: ^10.9.2
turbo: ^1.12.4
languageName: unknown
linkType: soft
......@@ -40269,6 +40270,44 @@ __metadata:
languageName: node
linkType: hard
 
"ts-node@npm:^10.9.2":
version: 10.9.2
resolution: "ts-node@npm:10.9.2"
dependencies:
"@cspotcode/source-map-support": ^0.8.0
"@tsconfig/node10": ^1.0.7
"@tsconfig/node12": ^1.0.7
"@tsconfig/node14": ^1.0.0
"@tsconfig/node16": ^1.0.2
acorn: ^8.4.1
acorn-walk: ^8.1.1
arg: ^4.1.0
create-require: ^1.1.0
diff: ^4.0.1
make-error: ^1.1.1
v8-compile-cache-lib: ^3.0.1
yn: 3.1.1
peerDependencies:
"@swc/core": ">=1.2.50"
"@swc/wasm": ">=1.2.50"
"@types/node": "*"
typescript: ">=2.7"
peerDependenciesMeta:
"@swc/core":
optional: true
"@swc/wasm":
optional: true
bin:
ts-node: dist/bin.js
ts-node-cwd: dist/bin-cwd.js
ts-node-esm: dist/bin-esm.js
ts-node-script: dist/bin-script.js
ts-node-transpile-only: dist/bin-transpile.js
ts-script: dist/bin-script-deprecated.js
checksum: fde256c9073969e234526e2cfead42591b9a2aec5222bac154b0de2fa9e4ceb30efcd717ee8bc785a56f3a119bdd5aa27b333d9dbec94ed254bd26f8944c67ac
languageName: node
linkType: hard
"ts-patch@npm:~3.0.2":
version: 3.0.2
resolution: "ts-patch@npm:3.0.2"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment