Skip to content

Commit

Permalink
BC-5828 - feathersJs upgrade (#4568)
Browse files Browse the repository at this point in the history
Co-authored-by: SevenWaysDP <[email protected]>
  • Loading branch information
virgilchiriac and SevenWaysDP authored Dec 6, 2023
1 parent 1df15ec commit 092c2f9
Show file tree
Hide file tree
Showing 48 changed files with 995 additions and 500 deletions.
2 changes: 1 addition & 1 deletion apps/server/src/apps/server.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function bootstrap() {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const feathersExpress = await legacyAppPromise(orm);
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
feathersExpress.setup();
await feathersExpress.setup();

// set reference to legacy app as an express setting so we can
// access it over the current request within FeathersServiceProvider
Expand Down
7 changes: 2 additions & 5 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
"$schema": "./default.schema.json",
"host": "localhost",
"port": 3030,
"public": "../public/",
"public": "./public/",
"services": {
"calendar": "http://localhost:3000",
"content": "https://content.schul-cloud.org",
"hydra": "http://localhost:9001",
"web": "http://localhost:3100"
"hydra": "http://localhost:9001"
},
"I18N": {
"AVAILABLE_LANGUAGES": "de,en,es,uk",
Expand Down
7 changes: 2 additions & 5 deletions config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"host": "localhost",
"port": "PORT",
"mongodb": "MONGO_URI",
"public": "../public/",
"public": "./public/",
"services": {
"calendar": "CALENDAR_URI",
"content": "CONTENT_URI",
"hydra": "HYDRA_URI",
"web": "HOST"
"hydra": "HYDRA_URI"
}
}
6 changes: 1 addition & 5 deletions config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
"SC_DOMAIN": "localhost",
"PUBLIC_BACKEND_URL": "http://localhost:3030/api",
"DB_URL": "mongodb://127.0.0.1:27017/schulcloud-test",
"public": "../public/",
"services": {
"calendar": "https://schul.tech:3000",
"content": "https://content.schul-cloud.org"
},
"public": "./public/",
"FORCE_SEND_EMAIL": true,
"LDAP_PASSWORD_ENCRYPTION_KEY": "1234567890123456",
"AES_KEY": "6543210987654321",
Expand Down
21 changes: 16 additions & 5 deletions esbuild/esmodules-bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const options = [
{
pathToResolutionModeError: 'node_modules/strtok3/lib/types.d.ts',
},
{
noExportedMember: 'node_modules/@feathersjs/express/lib/declarations.d.ts',
},
];

const globalOptions = {
Expand All @@ -41,11 +44,16 @@ const globalOptions = {
loader: { '.js': 'jsx' },
};

function replace(pathToResolutionModeError) {
const file = resolve(__dirname, '..', pathToResolutionModeError);
function replace(type, filePath) {
const file = resolve(__dirname, '..', filePath);
fs.readFile(file, 'utf8', (err, data) => {
if (err) throw err;
const result = data.replace(/resolution-mode="require"/g, '');
let result = data;
if (type === 'pathToResolutionModeError') {
result = data.replace(/resolution-mode="require"/g, '');
} else if (type === 'noExportedMember') {
result = `// @ts-nocheck\n\n${data}`;
}

fs.writeFile(file, result, 'utf8', (err) => {
if (err) throw err;
Expand All @@ -54,7 +62,7 @@ function replace(pathToResolutionModeError) {
}

for (const option of options) {
const { entryPoint, outdir, pathToResolutionModeError } = option;
const { entryPoint, outdir, pathToResolutionModeError, noExportedMember } = option;
try {
if (entryPoint && outdir) {
build({
Expand All @@ -71,7 +79,10 @@ for (const option of options) {

// remove resolution-mode="require" from file because it provokes an error in the commonjs build
if (pathToResolutionModeError) {
replace(pathToResolutionModeError);
replace('pathToResolutionModeError', pathToResolutionModeError);
}
if (noExportedMember) {
replace('noExportedMember', noExportedMember);
}
} catch (e) {
process.exit(1);
Expand Down
Loading

0 comments on commit 092c2f9

Please sign in to comment.