Skip to content

Commit

Permalink
Merge pull request #6 from 0time/fix-require-all
Browse files Browse the repository at this point in the history
v0.1.6
  • Loading branch information
hibes committed Aug 5, 2020
2 parents a076951 + c348fa0 commit 94726c9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@0ti.me/tiny-pfp",
"version": "0.1.5",
"version": "0.1.6",
"description": "A tiny, minimalist lodash alternative library",
"license": "GPL-3.0",
"main": "src/index.js",
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
@@ -1,3 +1,4 @@
const path = require('path');
const requireAll = require('./lib/require-all');

module.exports = requireAll('./src/src');
module.exports = requireAll(path.resolve(__dirname, './src'));
4 changes: 1 addition & 3 deletions src/lib/require-all/reduce-to-types-sync.js
Expand Up @@ -5,9 +5,7 @@ const path = require('path');
module.exports = dir => {
const dirList = fs.readdirSync(dir);

const setsOfStats = dirList.map(each =>
fs.statSync(path.join(process.cwd(), dir, each)),
);
const setsOfStats = dirList.map(each => fs.statSync(path.resolve(dir, each)));

return dirList.reduce(dirListReducer(dir, setsOfStats), {
directories: [],
Expand Down
7 changes: 2 additions & 5 deletions src/lib/require-all/require-all-file-reducer.js
Expand Up @@ -3,8 +3,5 @@ const path = require('path');
const set = require('../set');

module.exports = dir => (acc, file) =>
set(
acc,
convertToCamelCase(file),
require(path.join(process.cwd(), dir, file)),
);
console.error(6, dir, file) ||
set(acc, convertToCamelCase(file), require(path.resolve(dir, file)));
2 changes: 1 addition & 1 deletion src/lib/require-all/require-all-sync.js
Expand Up @@ -8,6 +8,6 @@ const requireAllFileReducer = require('./require-all-file-reducer');
module.exports = dir =>
flow([
listFilesSync,
fpMap(fpStringReplace(dir, '')),
fpMap(fpStringReplace(dir, '.')),
fpReduce(requireAllFileReducer(dir), {}),
])(dir);

0 comments on commit 94726c9

Please sign in to comment.