From f2e272403dbf98681a0303d50d4d11349312a402 Mon Sep 17 00:00:00 2001 From: MaxGenash Date: Mon, 12 Oct 2020 21:05:19 +0300 Subject: [PATCH] refactor: (strf-8740) move recursiveReadDir to fsUtils --- lib/stencil-bundle.js | 6 +++--- lib/utils/fsUtils.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/stencil-bundle.js b/lib/stencil-bundle.js index 62d18d2f..8eb74271 100644 --- a/lib/stencil-bundle.js +++ b/lib/stencil-bundle.js @@ -1,5 +1,4 @@ const upath = require('upath'); -const Readdir = require('recursive-readdir'); const Archiver = require('archiver'); const async = require('async'); const crypto = require('crypto'); @@ -12,6 +11,7 @@ const Cycles = require('./Cycles'); const cssAssembler = require('./css-assembler'); const langAssembler = require('./lang-assembler'); const templateAssembler = require('./template-assembler'); +const { recursiveReadDir } = require('./utils/fsUtils'); const { fetchRegions } = require('./regions'); const MEGABYTE = 1024 * 1024; @@ -149,7 +149,7 @@ class Bundle { assembleTemplatesTask(callback) { console.log('Template Parsing Started...'); - Readdir(this.templatesPath, ['!*.html'], (readdirError, files) => { + recursiveReadDir(this.templatesPath, ['!*.html'], (readdirError, files) => { if (readdirError) { return callback(readdirError); } @@ -228,7 +228,7 @@ class Bundle { generateManifest(taskResults, callback) { console.log('Generating Manifest Started...'); - Readdir(this.templatesPath, ['!*.html'], (err, filePaths) => { + recursiveReadDir(this.templatesPath, ['!*.html'], (err, filePaths) => { if (err) { return callback(err); } diff --git a/lib/utils/fsUtils.js b/lib/utils/fsUtils.js index 19868fda..34ea546e 100644 --- a/lib/utils/fsUtils.js +++ b/lib/utils/fsUtils.js @@ -3,6 +3,7 @@ */ const fs = require('fs'); +const recursiveReadDir = require('recursive-readdir'); const jsonLint = require('../json-lint'); /** @@ -17,4 +18,5 @@ async function parseJsonFile(filePath) { module.exports = { parseJsonFile, + recursiveReadDir, };