From e35fe5426134ede8f0180eb1c61ebe256fba290a Mon Sep 17 00:00:00 2001
From: Lennart Pegel <github@justlep.net>
Date: Fri, 15 Oct 2021 15:34:20 +0200
Subject: [PATCH] support .cjs extension

---
 lib/grunt/task.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/grunt/task.js b/lib/grunt/task.js
index ffd119eb0..8eb853f3c 100644
--- a/lib/grunt/task.js
+++ b/lib/grunt/task.js
@@ -345,7 +345,7 @@ function loadTasksMessage(info) {
 // Load tasks and handlers from a given directory.
 function loadTasks(tasksdir) {
   try {
-    var files = grunt.file.glob.sync('*.{js,coffee}', {cwd: tasksdir, maxDepth: 1});
+    var files = grunt.file.glob.sync('*.{js,cjs,coffee}', {cwd: tasksdir, maxDepth: 1});
     // Load tasks from files.
     files.forEach(function(filename) {
       loadTask(path.join(tasksdir, filename));
@@ -434,7 +434,7 @@ task.init = function(tasks, options) {
     gruntfile = null;
   } else {
     gruntfile = grunt.option('gruntfile') ||
-      grunt.file.findup('Gruntfile.{js,coffee}', {nocase: true});
+      grunt.file.findup('Gruntfile.{js,cjs,coffee}', {nocase: true});
     msg = 'Reading "' + (gruntfile ? path.basename(gruntfile) : '???') + '" Gruntfile...';
   }