inject-cli

0.1.0 • Public • Published

Inject-cli

Build Status Coverage Status

Simple cli for creating projects that used Dependency injection. The cli uses sloth-ts-injection as DI library.

Installing

$ npm i -g inject-cli

Getting Started

You can use the cli to create a new project. During the creation on the new project, it will create the package.json, install the DI lib.

$ inject init ProjectName

You can then start coding in the src/app.ts.

Create a new Class

Once the project created you can create your first class.

$ inject class ClassName

The Class will be created in the src/ folder. You can then call it from the src/app.ts

import { Injector } from 'sloth-ts-injection';
 
import { ClassName } from './src/ClassName/ClassName';
 
const inject = new Injector();
const commander: ClassName = inject.inject(ClassName);

You can now call its member functions.

Custom Templates

You can use the cli to create a custom class template. For this, you need to create a folder .injector at the root of your project. Here is the template used by default.

import { slothInject } from 'sloth-ts-injection';
 
@slothInject()
export class __NAME__ {
 
    constructor() { }
}

__NAME__ is reserved as it is replaced by the Class Name.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    1
    • latest

Version History

Package Sidebar

Install

npm i inject-cli

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

21.3 kB

Total Files

21

Last publish

Collaborators

  • imoverlord