-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
86 lines (86 loc) · 4.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"use strict";
exports.__esModule = true;
exports.DevMindGulpBuilder = void 0;
var apply_template_1 = require("./extension/apply-template");
var read_index_1 = require("./extension/read-index");
var read_asciidoctor_1 = require("./extension/read-asciidoctor");
var convert_to_html_1 = require("./extension/convert-to-html");
var convert_to_json_1 = require("./extension/convert-to-json");
var convert_to_rss_1 = require("./extension/convert-to-rss");
var convert_to_blog_list_1 = require("./extension/convert-to-blog-list");
var convert_to_blog_page_1 = require("./extension/convert-to-blog-page");
var file_exist_1 = require("./extension/file-exist");
var files_exist_1 = require("./extension/files-exist");
var highlight_code_1 = require("./extension/highlight-code");
var read_html_1 = require("./extension/read-html");
var convert_to_sitemap_1 = require("./extension/convert-to-sitemap");
var defaultOptions = {
path: '../../../',
modeDev: true,
metadata: {
rss: 'src/metadata/rss.json',
blog: 'src/metadata/blog.json',
html: 'src/metadata/html.json',
sitemap: 'src/metadata/sitemap.json'
},
dirNames: ['training/', 'blog/']
};
var DevMindGulpBuilder = /** @class */ (function () {
function DevMindGulpBuilder(givenOptions) {
this.options = defaultOptions;
this.options.modeDev = !(process.env.NODE_ENV && process.env.NODE_ENV === 'prod');
if (givenOptions) {
this.options.path = givenOptions.path || defaultOptions.path;
if (givenOptions.metadata) {
this.options.metadata.rss = givenOptions.metadata.rss || defaultOptions.metadata.rss;
this.options.metadata.blog = givenOptions.metadata.blog || defaultOptions.metadata.blog;
this.options.metadata.html = givenOptions.metadata.html || defaultOptions.metadata.html;
this.options.metadata.sitemap = givenOptions.metadata.sitemap || defaultOptions.metadata.sitemap;
}
if (givenOptions.dirNames) {
this.options.dirNames = givenOptions.dirNames;
}
}
}
DevMindGulpBuilder.prototype.applyTemplate = function (handlebarsTemplateFile, partials) {
return apply_template_1.extApplyTemplate(this.options, handlebarsTemplateFile, partials);
};
DevMindGulpBuilder.prototype.convertToHtml = function () {
return convert_to_html_1.extConvertToHtml();
};
DevMindGulpBuilder.prototype.convertToJson = function (filename) {
return convert_to_json_1.extConvertToJson(filename);
};
DevMindGulpBuilder.prototype.convertToRss = function (filename) {
return convert_to_rss_1.extConvertToRss(this.options, filename);
};
DevMindGulpBuilder.prototype.convertToSitemap = function () {
return convert_to_sitemap_1.extConvertToSitemap(this.options);
};
DevMindGulpBuilder.prototype.convertToBlogList = function (handlebarsTemplateFile, partials, filename, nbArticleMax) {
return convert_to_blog_list_1.extConvertToBlogList(this.options, handlebarsTemplateFile, partials, filename, nbArticleMax);
};
DevMindGulpBuilder.prototype.convertToBlogPage = function (handlebarsTemplateFile, partials, blogIndexFile) {
return convert_to_blog_page_1.extConvertToBlogPage(this.options, handlebarsTemplateFile, partials, blogIndexFile);
};
DevMindGulpBuilder.prototype.fileExist = function (filePath) {
return file_exist_1.extFileExist(filePath);
};
DevMindGulpBuilder.prototype.filesExist = function () {
return files_exist_1.extFilesExist(this.options);
};
DevMindGulpBuilder.prototype.highlightCode = function (selector) {
return highlight_code_1.extHighlightCode(selector);
};
DevMindGulpBuilder.prototype.readAsciidoc = function () {
return read_asciidoctor_1.extReadAsciidoc(this.options);
};
DevMindGulpBuilder.prototype.readHtml = function () {
return read_html_1.extReadHtml(this.options);
};
DevMindGulpBuilder.prototype.readIndex = function () {
return read_index_1.extReadIndex();
};
return DevMindGulpBuilder;
}());
exports.DevMindGulpBuilder = DevMindGulpBuilder;