Skip to content

Commit

Permalink
Merge pull request #29 from bandantonio/fix/remove-fs-promises-as-req…
Browse files Browse the repository at this point in the history
…uire

fix: removed fs/promises as a separate require
  • Loading branch information
bandantonio committed Apr 14, 2022
2 parents a22f171 + 8f3b84b commit 41620ba
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/common/prepare-content.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const ejs = require('ejs');
const fs = require('fs');
const fse = require('fs-extra');
const fsp = require('fs/promises');
const path = require('path');
const { md } = require('./md-parser');
const {
Expand Down Expand Up @@ -138,8 +137,8 @@ const saveHtmlContent = async (filename, htmlContent) => {

try {
const basePath = path.join(process.cwd(), 'public');
await fsp.mkdir(basePath, { recursive: true });
await fsp.writeFile(path.join(basePath, filename), htmlContent);
await fs.promises.mkdir(basePath, { recursive: true });
await fs.promises.writeFile(path.join(basePath, filename), htmlContent);
} catch (error) {
throw Error(`Can't save html file(s). Something went wrong: ${error.message}`);
}
Expand Down Expand Up @@ -225,7 +224,7 @@ const buildStaticFiles = async (docsDirectoryName = 'docs') => {
const generatedContent = await buildContent(docsDirectoryName);
const sidebarListOfPages = generatedContent.allPages.filter(page => page.name !== 'README');

const items = await fsp.readdir(templatesPath);
const items = await fs.promises.readdir(templatesPath);
items.filter(item => path.extname(item) === '.ejs').forEach(async template => {
if (template === 'page.ejs') {
const compiledTemplate = compileTemplate(templatesPath, template);
Expand Down

0 comments on commit 41620ba

Please sign in to comment.