@grouparoo/core
Version:
The Grouparoo Core
45 lines (44 loc) • 1.94 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT = void 0;
const actionhero_1 = require("actionhero");
const pluginDetails_1 = require("../modules/pluginDetails");
const pluginInjection_1 = __importDefault(require("./pluginInjection"));
// learn more about the next.js app options here https://nextjs.org/docs/advanced-features/custom-server
const namespace = "next";
exports.DEFAULT = {
[namespace]: () => {
const nextRootPath = getNextRootPath();
return {
enabled: process.env.NEXT_DISABLED === "true" || !nextRootPath ? false : true,
dev: process.env.NEXT_DEVELOPMENT_MODE
? process.env.NEXT_DEVELOPMENT_MODE === "false"
? false
: true
: actionhero_1.env === "development",
quiet: false,
path: nextRootPath,
};
},
};
function getNextRootPath() {
let nextRootPath;
const pluginManifest = (0, pluginDetails_1.getPluginManifest)();
const uiPlugin = process.env.GROUPAROO_RUN_MODE === "cli:config" &&
pluginManifest.plugins.find((p) => p.name === "@grouparoo/ui-config")
? pluginManifest.plugins.find((p) => p.name === "@grouparoo/ui-config")
: pluginManifest.plugins.find((p) => p.name === "@grouparoo/ui-community" ||
p.name === "@grouparoo/ui-enterprise");
if (uiPlugin)
nextRootPath = uiPlugin.path;
if (!nextRootPath && Object.keys(pluginInjection_1.default).length > 0) {
const injectedUiPlugin = Object.keys(pluginInjection_1.default).find((k) => k.match("@grouparoo/ui"));
if (injectedUiPlugin) {
nextRootPath = pluginInjection_1.default[injectedUiPlugin].path;
}
}
return nextRootPath;
}