Skip to content

Commit

Permalink
Add ejs to supported extensions
Browse files Browse the repository at this point in the history
This broke loading views otherwise
  • Loading branch information
Ell Bradshaw committed Mar 9, 2023
1 parent 4ab8748 commit 9253abc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/hooks/moduleloader/index.js
Expand Up @@ -26,8 +26,8 @@ module.exports = function(sails) {
// > For full list, see:
// > https://github.com/luislobo/common-js-file-extensions/blob/210fd15d89690c7aaa35dba35478cb91c693dfa8/README.md#code-file-extensions
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var BASIC_SUPPORTED_FILE_EXTENSIONS = COMMON_JS_FILE_EXTENSIONS.code;
var BASIC_SUPPORTED_FILE_EXTENSIONS_REGEX = new RegExp('^(.+)\\.(' + BASIC_SUPPORTED_FILE_EXTENSIONS.join('|') + ')$');
var SUPPORTED_FILE_EXTENSIONS_FOR_CODE = COMMON_JS_FILE_EXTENSIONS.code.concat(['ejs']);
var SUPPORTED_FILE_EXTENSIONS_FOR_CODE_REGEX = new RegExp('^(.+)\\.(' + SUPPORTED_FILE_EXTENSIONS_FOR_CODE.join('|') + ')$');

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Supported file extensions, ONLY for configuration files:
Expand All @@ -40,7 +40,7 @@ module.exports = function(sails) {
// > For full list, see:
// > https://github.com/luislobo/common-js-file-extensions/blob/210fd15d89690c7aaa35dba35478cb91c693dfa8/README.md#configobject-file-extensions
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var SUPPORTED_FILE_EXTENSIONS_FOR_CONFIG = COMMON_JS_FILE_EXTENSIONS.config.concat(BASIC_SUPPORTED_FILE_EXTENSIONS);
var SUPPORTED_FILE_EXTENSIONS_FOR_CONFIG = COMMON_JS_FILE_EXTENSIONS.config.concat(SUPPORTED_FILE_EXTENSIONS_FOR_CODE);


/**
Expand Down Expand Up @@ -304,7 +304,7 @@ module.exports = function(sails) {
// Get the main model files
includeAll.optional({
dirname : sails.config.paths.models,
filter : BASIC_SUPPORTED_FILE_EXTENSIONS_REGEX,
filter : SUPPORTED_FILE_EXTENSIONS_FOR_CODE_REGEX,
replaceExpr : /^.*\//,
flatten: true
}, function(err, models) {
Expand Down Expand Up @@ -339,7 +339,7 @@ module.exports = function(sails) {
loadServices: function (cb) {
includeAll.optional({
dirname : sails.config.paths.services,
filter : BASIC_SUPPORTED_FILE_EXTENSIONS_REGEX,
filter : SUPPORTED_FILE_EXTENSIONS_FOR_CODE_REGEX,
depth : 1,
caseSensitive : true
}, bindToSails(cb));
Expand All @@ -354,7 +354,7 @@ module.exports = function(sails) {
statViews: function (cb) {
includeAll.optional({
dirname: sails.config.paths.views,
filter: BASIC_SUPPORTED_FILE_EXTENSIONS_REGEX,
filter: SUPPORTED_FILE_EXTENSIONS_FOR_CODE_REGEX,
replaceExpr: null,
dontLoad: true
}, cb);
Expand All @@ -369,7 +369,7 @@ module.exports = function(sails) {
loadPolicies: function (cb) {
includeAll.optional({
dirname: sails.config.paths.policies,
filter: BASIC_SUPPORTED_FILE_EXTENSIONS_REGEX,
filter: SUPPORTED_FILE_EXTENSIONS_FOR_CODE_REGEX,
replaceExpr: null,
flatten: true,
keepDirectoryPath: true
Expand Down Expand Up @@ -404,7 +404,7 @@ module.exports = function(sails) {
hooksFolder: function(cb) {
includeAll.optional({
dirname: sails.config.paths.hooks,
filter: BASIC_SUPPORTED_FILE_EXTENSIONS_REGEX,
filter: SUPPORTED_FILE_EXTENSIONS_FOR_CODE_REGEX,

// Hooks should be defined as either single files as a function
// OR (better yet) a subfolder with an index.js file
Expand Down Expand Up @@ -580,7 +580,7 @@ module.exports = function(sails) {
loadBlueprints: function (cb) {
includeAll.optional({
dirname: sails.config.paths.blueprints,
filter: BASIC_SUPPORTED_FILE_EXTENSIONS_REGEX,
filter: SUPPORTED_FILE_EXTENSIONS_FOR_CODE_REGEX,
useGlobalIdForKeyName: true
}, cb);
},
Expand All @@ -594,7 +594,7 @@ module.exports = function(sails) {
loadResponses: function (cb) {
includeAll.optional({
dirname: sails.config.paths.responses,
filter: BASIC_SUPPORTED_FILE_EXTENSIONS_REGEX,
filter: SUPPORTED_FILE_EXTENSIONS_FOR_CODE_REGEX,
useGlobalIdForKeyName: true
}, bindToSails(cb));
},
Expand Down

0 comments on commit 9253abc

Please sign in to comment.