Skip to content

Commit

Permalink
Release 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sectsect committed May 19, 2020
1 parent a3d1d5f commit 0935771
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sect/webpack-sweet-entry",
"version": "2.1.2",
"version": "2.2.0",
"description": "Dynamic entry points with wildcards / Partial files named with a leading underscore / Keep Directory Structure for output",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
8 changes: 3 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fg from 'fast-glob'
import fg from 'fast-glob';

interface EntryPoints {
[key: string]: string;
Expand All @@ -8,7 +8,7 @@ const splitString = (stringToSplit: string, separator: string) => stringToSplit.

const dropUnderscoreFiles = (obj: EntryPoints) => {
const r: EntryPoints = {};
Object.keys(obj).forEach(function(key) {
Object.keys(obj).forEach(function (key) {
const val = this[key]; // this == obj
if (key.substring(0, 1) !== '_' && !key.includes('/_')) {
r[key] = val;
Expand All @@ -27,9 +27,7 @@ export const WebpackSweetEntry = (paths: string, ext: string | string[] = 'js',
const r: EntryPoints = {};
const rp = Array.isArray(ext) ? createRegex(ext) : `.${ext}`;
g.forEach((path: string) => {
const key = splitString(path, `/${parentdir}/`)
.slice(-1)[0]
.replace(rp, '');
const key = splitString(path, `/${parentdir}/`).slice(-1)[0].replace(rp, '');
r[key] = path;
});
return dropUnderscoreFiles(r);
Expand Down

0 comments on commit 0935771

Please sign in to comment.