Skip to content
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: Added server-diff and --cacheage (fixes 3547) #3548

Merged
merged 6 commits into from
May 14, 2024
Merged

Conversation

oliverfoster
Copy link
Member

@oliverfoster oliverfoster commented Apr 24, 2024

fixes #3547

Speed up AAT compilation by only compiling when necessary and allowing javascript compilation caches to live for longer.

New

  • Added grunt server-diff:dev which will only compile less, handlebars and javascript if those files are newer than their output and will only copy most files if they are also newer than their output
  • Allow the age of the javascript compilation cache to be changed from the command line using a millisecond integer at grunt server-diff:dev --cacheage=1000000000000

Fixes

  • Expanded newer configuration in javascript config to improve glob accuracy and increase speed
  • Allowed schema and data load caching for schema-defaults task to increase processing speed
  • Allowed the diff tasks to force build when switching from production to development and back
  • Improved grunt diff along the same lines as grunt server-diff

Notes

  • The copy task is split so that the replace task always has a fresh @@ directives to string replace
    'newer:copy:courseAssets',
    'newer:copy:componentAssets',
    'newer:copy:coreFonts',
    'newer:copy:themeAssets',
    'newer:copy:themeFonts',
    'newer:copy:coreLibraries',
    'newer:copy:libraries',
    'copy:required',
  • The javascript caching seems stable enough to extend the life of the files beyond one week, this is now configurable at the terminal only. Each cached file can be 2.5mb+ in size, there is one per course and they will live on the system for the defined length of time.

Testing

  1. Setup
git clone https://github.com/adaptlearning/adapt_framework/ 3547-diff
cd 3547-diff
git checkout issue/3547
adapt devinstall && npm install
mkdir build/
cp -r src/course/ build/course/
grunt server-diff:dev --cacheage=2419200000
  1. Rediff no changes
grunt server-diff:dev --cacheage=2419200000
  1. Rediff with changes
grunt server-diff:dev --cacheage=2419200000
  1. Switch from development to production
grunt server-diff:build --cacheage=2419200000

Caveats

  • A full rebuild grunt server-build is required for:
    • Files copied into the build output from plugins that are subsequently removed will not be cleared up
    • Files copied in by spoor at scorm 1.2 will not be cleared when switching to scorm 2004

@chris-steele
Copy link
Contributor

Looks slick 👍 @oliverfoster just remind me what was the reason for not using newer: on required files?

@oliverfoster
Copy link
Member Author

Looks slick 👍 @oliverfoster just remind me what was the reason for not using newer: on required files?

Ensuring that the @@ string replacement directives for the replace task work properly every time. Replace can only function on freshly copied original files where the directives haven't yet been replaced.

Like: https://github.com/adaptlearning/adapt-contrib-spoor/blob/df90b8dacbe8c20e12e1d57dfd1cdfc37de82903/required/index.html#L2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Member

@taylortom taylortom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well for me 🔥

@oliverfoster oliverfoster merged commit 762f361 into master May 14, 2024
2 checks passed
@oliverfoster oliverfoster deleted the issue/3547 branch May 14, 2024 10:38
github-actions bot pushed a commit that referenced this pull request May 14, 2024
# [5.39.0](v5.38.2...v5.39.0) (2024-05-14)

### New

* Added server-diff and --cacheage (fixes 3547) (#3548) ([762f361](762f361)), closes [#3548](#3548)
Copy link

🎉 This PR is included in version 5.39.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AAT compilation improvements
4 participants