New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

blog-engine-sac

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blog-engine-sac - npm Package Compare versions

Comparing version 1.3.2 to 2.0.0

css/bootstrap-legend.css

18

html/category.html.js

@@ -7,2 +7,3 @@ export { createCategoryHtml };

import { normalizeDate } from "../source/dates.js";
import {makeUrl, escapeHtml} from "./links.js";

@@ -18,10 +19,11 @@

const listOfPosts = posts.map(function (post) {
// inline 3 first preview
const link = `../b/${escape(post.title)}.html`;
return `<li>
<a href="${link}">
${post.title}
</a></li>`;
// todo deduplicate from index
return `<a href="${makeUrl(post.base)}" class="post-preview">
<span class="post-title">
${escapeHtml(post.title)}
</span>
<p class="post-meta">Posted by
${post.author}
on <time>${post.creationDateString}</time></p>
</a>`;
});

@@ -28,0 +30,0 @@

export { createHeaderHtml };
import {indexFileName} from "./links.js";
const translations = {
fr: {
Home: `Accueil`,
About: `À propos`,
Contact: `Contact`,
}
}
const traduire = ((translations, lang, key) => {
if (translations[lang]) {
if (translations[lang][key]) {
return translations[lang][key];
}
}
return key;
})
.bind(undefined, translations);
const createHeaderHtml = (options) => {
const {searchCode, topLevel} = options;
const {searchCode, topLevel, lang, defaultLang} = options;
let prePath;

@@ -16,9 +33,9 @@ if (topLevel) {

<li class="nav-item">
<a class="nav-link" href="${prePath}/index.html">Home</a>
<a class="nav-link" href="${prePath}/${indexFileName(lang, defaultLang)}">${traduire(lang, `Home`)}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="${prePath}/about.html">About</a>
<a class="nav-link" href="${prePath}/about.html">${traduire(lang, `About`)}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="${prePath}/contact.html">Contact</a>
<a class="nav-link" href="${prePath}/contact.html">${traduire(lang, `Contact`)}</a>
</li>

@@ -25,0 +42,0 @@ <script type="module">${searchCode}</script>

@@ -10,3 +10,3 @@ export { createIndexHtml };

const createIndexHtml = (options) => {
const { body, title, author, description, posts, categories } = options;
const { body, title, author, description, posts, categories, lang, } = options;
const MAX_ARTICLE_PREVIEW = Number.MAX_SAFE_INTEGER || 3;

@@ -16,7 +16,8 @@ // can make this number smaller once a ui element has been created to display all entries

const postsPreview = posts.filter(function (post, index) {
const postsPreview = posts.filter(function (post) {
return post.lang === lang;
}).filter(function (post, index) {
return index < MAX_ARTICLE_PREVIEW;
}).map(function (post) {
return `<a href="${makeUrl(post.title)}" class="post-preview">
return `<a href="${makeUrl(post.base)}" class="post-preview">
<span class="post-title">

@@ -42,3 +43,3 @@ ${escapeHtml(post.title)}

return `<!DOCTYPE html>
<html lang="en">
<html lang="${lang}">
<head>

@@ -45,0 +46,0 @@ <meta charset="utf-8">

@@ -1,2 +0,2 @@

export { makeUrl, linkFromPost, linkFromCategory, escapeHtml};
export { makeUrl, linkFromPost, linkFromCategory, escapeHtml, indexFileName};

@@ -6,10 +6,10 @@ const escapeHtml = (x) => {

return x;
}
};
const linkFromCategory = (categoryName) => {
return `<a href="./c/${escape(categoryName)}.html">${escapeHtml(categoryName)}</a>`;
return `<a href="/c/${escape(categoryName)}.html">${escapeHtml(categoryName)}</a>`;
};
const linkFromPost = (post) => {
const {title} = post;
return `<a href="${makeUrl(title)}">${escapeHtml(title)}</a>`;
const {base, title} = post;
return `<a href="${makeUrl(base)}">${escapeHtml(title)}</a>`;
};

@@ -20,2 +20,10 @@

return `/b/${escape(ref)}`;
};
const indexFileName = (lang, defaultLang) => {
let name = `index.html`;
if (lang && lang !== defaultLang) {
name = `index-${lang}.html`;
}
return name;
};

@@ -9,3 +9,3 @@ export {createPostHtml};

const createPostHtml = (options) => {
const { body, title, author, description, creationDateString, modifiedDateString } = options;
const { body, title, author, description, creationDateString, modifiedDateString, translations } = options;
let lastEdit;

@@ -18,2 +18,9 @@

}
let availableTranslations = ``;
if (translations && translations.length) {
availableTranslations = `Translations <ul>${translations.map(({post}) => {
return `<li>[${post.lang}] ${linkFromPost(post)}</li>`;
}).join(``)}</ul>`;
}
return `<!DOCTYPE html>

@@ -55,2 +62,5 @@ <html lang="en">

<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
${availableTranslations}
</div>
<div class="col-lg-8 col-md-10 mx-auto">

@@ -92,3 +102,6 @@ ${lastEdit}

}
return `<p class="col-lg-8 col-md-10 mx-auto">${nextHtml} ${previousHtml}</p>`;
return `<div class="container"><div class="row">
<p class="col-lg-8 col-md-10 mx-auto">${previousHtml}</p>
<p class="col-lg-8 col-md-10 mx-auto">${nextHtml}</p>
</div></div>`;
};

@@ -6,4 +6,4 @@ export {styleSheets};

return `
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/bootstrap-legend.css" rel="stylesheet">
<link href="/css/clean-blog.min.css" rel="stylesheet">`;
};
export { searchCodeTemplate };
import {makeUrl} from "../html/links.js";
const maxResults = 10;
const searchCodeTemplate = (posts) => {
const tagsAndUrls = posts.map(({ title, finalTags }) => {
const tagsAndUrls = posts.map((post) => {
const { title, finalTags, base } = post;
return {
// convert to string for lunr
finalTags: finalTags.join(` `),
url: title,
title,
url: base,
};

@@ -23,4 +26,4 @@ });

const index = lunr(function () {
this.field("finalTags")
this.ref("url")
this.field("finalTags");
this.ref("url");

@@ -35,4 +38,6 @@ articles.forEach((item) => {

};
// duplicate from search
const makeUrl = (ref) => {
return \`/b/\${ref}\`;
return \`/b/\${escape(ref)}\`;
};

@@ -46,10 +51,16 @@

}
const results = index.search(event.target.value).map(takeRef);
results.length = 10; // do not display more
const rawResults = index.search(event.target.value)
rawResults.length = Math.min(${maxResults}, rawResults.length); // do not display more
rawResults.forEach(console.log);
const results = rawResults.map(takeRef).map(url => {
return articles.find(article => {
return article.url === url;
});
});
const elements = results.map(ref => {
const url = makeUrl(ref); // root url
const elements = results.map(article => {
const url = makeUrl(article.url); // root url
const li = document.createElement("li");
const a = document.createElement("a");
a.textContent = ref;
a.textContent = article.title;
a.href = url;

@@ -56,0 +67,0 @@ li.appendChild(a);

{
"name": "blog-engine-sac",
"version": "1.0.1",
"version": "2.0.0",
"lockfileVersion": 1,

@@ -27,12 +27,2 @@ "requires": true,

},
"@types/estree": {
"version": "0.0.42",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.42.tgz",
"integrity": "sha512-K1DPVvnBCPxzD+G51/cxVIoc2X8uUVl1zpJeE6iKcgHMj4+tbat5Xu4TjV7v2QSDbIeAfLi2hIk+u2+s0MlpUQ=="
},
"@types/node": {
"version": "13.1.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.1.8.tgz",
"integrity": "sha512-6XzyyNM9EKQW4HKuzbo/CkOIjn/evtCmsU+MUM1xDfJ+3/rNjBttM1NgN7AOQvN6tP1Sl1D1PIKMreTArnxM9A=="
},
"abbrev": {

@@ -46,3 +36,4 @@ "version": "1.1.1",

"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ=="
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
"dev": true
},

@@ -109,7 +100,2 @@ "acorn-jsx": {

},
"bootstrap": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.3.1.tgz",
"integrity": "sha512-rXqOmH1VilAt2DyPzluTi2blhk17bO7ef+zLLPlWvG494pDxcM234pJ8wTc/6R40UWizAIIMgxjvxZg5kmsbag=="
},
"brace-expansion": {

@@ -287,5 +273,5 @@ "version": "1.1.11",

"eslint-config-red": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/eslint-config-red/-/eslint-config-red-1.4.1.tgz",
"integrity": "sha512-ZNvQF2cyNcw+ludk86UcKlR3iQCUF/w2QZZDlEamJKkgBs0I+1b+ydizUG3VW6BueD3bvoG2+G2Fax6rsa6m8Q==",
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/eslint-config-red/-/eslint-config-red-1.7.0.tgz",
"integrity": "sha512-nHSUpsJszZx1pQO3S1/yL4qVC1OPMaiOlHDDKQWzaca4kv8NwJdcidPw+HI4RgcB5EeLM4c72rNZZVrqINYVmg==",
"dev": true

@@ -413,5 +399,5 @@ },

"filesac": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/filesac/-/filesac-11.1.0.tgz",
"integrity": "sha512-fJzKr9mdH4PCjvRBBYVNaLQd4ewqeZcr0NlGusAiEpOZnFZOh85ks8LHL09/kkW4u3JSS7Pep/1zcWg1svFuAQ=="
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/filesac/-/filesac-11.1.1.tgz",
"integrity": "sha512-NVFtfiqjZYA3+qSwgXD8hAhVoAHTnEtONryIGvTGWFuPelSRL4CMPID4GCgOusGvBov47Ki9IHePvv1gNw0d1Q=="
},

@@ -441,2 +427,8 @@ "flat-cache": {

},
"fsevents": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz",
"integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==",
"optional": true
},
"functional-red-black-tree": {

@@ -634,5 +626,5 @@ "version": "1.0.1",

"lunr": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.7.tgz",
"integrity": "sha512-HjFSiy0Y0qZoW5OA1I6qBi7OnsDdqQnaUr03jhorh30maQoaP+4lQCKklYE3Nq3WJMSUfuBl6N+bKY5wxCb9hw=="
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz",
"integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg=="
},

@@ -831,9 +823,7 @@ "markdown": {

"rollup": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-1.29.0.tgz",
"integrity": "sha512-V63Iz0dSdI5qPPN5HmCN6OBRzBFhMqNWcvwgq863JtSCTU6Vdvqq6S2fYle/dSCyoPrBkIP3EIr1RVs3HTRqqg==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.0.0.tgz",
"integrity": "sha512-tbvWownITR+0ebaX6iRr7IcLkziTCJacRpmWz03NIj3CZDmGlergYSwdG8wPx68LT0ms1YzqmbjUQHb6ut8pdw==",
"requires": {
"@types/estree": "*",
"@types/node": "*",
"acorn": "^7.1.0"
"fsevents": "~2.1.2"
}

@@ -1032,2 +1022,7 @@ },

},
"utilsac": {
"version": "12.3.0",
"resolved": "https://registry.npmjs.org/utilsac/-/utilsac-12.3.0.tgz",
"integrity": "sha512-Ig9h6rK2tKI2OWLkSEmC848taIpbtCI9DUdevXW2MzvlaFSHhVp6/7+bZvGbye1djRvicR6xdWolZw1PWx5U2Q=="
},
"v8-compile-cache": {

@@ -1034,0 +1029,0 @@ "version": "2.1.0",

{
"name": "blog-engine-sac",
"version": "1.3.2",
"version": "2.0.0",
"type": "module",

@@ -13,13 +13,13 @@ "bin": {

"dependencies": {
"bootstrap": "^4.3.1",
"filesac": "^11.1.0",
"lunr": "^2.3.7",
"filesac": "^11.1.1",
"lunr": "^2.3.8",
"markdown": "^0.5.0",
"node-fetch": "^2.6.0",
"node-html-parser": "^1.1.12",
"rollup": "^1.29.0"
"rollup": "^2.0.0",
"utilsac": "^12.3.0"
},
"devDependencies": {
"eslint": "^6.5.1",
"eslint-config-red": "^1.4.1"
"eslint-config-red": "^1.7.0"
},

@@ -26,0 +26,0 @@ "eslintConfig": {

@@ -22,3 +22,11 @@ # Blog

### site settings
Create file `blog-engine-sac.json` with
```json
{
"defaultLang": "en",
"defaultAuthor": "AUTHOR NAME"
}
```

@@ -25,0 +33,0 @@ ### about page

@@ -14,6 +14,10 @@ export { processPost, supportedFormats, getDetailsFromPost };

const author = `Cyril Walle`;
const supportedFormats = [`md`, `json`, `html`];
const processPost = async function ({ title, extension, postFilePath, fullPath }, detailedFiles) {
const isMeta = (post) => {
return !post || !post.base;
};
const processPost = async function (fileDetails, detailedFiles, metas, commonOptions) {
const { title, extension, postFilePath, fullPath, base } = fileDetails;
if (!supportedFormats.includes(extension)) {

@@ -24,20 +28,22 @@ return;

const [meta, content] = await Promise.all([
initialMeta({ fullPath, title }, detailedFiles),
initialMeta(fileDetails, detailedFiles, metas, commonOptions),
textFileContent(fullPath),
]);
meta.content = content;
if (extension === `html`) {
return processPostAsHTML({ title, extension, postFilePath, fullPath, meta, content });
return processPostAsHTML(meta);
}
if (extension === `md`) {
return processPostAsMD({ title, extension, postFilePath, fullPath, meta, content });
return processPostAsMD(meta);
}
if (extension === `json`) {
return processPostAsJSON({ title, extension, postFilePath, fullPath, meta, content }, detailedFiles);
return processPostAsJSON(meta, detailedFiles);
}
};
const processPostAsHTML = function ({ title, extension, postFilePath, fullPath, meta, content }) {
const processPostAsHTML = function (post) {
const { content } = post;
const htmlContainers = [`html`, `body`, `head`];

@@ -67,18 +73,21 @@ const rootOriginal = parse(content);

const post = Object.assign({
return Object.assign(post, {
body: htmlBody,
raw: rawText,
}, meta);
return post;
});
};
const processPostAsMD = function ({ title, extension, postFilePath, fullPath, meta, content }) {
const postHTML = markdown.toHTML(content);
const processPostAsMD = function (post) {
const { content } = post;
let postHTML;
if (content) {
postHTML = markdown.toHTML(content);
} else {
postHTML = `<p>Empty</p>`;
}
const post = Object.assign({
return Object.assign(post, {
body: postHTML,
raw: content,
}, meta);
return post;
});
};

@@ -110,3 +119,4 @@

const processPostAsJSON = function ({ title, extension, postFilePath, fullPath, meta, content }, detailedFiles) {
const processPostAsJSON = function (post, detailedFiles, metas, commonOptions) {
const { content, fullPath } = post;
let postObject;

@@ -126,8 +136,8 @@ try {

// open from file
return processPost(getDetailsFromPost(src), detailedFiles);
return processPost(getDetailsFromPost(src), detailedFiles, metas, commonOptions);
}
return processExternalPost({ src, meta });
return processExternalPost({ ...post, src });
};
const defaultMetaFromPost = function ({ fullPath, title }) {
const defaultMetaFromPost = function ({ fullPath, title,}, {defaultLang, defaultAuthor }) {
let stats;

@@ -140,2 +150,4 @@ if (isLocalUrl(fullPath)) {

const meta = {
src: `defined`,
raw: ``,
isTranslation: false,

@@ -150,3 +162,3 @@ indexed: true,

title: normalizeFileName(title),
author,
author: defaultAuthor,
description: `post`,

@@ -160,2 +172,4 @@ next: undefined,

words: {},
sortedWords: [],
lang: defaultLang,
};

@@ -165,25 +179,22 @@ return meta;

const extendMetaWithPotentialMeta = function ({ fullPath, title, meta }, detailedFiles) {
const metaFile = detailedFiles.find(function (detailedFile) {
const extendMetaWithPotentialMeta = function (post, detailedFiles, metas) {
const metaExtension = metas.find(function (otherPost) {
return (
(detailedFile.title === title) &&
(detailedFile.extension === `json`)
otherPost &&
(otherPost.base === post.base)
);
});
meta.hasExternalMeta = Boolean(metaFile);
if (!meta.hasExternalMeta) {
post.hasExternalMeta = Boolean(metaExtension);
if (!post.hasExternalMeta) {
// do not extend meta
return Promise.resolve(meta);
return Promise.resolve(post);
}
return textFileContent(`${metaFile.fullPath}`).then(function (metaText) {
Object.assign(meta, JSON.parse(metaText));
});
//todo make normal function
return Promise.resolve(Object.assign(post, metaExtension));
};
const initialMeta = function ({ fullPath, title }, detailedFiles) {
const meta = defaultMetaFromPost({ fullPath, title });
return extendMetaWithPotentialMeta({ fullPath, title, meta }, detailedFiles).then(function () {
return meta;
});
const initialMeta = function (fileDetails, detailedFiles, metas, commonOptions) {
const meta = { ...defaultMetaFromPost(fileDetails, commonOptions), ...fileDetails};
return extendMetaWithPotentialMeta(meta, detailedFiles, metas);
};

@@ -194,3 +205,2 @@

const title = parsedPath.name;
const extension = extname(fullPath).substr(1);

@@ -202,3 +212,3 @@ if (!supportedFormats.includes(extension) && extension !== ``) {

return { title, extension, base: parsedPath.base, fullPath };
return { title, extension, base: parsedPath.name, fullPath };
};

@@ -12,3 +12,7 @@ /* stats.birthtime, can be later than modified date

import { processPost, getDetailsFromPost } from "./buildPosts.js";
import { processMetaFile } from "./meta.js";
import {chainPromises} from "utilsac";
import { extname, basename, parse as parsePath } from "path";
import {indexFileName} from "../html/links.js";

@@ -25,2 +29,3 @@ import markdownModule from "markdown";

// sources
const settingsSource = `./blog-engine-sac.json`
const postsPath = `./source/`;

@@ -36,5 +41,3 @@ const aboutSource = `${postsPath}/extras/about.md`;

const categoriesPath = `${builtBlog}/c/`;
const indexPath = `${builtBlog}/index.html`;
const niceDatesOnPost = function (post) {

@@ -79,3 +82,3 @@ post.modifiedDateString = niceDateString(post.modifiedDate);

});
})
});
return hiddenCategoryMap;

@@ -99,10 +102,20 @@ };

const createIndex = async function (posts, categories, commonOptions) {
const createIndex = function (posts, categories, lang, commonOptions) {
const indexHTML = createIndexHtml(Object.assign({
posts,
categories,
lang,
}, commonOptions));
const indexPath = `${builtBlog}/${indexFileName(lang, commonOptions.defaultLang)}`;
return writeTextInFile(indexPath, indexHTML);
};
const createIndexes = function (posts, categories, langs, commonOptions) {
return Promise.all(Array.from(langs).map(lang => {
return createIndex(posts, categories, lang, commonOptions);
}));
};
const createContact = function (commonOptions) {

@@ -133,3 +146,3 @@ return textFileContent(contactSource).then(function (contactMarkdown) {

const postInsideHTML = createPostHtml(Object.assign(post, commonOptions));
return writeTextInFile(`${blogPath}${post.title}.html`, postInsideHTML);
return writeTextInFile(`${blogPath}${post.base}.html`, postInsideHTML);
}));

@@ -151,9 +164,13 @@ };

footerText: undefined,
defaultLang: undefined,
defaultAuthor: undefined,
};
const [sourceFileNames, footerText] = await Promise.all([
const [sourceFileNames, footerText, settingsText] = await Promise.all([
namesInDirectory(postsPath),
textFileContent(footerSource),
textFileContent(settingsSource),
]);
const footerHTML = markdown.toHTML(footerText);
commonOptions.footerText = footerHTML;
Object.assign(commonOptions, JSON.parse(settingsText));

@@ -164,19 +181,11 @@ const sourceFileNames2 = sourceFileNames.map((file) => {

const detailedSources = sourceFileNames2.map(getDetailsFromPost);
const jsonSmaller = ({extension}) => {
if (extension === `json`) {
return 0;
}
return 1;
};
detailedSources.sort((a, b) => {
return jsonSmaller(a) - jsonSmaller(b);
});
detailedSources.forEach(({extension}) => {
console.log(extension);
});
const posts = (await Promise.all(detailedSources.map(post => {
return processPost(post, detailedSources);
/* pass this array so that processPost can use meta information of previous posts*/
const metaFiles = (await Promise.all(detailedSources.map(processMetaFile))).filter(Boolean);
const posts = (await Promise.all(detailedSources.map((detailedSource) => {
return processPost(detailedSource, detailedSources, metaFiles, commonOptions);
}))).filter(Boolean).filter(post => {
return post.indexed;
return post.content;
}).filter(post => {
return post.src;
});

@@ -194,6 +203,46 @@

posts.forEach(function (post, i) {
console.log(`\t** ${post.title}`)
console.log(`\t** ${post.title} ${post.indexed ? `` : `(not indexed)` }`);
});
const allWords = wordCount(posts);
generateTags(posts, allWords);
const linkedTranslations = new Set();
const langUsed = new Set([commonOptions.defaultLang]);
// side effects on posts
const indexedPosts = posts.filter(post => {
return post.indexed;
});
indexedPosts.forEach(post => {
// filter translations
return !posts.some(postB => {
// todo (set and) use isTranslation
return post !== postB && postB.translations && postB.translations.some(translation => {
if (parsePath(translation.src).name === post.base) {
langUsed.add(translation.lang)
linkedTranslations.add(postB)
Object.assign(post, translation);
translation.post = post;
};
});
});
});
linkedTranslations.forEach(postWithTranslations => {
const {title, lang} = postWithTranslations;
const translationObject = {
lang,
title,
post: postWithTranslations,
};
postWithTranslations.translations.forEach(nonLinkedYetLink => {
const nonLinkedYet = nonLinkedYetLink.post;
if (nonLinkedYet.translations) {
return;
}
nonLinkedYet.translations = postWithTranslations.translations.filter(a => {
return a.post === nonLinkedYetLink;
}).concat(translationObject);
});
});
posts.forEach(function (post) {

@@ -205,2 +254,6 @@ post.tags.forEach(function (tag) {

indexedPosts.forEach(function (post, i) {
post.next = indexedPosts[i - 1];
post.previous = indexedPosts[i + 1];
});
commonOptions.searchCode = await generateSearchCode(posts);

@@ -210,14 +263,15 @@ const contactPromise = createContact(commonOptions);

const categories = await categoriesPromise;
const categoryMap = createCategoryMap(posts, categories, commonOptions);
const hiddenCategoryMap = createHiddenCategoryMap(posts, categories, categoryMap, commonOptions);
const categoryMap = createCategoryMap(indexedPosts, categories, commonOptions);
const hiddenCategoryMap = createHiddenCategoryMap(indexedPosts, categories, categoryMap, commonOptions);
createCategoryPages(categoryMap, hiddenCategoryMap, commonOptions);
const indexPromise = createIndex(posts, categoryMap, commonOptions);
createPosts(posts, commonOptions);
const indexesPromise = createIndexes(indexedPosts, categoryMap, langUsed, commonOptions);
const postsPromise = createPosts(posts, commonOptions);
await Promise.all([
indexPromise,
indexesPromise,
contactPromise,
aboutPromise,
staticPromise,
postsPromise,
]);
};
export { generateSearchCode };
import { searchCodeTemplate } from "../js/search.js";
import rollup from "rollup";
import {rollup} from "rollup/dist/es/rollup.js";
import { textFileContent } from "filesac";

@@ -80,3 +80,3 @@ import path from "path";

lunrCode = `${lunrCode}; export default lunr`;
const bundle = await rollup.rollup(inputOptions);
const bundle = await rollup(inputOptions);

@@ -83,0 +83,0 @@ //console.log(bundle.imports); // an array of external dependencies

@@ -26,4 +26,3 @@ export {

const filesToCopy = [
`/../node_modules/bootstrap/dist/css/bootstrap.min.css`,
// `/vendor/bootstrap/css/bootstrap.min.css`,
`/../css/bootstrap-legend.css`,
`/../css/clean-blog.min.css`,

@@ -30,0 +29,0 @@ ];

@@ -50,2 +50,7 @@ export { generateTags, wordCount };

posts.forEach(function (post) {
if (!post.raw) {
post.raw = ``;
post.totalCount = 0;
return;
}
const words = post.raw.split(` `);

@@ -52,0 +57,0 @@ const { length } = words;

@@ -11,5 +11,5 @@ export { isLocalUrl };

// throws if origin is missing
return true;
return Boolean(x);
}
return !parsed.host;
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc