@paukuman/autoloader

1.0.4 • Public • Published

Autoloader

This is a autoloader modules like PHP autoloader

Installation

Install autoloader with npm

  npm install fs fs.promises
  npm install @paukuman/autoloader

How to use it

    (async function() => {
        /* [ Autoloader Modules ] */
        const autoloader = require('@paukuman/autoloader');

        // modules installed
        const packages = `${__dirname}/package.json`;
        
        // local modules
        const locals = `${__dirname}/plugins`;
        
        /* [ Configuration ] */
        await autoloader(packages, locals);
    })();

so

    // example if you want to see all installed modules
    console.log(m);
    // example if you have installed express
    const app = m.express;
    app.get('/', (req, res) => {
        res.send('Hello World');
    })
    // example if you have installed fs.promises
    console.log(await m['fs.promises'].readdir(args[1]));

Readme

Keywords

Package Sidebar

Install

npm i @paukuman/autoloader

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

2.38 kB

Total Files

3

Last publish

Collaborators

  • paukuman