Fix monorepo setup

This commit is contained in:
soupette 2018-04-25 14:59:28 +02:00
parent 0a9f81765e
commit fb35bc75e0

View File

@ -4,13 +4,16 @@ const shell = require('shelljs');
const pwd = shell.pwd();
const isDevelopmentMode = path.resolve(pwd.stdout).indexOf('strapi-admin') !== -1;
const appPath = isDevelopmentMode ? path.resolve(process.env.PWD, '..') : path.resolve(pwd.stdout, '..');
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
const strapi = require(path.join(appPath, 'node_modules', 'strapi'));
strapi.config.appPath = appPath;
strapi.log.level = 'silent';
if (!isSetup) {
const strapi = require(path.join(appPath, 'node_modules', 'strapi'));
strapi.config.appPath = appPath;
strapi.log.level = 'silent';
(async () => {
await strapi.load({
environment: process.env.NODE_ENV,
});
})();
(async () => {
await strapi.load({
environment: process.env.NODE_ENV,
});
})();
}