mrkdown
Version:
Markdown files to HTML static site generator - angular.js app
91 lines (90 loc) • 3.73 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchConfig = exports.defaultConfig = void 0;
var path_1 = __importDefault(require("path"));
var fs_1 = __importDefault(require("fs"));
var const_1 = require("./const");
var os = __importStar(require("os"));
exports.defaultConfig = {
removeRightSideBar: true,
distFolderName: 'markdown-publish',
title: 'Notes',
brandName: 'Notes',
favIconUrl: '',
skipFolders: [
".git",
"node_modules",
],
skipFiles: [],
home: false,
homeHtmlUrl: '',
homeHtml: '',
menus: [],
users: [],
useHash: true,
prod: false,
separator: os.type() === "Windows_NT" ? "\\" : "/"
};
function fetchConfig() {
var configPath = path_1.default.join(path_1.default.resolve(const_1.CONFIG_FILE_NAME));
if (fs_1.default.existsSync(configPath)) {
var configValues_1 = require(configPath);
Object.keys(exports.defaultConfig).forEach(function (x) {
if (x == "skipFolders") {
if (configValues_1[x] != null && configValues_1[x] != undefined && Array.isArray(configValues_1[x])) {
configValues_1[x].forEach(function (conValue) {
if (!exports.defaultConfig.skipFolders.some(function (skipFolderValue) { return skipFolderValue == conValue; })) {
exports.defaultConfig.skipFolders.push(conValue);
}
});
}
}
else if (x == "skipFiles") {
if (configValues_1[x] != null && configValues_1[x] != undefined && Array.isArray(configValues_1[x])) {
configValues_1[x].forEach(function (conValue) {
if (!exports.defaultConfig.skipFiles.some(function (skipFileName) { return skipFileName == conValue; })) {
exports.defaultConfig.skipFiles.push(conValue);
}
});
}
}
else if (x == "users") {
if (configValues_1[x] != null && configValues_1[x] != undefined && Array.isArray(configValues_1[x])) {
exports.defaultConfig.users = configValues_1[x];
}
}
else if (configValues_1[x] != null && configValues_1[x] != undefined) {
exports.defaultConfig[x] = configValues_1[x];
}
else { }
});
}
return exports.defaultConfig;
}
exports.fetchConfig = fetchConfig;