Skip to content

Commit

Permalink
actually fix glob call
Browse files Browse the repository at this point in the history
  • Loading branch information
koddsson committed Aug 15, 2023
1 parent dd4246b commit 5ca0675
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
24 changes: 7 additions & 17 deletions packages/rollup-plugin-copy/src/listFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,14 @@ const path = require('path');
* @param {string} fromGlob
* @param {string} rootDir
* @param {string|string[]} [ignore]
*
* @returns Promise<string[]>
*/
function listFiles(fromGlob, rootDir, ignore) {
return new Promise(resolve => {
glob.sync(fromGlob, { cwd: rootDir, dot: true, ignore }, (er, files) => {
// remember, each filepath returned is relative to rootDir
resolve(
files
.map(
/** @param {string} filePath */
filePath => path.resolve(rootDir, filePath),
)
.filter(
/** @param {string} filePath */
filePath => !fs.lstatSync(filePath).isDirectory(),
),
);
});
});
async function listFiles(fromGlob, rootDir, ignore) {
const files = await glob(fromGlob, { cwd: rootDir, dot: true, ignore });
return files
.map(filePath => path.resolve(rootDir, filePath))
.filter(filePath => !fs.lstatSync(filePath).isDirectory());
}

module.exports = { listFiles };
2 changes: 1 addition & 1 deletion packages/rollup-plugin-html/src/input/getInputData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import glob from 'glob';
import type {GlobOptions} from 'glob';
import type { GlobOptions } from 'glob';

import { createError } from '../utils';
import { RollupPluginHTMLOptions } from '../RollupPluginHTMLOptions';
Expand Down

0 comments on commit 5ca0675

Please sign in to comment.