mirror of
https://github.com/strapi/strapi.git
synced 2025-12-25 06:04:29 +00:00
Use new dirs (app/dist)
This commit is contained in:
parent
fb91d68983
commit
84d106e7f8
@ -5,7 +5,7 @@ const fse = require('fs-extra');
|
||||
const koaStatic = require('koa-static');
|
||||
|
||||
const registerAdminPanelRoute = ({ strapi }) => {
|
||||
let buildDir = resolve(strapi.dirs.root, 'build');
|
||||
let buildDir = resolve(strapi.dirs.dist.root, 'build');
|
||||
|
||||
if (!fse.pathExistsSync(buildDir)) {
|
||||
buildDir = resolve(__dirname, '../../build');
|
||||
|
||||
@ -7,7 +7,7 @@ const fs = require('fs-extra');
|
||||
const getPkgPath = name => path.dirname(require.resolve(`${name}/package.json`));
|
||||
|
||||
async function createPluginsJs(plugins, dest) {
|
||||
const pluginsArray = plugins.map(({ pathToPlugin, name }) => {
|
||||
const pluginsArray = plugins.map(({ appPathToPlugin, name }) => {
|
||||
const shortName = _.camelCase(name);
|
||||
|
||||
/**
|
||||
@ -19,7 +19,7 @@ async function createPluginsJs(plugins, dest) {
|
||||
* Backslash looks to work only for absolute paths with webpack => https://webpack.js.org/concepts/module-resolution/#absolute-paths
|
||||
*/
|
||||
const realPath = path
|
||||
.join(path.relative(path.resolve(dest, 'admin', 'src'), pathToPlugin), 'strapi-admin.js')
|
||||
.join(path.relative(path.resolve(dest, 'admin', 'src'), appPathToPlugin), 'strapi-admin.js')
|
||||
.replace(/\\/g, '/');
|
||||
|
||||
return {
|
||||
|
||||
@ -10,7 +10,7 @@ const fse = require('fs-extra');
|
||||
async function clear(uid) {
|
||||
const { apiName, modelName } = strapi.contentTypes[uid];
|
||||
|
||||
const apiFolder = path.join(strapi.dirs.api, apiName);
|
||||
const apiFolder = path.join(strapi.dirs.app.api, apiName);
|
||||
|
||||
await recursiveRemoveFiles(apiFolder, createDeleteApiFunction(modelName));
|
||||
await deleteBackup(uid);
|
||||
@ -23,8 +23,8 @@ async function clear(uid) {
|
||||
async function backup(uid) {
|
||||
const { apiName } = strapi.contentTypes[uid];
|
||||
|
||||
const apiFolder = path.join(strapi.dirs.api, apiName);
|
||||
const backupFolder = path.join(strapi.dirs.api, '.backup', apiName);
|
||||
const apiFolder = path.join(strapi.dirs.app.api, apiName);
|
||||
const backupFolder = path.join(strapi.dirs.app.api, '.backup', apiName);
|
||||
|
||||
// backup the api folder
|
||||
await fse.copy(apiFolder, backupFolder);
|
||||
@ -37,8 +37,8 @@ async function backup(uid) {
|
||||
async function deleteBackup(uid) {
|
||||
const { apiName } = strapi.contentTypes[uid];
|
||||
|
||||
const backupFolder = path.join(strapi.dirs.api, '.backup');
|
||||
const apiBackupFolder = path.join(strapi.dirs.api, '.backup', apiName);
|
||||
const backupFolder = path.join(strapi.dirs.app.api, '.backup');
|
||||
const apiBackupFolder = path.join(strapi.dirs.app.api, '.backup', apiName);
|
||||
|
||||
await fse.remove(apiBackupFolder);
|
||||
|
||||
@ -55,8 +55,8 @@ async function deleteBackup(uid) {
|
||||
async function rollback(uid) {
|
||||
const { apiName } = strapi.contentTypes[uid];
|
||||
|
||||
const apiFolder = path.join(strapi.dirs.api, apiName);
|
||||
const backupFolder = path.join(strapi.dirs.api, '.backup', apiName);
|
||||
const apiFolder = path.join(strapi.dirs.app.api, apiName);
|
||||
const backupFolder = path.join(strapi.dirs.app.api, '.backup', apiName);
|
||||
|
||||
const exists = await fse.exists(backupFolder);
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ const editCategory = async (name, infos) => {
|
||||
// only edit the components in this specific category
|
||||
if (component.category !== name) return;
|
||||
|
||||
component.setUID(newUID).setDir(join(strapi.dirs.components, newName));
|
||||
component.setUID(newUID).setDir(join(strapi.dirs.app.components, newName));
|
||||
|
||||
builder.components.forEach(compo => {
|
||||
compo.updateComponent(oldUID, newUID);
|
||||
|
||||
@ -141,7 +141,7 @@ const generateAPI = ({ singularName, kind = 'collectionType', pluralName, displa
|
||||
bootstrapApi: true,
|
||||
attributes: [],
|
||||
},
|
||||
{ dir: strapi.dirs.root }
|
||||
{ dir: strapi.dirs.app.root }
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ module.exports = function createComponentBuilder() {
|
||||
}
|
||||
|
||||
const handler = createSchemaHandler({
|
||||
dir: path.join(strapi.dirs.components, nameToSlug(infos.category)),
|
||||
dir: path.join(strapi.dirs.app.components, nameToSlug(infos.category)),
|
||||
filename: `${nameToSlug(infos.displayName)}.json`,
|
||||
});
|
||||
|
||||
@ -88,7 +88,7 @@ module.exports = function createComponentBuilder() {
|
||||
throw new ApplicationError('component.edit.alreadyExists');
|
||||
}
|
||||
|
||||
const newDir = path.join(strapi.dirs.components, newCategory);
|
||||
const newDir = path.join(strapi.dirs.app.components, newCategory);
|
||||
|
||||
const oldAttributes = component.schema.attributes;
|
||||
|
||||
|
||||
@ -79,7 +79,12 @@ module.exports = function createComponentBuilder() {
|
||||
|
||||
const contentType = createSchemaHandler({
|
||||
modelName: infos.singularName,
|
||||
dir: path.join(strapi.dirs.api, infos.singularName, 'content-types', infos.singularName),
|
||||
dir: path.join(
|
||||
strapi.dirs.app.api,
|
||||
infos.singularName,
|
||||
'content-types',
|
||||
infos.singularName
|
||||
),
|
||||
filename: `schema.json`,
|
||||
});
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ module.exports = function createBuilder() {
|
||||
plugin: compo.modelName,
|
||||
uid: compo.uid,
|
||||
filename: compo.__filename__,
|
||||
dir: join(strapi.dirs.components, compo.category),
|
||||
dir: join(strapi.dirs.app.components, compo.category),
|
||||
schema: compo.__schema__,
|
||||
};
|
||||
});
|
||||
@ -33,12 +33,17 @@ module.exports = function createBuilder() {
|
||||
|
||||
const dir = contentType.plugin
|
||||
? join(
|
||||
strapi.dirs.extensions,
|
||||
strapi.dirs.app.extensions,
|
||||
contentType.plugin,
|
||||
'content-types',
|
||||
contentType.info.singularName
|
||||
)
|
||||
: join(strapi.dirs.api, contentType.apiName, 'content-types', contentType.info.singularName);
|
||||
: join(
|
||||
strapi.dirs.app.api,
|
||||
contentType.apiName,
|
||||
'content-types',
|
||||
contentType.info.singularName
|
||||
);
|
||||
|
||||
return {
|
||||
modelName: contentType.modelName,
|
||||
|
||||
@ -23,7 +23,7 @@ const migrationResolver = path => {
|
||||
};
|
||||
|
||||
const createUmzugProvider = db => {
|
||||
const migrationDir = path.join(strapi.dirs.root, 'database/migrations');
|
||||
const migrationDir = path.join(strapi.dirs.app.root, 'database/migrations');
|
||||
|
||||
fse.ensureDirSync(migrationDir);
|
||||
|
||||
|
||||
@ -52,8 +52,8 @@ class Strapi {
|
||||
constructor(opts = {}) {
|
||||
destroyOnSignal(this);
|
||||
|
||||
const rootDir = opts.dir ? path.resolve(process.cwd(), opts.dir) : process.cwd();
|
||||
const appConfig = loadConfiguration(rootDir, opts);
|
||||
const distRootDir = opts.dir ? path.resolve(process.cwd(), opts.dir) : process.cwd();
|
||||
const appConfig = loadConfiguration(distRootDir, opts);
|
||||
|
||||
this.container = createContainer(this);
|
||||
this.container.register('config', createConfigProvider(appConfig));
|
||||
@ -68,7 +68,13 @@ class Strapi {
|
||||
this.container.register('apis', apisRegistry(this));
|
||||
this.container.register('auth', createAuth(this));
|
||||
|
||||
this.dirs = utils.getDirs(rootDir, { strapi: this });
|
||||
this.dirs = utils.getDirs(
|
||||
{
|
||||
appDir: process.cwd(),
|
||||
distDir: distRootDir,
|
||||
},
|
||||
{ strapi: this }
|
||||
);
|
||||
|
||||
this.isLoaded = false;
|
||||
this.reload = this.reload();
|
||||
@ -89,7 +95,7 @@ class Strapi {
|
||||
}
|
||||
|
||||
get EE() {
|
||||
return ee({ dir: this.dirs.root, logger: this.log });
|
||||
return ee({ dir: this.dirs.dist.root, logger: this.log });
|
||||
}
|
||||
|
||||
get services() {
|
||||
|
||||
@ -18,18 +18,18 @@ const DEFAULT_CONTENT_TYPE = {
|
||||
};
|
||||
|
||||
module.exports = async strapi => {
|
||||
if (!existsSync(strapi.dirs.api)) {
|
||||
if (!existsSync(strapi.dirs.dist.api)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const apisFDs = await fse.readdir(strapi.dirs.api, { withFileTypes: true });
|
||||
const apisFDs = await fse.readdir(strapi.dirs.dist.api, { withFileTypes: true });
|
||||
const apis = {};
|
||||
|
||||
// only load folders
|
||||
for (const apiFD of apisFDs) {
|
||||
if (apiFD.isDirectory()) {
|
||||
const apiName = normalizeName(apiFD.name);
|
||||
const api = await loadAPI(join(strapi.dirs.api, apiFD.name));
|
||||
const api = await loadAPI(join(strapi.dirs.dist.api, apiFD.name));
|
||||
|
||||
apis[apiName] = api;
|
||||
}
|
||||
|
||||
@ -6,19 +6,20 @@ const { pathExists } = require('fs-extra');
|
||||
const loadFiles = require('../../load/load-files');
|
||||
|
||||
module.exports = async strapi => {
|
||||
if (!(await pathExists(strapi.dirs.components))) {
|
||||
if (!(await pathExists(strapi.dirs.dist.components))) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const map = await loadFiles(strapi.dirs.components, '*/*.*(js|json)');
|
||||
const map = await loadFiles(strapi.dirs.dist.components, '*/*.*(js|json)');
|
||||
|
||||
return Object.keys(map).reduce((acc, category) => {
|
||||
Object.keys(map[category]).forEach(key => {
|
||||
const schema = map[category][key];
|
||||
|
||||
const filePath = join(strapi.dirs.components, category, schema.__filename__);
|
||||
|
||||
if (!schema.collectionName) {
|
||||
// NOTE: We're using the filepath from the app directory instead of the dist for information purpose
|
||||
const filePath = join(strapi.dirs.app.components, category, schema.__filename__);
|
||||
|
||||
return strapi.stopWithError(
|
||||
`Component ${key} is missing a "collectionName" property.\nVerify file ${filePath}.`
|
||||
);
|
||||
|
||||
@ -13,7 +13,7 @@ module.exports = async function loadMiddlewares(strapi) {
|
||||
};
|
||||
|
||||
const loadLocalMiddlewares = async strapi => {
|
||||
const dir = strapi.dirs.middlewares;
|
||||
const dir = strapi.dirs.dist.middlewares;
|
||||
|
||||
if (!(await fse.pathExists(dir))) {
|
||||
return {};
|
||||
|
||||
@ -29,10 +29,15 @@ const toDetailedDeclaration = declaration => {
|
||||
let detailedDeclaration = pick(['enabled'], declaration);
|
||||
if (has('resolve', declaration)) {
|
||||
let pathToPlugin = '';
|
||||
let appPathToPlugin = '';
|
||||
|
||||
try {
|
||||
pathToPlugin = dirname(require.resolve(declaration.resolve));
|
||||
appPathToPlugin = pathToPlugin;
|
||||
} catch (e) {
|
||||
pathToPlugin = resolve(strapi.dirs.root, declaration.resolve);
|
||||
// FIXME: It'll break for resolve paths that are located outside the project files
|
||||
pathToPlugin = resolve(strapi.dirs.dist.root, declaration.resolve);
|
||||
appPathToPlugin = resolve(strapi.dirs.app.root, declaration.resolve);
|
||||
|
||||
if (!existsSync(pathToPlugin) || !statSync(pathToPlugin).isDirectory()) {
|
||||
throw new Error(`${declaration.resolve} couldn't be resolved`);
|
||||
@ -40,6 +45,7 @@ const toDetailedDeclaration = declaration => {
|
||||
}
|
||||
|
||||
detailedDeclaration.pathToPlugin = pathToPlugin;
|
||||
detailedDeclaration.appPathToPlugin = appPathToPlugin;
|
||||
}
|
||||
return detailedDeclaration;
|
||||
};
|
||||
|
||||
@ -12,9 +12,9 @@ const loadConfigFile = require('../../app-configuration/load-config-file');
|
||||
* @return {Promise<{}>}
|
||||
*/
|
||||
const getUserPluginsConfig = async () => {
|
||||
const globalUserConfigPath = join(strapi.dirs.config, 'plugins.js');
|
||||
const globalUserConfigPath = join(strapi.dirs.dist.config, 'plugins.js');
|
||||
const currentEnvUserConfigPath = join(
|
||||
strapi.dirs.config,
|
||||
strapi.dirs.dist.config,
|
||||
'env',
|
||||
process.env.NODE_ENV,
|
||||
'plugins.js'
|
||||
|
||||
@ -26,7 +26,7 @@ const defaultPlugin = {
|
||||
};
|
||||
|
||||
const applyUserExtension = async plugins => {
|
||||
const extensionsDir = strapi.dirs.extensions;
|
||||
const extensionsDir = strapi.dirs.dist.extensions;
|
||||
if (!(await fse.pathExists(extensionsDir))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ const fse = require('fs-extra');
|
||||
|
||||
// TODO:: allow folders with index.js inside for bigger policies
|
||||
module.exports = async function loadPolicies(strapi) {
|
||||
const dir = strapi.dirs.policies;
|
||||
const dir = strapi.dirs.dist.policies;
|
||||
|
||||
if (!(await fse.pathExists(dir))) {
|
||||
return;
|
||||
|
||||
@ -18,11 +18,11 @@ const validateSrcIndex = srcIndex => {
|
||||
};
|
||||
|
||||
module.exports = strapi => {
|
||||
if (!existsSync(strapi.dirs.src)) {
|
||||
if (!existsSync(strapi.dirs.dist.src)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pathToSrcIndex = resolve(strapi.dirs.src, 'index.js');
|
||||
const pathToSrcIndex = resolve(strapi.dirs.dist.src, 'index.js');
|
||||
if (!existsSync(pathToSrcIndex) || statSync(pathToSrcIndex).isDirectory()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -15,5 +15,5 @@ const defaults = {
|
||||
module.exports = (config, { strapi }) => {
|
||||
const { maxAge, path: faviconPath } = defaultsDeep(defaults, config);
|
||||
|
||||
return favicon(resolve(strapi.dirs.root, faviconPath), { maxAge });
|
||||
return favicon(resolve(strapi.dirs.app.root, faviconPath), { maxAge });
|
||||
};
|
||||
|
||||
@ -71,6 +71,7 @@ module.exports = (config, { strapi }) => {
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/assets/images/(.*)',
|
||||
// Why do we use the __dirname and not strapi.dirs here? @alexandrebodin
|
||||
handler: serveStatic(path.resolve(__dirname, 'assets/images'), {
|
||||
maxage: maxAge,
|
||||
defer: true,
|
||||
@ -80,7 +81,7 @@ module.exports = (config, { strapi }) => {
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/(.*)',
|
||||
handler: koaStatic(strapi.dirs.public, {
|
||||
handler: koaStatic(strapi.dirs.app.public, {
|
||||
maxage: maxAge,
|
||||
defer: true,
|
||||
}),
|
||||
|
||||
@ -12,7 +12,7 @@ module.exports = strapi => {
|
||||
|
||||
const normalizedPath = path.normalize(filePath).replace(/^\/?(\.\/|\.\.\/)+/, '');
|
||||
|
||||
return path.resolve(strapi.dirs.root, normalizedPath);
|
||||
return path.resolve(strapi.dirs.app.root, normalizedPath);
|
||||
}
|
||||
|
||||
const strapiFS = {
|
||||
|
||||
@ -90,7 +90,7 @@ const hashProject = strapi =>
|
||||
|
||||
const hashDep = strapi => {
|
||||
const depStr = JSON.stringify(strapi.config.info.dependencies);
|
||||
const readmePath = path.join(strapi.dirs.root, 'README.md');
|
||||
const readmePath = path.join(strapi.dirs.app.root, 'README.md');
|
||||
|
||||
try {
|
||||
if (fs.existsSync(readmePath)) {
|
||||
|
||||
@ -112,7 +112,7 @@ const resolveCustomMiddleware = (resolve, strapi) => {
|
||||
modulePath = require.resolve(resolve);
|
||||
} catch (error) {
|
||||
if (error.code === 'MODULE_NOT_FOUND') {
|
||||
modulePath = path.resolve(strapi.dirs.root, resolve);
|
||||
modulePath = path.resolve(strapi.dirs.dist.root, resolve);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
|
||||
@ -2,16 +2,32 @@
|
||||
|
||||
const { join, resolve } = require('path');
|
||||
|
||||
const getDirs = (root, { strapi }) => ({
|
||||
root,
|
||||
src: join(root, 'src'),
|
||||
api: join(root, 'src', 'api'),
|
||||
components: join(root, 'src', 'components'),
|
||||
extensions: join(root, 'src', 'extensions'),
|
||||
policies: join(root, 'src', 'policies'),
|
||||
middlewares: join(root, 'src', 'middlewares'),
|
||||
config: join(root, 'config'),
|
||||
public: resolve(root, strapi.config.get('server.dirs.public')),
|
||||
const getDirs = ({ appDir, distDir }) => ({
|
||||
dist: {
|
||||
root: distDir,
|
||||
src: join(distDir, 'src'),
|
||||
api: join(distDir, 'src', 'api'),
|
||||
components: join(distDir, 'src', 'components'),
|
||||
extensions: join(distDir, 'src', 'extensions'),
|
||||
policies: join(distDir, 'src', 'policies'),
|
||||
middlewares: join(distDir, 'src', 'middlewares'),
|
||||
config: join(distDir, 'config'),
|
||||
public: join(distDir, 'public'),
|
||||
},
|
||||
app: {
|
||||
root: appDir,
|
||||
src: join(appDir, 'src'),
|
||||
api: join(appDir, 'src', 'api'),
|
||||
components: join(appDir, 'src', 'components'),
|
||||
extensions: join(appDir, 'src', 'extensions'),
|
||||
policies: join(appDir, 'src', 'policies'),
|
||||
middlewares: join(appDir, 'src', 'middlewares'),
|
||||
config: join(appDir, 'config'),
|
||||
public: join(appDir, 'public'),
|
||||
},
|
||||
static: {
|
||||
public: resolve(appDir, strapi.config.get('server.dirs.public')),
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = getDirs;
|
||||
|
||||
@ -38,7 +38,7 @@ const createUpdateNotifier = strapi => {
|
||||
config = new Configstore(
|
||||
pkg.name,
|
||||
{},
|
||||
{ configPath: path.join(strapi.dirs.root, '.strapi-updater.json') }
|
||||
{ configPath: path.join(strapi.dirs.app.root, '.strapi-updater.json') }
|
||||
);
|
||||
} catch {
|
||||
// we don't have write access to the file system
|
||||
|
||||
@ -25,7 +25,7 @@ module.exports = ({ strapi }) => {
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/uploads/(.*)',
|
||||
handler: [range, koaStatic(strapi.dirs.public, { defer: true, ...localServerConfig })],
|
||||
handler: [range, koaStatic(strapi.dirs.app.public, { defer: true, ...localServerConfig })],
|
||||
config: { auth: false },
|
||||
},
|
||||
]);
|
||||
|
||||
@ -49,7 +49,7 @@ module.exports = {
|
||||
.getDocumentationVersion();
|
||||
|
||||
const openAPISpecsPath = path.join(
|
||||
strapi.dirs.extensions,
|
||||
strapi.dirs.dist.extensions,
|
||||
'documentation',
|
||||
'documentation',
|
||||
version,
|
||||
@ -69,7 +69,7 @@ module.exports = {
|
||||
|
||||
try {
|
||||
const layoutPath = path.resolve(
|
||||
strapi.dirs.extensions,
|
||||
strapi.dirs.app.extensions,
|
||||
'documentation',
|
||||
'public',
|
||||
'index.html'
|
||||
@ -81,7 +81,11 @@ module.exports = {
|
||||
ctx.url = path.basename(`${ctx.url}/index.html`);
|
||||
|
||||
try {
|
||||
const staticFolder = path.resolve(strapi.dirs.extensions, 'documentation', 'public');
|
||||
const staticFolder = path.resolve(
|
||||
strapi.dirs.dist.extensions,
|
||||
'documentation',
|
||||
'public'
|
||||
);
|
||||
return koaStatic(staticFolder)(ctx, next);
|
||||
} catch (e) {
|
||||
strapi.log.error(e);
|
||||
@ -116,7 +120,7 @@ module.exports = {
|
||||
|
||||
try {
|
||||
const layoutPath = path.resolve(
|
||||
strapi.dirs.extensions,
|
||||
strapi.dirs.dist.extensions,
|
||||
'documentation',
|
||||
'public',
|
||||
'login.html'
|
||||
@ -127,7 +131,7 @@ module.exports = {
|
||||
ctx.url = path.basename(`${ctx.url}/login.html`);
|
||||
|
||||
try {
|
||||
const staticFolder = path.resolve(strapi.dirs.extensions, 'documentation', 'public');
|
||||
const staticFolder = path.resolve(strapi.dirs.dist.extensions, 'documentation', 'public');
|
||||
return koaStatic(staticFolder)(ctx, next);
|
||||
} catch (e) {
|
||||
strapi.log.error(e);
|
||||
|
||||
@ -17,11 +17,12 @@ module.exports = ({ strapi }) => {
|
||||
},
|
||||
|
||||
getFullDocumentationPath() {
|
||||
return path.join(strapi.dirs.extensions, 'documentation', 'documentation');
|
||||
return path.join(strapi.dirs.app.extensions, 'documentation', 'documentation');
|
||||
},
|
||||
|
||||
getCustomDocumentationPath() {
|
||||
return path.join(strapi.dirs.extensions, 'documentation', 'config', 'settings.json');
|
||||
// ??
|
||||
return path.join(strapi.dirs.app.extensions, 'documentation', 'config', 'settings.json');
|
||||
},
|
||||
|
||||
getDocumentationVersions() {
|
||||
@ -71,10 +72,10 @@ module.exports = ({ strapi }) => {
|
||||
*/
|
||||
getApiDocumentationPath(api) {
|
||||
if (api.getter === 'plugin') {
|
||||
return path.join(strapi.dirs.extensions, api.name, 'documentation');
|
||||
return path.join(strapi.dirs.app.extensions, api.name, 'documentation');
|
||||
}
|
||||
|
||||
return path.join(strapi.dirs.api, api.name, 'documentation');
|
||||
return path.join(strapi.dirs.app.api, api.name, 'documentation');
|
||||
},
|
||||
|
||||
async deleteDocumentation(version) {
|
||||
|
||||
@ -22,7 +22,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
// Ensure uploads folder exists
|
||||
const uploadPath = path.resolve(strapi.dirs.public, UPLOADS_FOLDER_NAME);
|
||||
const uploadPath = path.resolve(strapi.dirs.static.public, UPLOADS_FOLDER_NAME);
|
||||
if (!fse.pathExistsSync(uploadPath)) {
|
||||
throw new Error(
|
||||
`The upload folder (${uploadPath}) doesn't exist or is not accessible. Please make sure it exists.`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user