2018-04-25 14:33:38 +02:00
|
|
|
const path = require('path');
|
|
|
|
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, '..');
|
2018-05-03 17:39:24 +02:00
|
|
|
// const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
|
|
|
const isSetup = process.env.IS_MONOREPO;
|
2018-04-25 14:33:38 +02:00
|
|
|
|
2018-04-25 17:27:09 +02:00
|
|
|
// 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)
|
2018-04-25 14:59:28 +02:00
|
|
|
if (!isSetup) {
|
|
|
|
const strapi = require(path.join(appPath, 'node_modules', 'strapi'));
|
|
|
|
strapi.config.appPath = appPath;
|
|
|
|
strapi.log.level = 'silent';
|
2018-04-25 14:33:38 +02:00
|
|
|
|
2018-04-25 14:59:28 +02:00
|
|
|
(async () => {
|
|
|
|
await strapi.load({
|
|
|
|
environment: process.env.NODE_ENV,
|
|
|
|
});
|
2018-06-15 11:59:26 +02:00
|
|
|
|
|
|
|
// Force exit process if an other process doen't exit during Strapi load.
|
|
|
|
process.exit();
|
2018-04-25 14:59:28 +02:00
|
|
|
})();
|
|
|
|
}
|
2018-06-15 11:59:26 +02:00
|
|
|
|