Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the Backend fully ESM compatible, remove Babel (#1332)
* First step towards making Backend fully ESM-compatible: - Necessary changes made in package.json - Most other changes are due to a missing file extension in most imports. - One small change was that __dirname isn't available when using ESM, so I changed the way we resolve path to the YAML specifications by using process.cwd(), as we do in other fs.* functions. - I'm testing the VSCode-GitHub integration now, hence the branch name that does not follow our convention - sorry * Removed Babel, etc: - Removed Babel, including: 'compile' step in package.json and other commands, all dependencies and configuration file - Replaced the 'compile' step with a basic copy of directory to dist/. The reasoning behind this is that it let's us continue using current Dockerfiles etc without any changes. - Major cleanups in ESlint config. Seems good so far, check out the screenshot in this issue: https://github.com/hajkmap/Hajk/issues/1328\#issuecomment-1517542129 - Moved Prettier's config to an own file - Prettier seems fine too, see screenshot above - If this works as intended, we have a much cleaner toolchain. NodeJS 16+ is now required but it shouldn't be a major problem. * Added missing definition, no idea how it got lost. * New lock file after clean deps install. Should close #1328. * Workaround the fact that __dirname isn't available in ESM. This pretty much closes #1328. * Ensure that the OpenApiValidator runs _after_ any async routes have been imported: - This was discovered in #1332 but the problem first came up in #1309. - OAV will only take care of routes that exists when the middleware runs. Hence, any async imports that haven't yet run will be unknown to the OAV and render a 404. - This ugly setTimeout fix takes care of it but I'm open for a better solution (including discussing the future of OAV in our Backend). * Minor fix in Prettier config to reflect that we use LF for new line throughout the project.
- Loading branch information