directory-import
Advanced tools
Comparing version 3.0.8 to 3.0.9
{ | ||
"name": "directory-import", | ||
"version": "3.0.8", | ||
"version": "3.0.9", | ||
"description": "Module will allow you to synchronously or asynchronously import (requires) all modules from the folder you specify", | ||
@@ -22,3 +22,3 @@ "main": "dist/src/index.js", | ||
"engines": { | ||
"node": ">=20.5.0" | ||
"node": ">=18.17.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "keywords": [ |
<!--suppress HtmlDeprecatedAttribute --> | ||
<div align="center"> | ||
<p> | ||
<img src="https://img.shields.io/node/v/directory-import" alt="Node version required"> | ||
<img src="https://img.shields.io/github/languages/code-size/KiiDii/directory-import" alt="GitHub code size"> | ||
<img src="https://img.shields.io/npm/dt/directory-import" alt="Downloads"> | ||
<img src="https://img.shields.io/node/v/directory-import?logo=nodedotjs&label=Node.JS version" alt="Node version required"> | ||
<img src="https://img.shields.io/github/languages/code-size/KiiDii/directory-import?logo=typescript&label=Builded code size" alt="GitHub code size"> | ||
<img src="https://img.shields.io/github/actions/workflow/status/KiiDii/directory-import/test.yml?logo=jest&label=Tests" alt="Github tests"> | ||
<img src="https://img.shields.io/github/issues/KiiDii/directory-import?logo=github&label=Issues"> | ||
<img src="https://img.shields.io/npm/dt/directory-import?logo=npm&label=Downloads" alt="Downloads"> | ||
<a href="https://discord.gg/ADFYZtJ"> | ||
<img src="https://img.shields.io/discord/219557939466338304?label=Discord%20chat" alt="Discord server"> | ||
<img src="https://img.shields.io/discord/219557939466338304?logo=discord&label=Discord%20chat" alt="Discord server"> | ||
</a> | ||
@@ -20,4 +22,4 @@ </p> | ||
Module for automatic import of files from a directory and subdirectories (sync and async). | ||
You can use imported modules either from the returned object or in the callback function. | ||
A module for the automatic import of files from a directory and its subdirectories (sync and async). | ||
The imported modules can be used either from the returned object or in the callback function. | ||
@@ -39,3 +41,3 @@ --- | ||
// Will output an object with imported modules | ||
// Outputs an object with imported modules | ||
// For example: { modulePath1: module1, modulePath2: module2, ... } | ||
@@ -52,3 +54,3 @@ console.log(importedModules); | ||
// Will output an object with imported modules | ||
// Outputs an object with imported modules | ||
// For example: { modulePath1: module1, modulePath2: module2, ... } | ||
@@ -62,3 +64,3 @@ console.log(importedModules); | ||
This is one simple example of how to use the library and how it works under the hood: | ||
Here's a simple example of how to use the library and how it works under the hood: | ||
@@ -74,10 +76,10 @@ ```javascript | ||
<a href="https://github.com/KiiDii/directory-import/blob/master/media/directory-import-example.gif"> | ||
<img src="https://github.com/KiiDii/directory-import/blob/master/media/directory-import-example.gif?raw=true" alt="GIF how it works under the hood"> | ||
<img src="https://github.com/KiiDii/directory-import/blob/master/media/directory-import-example.gif?raw=true" alt="GIF demonstrating how it works"> | ||
</a> | ||
### [Path to directory from GIF above][pathToDirectoryFromGif] | ||
### [Path to directory from the GIF above][pathToDirectoryFromGif] | ||
### You can invoke callback on each file | ||
### Invoking a callback on each file | ||
This can be useful when, for example, you need to do some action depending on the imported file. | ||
This can be handy when, for instance, you need to perform a specific action based on the imported file. | ||
@@ -93,3 +95,3 @@ ```javascript | ||
<a href="https://github.com/KiiDii/directory-import/blob/master/media/directory-import-example-with-callback.gif"> | ||
<img src="https://github.com/KiiDii/directory-import/blob/master/media/directory-import-example-with-callback.gif?raw=true" alt="GIF how it works under the hood"> | ||
<img src="https://github.com/KiiDii/directory-import/blob/master/media/directory-import-example-with-callback.gif?raw=true" alt="GIF demonstrating the callback feature"> | ||
</a> | ||
@@ -99,19 +101,21 @@ | ||
| Property | Type | Description | | ||
| -------- | ------ | ------------------------------------------------------------ | | ||
| name | String | Module name based on file name | | ||
| path | String | Relative module path | | ||
| data | String | Exported data of the module. (Ex: "module.exports = 'test'") | | ||
| index | Number | Imported module index | | ||
| Property | Type | Description | | ||
| -------- | ------ | -------------------------------------------------------------- | | ||
| name | String | Module name based on the filename | | ||
| path | String | Relative module path | | ||
| data | String | Exported data from the module. (Ex: "module.exports = 'test'") | | ||
| index | Number | Index of the imported module | | ||
### {Object} Options properties: | ||
| Property | Type | Description | | ||
| --------------------- | ------- | --------------------------------------------------------- | | ||
| includeSubdirectories | Boolean | If true, the module will import files from subdirectories | | ||
| targetDirectoryPath | String | The path to the directory to import modules from | | ||
| importPattern | RegExp | RegExp pattern to filter files | | ||
| importMode | String | The import mode. Can be 'sync' or 'async' | | ||
| limit | Number | Limit the number of imported modules | | ||
| Property | Type | Description | | ||
| --------------------- | ------- | --------------------------------------------------------------- | | ||
| includeSubdirectories | Boolean | If true, the module will import files from subdirectories | | ||
| targetDirectoryPath | String | The path to the directory from which modules are to be imported | | ||
| importPattern | RegExp | RegExp pattern to filter files | | ||
| importMode | String | The import mode. Can be 'sync' or 'async' | | ||
| limit | Number | Limit the number of imported modules | | ||
[back to top](#top) | ||
--- | ||
@@ -121,3 +125,3 @@ | ||
Minimum code to use: | ||
Minimum code needed for use: | ||
@@ -127,3 +131,3 @@ ```js | ||
// Will synchronously import all files in the same directory as the code was called | ||
// Synchronously imports all modules in the same directory from which the code was called | ||
directoryImport(); | ||
@@ -143,3 +147,3 @@ ``` | ||
Put result in a variable and invoce callback on each file: | ||
Put the result in a variable and invoke a callback on each file: | ||
@@ -166,2 +170,4 @@ ```js | ||
[back to top](#top) | ||
--- | ||
@@ -335,7 +341,33 @@ | ||
[back to top](#top) | ||
--- | ||
## Contribution | ||
Contributions to `directory-import` are always welcome. Here is how you can contribute to the project: | ||
1. **Report issues** - Report about a bug or suggest a new feature [here][gitIssues]. | ||
2. **Submit Pull Requests** - If you fixed a bug or developed a new feature, you can submit a PR. Please follow these guidelines while preparing your code: | ||
- Ensure that your code properly complies with the standard TS conventions. | ||
- Make sure to add comments in your code. | ||
- Add a description explaining what changes you have made in your PR. | ||
Before making a PR, please make sure your changes are consistent with the project's coding style and all tests are passing. | ||
3. **Improve the Documentation** - You can enhance the README or the wiki page by adding more explanations, fixing typos, adding examples, etc. | ||
Please note that your contributions should follow the guidelines described in the [Code of Conduct][CODE_OF_CONDUCT]. | ||
Thank you for your interest in contributing to the `directory-import`! | ||
[back to top](#top) | ||
--- | ||
### Help | ||
- If you have any questions, you can ask them in the [Discord server][discordServer]. | ||
- If you have any questions or need help, feel free to join our [Discord server][discordServer]. | ||
- If you find a bug, or you have any suggestions? please create an issue on [GitHub issues][gitIssues]. | ||
@@ -345,2 +377,4 @@ - If you want to help with the development of the project, you can create a pull request on [GitHub pull requests][gitPullRequests]. | ||
[back to top](#top) | ||
[pathToDirectoryFromGif]: https://github.com/KiiDii/directory-import/tree/master/sample-directory | ||
@@ -351,1 +385,2 @@ [discordServer]: https://discord.gg/ADFYZtJ | ||
[gitPullRequests]: https://github.com/ANIname/directory-import/pulls | ||
[CODE_OF_CONDUCT]: https://github.com/ANIname/directory-import/blob/master/CODE_OF_CONDUCT.md |
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
46287
19
613
373
1