Aurélien Georget 6c5dcd2c83 Fix setup on Mac
2019-02-01 17:04:08 +01:00

28 lines
870 B
JavaScript

const path = require('path');
const shell = require('shelljs');
const pwd = shell.pwd();
const isDevelopmentMode = path.resolve(pwd.stdout).indexOf('strapi-admin') !== -1;
const isSetup = process.env.IS_MONOREPO || false;
const appPath = isDevelopmentMode ? path.resolve(process.env.PWD || process.cwd(), '..') : path.resolve(pwd.stdout, '..');
// Load the app configurations only when :
// - starting the app in dev mode
// - building the admin from an existing app (`npm run setup` at the root of the project)
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,
});
// Force exit process if an other process doen't exit during Strapi load.
process.exit();
})();
}