@avleon/cli 0.0.46 → 0.4.0

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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bin.d.ts +2 -0
  3. package/dist/bin.js +10 -0
  4. package/dist/commands/build.d.ts +11 -0
  5. package/dist/commands/build.js +65 -0
  6. package/dist/commands/doctor.d.ts +10 -0
  7. package/dist/commands/doctor.js +96 -0
  8. package/dist/commands/new.d.ts +19 -0
  9. package/dist/commands/new.js +306 -0
  10. package/dist/commands/route-list.d.ts +19 -0
  11. package/dist/commands/route-list.js +160 -0
  12. package/dist/commands/serve.d.ts +17 -0
  13. package/dist/commands/serve.js +238 -0
  14. package/dist/commands/start.d.ts +10 -0
  15. package/dist/commands/start.js +43 -0
  16. package/dist/compiler.d.ts +24 -0
  17. package/dist/compiler.js +83 -0
  18. package/dist/errors.d.ts +8 -0
  19. package/dist/errors.js +16 -0
  20. package/dist/generators/make.d.ts +24 -0
  21. package/dist/generators/make.js +157 -0
  22. package/dist/index.d.ts +17 -0
  23. package/dist/index.js +40 -15
  24. package/dist/program.d.ts +22 -0
  25. package/dist/program.js +178 -0
  26. package/dist/utils/entry.d.ts +15 -0
  27. package/dist/utils/entry.js +55 -0
  28. package/dist/utils/env-types.d.ts +8 -0
  29. package/dist/utils/env-types.js +19 -0
  30. package/dist/utils/log.d.ts +25 -0
  31. package/dist/utils/log.js +39 -0
  32. package/dist/utils/names.d.ts +27 -0
  33. package/dist/utils/names.js +58 -0
  34. package/dist/utils/process.d.ts +18 -0
  35. package/dist/utils/process.js +84 -0
  36. package/dist/utils/project.d.ts +17 -0
  37. package/dist/utils/project.js +91 -0
  38. package/dist/utils/stubs.d.ts +15 -0
  39. package/dist/utils/stubs.js +52 -0
  40. package/dist/utils/tsconfig.d.ts +13 -0
  41. package/dist/utils/tsconfig.js +102 -0
  42. package/package.json +63 -62
  43. package/readme.md +155 -66
  44. package/stubs/config/config.stub +9 -0
  45. package/stubs/controllers/basic-controller.stub +9 -12
  46. package/stubs/controllers/resource-controller.stub +45 -0
  47. package/stubs/controllers/rest-controller.stub +29 -34
  48. package/stubs/dtos/dto.stub +11 -0
  49. package/stubs/middlewares/middleware.stub +9 -0
  50. package/stubs/models/basic-model.stub +4 -6
  51. package/stubs/models/entity-model.stub +16 -23
  52. package/stubs/project/app-minimal.stub +7 -0
  53. package/stubs/project/app.stub +8 -0
  54. package/stubs/project/env.stub +3 -0
  55. package/stubs/project/gitignore.stub +5 -0
  56. package/stubs/project/home.controller.spec.stub +19 -0
  57. package/stubs/project/home.controller.stub +12 -0
  58. package/stubs/project/home.service.stub +8 -0
  59. package/stubs/project/openapi.config.stub +15 -0
  60. package/stubs/project/readme.stub +26 -0
  61. package/stubs/project/serve.stub +10 -0
  62. package/stubs/project/tsconfig.build.stub +4 -0
  63. package/stubs/project/tsconfig.stub +18 -0
  64. package/stubs/project/vitest-e2e.config.stub +10 -0
  65. package/stubs/project/vitest.config.stub +17 -0
  66. package/stubs/services/basic-service.stub +8 -9
  67. package/stubs/services/orm-rest-service.stub +61 -73
  68. package/stubs/services/rest-service.stub +34 -71
  69. package/dist/av-cli.js +0 -60
  70. package/dist/avcli.js +0 -26
  71. package/dist/cli.interface.js +0 -2
  72. package/dist/cli.js +0 -358
  73. package/dist/commands.js +0 -55
  74. package/dist/controller.js +0 -92
  75. package/dist/create.js +0 -498
  76. package/dist/helpers/file-helper.js +0 -30
  77. package/dist/helpers/path-helper.js +0 -21
  78. package/dist/paths.js +0 -32
  79. package/dist/scripts/serve.js +0 -290
  80. package/dist/serve.js +0 -311
  81. package/dist/service.js +0 -73
  82. package/stubs/app/app-controller.stub +0 -11
  83. package/stubs/app/app-minimal.stub +0 -17
  84. package/stubs/app/app-withdb.stub +0 -0
  85. package/stubs/basic-controller.stub +0 -7
  86. package/stubs/config.stub +0 -11
  87. package/stubs/controllers/orm-rest-controller.stub +0 -52
  88. package/stubs/model.stub +0 -0
  89. package/stubs/serve.stub +0 -10
package/readme.md CHANGED
@@ -1,66 +1,155 @@
1
-
2
- ### ⚠️ WARNING: NOT FOR PRODUCTION USE
3
-
4
- > **🚧 This project is in active development.**
5
- >
6
- > It is **not stable** and **not ready** for live environments.
7
- > Use **only for testing, experimentation, or internal evaluation**.
8
- >
9
- > ####❗ Risks of using this in production:
10
- >
11
- > - 🔄 Breaking changes may be introduced at any time
12
- > - 🧪 Features are experimental and may be unstable
13
- > - 🔐 Security has not been audited
14
- > - 💥 Potential for data loss or critical errors
15
- >
16
- > **Please do not deploy this in production environments.**
17
-
18
- # Avleon CLI - v0.0.37
19
-
20
- ### Create Application
21
- ```sh
22
- npx @avleon/cli new my_api
23
- ```
24
- ### Create Controller
25
- ```sh
26
- npx avleon make:controller product
27
- # or shorthand
28
- npx avleon m:c product
29
- # for resource controller with -r flag
30
- npx avleon m:c product -m product -r
31
- ```
32
-
33
- ### Create Model/Entity
34
- ```sh
35
- # basic model
36
- npx avleon make:model product
37
- # typeorm model
38
- npx avleon m:m product --orm
39
- ```
40
-
41
- ### Create Service
42
- ```sh
43
- # basic service
44
- npx avleon make:service product
45
- # resource service with built-in collection
46
- npx avleon make:service product -m product -r
47
- # resource service with typeorm collection
48
- npx avleon make:service product -m product -r --orm
49
- ```
50
-
51
- ### Create Middleware
52
- ```sh
53
- npx avleon make:config product
54
- ```
55
-
56
- ### Create Config
57
- ```sh
58
- npx avleon make:config product
59
- ```
60
-
61
- ### Create authoriztion (Experimental)
62
- ```sh
63
- npx avleon make:auth jwt
64
- ```
65
-
66
-
1
+ ### ⚠️ WARNING: NOT FOR PRODUCTION USE
2
+
3
+ > **🚧 This project is in active development.**
4
+ >
5
+ > It is **not stable** and **not ready** for live environments.
6
+ > Use **only for testing, experimentation, or internal evaluation**.
7
+ >
8
+ > #### ❗ Risks of using this in production:
9
+ >
10
+ > - 🔄 Breaking changes may be introduced at any time
11
+ > - 🧪 Features are experimental and may be unstable
12
+ > - 🔐 Security has not been audited
13
+ > - 💥 Potential for data loss or critical errors
14
+ >
15
+ > **Please do not deploy this in production environments.**
16
+
17
+ # Avleon CLI
18
+
19
+ Scaffold and run [Avleon](https://github.com/avleonjs/avleon-core) applications.
20
+
21
+ ## Create an Application
22
+
23
+ ```sh
24
+ npx @avleon/cli new my_api
25
+ ```
26
+
27
+ You are prompted for a package manager and for optional features (OpenAPI,
28
+ CORS, TypeORM, Knex, Scalar UI). The generated project uses `@avleon/core`'s
29
+ `Avleon.createApplication()` and is ready to run:
30
+
31
+ ```sh
32
+ cd my_api
33
+ npm run start:dev
34
+ ```
35
+
36
+ ## Commands
37
+
38
+ | Command | Alias | Options | Description |
39
+ |---------|-------|---------|-------------|
40
+ | `new <name>` | | `-m`, `-f`, `-y`, `--pm <npm\|yarn\|pnpm>`, `--features <list>`, `--skip-install` | Create a new application |
41
+ | `serve` | | `--entry <file>`, `--no-type-check`, `--debounce <ms>` | Dev server: SWC compile, run, reload on change |
42
+ | `build` | | `-p <tsconfig>` | Compile with `tsconfig.build.json` and copy assets |
43
+ | `start` | | `--entry <file>` | Run the compiled app with `NODE_ENV=production` |
44
+ | `doctor` | | | Check Node.js, `@avleon/core`, `reflect-metadata` and decorator settings |
45
+ | `route:list` | `routes` | `--json`, `--static` | List the app's routes |
46
+ | `make:model` | `m:m` | `-f`, `--orm`, `--root <dir>` | Create a model / TypeORM entity |
47
+ | `make:controller` | `m:c` | `-f`, `-r`, `-m <model>`, `--orm`, `--root <dir>`, `--base-path` | Create a controller |
48
+ | `make:service` | `m:s` | `-f`, `-r`, `-m <model>`, `--orm`, `--root <dir>` | Create a service |
49
+ | `make:config` | `m:cnf` | `-f`, `--root <dir>` | Create an `@AppConfig` class |
50
+ | `make:middleware` | `m:mlwr` | `-f`, `--root <dir>` | Create a middleware |
51
+ | `make:dto` | `m:dto` | `-f`, `--root <dir>` | Create a class-validator DTO |
52
+
53
+ `-f` / `--force` overwrites an existing file. `-r` / `--resource` generates a
54
+ full REST skeleton. `--root <dir>` (also `-rt`) writes under `src/<dir>`
55
+ instead of the default folder. Names may be nested, e.g. `admin/User`.
56
+ Run `avleon <command> --help` for details.
57
+
58
+ Generated controllers must be registered in your app with
59
+ `app.useControllers([...])`.
60
+
61
+ ### Controller
62
+
63
+ ```sh
64
+ npx avleon make:controller product
65
+ # shorthand
66
+ npx avleon m:c product
67
+
68
+ # REST controller — also generates the matching service
69
+ npx avleon m:c product -m product -r
70
+
71
+ # REST controller backed by a TypeORM repository
72
+ npx avleon m:c product -m product -r --orm
73
+ ```
74
+
75
+ With `-m`, the generated controller delegates to `src/services/<model>.service.ts`,
76
+ which is created alongside it.
77
+
78
+ ### Model / Entity
79
+
80
+ ```sh
81
+ # plain class
82
+ npx avleon make:model product
83
+
84
+ # TypeORM entity
85
+ npx avleon m:m product --orm
86
+ ```
87
+
88
+ ### Service
89
+
90
+ ```sh
91
+ # basic service
92
+ npx avleon make:service product
93
+
94
+ # resource service backed by an in-memory Collection
95
+ npx avleon make:service product -m product -r
96
+
97
+ # resource service backed by a TypeORM repository
98
+ npx avleon make:service product -m product -r --orm
99
+ ```
100
+
101
+ ### Middleware
102
+
103
+ ```sh
104
+ npx avleon make:middleware auth
105
+ ```
106
+
107
+ Generates a class extending `AvleonMiddleware` with an `invoke(req, res)` method.
108
+
109
+ ### Config
110
+
111
+ ```sh
112
+ npx avleon make:config jwt
113
+ ```
114
+
115
+ Generates a class extending `AvleonConfig`, registered via `@AppConfig`.
116
+
117
+ ## Development Server
118
+
119
+ ```sh
120
+ npx avleon serve
121
+ ```
122
+
123
+ Compiles `src/` with SWC into `dist/`, starts the entry point, and restarts on
124
+ change to sources, assets or `.env*` files. The entry file is taken from
125
+ `--entry`, `avleon.entry` in `package.json`, `main`, then `dist/serve.js`,
126
+ `server.js`, `main.js` or `index.js`.
127
+
128
+ Type errors are reported by a parallel `tsc --noEmit --watch` (disable with
129
+ `--no-type-check`) and never block a reload. Syntax errors stop the app until
130
+ they are fixed, so stale code never keeps serving.
131
+
132
+ ## Build and Run
133
+
134
+ ```sh
135
+ npx avleon build # tsc with tsconfig.build.json, then copy non-TS assets
136
+ npx avleon start # node dist/serve.js with NODE_ENV=production
137
+ ```
138
+
139
+ ## Routes
140
+
141
+ ```sh
142
+ npx avleon route:list # compile and read Avleon's route metadata
143
+ npx avleon route:list --static # scan decorators in the source, no dependencies
144
+ npx avleon routes --json
145
+ ```
146
+
147
+ ## Doctor
148
+
149
+ ```sh
150
+ npx avleon doctor
151
+ ```
152
+
153
+ Checks the Node.js version, that `@avleon/core` matches the CLI's version,
154
+ that `reflect-metadata` is installed, and that `experimentalDecorators` and
155
+ `emitDecoratorMetadata` are enabled. Exits non-zero if a check fails.
@@ -0,0 +1,9 @@
1
+ import { AppConfig, AvleonConfig, Environment } from '@avleon/core';
2
+
3
+ @AppConfig
4
+ export class {ClassName} extends AvleonConfig {
5
+ config(env: Environment) {
6
+ // Return this config's values, e.g. { secret: env.get('JWT_SECRET') }.
7
+ return {};
8
+ }
9
+ }
@@ -1,12 +1,9 @@
1
- import { ApiController, Get, HttpResponse } from '@avleon/core';
2
-
3
-
4
- @ApiController('/{controller}s')
5
- export class {Controller}Controller{
6
-
7
- @Get()
8
- index(){
9
- return "{controller} ok";
10
- }
11
-
12
- }
1
+ import { ApiController, Get } from '@avleon/core';
2
+
3
+ @ApiController('/{route}')
4
+ export class {ClassName} {
5
+ @Get()
6
+ index() {
7
+ return { message: '{ClassName} works' };
8
+ }
9
+ }
@@ -0,0 +1,45 @@
1
+ import { ApiController, Get, Post, Put, Delete, Param, Query, Body, HttpExceptions } from '@avleon/core';
2
+ import { {ServiceClass} } from '{serviceImport}';
3
+
4
+ @ApiController('/{route}')
5
+ export class {ClassName} {
6
+ constructor(private readonly {serviceVar}: {ServiceClass}) {}
7
+
8
+ @Get()
9
+ async index(@Query() query?: any) {
10
+ if (query && query.page) {
11
+ return this.{serviceVar}.paginate(Number(query.page));
12
+ }
13
+ return this.{serviceVar}.findAll();
14
+ }
15
+
16
+ @Get('/:id')
17
+ async findOne(@Param('id') id: number) {
18
+ const {modelVar} = await this.{serviceVar}.findByPk(Number(id));
19
+ if (!{modelVar}) throw HttpExceptions.notFound('{Model} not found.');
20
+ return {modelVar};
21
+ }
22
+
23
+ @Post()
24
+ async create(@Body() body: any) {
25
+ return this.{serviceVar}.create(body);
26
+ }
27
+
28
+ @Put('/:id')
29
+ async update(@Param('id') id: number, @Body() updateBody: any) {
30
+ const {modelVar} = await this.{serviceVar}.findByPk(Number(id));
31
+ if (!{modelVar}) throw HttpExceptions.notFound('{Model} not found.');
32
+ const isUpdated = await this.{serviceVar}.update(Number(id), updateBody);
33
+ if (!isUpdated) throw HttpExceptions.internalError("Can't update {Model}");
34
+ return { message: 'Updated successfully' };
35
+ }
36
+
37
+ @Delete('/:id')
38
+ async delete(@Param('id') id: number) {
39
+ const {modelVar} = await this.{serviceVar}.findByPk(Number(id));
40
+ if (!{modelVar}) throw HttpExceptions.notFound('{Model} not found.');
41
+ const isDeleted = await this.{serviceVar}.delete(Number(id));
42
+ if (!isDeleted) throw HttpExceptions.internalError("Can't delete {Model}");
43
+ return { message: 'Deleted successfully' };
44
+ }
45
+ }
@@ -1,34 +1,29 @@
1
- import { ApiController, Get, Post, Delete, Param, Query, Body, HttpExceptions } from '@avleon/core';
2
-
3
- @ApiController('/{controller}s')
4
- export class {Controller}Controller{
5
-
6
-
7
-
8
- @Get()
9
- async index(@Query() query?:any){
10
- throw new Error("Method not implemented.");
11
- }
12
-
13
- @Get('/:id')
14
- async findOne(@Param('id') id:number){
15
- throw new Error("Method not implemented.");
16
- }
17
-
18
- @Post()
19
- async create(@Body() body:any){
20
- throw new Error("Method not implemented.");
21
- }
22
-
23
- @Post('/:id')
24
- async update(@Param('id') id:number, updateBody:any){
25
-
26
- throw new Error("Method not implemented.");
27
- }
28
-
29
- @Delete('/:id')
30
- async delete(@Param('id') id:number){
31
- throw new Error("Method not implemented.");
32
- }
33
-
34
- }
1
+ import { ApiController, Get, Post, Put, Delete, Param, Query, Body } from '@avleon/core';
2
+
3
+ @ApiController('/{route}')
4
+ export class {ClassName} {
5
+ @Get()
6
+ async index(@Query() query?: any) {
7
+ throw new Error('Method not implemented.');
8
+ }
9
+
10
+ @Get('/:id')
11
+ async findOne(@Param('id') id: number) {
12
+ throw new Error('Method not implemented.');
13
+ }
14
+
15
+ @Post()
16
+ async create(@Body() body: any) {
17
+ throw new Error('Method not implemented.');
18
+ }
19
+
20
+ @Put('/:id')
21
+ async update(@Param('id') id: number, @Body() updateBody: any) {
22
+ throw new Error('Method not implemented.');
23
+ }
24
+
25
+ @Delete('/:id')
26
+ async delete(@Param('id') id: number) {
27
+ throw new Error('Method not implemented.');
28
+ }
29
+ }
@@ -0,0 +1,11 @@
1
+ import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
2
+
3
+ export class {ClassName} {
4
+ @IsString()
5
+ @IsNotEmpty()
6
+ name!: string;
7
+
8
+ @IsString()
9
+ @IsOptional()
10
+ description?: string;
11
+ }
@@ -0,0 +1,9 @@
1
+ import { AppMiddleware, AvleonMiddleware, IRequest, IResponse } from '@avleon/core';
2
+
3
+ @AppMiddleware
4
+ export class {ClassName} extends AvleonMiddleware {
5
+ async invoke(req: IRequest, res?: IResponse) {
6
+ // your logic goes here
7
+ return req;
8
+ }
9
+ }
@@ -1,6 +1,4 @@
1
-
2
-
3
- export class {Model}{
4
- id: number;
5
- name: string;
6
- }
1
+ export class {Model} {
2
+ id!: number;
3
+ name!: string;
4
+ }
@@ -1,23 +1,16 @@
1
-
2
- import {Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn} from 'typeorm';
3
-
4
- @Entity({name:"{Model}"})
5
- export class {Model}{
6
-
7
- @PrimaryGeneratedColumn()
8
- id:number;
9
-
10
-
11
- // your fields
12
-
13
- // @Column()
14
- // name:string
15
-
16
-
17
- @CreateDateColumn()
18
- createdAt: Date;
19
-
20
-
21
- @UpdateDateColumn()
22
- updatedAt: Date;
23
- }
1
+ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
2
+
3
+ @Entity({ name: '{table}' })
4
+ export class {Model} {
5
+ @PrimaryGeneratedColumn()
6
+ id!: number;
7
+
8
+ @Column()
9
+ name!: string;
10
+
11
+ @CreateDateColumn()
12
+ createdAt!: Date;
13
+
14
+ @UpdateDateColumn()
15
+ updatedAt!: Date;
16
+ }
@@ -0,0 +1,7 @@
1
+ import { Avleon } from '@avleon/core';
2
+
3
+ const app = Avleon.createApplication();
4
+
5
+ app.mapGet('/', () => ({ message: 'Hello World!' }));
6
+
7
+ export default app;
@@ -0,0 +1,8 @@
1
+ import { Avleon } from '@avleon/core';
2
+ import { HomeController } from './controllers/home.controller';
3
+ {Imports}
4
+ const app = Avleon.createApplication();
5
+ {Setup}
6
+ app.useControllers([HomeController]);
7
+
8
+ export default app;
@@ -0,0 +1,3 @@
1
+ # Core treats an unset NODE_ENV as production.
2
+ NODE_ENV=development
3
+ PORT=4000
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ dist/
3
+ .env
4
+ .env.local
5
+ coverage/
@@ -0,0 +1,19 @@
1
+ import { beforeAll, describe, expect, it } from 'vitest';
2
+ import { AvleonTest } from '@avleon/core';
3
+ import { HomeController } from './home.controller';
4
+
5
+ describe('HomeController', () => {
6
+ let controller!: HomeController;
7
+
8
+ beforeAll(() => {
9
+ controller = AvleonTest.getController(HomeController);
10
+ });
11
+
12
+ it('should be defined', () => {
13
+ expect(controller).toBeDefined();
14
+ });
15
+
16
+ it('should return hello message', () => {
17
+ expect(controller.sayHello()).toEqual({ message: 'Hello World!' });
18
+ });
19
+ });
@@ -0,0 +1,12 @@
1
+ import { ApiController, Get } from '@avleon/core';
2
+ import { HomeService } from '../services/home.service';
3
+
4
+ @ApiController('/')
5
+ export class HomeController {
6
+ constructor(private readonly homeService: HomeService) {}
7
+
8
+ @Get()
9
+ sayHello() {
10
+ return this.homeService.sayHello();
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ import { AppService } from '@avleon/core';
2
+
3
+ @AppService
4
+ export class HomeService {
5
+ sayHello() {
6
+ return { message: 'Hello World!' };
7
+ }
8
+ }
@@ -0,0 +1,15 @@
1
+ import { AppConfig, AvleonConfig, Environment, OpenApiUiOptions } from '@avleon/core';
2
+
3
+ @AppConfig
4
+ export class OpenApiConfig extends AvleonConfig<OpenApiUiOptions> {
5
+ config(env: Environment): OpenApiUiOptions {
6
+ return {
7
+ info: {
8
+ title: '{AppTitle} API',
9
+ version: '0.0.1',
10
+ description: 'API documentation for {AppTitle}',
11
+ },{Provider}
12
+ routePrefix: '/docs',
13
+ };
14
+ }
15
+ }
@@ -0,0 +1,26 @@
1
+ # {AppTitle}
2
+
3
+ Built with [Avleon](https://github.com/avleonjs/avleon-core).
4
+
5
+ ## Getting Started
6
+
7
+ ```bash
8
+ {InstallCmd}
9
+ {DevCmd}
10
+ ```
11
+
12
+ ## Scripts
13
+
14
+ | Script | Description |
15
+ |--------|-------------|
16
+ | `start:dev` | Start the development server with reload (`avleon serve`) |
17
+ | `build` | Compile TypeScript to `dist/` (`avleon build`) |
18
+ | `start` | Run the compiled app in production (`avleon start`) |
19
+ {TestRow}
20
+ ## Project Structure
21
+
22
+ ```
23
+ src/
24
+ {Tree}├── app.ts # App setup
25
+ └── serve.ts # Entry point
26
+ ```
@@ -0,0 +1,10 @@
1
+ import { Environment, inject } from '@avleon/core';
2
+ import app from './app';
3
+
4
+ async function serve() {
5
+ const env = inject(Environment);
6
+ const port = Number(env.get('PORT')) || 4000;
7
+ await app.run(port);
8
+ }
9
+
10
+ serve();
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["node_modules", "coverage", "test", "dist", "**/*.spec.ts", "**/*.test.ts"]
4
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "CommonJS",
5
+ "moduleResolution": "node",
6
+ "experimentalDecorators": true,
7
+ "emitDecoratorMetadata": true,
8
+ "outDir": "./dist",
9
+ "esModuleInterop": true,
10
+ "allowSyntheticDefaultImports": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "skipLibCheck": true,
13
+ "sourceMap": true,
14
+ "strict": false
15
+ },
16
+ "include": ["avleon-env.d.ts", "src/**/*"],
17
+ "exclude": ["node_modules", "dist"]
18
+ }
@@ -0,0 +1,10 @@
1
+ import swc from 'unplugin-swc';
2
+ import { defineConfig } from 'vitest/config';
3
+
4
+ export default defineConfig({
5
+ plugins: [swc.vite()],
6
+ test: {
7
+ environment: 'node',
8
+ include: ['test/**/*.e2e-spec.ts'],
9
+ },
10
+ });
@@ -0,0 +1,17 @@
1
+ import swc from 'unplugin-swc';
2
+ import { defineConfig } from 'vitest/config';
3
+
4
+ export default defineConfig({
5
+ // SWC emits the decorator metadata that Avleon's dependency injection
6
+ // and validation rely on; Vitest's default transform (esbuild) does not.
7
+ plugins: [swc.vite()],
8
+ test: {
9
+ environment: 'node',
10
+ include: ['src/**/*.spec.ts'],
11
+ coverage: {
12
+ include: ['src/**/*.ts'],
13
+ exclude: ['src/**/*.spec.ts'],
14
+ reportsDirectory: 'coverage',
15
+ },
16
+ },
17
+ });
@@ -1,9 +1,8 @@
1
- import { AppService } from '@avleon/core';
2
-
3
- @AppService
4
- export class {Service} {
5
-
6
- sayHello(){
7
- return "Hello World!";
8
- }
9
- }
1
+ import { AppService } from '@avleon/core';
2
+
3
+ @AppService
4
+ export class {ClassName} {
5
+ sayHello() {
6
+ return 'Hello World!';
7
+ }
8
+ }