@adonisjs/core 6.10.1 → 6.12.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.
package/build/commands/add.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export default class Add extends BaseCommand {
|
|
|
11
11
|
static options: CommandOptions;
|
|
12
12
|
name: string;
|
|
13
13
|
verbose?: boolean;
|
|
14
|
-
packageManager?: 'npm' | 'pnpm' | 'yarn' | 'yarn@berry';
|
|
14
|
+
packageManager?: 'npm' | 'pnpm' | 'bun' | 'yarn' | 'yarn@berry';
|
|
15
15
|
dev?: boolean;
|
|
16
16
|
force?: boolean;
|
|
17
17
|
/**
|
package/build/commands/add.js
CHANGED
|
@@ -32,7 +32,7 @@ export default class Add extends BaseCommand {
|
|
|
32
32
|
if (['npm', 'pnpm', 'yarn', 'yarn@berry'].includes(pkgManager)) {
|
|
33
33
|
return pkgManager;
|
|
34
34
|
}
|
|
35
|
-
throw new Error('Invalid package manager. Must be one of npm, pnpm or yarn');
|
|
35
|
+
throw new Error('Invalid package manager. Must be one of npm, pnpm, bun or yarn');
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Configure the package by delegating the work to the `node ace configure` command
|
|
@@ -12,6 +12,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
+
import { stubsRoot } from '../stubs/main.js';
|
|
15
16
|
import { args, BaseCommand, flags } from '../modules/ace/main.js';
|
|
16
17
|
/**
|
|
17
18
|
* The configure command is used to configure packages after installation
|
|
@@ -69,6 +70,20 @@ export default class Configure extends BaseCommand {
|
|
|
69
70
|
rcFile.addMetaFile('resources/views/**/*.edge', false);
|
|
70
71
|
});
|
|
71
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Configure health checks
|
|
75
|
+
*/
|
|
76
|
+
async #configureHealthChecks() {
|
|
77
|
+
const codemods = await this.createCodemods();
|
|
78
|
+
await codemods.makeUsingStub(stubsRoot, 'make/health/main.stub', {
|
|
79
|
+
flags: this.parsed.flags,
|
|
80
|
+
entity: this.app.generators.createEntity('health'),
|
|
81
|
+
});
|
|
82
|
+
await codemods.makeUsingStub(stubsRoot, 'make/health/controller.stub', {
|
|
83
|
+
flags: this.parsed.flags,
|
|
84
|
+
entity: this.app.generators.createEntity('health_checks'),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
72
87
|
/**
|
|
73
88
|
* Creates codemods as per configure command options
|
|
74
89
|
*/
|
|
@@ -88,6 +103,9 @@ export default class Configure extends BaseCommand {
|
|
|
88
103
|
if (this.name === 'edge') {
|
|
89
104
|
return this.#configureEdge();
|
|
90
105
|
}
|
|
106
|
+
if (this.name === 'health_checks') {
|
|
107
|
+
return this.#configureHealthChecks();
|
|
108
|
+
}
|
|
91
109
|
const packageExports = await this.#getPackageSource(this.name);
|
|
92
110
|
if (!packageExports) {
|
|
93
111
|
this.logger.error(`Cannot find module "${this.name}". Make sure to install it`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{{#var controllerName = generators.controllerName(entity.name, false)}}
|
|
2
|
+
{{#var controllerFileName = generators.controllerFileName(entity.name, false)}}
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.httpControllersPath(entity.path, controllerFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
8
|
+
import { healthChecks } from '#start/health'
|
|
9
|
+
import type { HttpContext } from '@adonisjs/core/http'
|
|
10
|
+
|
|
11
|
+
export default class {{ controllerName }} {
|
|
12
|
+
async handle({ response }: HttpContext) {
|
|
13
|
+
const report = await healthChecks.run()
|
|
14
|
+
|
|
15
|
+
if (report.isHealthy) {
|
|
16
|
+
return response.ok(report)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return response.serviceUnavailable(report)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{{#var preloadFileName = string(entity.name).snakeCase().removeExtension().ext('.ts').toString()}}
|
|
2
|
+
{{{
|
|
3
|
+
exports({
|
|
4
|
+
to: app.startPath(entity.path, preloadFileName)
|
|
5
|
+
})
|
|
6
|
+
}}}
|
|
7
|
+
import { HealthChecks, DiskSpaceCheck, MemoryHeapCheck } from '@adonisjs/core/health'
|
|
8
|
+
|
|
9
|
+
export const healthChecks = new HealthChecks().register([
|
|
10
|
+
new DiskSpaceCheck(),
|
|
11
|
+
new MemoryHeapCheck(),
|
|
12
|
+
])
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/core",
|
|
3
3
|
"description": "Core of AdonisJS",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.12.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.6.0"
|
|
7
7
|
},
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"@japa/expect-type": "^2.0.2",
|
|
92
92
|
"@japa/file-system": "^2.3.0",
|
|
93
93
|
"@japa/runner": "^3.1.4",
|
|
94
|
-
"@swc/core": "^1.
|
|
95
|
-
"@types/node": "^20.14.
|
|
94
|
+
"@swc/core": "^1.6.1",
|
|
95
|
+
"@types/node": "^20.14.5",
|
|
96
96
|
"@types/pretty-hrtime": "^1.0.3",
|
|
97
97
|
"@types/sinon": "^17.0.3",
|
|
98
98
|
"@types/supertest": "^6.0.2",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"@vinejs/vine": "^2.1.0",
|
|
101
101
|
"argon2": "^0.40.3",
|
|
102
102
|
"bcrypt": "^5.1.1",
|
|
103
|
-
"c8": "^
|
|
103
|
+
"c8": "^10.1.2",
|
|
104
104
|
"copyfiles": "^2.4.1",
|
|
105
105
|
"cross-env": "^7.0.3",
|
|
106
106
|
"del-cli": "^5.1.0",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"get-port": "^7.1.0",
|
|
111
111
|
"github-label-sync": "^2.3.1",
|
|
112
112
|
"husky": "^9.0.11",
|
|
113
|
-
"prettier": "^3.3.
|
|
113
|
+
"prettier": "^3.3.2",
|
|
114
114
|
"release-it": "^17.3.0",
|
|
115
115
|
"sinon": "^18.0.0",
|
|
116
116
|
"supertest": "^7.0.0",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"typescript": "^5.4.5"
|
|
120
120
|
},
|
|
121
121
|
"dependencies": {
|
|
122
|
-
"@adonisjs/ace": "^13.0
|
|
122
|
+
"@adonisjs/ace": "^13.1.0",
|
|
123
123
|
"@adonisjs/application": "^8.3.1",
|
|
124
124
|
"@adonisjs/bodyparser": "^10.0.2",
|
|
125
125
|
"@adonisjs/config": "^5.0.2",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"@adonisjs/events": "^9.0.2",
|
|
129
129
|
"@adonisjs/fold": "^10.1.2",
|
|
130
130
|
"@adonisjs/hash": "^9.0.3",
|
|
131
|
-
"@adonisjs/health": "^
|
|
131
|
+
"@adonisjs/health": "^2.0.0",
|
|
132
132
|
"@adonisjs/http-server": "^7.2.3",
|
|
133
133
|
"@adonisjs/logger": "^6.0.3",
|
|
134
134
|
"@adonisjs/repl": "^4.0.1",
|
|
@@ -220,5 +220,6 @@
|
|
|
220
220
|
"factories/**",
|
|
221
221
|
".yalc/**"
|
|
222
222
|
]
|
|
223
|
-
}
|
|
223
|
+
},
|
|
224
|
+
"packageManager": "pnpm@9.2.0+sha512.98a80fd11c2e7096747762304106432b3ddc67dcf54b5a8c01c93f68a2cd5e05e6821849522a06fb76284d41a2660d5e334f2ee3bbf29183bf2e739b1dafa771"
|
|
224
225
|
}
|