{"id":16641214,"url":"https://github.com/cmstead/dject-cli","last_synced_at":"2025-04-05T01:25:43.168Z","repository":{"id":34078362,"uuid":"169007236","full_name":"cmstead/dject-cli","owner":"cmstead","description":"CLI tooling for setting up and using the Dject DI system","archived":false,"fork":false,"pushed_at":"2022-02-11T15:34:19.000Z","size":144,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T04:28:27.978Z","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":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmstead.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":"2019-02-03T23:54:36.000Z","updated_at":"2020-02-24T17:52:19.000Z","dependencies_parsed_at":"2022-08-08T00:00:42.989Z","dependency_job_id":null,"html_url":"https://github.com/cmstead/dject-cli","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmstead","download_url":"https://codeload.github.com/cmstead/dject-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247273976,"owners_count":20912027,"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-12T07:45:51.031Z","updated_at":"2025-04-05T01:25:43.136Z","avatar_url":"https://github.com/cmstead.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Dject-CLI #\n#### CLI tooling for setting up and using the Dject DI system ####\n\n## Table Of Contents ##\n\n- [Section 1: Introduction](#user-content-introduction)\n- [Section 2: Installation](#user-content-installation)\n- [Section 3: Dject CLI Usage](#user-content-dject-cli-usage)\n- [Section 4: Version History](#user-content-version-history)\n\n## Introduction ##\nDject CLI is the companion tool to Dject for simplifying setup and use of the Dject dependency injection system.\n\nThe goal of this project is to simplify:\n\n- Setup of a Node, require-based Dject configuration\n- Setup for compile-at-build Dject configuration file for import-based projects\n- Running build-time import-based Dject configuration\n\n    \n\n## Installation ##\n\n- `npm i --global dject-cli`\n- `npm i dject-cli --save-dev`\n    \n\n## Dject CLI Usage ##\n\nCurrently Dject CLI supports configuration creation for Node projects using CommonJS modules. Dject is capable of managing dependencies in a number of scenarios, but we all have to start somewhere, right?\n\n### Getting Help ###\n\n**Command**: `dject --help`\n\nThis command will give you information about the current supported behaviors of Dject CLI. The provided information will always reflect the most up-to-date functionality.\n\n### Building a Node CommonJS Container Configuration ###\n\n**Command**: `dject --configure-node-commonjs`\n\nConfigure-node-commonjs will prompt the user for configuration options. Sane defaults are provided and providing values for any options is strictly optional.  After running configure-node-commonjs, a file will be written in the current working directory which fully configures Dject to work as a DI container for your node application.\n\n### Creating a Container Builder Config for ES-Next Modules ###\n\n**Command**: `dject --configure-es-module-builder`\n\nConfigure-es-module-builder will prompt the user for configuration options. Sane defaults are provided and providing values for any options is strictly optional.  After running Configure-es-module-builder, a file will be written in the current working directory which fully configures Dject CLI to build/rebuild a DI file for your import-based project. This build step will need to be integrated into your project build process.\n\nAn example of the generated config is as follows:\n\n```json\n{\n    \"cwd\": \"app\",\n    \"djectLocation\": \"dject\",\n    \"destinationPath\": \"${cwd}${pathSeparator}container\",\n    \"modulePaths\": [\n        \"**${pathSeparator}*.js\"\n    ]\n}\n```\n\n#### Configuration Variables ####\n\nThere are currently two supported configuration variables: ${cwd} and ${pathSeparator}. Following is how they are used:\n\n- ${cwd} -- This will be replaced with the value in the cwd property of your configuration.\n- ${pathSeparator} -- this will be replaced with the path separator for your operating system, '\\' in Windows and '/' in all other operating systems.  This is identical to the value in path.sep within Node.\n\n### Building a Container for Imported/ES-Next Modules ###\n\n**Command**: `dject --build-import-container [--config-path ./path/to/config/file.json]\n\nBuild-import-container will create a Dject container and load all import-style modules found in configured path.  An example of the generated file is as follows:\n\n```javascript\nimport dject from 'dject';\n\nimport module0 from '../test-imports/subfolder/test2.js';\nimport module1 from '../test-imports/test1.js';\n\n\nconst container = dject.new();\n\ncontainer.register(module0.value, module0.name);\ncontainer.register(module1.value, module1.name);\n\n\nexport default container;\n```\n\nAll files which are intended to be consumed this way should be in the Dject-style module configuration and export a name and a value, like the following:\n\n```javascript\nfunction myModule(\n    dependency1,\n    dependency2\n) {\n    // your module code goes here\n}\n\nexport default {\n    name: 'myModule',\n    value: myModule\n};\n```\n    \n\n## Version History ##\n\n**v1.2.0**\n\n- Added import DI container automated build, which consumes the configuration generated from added feature in v1.1.0\n- Added configuration path option for choosing a different file name than the default (es-module-config.json).\n\n**v1.1.0**\n\n- Updated default file location to app instead of dependencies for configuration builders\n- Introduced configuration construction for ES-Next Module DI container builder -- `dject --configure-es-module-builder`\n\n**v1.0.0**\n\nInitial release. Current feature support:\n\n- Help -- `dject --help`\n- Configure Node CommonJS container -- `dject --configure-node-commonjs`\n    \n\n    ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmstead%2Fdject-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmstead%2Fdject-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmstead%2Fdject-cli/lists"}