How to use the strapi-utils.dictionary.optional function in strapi-utils

To help you get started, we’ve selected a few strapi-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / packages / strapi / lib / configuration / hooks / dictionary / _api / index.js View on Github external
'services/*': cb => {
            dictionary.optional({
              dirname: path.resolve(strapi.config.appPath, strapi.config.paths.api, api, strapi.config.paths.services),
              filter: /(.+)\.(js)$/,
              depth: 1
            }, cb);
          },
github strapi / strapi / packages / strapi / lib / configuration / hooks / dictionary / _config / index.js View on Github external
'api/**': cb => {
            dictionary.optional(
              {
                dirname: path.resolve(
                  strapi.config.appPath,
                  strapi.config.paths.api
                ),
                excludeDirs: /(public)$/,
                filter: /(.+)\.(js|json)$/,
                depth: 3
              },
              cb
            );
          },
github strapi / strapi / packages / strapi / lib / configuration / hooks / dictionary / _externalHooks / index.js View on Github external
externalHooks: cb => {
          dictionary.optional({
            dirname: path.resolve(strapi.config.appPath, 'node_modules'),
            filter: /^(package\.json)$/,
            excludeDirs: /^((?!(strapi-)).)*$/,
            depth: 2
          }, cb);
        }
      },
github strapi / strapi / packages / strapi / lib / configuration / hooks / dictionary / _plugins / index.js View on Github external
'controllers/*': cb => {
            dictionary.optional({
              dirname: path.resolve(strapi.config.appPath, strapi.config.paths.plugins, plugin, strapi.config.paths.controllers),
              filter: /(.+)\.(js)$/,
              depth: 1
            }, cb);
          },
github strapi / strapi / packages / strapi / lib / configuration / hooks / dictionary / _admin / index.js View on Github external
'services/*': cb => {
          dictionary.optional({
            dirname: path.resolve(strapi.config.appPath, strapi.config.paths.admin, strapi.config.paths.services),
            filter: /(.+)\.(js)$/,
            depth: 1
          }, cb);
        },