adapt_framework icon indicating copy to clipboard operation
adapt_framework copied to clipboard

New: customscriptsdir added to migrations grunt task (fixes #3677)

Open joe-allen-89 opened this issue 9 months ago • 3 comments

Adding the customscriptdir is to allow a custom folder to be specified, this allows us to load custom migration scripts for the authoring tool.

Changed the fileNameIncludes matching from .includes() to RegExp, this is to make it more accurate when targetting a specific file. For example when using .includes() the flag --file=text will also pull through textInput.

#3677

Fix

  • match fileNameIncludes changed to RegExp

New

  • customscriptsdir added to migrations grunt task (#3677)

joe-allen-89 avatar May 01 '25 16:05 joe-allen-89

minimatch(filePath, '**/' + fileNameIncludes)

This should do what you're doing with the regex. It just uses globs to define the regex. I'm not clear on how the behaviour is changed.

https://github.com/isaacs/minimatch

The use of includes as well as glob matching is by design. It was originally just includes https://github.com/adaptlearning/adapt-migrations/blame/831052bb4b3bf06ed8bb4d0e8b57961fa6e282aa/examples/migrations.js#L55 and Joe R had gotten used to it. I replaced it with the globs check because it made more sense to me and then Joe R requested a reversion, so I implemented both. You should be able to write text/ or adapt-contrib-text if you want to run only text component scripts.

--file=text will also pull through textInput.

I think this is acceptable. We're specify files/folder names with --file, not explicit components. In the same way --file=assessment would also include assessmentResults.

The code for the custom folder looks good.

oliverfoster avatar May 01 '25 18:05 oliverfoster

My thought process was to avoid any potential issue with naming custom tasks in the authoring tool. Regex change reveretd.

joe-allen-89 avatar May 12 '25 13:05 joe-allen-89

There is currently no API for getting all of the existing tasks and running a specific one (other than --file). If you need the AAT to be able do that then you can add new stuff in here for that specific purpose?

grunt migration:gettasks to output JSON or such?

oliverfoster avatar May 12 '25 14:05 oliverfoster

:tada: This PR is included in version 5.52.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Sep 17 '25 10:09 github-actions[bot]