Skip to content

Commit

Permalink
ignoring declaration files
Browse files Browse the repository at this point in the history
  • Loading branch information
KiiDii committed Nov 17, 2023
1 parent 708e477 commit 7e860e9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 45 deletions.
87 changes: 43 additions & 44 deletions 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": "directory-import",
"version": "3.0.15",
"version": "3.1.0",
"description": "Module will allow you to synchronously or asynchronously import (requires) all modules from the folder you specify",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions sample-directory/sample-type.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type ImportedModules = Record<string, unknown>;
2 changes: 2 additions & 0 deletions src/import-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ function importModule(
) {
const { name: fileName, ext: fileExtension } = path.parse(filePath);
const isValidModuleExtension = VALID_IMPORT_EXTENSIONS.has(fileExtension);
const isDeclarationFile = filePath.endsWith('.d.ts');
const isValidFilePath = options.importPattern ? options.importPattern.test(filePath) : true;

if (!isValidModuleExtension) return false;
if (!isValidFilePath) return false;
if (isDeclarationFile) return false;

const relativeModulePath = filePath.slice(options.targetDirectoryPath.length + 1);

Expand Down

0 comments on commit 7e860e9

Please sign in to comment.