@avleon/cli 0.0.43 → 0.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -117,28 +117,28 @@ async function createModel(name, options = { force: false, orm: false }) {
117
117
  console.log("Model already exists!", "Use -f or --force to overwrite.\r");
118
118
  return;
119
119
  }
120
- const basicModel = `
121
- \t
122
- export class ${modelName}{
123
- id:number;
124
- name: string;
125
- }
120
+ const basicModel = `
121
+ \t
122
+ export class ${modelName}{
123
+ id:number;
124
+ name: string;
125
+ }
126
126
  `;
127
- const ormModel = `
128
- import {Entity, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
129
- \t
130
- @Entity({name:'${modelName}'})
131
- export class ${modelName}{
132
-
133
- @PrimaryGeneratedColumn()
134
- id:number;
135
-
136
- @CreateDateColumn()
137
- createdAt: Date;
138
-
139
- @UpdateDateColumn()
140
- updatedAt: Date;
141
- }
127
+ const ormModel = `
128
+ import {Entity, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
129
+ \t
130
+ @Entity({name:'${modelName}'})
131
+ export class ${modelName}{
132
+
133
+ @PrimaryGeneratedColumn()
134
+ id:number;
135
+
136
+ @CreateDateColumn()
137
+ createdAt: Date;
138
+
139
+ @UpdateDateColumn()
140
+ updatedAt: Date;
141
+ }
142
142
  `;
143
143
  const formatModel = await prettier.format(options.orm ? ormModel : basicModel, {
144
144
  singleQuote: true,
@@ -164,19 +164,19 @@ async function createMiddleware(name, options = { force: false }) {
164
164
  recursive: true,
165
165
  });
166
166
  }
167
- const basicMiddleware = `
168
- \t
169
- import { Middleware, IMiddleware } from '@avleon/core';
170
-
171
- @Middleware
172
- export class ${modelName}Middleware implements IMiddleware{
173
-
174
- invoke(req:IRequest){
175
- // your logic goes here
176
- return req;
177
- }
178
-
179
- }
167
+ const basicMiddleware = `
168
+ \t
169
+ import { Middleware, IMiddleware } from '@avleon/core';
170
+
171
+ @Middleware
172
+ export class ${modelName}Middleware implements IMiddleware{
173
+
174
+ invoke(req:IRequest){
175
+ // your logic goes here
176
+ return req;
177
+ }
178
+
179
+ }
180
180
  `;
181
181
  const formatModel = await prettier.format(basicMiddleware, {
182
182
  singleQuote: true,
@@ -203,21 +203,21 @@ async function createConfig(name, options = { force: false }) {
203
203
  recursive: true,
204
204
  });
205
205
  }
206
- const basicMiddleware = `
207
- \t
208
- import { Config, IConfig } from '@avleon/core';
209
-
210
- @AppConfig
211
- export class ${modelClassName} implements IConfig<T>{
212
-
213
- config(env: Environment){
214
- // config must return config
215
- return {
216
-
217
- };
218
- }
219
-
220
- }
206
+ const basicMiddleware = `
207
+ \t
208
+ import { AppConfig, IConfig } from '@avleon/core';
209
+
210
+ @AppConfig
211
+ export class ${modelClassName} implements IConfig<T>{
212
+
213
+ config(env: Environment){
214
+ // config must return config
215
+ return {
216
+
217
+ };
218
+ }
219
+
220
+ }
221
221
  `;
222
222
  const formatModel = await prettier.format(basicMiddleware, {
223
223
  singleQuote: true,
@@ -230,6 +230,10 @@ export class ${modelClassName} implements IConfig<T>{
230
230
  async function run() {
231
231
  try {
232
232
  const args = process.argv.slice(2);
233
+ if (args[0] == "serve") {
234
+ require('./serve');
235
+ return;
236
+ }
233
237
  if (args.length < 1) {
234
238
  await displayCommandList({ logo: true, all: false });
235
239
  }
package/dist/commands.js CHANGED
@@ -22,22 +22,22 @@ exports.commandList = [
22
22
  Command: "make:controller",
23
23
  Alias: "m:c",
24
24
  Options: `-f, --force for force create\n -r or --resource for resource controller`,
25
- Description: `Create a new controller. Use -f or --force to overwrite existing controller. If you want to create a resource controller pass options -r or --resource.
26
- You may also pass model by -m or --model.\n
27
- ${chalk_1.default.blueBright("Note:")} when using a resource contorller iqra will automaticall check for dtos related to model name. If -m is user then
28
- it will check for dtos like UserCreateDto and UserUpdateDto. If dtos not found it will create automatically using
29
- model properties.
25
+ Description: `Create a new controller. Use -f or --force to overwrite existing controller. If you want to create a resource controller pass options -r or --resource.
26
+ You may also pass model by -m or --model.\n
27
+ ${chalk_1.default.blueBright("Note:")} when using a resource contorller iqra will automaticall check for dtos related to model name. If -m is user then
28
+ it will check for dtos like UserCreateDto and UserUpdateDto. If dtos not found it will create automatically using
29
+ model properties.
30
30
  `,
31
31
  },
32
32
  {
33
33
  Command: "make:service",
34
34
  Alias: "m:s",
35
35
  Options: `-f, --force for force create\n -r or --resource for resource controller, --dtos`,
36
- Description: `Create a new controller. Use -f or --force to overwrite existing controller. If you want to create a resource controller pass options -r or --resource.
37
- You may also pass model by -m or --model.\n
38
- ${chalk_1.default.blueBright("Note:")} when using a resource contorller iqra will automaticall check for dtos related to model name. If -m is user then
39
- it will check for dtos like UserCreateDto and UserUpdateDto. If dtos not found it will create automatically using
40
- model properties.
36
+ Description: `Create a new controller. Use -f or --force to overwrite existing controller. If you want to create a resource controller pass options -r or --resource.
37
+ You may also pass model by -m or --model.\n
38
+ ${chalk_1.default.blueBright("Note:")} when using a resource contorller iqra will automaticall check for dtos related to model name. If -m is user then
39
+ it will check for dtos like UserCreateDto and UserUpdateDto. If dtos not found it will create automatically using
40
+ model properties.
41
41
  `,
42
42
  },
43
43
  {