New: customscriptsdir added to migrations grunt task (fixes #3677)
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)
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=textwill 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.
My thought process was to avoid any potential issue with naming custom tasks in the authoring tool. Regex change reveretd.
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?
:tada: This PR is included in version 5.52.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: