Skip to content

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

Merged
joe-allen-89 merged 4 commits into
masterfrom
issue/3677
Sep 17, 2025
Merged

New: customscriptsdir added to migrations grunt task (fixes #3677)#3680
joe-allen-89 merged 4 commits into
masterfrom
issue/3677

Conversation

@joe-allen-89
Copy link
Copy Markdown
Contributor

@joe-allen-89 joe-allen-89 commented May 1, 2025

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

@oliverfoster
Copy link
Copy Markdown
Member

oliverfoster commented May 1, 2025

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.

@joe-allen-89 joe-allen-89 moved this from New to Assigned in adapt_framework: The TODO Board May 6, 2025
@joe-allen-89
Copy link
Copy Markdown
Contributor Author

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

@oliverfoster
Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👀

@cahirodoherty-learningpool cahirodoherty-learningpool moved this from Assigned to Needs Reviewing in adapt_framework: The TODO Board Jul 28, 2025
@joe-allen-89 joe-allen-89 merged commit 7a6dac4 into master Sep 17, 2025
1 check passed
@joe-allen-89 joe-allen-89 deleted the issue/3677 branch September 17, 2025 10:11
@github-project-automation github-project-automation Bot moved this from Needs Reviewing to Recently Released in adapt_framework: The TODO Board Sep 17, 2025
github-actions Bot pushed a commit that referenced this pull request Sep 17, 2025
# [5.52.0](v5.51.2...v5.52.0) (2025-09-17)

### New

* customscriptsdir added to migrations grunt task (fixes #3677) (#3680) ([7a6dac4](7a6dac4)), closes [#3677](#3677) [#3680](#3680)
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 5.52.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.

Add the ability to pass in a folder containing migration scripts.

3 participants