Skip to content

Commit

Permalink
feat: add service and provider ejs templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Apr 6, 2022
1 parent a3e54f0 commit 36af839
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
*/

import figlet from 'figlet'
import chalkRainbow from 'chalk-rainbow'

import { resolve } from 'path'
import { Command } from 'commander'
import { New } from './Commands/New'
import { Make } from './Commands/Make'
import chalkRainbow from 'chalk-rainbow'
import { version } from '../package.json'

export class Cli {
Expand Down
1 change: 1 addition & 0 deletions src/Commands/Make.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class Make {
}
}

// TODO Add middleware to namedMiddlewares object of HttpKernel
async middleware(name: string, options: any): Promise<void> {
console.log(chalk.bold.green('[ MAKING MIDDLEWARE ]\n'))

Expand Down
2 changes: 1 addition & 1 deletion templates/__name__Controller.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class <%= namePascal %>Controller {
* @param container
* @return <%= namePascal %>Controller
*/
constructor(_container: Container) {}
public constructor(_container: Container) {}

/**
* Index method
Expand Down
2 changes: 1 addition & 1 deletion templates/__name__Middleware.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class <%= namePascal %>Middleware implements MiddlewareContract {
* @param container
* @return <%= namePascal %>Middleware
*/
constructor(_container: Container) {}
public constructor(_container: Container) {}

/**
* Handle method is executed before the request gets in your controller.
Expand Down
32 changes: 32 additions & 0 deletions templates/__name__Provider.js.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ServiceProvider } from '@athenna/ioc'

export class <%= namePascal %>Provider extends ServiceProvider {
/**
* All the container bindings that should be registered.
*/
bindings = {}

/**
* All the container instances that should be registered.
*/
instances = {}

/**
* All the container singletons that should be registered.
*/
singletons = {}

/**
* Register any application services.
*
* @return void
*/
register() {}

/**
* Bootstrap any application services.
*
* @return void
*/
boot() {}
}
32 changes: 32 additions & 0 deletions templates/__name__Provider.ts.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ServiceProvider } from '@athenna/ioc'

export class <%= namePascal %>Provider extends ServiceProvider {
/**
* All the container bindings that should be registered.
*/
public bindings = {}

/**
* All the container instances that should be registered.
*/
public instances = {}

/**
* All the container singletons that should be registered.
*/
public singletons = {}

/**
* Register any application services.
*
* @return void
*/
public register() {}

/**
* Bootstrap any application services.
*
* @return void
*/
public boot() {}
}
9 changes: 9 additions & 0 deletions templates/__name__Service.js.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export class <%= namePascal %>Service {
/**
* Use the constructor to resolve any dependency of the Ioc container
*
* @param _container
* @return <%= namePascal %>Service
*/
constructor(_container) {}
}
11 changes: 11 additions & 0 deletions templates/__name__Service.ts.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Container } from 'providers/Container'

export class <%= namePascal %>Service {
/**
* Use the constructor to resolve any dependency of the Ioc container
*
* @param _container
* @return <%= namePascal %>Service
*/
public constructor(_container: Container) {}
}

0 comments on commit 36af839

Please sign in to comment.