Git Product home page Git Product logo

aniname / directory-import Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 2.0 22.12 MB

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

Home Page: https://npmjs.com/directory-import

License: MIT License

JavaScript 1.24% CSS 0.08% HTML 0.71% TypeScript 97.96%
directory import module modules recursive require subdirectories

directory-import's Introduction

Hello there!

directory-import's People

Contributors

dependabot[bot] avatar kiidii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

shefla

directory-import's Issues

Incompatible Node versions

Hi,
I'm getting this error when trying to install directory-import:

Your Node version is incompatible with "registry.npmjs.org/directory-import/3.0.12".

Expected version: >=18.17.0
Got: v18.12.1

This is happening because the package's manifest has an engines.node field specified.
To fix this issue, install the required Node version.

I'm using nvm to manage my node version and it seems that their newest v18 version is v18.16.1.
Is your code really relying on v18.17.0 or is it maybe possible to loosen your requirements a bit?

Thanks in advance :)

Fail to import modules on Windows

I was deploying RSSHub on Windows 10 which uses directory-import. However, the following code failed to run:

const imports = directoryImport({
    targetDirectoryPath: path.join(__dirname, './routes'),
    importPattern: /router\.js$/,
});
Error: Cannot find module '/D:\SystemDefault\Documents\code\GitProjects\RSSHub\lib\routes/0818tuan/router.js'

Full error report: https://pastebin.com/MqCwCVq1

The same project runs fine on Ubuntu, so it should be the problem with Windows path. Hope this problem gets fixed.

A related issue: DIYgod/RSSHub#14625

There is an error in the `getDefaultOptions` function: `TypeError: Cannot read properties of undefined (reading 'split')`

This error seems to be caused by the value of new Error('functional-error').stack. This is the value I output locally:

Error: functional-error
    at getDefaultOptions (/Users/diygod/Code/Project/RSSHub-Hono/node_modules/.pnpm/[email protected]/node_modules/directory-import/dist/src/prepare-private-options.js:17:17)
    at preparePrivateOptions (/Users/diygod/Code/Project/RSSHub-Hono/node_modules/.pnpm/[email protected]/node_modules/directory-import/dist/src/prepare-private-options.js:31:26)
    at directoryImport (/Users/diygod/Code/Project/RSSHub-Hono/node_modules/.pnpm/[email protected]/node_modules/directory-import/dist/src/index.js:15:51)
    at /Users/diygod/Code/Project/RSSHub-Hono/src/routes.ts:3:25
    at Object.<anonymous> (/Users/diygod/Code/Project/RSSHub-Hono/src/routes.ts:3:3)
    at Module._compile (node:internal/modules/cjs/loader:1378:14)
    at Object.j (/Users/diygod/Code/Project/RSSHub-Hono/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/cjs/index.cjs:1:1197)
    at Module.load (node:internal/modules/cjs/loader:1212:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1028:12)
    at Module.require (node:internal/modules/cjs/loader:1237:19)

It does not contain the string at file:// inside.

I am using macOS with Node.js v21.6.0 as my environment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.