mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +00:00
Merge pull request #16508 from strapi/chore/add-error-on-empty-content-type-folder
This commit is contained in:
commit
c33855d39e
@ -5,6 +5,7 @@ const { existsSync } = require('fs-extra');
|
||||
const _ = require('lodash');
|
||||
const fse = require('fs-extra');
|
||||
const { isKebabCase, importDefault } = require('@strapi/utils');
|
||||
const { isEmpty } = require('lodash/fp');
|
||||
|
||||
const DEFAULT_CONTENT_TYPE = {
|
||||
schema: {},
|
||||
@ -115,6 +116,10 @@ const loadContentTypes = async (dir) => {
|
||||
const contentTypeName = normalizeName(fd.name);
|
||||
const contentType = await loadDir(join(dir, fd.name));
|
||||
|
||||
if (isEmpty(contentType) || isEmpty(contentType.schema)) {
|
||||
throw new Error(`Could not load content type found at ${dir}`);
|
||||
}
|
||||
|
||||
contentTypes[normalizeName(contentTypeName)] = _.defaults(contentType, DEFAULT_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user