-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Module Compilation System #163
Conversation
The ShapeDrawn, RunesDrawn and AudioPlayed arrays were showing up in the documentation generated by typedoc
Merge source academy master
jsons will now build correctly even if the corresponding element does not have any docstrings attached to it
esbuild has since been updated with some new features that I think this PR can take advantage of, give me some time to add them in |
With regards to
With regards to typechecking and linting, I am considering running both |
Certain arguments did not have their default values set properly, resulting in an error at runtime
Would be great to have these improvements in place before the student teams get serious about PRs in the modules repo. |
Extract the header and description return for parsers
Add the lint, typecheck and prebuild commands to the main command parser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A consensus emerged that this PR is of strategic importance. @Cloud7050 reviewed and made comments. The CSG module was a showstopper, but the CSG team confirmed that CSG is now working with this PR.
Motivation
Currently module compilation times are in the order of several minutes. It would be great to reduce that time.
Replacing Rollup and Babel
esbuild
is an extremely fast Javascript bundler which replaces the functionality provided by Rollup with Babel.This also significantly reduces the number of dependencies that have to be installed. Rollup and Babel each required many packages and plugins. As far as I am aware
esbuild
is able to replace them, but I haven't been able to check for every single module and every single use case that the code functions exactly the same.esbuild
also provides built in minification, but that is currently left off as it may affect module code. It is already present should we wish to utilize this function in the future.Watch Mode
Running
yarn watch
will runesbuild
in watch mode, where tabs, bundles and documentation will be automatically rebuilt when changes in the file system are detected, You can disable building of documentation using the--no-docs
option.Linting and typechecking won't run by default, but you can use
--tsc
and--lint
to run the Typescript compiler and eslint.Replacing
ts-node
Script code is written in Typescript, so currently
ts-node
is used to to run scripts. This is also a major bottleneck. Now, script code is compiled to Javascript andnode
is used directly.RFC: Should the compiled script code be committed, or should it just be the source code, then every developer has their own compiled version?
Testing
I have run some tests on a fairly old Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz Windows machine with 16GB of RAM, and also on my M1 Pro MacBook Pro
yarn build --tsc --lint
Runs eslint, tsc (for type checking), esbuild and typedoc.
yarn build modules
Same as
yarn build
, but documentation is not rebuiltyarn build modules
Only build bundles and tabs without linting, type checking and documentation.
Removal of
database.json
With compilation times greatly reduced, the current system that checks against the last modified time of a bundle or tab is no longer required and has been removed to speed up the process.
Once a proper versioning system for modules has been introduced, this feature can be reintroduced.
Breaking Changes
ES5 to ES6
esbuild
is not able to compile code down to ES5, which is the current compilation target in use. @martin-henz has indicated that there is no need to support ES5, so this PR will bump the lowest supported version of Javascript to ES6type: 'module'
To further increase compatibility of the script system with ESM only packages, this field has been set in
package.json
. This has required.eslintrc.js
files to be renamed.eslintrc.cjs
. Configuration files that support ESM (i.ejest
) have also been changed to ESM. This doesn't affect module code as far as I am aware.Bug Fixes
--experimental-node-specifier
, the scripts will use imports that conform to the ES standard instead, i.e. with file extensions and no directory imports.Should fix the plethora of issues with the build system namely #164, #165 and #166