{"id":17679925,"url":"https://github.com/sbsoftware/node-di-modules","last_synced_at":"2025-03-30T18:47:40.713Z","repository":{"id":11991511,"uuid":"14567835","full_name":"sbsoftware/node-di-modules","owner":"sbsoftware","description":"Simple helper to create module specification objects for node-di","archived":false,"fork":false,"pushed_at":"2014-01-12T12:58:07.000Z","size":240,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-25T01:26:23.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbsoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-20T20:15:10.000Z","updated_at":"2014-01-12T12:58:08.000Z","dependencies_parsed_at":"2022-07-31T12:17:57.379Z","dependency_job_id":null,"html_url":"https://github.com/sbsoftware/node-di-modules","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbsoftware%2Fnode-di-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbsoftware%2Fnode-di-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbsoftware%2Fnode-di-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbsoftware%2Fnode-di-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbsoftware","download_url":"https://codeload.github.com/sbsoftware/node-di-modules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246365640,"owners_count":20765546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T09:04:44.118Z","updated_at":"2025-03-30T18:47:40.412Z","avatar_url":"https://github.com/sbsoftware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"node-di-modules\n===============\n\nSimple helper to create module specification objects for node-di.\nIt gives you two methods to add modules to the container. The first one, .add(), is nothing more than\njust setting `modules[moduleName] = [type, module]` manually. The reason why I built this is the second\nmethod, .addDir(), which dynamically requires all \\*.js files in the given folder and adds them to the\nmodule container, using the file name as the module name and assuming type = 'factory'.\n\n\nInstallation\n------------\n\n`npm install di-modules`\n\n\nUsage\n-----\n\n    var di = require('di');\n    var modules = new (require('di-modules'))();\n\n    modules.add('fs', 'value', require('fs'));\n    // directory paths must be relative to __dirname of the calling file\n    modules.addDir('./src'); // contains myModule.js and yourModule.js, which must be \"factory\" modules\n    modules.addDir('./src2', true); // recursively goes deeper into subdirectories\n    // add all node_modules entries (in the same directory as the calling file)\n    modules.addNodeModules();\n    // add specific modules by name\n    modules.addNodeModules(['events', 'express', 'async']);\n\n    // use di as if you filled the modules container manually\n    new di.Injector([modules]).invoke(async, fs, events, express, myModule, yourModule) {\n      ...\n    });\n\nIdeas\n-----\n\n* .addDir() could support other module types than 'factory', either by specifying when calling it\nor by indicating it in the file name\n\nChangelog\n---------\n\n* 0.2.0\n  * .addNodeModules()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbsoftware%2Fnode-di-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbsoftware%2Fnode-di-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbsoftware%2Fnode-di-modules/lists"}