@cresteem/hawk-js
Version:
Hawk.js is an advanced, open-source sitemap generator and SEO automation tool designed to enhance your website's search engine visibility. It automates the creation of comprehensive sitemaps and simplifies their submission to major search engines such as
28 lines (27 loc) • 933 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = loadConfig;
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
function loadConfig() {
const CONFIG_FILE_NAME = "hawk.config";
const projectConfigFile = (0, node_path_1.join)(process.cwd(), `${CONFIG_FILE_NAME}.js`);
const projectHasConfig = (0, node_fs_1.existsSync)(projectConfigFile);
let projectConfig = {};
let defaultConfig = {};
if (projectHasConfig) {
try {
projectConfig = require(projectConfigFile).default;
}
catch (err) {
console.log("Error while loading settings\n", err);
process.exit(1);
}
}
defaultConfig = require((0, node_path_1.join)(__dirname, CONFIG_FILE_NAME)).default;
const configurations = {
...defaultConfig,
...projectConfig,
};
return configurations;
}