{"id":18867929,"url":"https://github.com/hodfords-solutions/nestjs-command","last_synced_at":"2025-04-06T06:07:49.309Z","repository":{"id":257800666,"uuid":"395545224","full_name":"hodfords-solutions/nestjs-command","owner":"hodfords-solutions","description":"nestjs-command simplifies creating and managing CLI commands in NestJS applications. It offers an easy way to define and execute commands, streamlining CLI integration and boosting productivity with minimal configuration.","archived":false,"fork":false,"pushed_at":"2025-03-26T07:28:58.000Z","size":310,"stargazers_count":47,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-30T05:08:13.044Z","etag":null,"topics":["cli","command","nestjs","nodejs"],"latest_commit_sha":null,"homepage":"https://opensource.hodfords.uk/nestjs-command","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hodfords-solutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-13T06:37:41.000Z","updated_at":"2025-03-18T07:52:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"13d49136-6a57-464a-8bc3-334b1d00f314","html_url":"https://github.com/hodfords-solutions/nestjs-command","commit_stats":null,"previous_names":["hodfords-solutions/nestjs-command"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodfords-solutions%2Fnestjs-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodfords-solutions%2Fnestjs-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodfords-solutions%2Fnestjs-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodfords-solutions%2Fnestjs-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hodfords-solutions","download_url":"https://codeload.github.com/hodfords-solutions/nestjs-command/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441050,"owners_count":20939239,"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":["cli","command","nestjs","nodejs"],"created_at":"2024-11-08T05:11:53.920Z","updated_at":"2025-04-06T06:07:49.291Z","avatar_url":"https://github.com/hodfords-solutions.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://opensource.hodfords.uk\" target=\"blank\"\u003e\u003cimg src=\"https://opensource.hodfords.uk/img/logo.svg\" width=\"320\" alt=\"Hodfords Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e \u003cb\u003enestjs-command\u003c/b\u003e simplifies creating and managing CLI commands in NestJS applications. It offers an easy way to define and execute commands, streamlining CLI integration and boosting productivity with minimal configuration.\u003c/p\u003e\n\n## Installation 🤖\n\nInstall the `nestjs-command` package with:\n\n```\nnpm install @hodfords/nestjs-command --save\n```\n\nSet up in your codebase:\n\n-   `src/config/command.config.ts`\n\n```javascript\nimport { CommandModule } from '@hodfords/nestjs-command';\n\nexport const commandConfig = CommandModule.register();\n\n// export const = CommandModule.register(false) if typeorm is disabled\n```\n\n-   `src/app.module.ts`\n\n```javascript\nimport { Module } from '@nestjs/common';\nimport { commandConfig } from '~config/command.config';\n\n@Module({\n    imports: [commandConfig],\n    controllers: [],\n    providers: []\n})\nexport class AppModule {}\n```\n\n-   `src/cli.ts`\n\n```javascript\nimport { NestFactory } from '@nestjs/core';\nimport { CommandService } from '@hodfords/nestjs-command';\nimport { commandConfig } from '~config/command.config';\n\nasync function bootstrap() {\n    const app = await NestFactory.createApplicationContext(AppModule);\n    const commandService: CommandService = app.select(commandConfig).get(CommandService, { strict: true });\n    await commandService.exec();\n    await app.close();\n}\n\nbootstrap();\n```\n\n-   `package.json`\n\n```json\n\"wz-command\": \"wz-command\"\n```\n\n## Usage 🚀\n\nHere’s how you can use them. For each type of component, you can use one of the two available command formats: with `npm run` or directly with `wz-command`\n\n### Make a command\n\n```bash\nnpm run wz-command make-command \u003cfile-name\u003e -- --module \u003cmodule-name\u003e\n```\n\n```bash\nwz-command make-command \u003cfile-name\u003e --module \u003cmodule-name\u003e\n```\n\n### Make a controller\n\n```bash\nnpm run wz-command make-controller \u003cfile-name\u003e -- --module \u003cmodule-name\u003e\n```\n\n```bash\nwz-command make-controller \u003cfile-name\u003e --module \u003cmodule-name\u003e\n```\n\n### Make a dto\n\n```bash\nnpm run wz-command make-dto \u003cfile-name\u003e -- --module \u003cmodule-name\u003e\n```\n\n```bash\nwz-command make-dto \u003cfile-name\u003e --module \u003cmodule-name\u003e\n```\n\n### Make an e2e test\n\n```bash\nnpm run wz-command make-e2e-test \u003cfile-name\u003e -- --module \u003cmodule-name\u003e\n```\n\n```bash\nwz-command make-e2e-test \u003cfile-name\u003e --module \u003cmodule-name\u003e\n```\n\n### Make an entity\n\n```bash\nnpm run wz-command make-entity \u003cfile-name\u003e -- --module \u003cmodule-name\u003e\n```\n\n```bash\nwz-command make-entity \u003cfile-name\u003e --module \u003cmodule-name\u003e\n```\n\n### Make a migration\n\n#### Create table\n\n```bash\nnpm run wz-command make-migration \u003cfile-name\u003e -- --module \u003cmodule-name\u003e --create=\u003centity-name\u003e\n```\n\n```bash\nwz-command make-migration \u003cfile-name\u003e --module \u003cmodule-name\u003e --create=\u003centity-name\u003e\n```\n\n#### Update table\n\n```bash\nnpm run wz-command make-migration \u003cfile-name\u003e -- --module \u003cmodule-name\u003e --update=\u003centity-name\u003e\n```\n\n```bash\nwz-command make-migration \u003cfile-name\u003e --module \u003cmodule-name\u003e --update=\u003centity-name\u003e\n```\n\n### Make a module\n\n```bash\nnpm run wz-command make-module \u003cmodule-name\u003e\n```\n\n```bash\nwz-command make-module \u003cfile-name\u003e\n```\n\n### Make a repository\n\n```bash\nnpm run wz-command make-repository \u003cfile-name\u003e -- --module \u003cmodule-name\u003e\n```\n\n```bash\nwz-command make-repository \u003cfile-name\u003e --module \u003cmodule-name\u003e\n```\n\n### Make a service\n\n```bash\nnpm run wz-command make-service \u003cfile-name\u003e -- --module \u003cmodule-name\u003e\n```\n\n```bash\nwz-command make-service \u003cfile-name\u003e --module \u003cmodule-name\u003e\n```\n\n### List all scheduled cron jobs\n\n```bash\nnpm run wz-command list-cron-jobs\n```\n\n```bash\nwz-command list-cron-jobs\n```\n\n### Run specific cron jobs\n\n```bash\nnpm run wz-command run-cron-jobs -- --jobs \u003cjobName\u003e\n```\n\n```bash\nwz-command run-cron-jobs --jobs \u003cjobName\u003e\n```\n\n## License 📝\n\nThis project is licensed under the MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhodfords-solutions%2Fnestjs-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhodfords-solutions%2Fnestjs-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhodfords-solutions%2Fnestjs-command/lists"}