drevo-shizni-html-builder
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -36,2 +36,5 @@ const fs = require("fs-extra"); | ||
} | ||
if (cfg.page.max_zoom < cfg.page.min_zoom) { | ||
throw new Error('"page.max_zoom" must be greater than or equal to "page.min_zoom"') | ||
} | ||
if (cfg.page.use_anchor_state === undefined) { | ||
@@ -38,0 +41,0 @@ cfg.page.use_anchor_state = true |
@@ -12,2 +12,3 @@ #!/usr/bin/env node | ||
const getConfig = require("./config"); | ||
const getPaths = require("./paths").getPaths; | ||
@@ -20,36 +21,21 @@ const cfgPath = process.argv.length > 3 | ||
const cfg = getConfig(cfgPath) | ||
const paths = getPaths(cfgDir, cfg) | ||
const srcTreeHtmlFilePath = path.join(cfgDir, cfg.entry) | ||
const treeFileName = path.basename(cfg.entry) | ||
const srcTreeHtmlFilesDir = path.join(cfgDir, path.join(path.dirname(cfg.entry), treeFileName + '.files')) | ||
const outputDir = path.join(cfgDir, cfg.output) | ||
const outputTreeHtmlFilePath = path.join(outputDir, treeFileName) | ||
const outputTreeHtmlFilesDir = path.join(outputDir, treeFileName + '.files') | ||
const popupCustomCssFileName = 'popup-custom.css' | ||
const srcPopupCustomCssPath = path.join(__dirname, '..', 'web', popupCustomCssFileName) | ||
const outputPopupCustomCssPath = path.join(outputDir, popupCustomCssFileName) | ||
const indexJsFileName = 'index.js' | ||
const srcIndexJsPath = path.join(__dirname, '..', 'dist', indexJsFileName) | ||
const outputIndexJsPath = path.join(outputDir, indexJsFileName) | ||
const faviconFileName = path.basename(cfg.favicon) | ||
const outputFaviconFilePath = path.join(outputDir, faviconFileName) | ||
const srcFaviconPath = path.join(cfgDir, cfg.favicon) | ||
if (fs.existsSync(outputDir)) { | ||
fs.rmSync(outputDir, {recursive: true}); | ||
if (fs.existsSync(paths.outputDir)) { | ||
fs.rmSync(paths.outputDir, {recursive: true}); | ||
} | ||
fs.ensureDirSync(outputDir); | ||
fs.ensureDirSync(paths.outputDir); | ||
// process tree html | ||
if (cfg.favicon && path.normalize(srcFaviconPath) !== path.normalize(outputFaviconFilePath)) { | ||
console.log(`Copying ${srcFaviconPath} to ${outputFaviconFilePath}...`); | ||
fs.copySync(srcFaviconPath, outputFaviconFilePath); | ||
if (cfg.favicon && paths.srcFaviconPath !== paths.outputFaviconFilePath) { | ||
console.log(`Copying ${paths.srcFaviconPath} to ${paths.outputFaviconFilePath}...`); | ||
fs.copySync(paths.srcFaviconPath, paths.outputFaviconFilePath); | ||
} | ||
fs.copySync(srcTreeHtmlFilePath, outputTreeHtmlFilePath); | ||
processHtml(outputTreeHtmlFilePath, dom => modifyMainHtmlDom( | ||
fs.copySync(paths.srcTreeHtmlFilePath, paths.outputTreeHtmlFilePath); | ||
processHtml(paths.outputTreeHtmlFilePath, dom => modifyMainHtmlDom( | ||
dom, | ||
indexJsFileName, | ||
cfg.favicon ? faviconFileName : undefined, | ||
paths.indexJsFileName, | ||
cfg.favicon ? paths.faviconFileName : undefined, | ||
cfg.noIndex, | ||
@@ -61,4 +47,4 @@ cfg.page, | ||
fs.copySync(srcTreeHtmlFilesDir, outputTreeHtmlFilesDir); | ||
glob(path.join(outputTreeHtmlFilesDir, "*.html"), undefined, function (err, files) { | ||
fs.copySync(paths.srcTreeHtmlFilesDir, paths.outputTreeHtmlFilesDir); | ||
glob(path.join(paths.outputTreeHtmlFilesDir, "*.html"), undefined, function (err, files) { | ||
if (err) { | ||
@@ -70,3 +56,3 @@ console.error(err); | ||
dom, | ||
popupCustomCssFileName, | ||
paths.popupCustomCssFileName, | ||
cfg.noIndex | ||
@@ -78,3 +64,3 @@ ))); | ||
fs.copySync(srcPopupCustomCssPath, outputPopupCustomCssPath); | ||
fs.copySync(srcIndexJsPath, outputIndexJsPath); | ||
fs.copySync(paths.srcPopupCustomCssPath, paths.outputPopupCustomCssPath); | ||
fs.copySync(paths.srcIndexJsPath, paths.outputIndexJsPath); |
{ | ||
"name": "drevo-shizni-html-builder", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"author": "cardinalby", | ||
@@ -5,0 +5,0 @@ "description": "Builds a proper html page from 'Древо Жизни' app's exported tree", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
303534
10
408
4