@adonisjs/core 6.11.0 → 6.12.1
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 +3 -1
- package/build/commands/add.js +3 -2
- package/build/commands/configure.js +4 -0
- package/build/factories/core/ace.d.ts +0 -1
- package/build/factories/core/ignitor.d.ts +0 -1
- package/build/factories/core/test_utils.d.ts +0 -1
- package/build/modules/ace/codemods.d.ts +0 -1
- package/build/src/cli_formatters/routes_list.d.ts +1 -1
- package/build/src/config_provider.d.ts +2 -2
- package/build/src/debug.d.ts +0 -1
- package/build/src/ignitor/http.d.ts +0 -2
- package/build/src/ignitor/main.d.ts +0 -1
- package/build/src/test_utils/http.d.ts +0 -2
- package/build/src/test_utils/main.d.ts +0 -1
- package/build/stubs/make/health/controller.stub +21 -0
- package/build/stubs/make/health/main.stub +3 -7
- package/package.json +11 -8
package/build/commands/add.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommandOptions } from '../types/ace.js';
|
|
2
2
|
import { BaseCommand } from '../modules/ace/main.js';
|
|
3
|
+
declare const KNOWN_PACKAGE_MANAGERS: readonly ["npm", "pnpm", "bun", "yarn", "yarn@berry", "pnpm@6"];
|
|
3
4
|
/**
|
|
4
5
|
* The install command is used to `npm install` and `node ace configure` a new package
|
|
5
6
|
* in one go.
|
|
@@ -11,7 +12,7 @@ export default class Add extends BaseCommand {
|
|
|
11
12
|
static options: CommandOptions;
|
|
12
13
|
name: string;
|
|
13
14
|
verbose?: boolean;
|
|
14
|
-
packageManager?:
|
|
15
|
+
packageManager?: (typeof KNOWN_PACKAGE_MANAGERS)[number];
|
|
15
16
|
dev?: boolean;
|
|
16
17
|
force?: boolean;
|
|
17
18
|
/**
|
|
@@ -19,3 +20,4 @@ export default class Add extends BaseCommand {
|
|
|
19
20
|
*/
|
|
20
21
|
run(): Promise<void>;
|
|
21
22
|
}
|
|
23
|
+
export {};
|
package/build/commands/add.js
CHANGED
|
@@ -14,6 +14,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
14
14
|
};
|
|
15
15
|
import { detectPackageManager, installPackage } from '@antfu/install-pkg';
|
|
16
16
|
import { args, BaseCommand, flags } from '../modules/ace/main.js';
|
|
17
|
+
const KNOWN_PACKAGE_MANAGERS = ['npm', 'pnpm', 'bun', 'yarn', 'yarn@berry', 'pnpm@6'];
|
|
17
18
|
/**
|
|
18
19
|
* The install command is used to `npm install` and `node ace configure` a new package
|
|
19
20
|
* in one go.
|
|
@@ -29,10 +30,10 @@ export default class Add extends BaseCommand {
|
|
|
29
30
|
*/
|
|
30
31
|
async #getPackageManager() {
|
|
31
32
|
const pkgManager = this.packageManager || (await detectPackageManager(this.app.makePath())) || 'npm';
|
|
32
|
-
if (
|
|
33
|
+
if (KNOWN_PACKAGE_MANAGERS.includes(pkgManager)) {
|
|
33
34
|
return pkgManager;
|
|
34
35
|
}
|
|
35
|
-
throw new Error('Invalid package manager. Must be one of npm, pnpm or yarn');
|
|
36
|
+
throw new Error('Invalid package manager. Must be one of npm, pnpm, bun or yarn');
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Configure the package by delegating the work to the `node ace configure` command
|
|
@@ -79,6 +79,10 @@ export default class Configure extends BaseCommand {
|
|
|
79
79
|
flags: this.parsed.flags,
|
|
80
80
|
entity: this.app.generators.createEntity('health'),
|
|
81
81
|
});
|
|
82
|
+
await codemods.makeUsingStub(stubsRoot, 'make/health/controller.stub', {
|
|
83
|
+
flags: this.parsed.flags,
|
|
84
|
+
entity: this.app.generators.createEntity('health_checks'),
|
|
85
|
+
});
|
|
82
86
|
}
|
|
83
87
|
/**
|
|
84
88
|
* Creates codemods as per configure command options
|
|
@@ -4,6 +4,6 @@ import { ApplicationService, ConfigProvider } from './types.js';
|
|
|
4
4
|
* them
|
|
5
5
|
*/
|
|
6
6
|
export declare const configProvider: {
|
|
7
|
-
create<T>(resolver: ConfigProvider<T>[
|
|
8
|
-
resolve<
|
|
7
|
+
create<T>(resolver: ConfigProvider<T>["resolver"]): ConfigProvider<T>;
|
|
8
|
+
resolve<T>(app: ApplicationService, provider: unknown): Promise<T | null>;
|
|
9
9
|
};
|
package/build/src/debug.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import type { Server as NodeHttpsServer } from 'node:https';
|
|
4
2
|
import { IncomingMessage, ServerResponse, Server as NodeHttpServer } from 'node:http';
|
|
5
3
|
import { Ignitor } from './main.js';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import type { TestUtils } from './main.js';
|
|
4
2
|
import type { Server as NodeHttpsServer } from 'node:https';
|
|
5
3
|
import { IncomingMessage, ServerResponse, Server as NodeHttpServer } from 'node:http';
|
|
@@ -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
|
+
}
|
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
to: app.startPath(entity.path, preloadFileName)
|
|
5
5
|
})
|
|
6
6
|
}}}
|
|
7
|
-
import {
|
|
8
|
-
HealthChecks,
|
|
9
|
-
DiskSpaceHealthCheck,
|
|
10
|
-
MemoryHeapHealthCheck,
|
|
11
|
-
} from '@adonisjs/core/health'
|
|
7
|
+
import { HealthChecks, DiskSpaceCheck, MemoryHeapCheck } from '@adonisjs/core/health'
|
|
12
8
|
|
|
13
9
|
export const healthChecks = new HealthChecks().register([
|
|
14
|
-
new
|
|
15
|
-
new
|
|
10
|
+
new DiskSpaceCheck(),
|
|
11
|
+
new MemoryHeapCheck(),
|
|
16
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.1",
|
|
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.6.
|
|
95
|
-
"@types/node": "^20.14.
|
|
94
|
+
"@swc/core": "^1.6.5",
|
|
95
|
+
"@types/node": "^20.14.7",
|
|
96
96
|
"@types/pretty-hrtime": "^1.0.3",
|
|
97
97
|
"@types/sinon": "^17.0.3",
|
|
98
98
|
"@types/supertest": "^6.0.2",
|
|
@@ -106,20 +106,20 @@
|
|
|
106
106
|
"del-cli": "^5.1.0",
|
|
107
107
|
"edge.js": "^6.0.2",
|
|
108
108
|
"eslint": "^8.57.0",
|
|
109
|
-
"execa": "^9.
|
|
109
|
+
"execa": "^9.3.0",
|
|
110
110
|
"get-port": "^7.1.0",
|
|
111
111
|
"github-label-sync": "^2.3.1",
|
|
112
112
|
"husky": "^9.0.11",
|
|
113
113
|
"prettier": "^3.3.2",
|
|
114
|
-
"release-it": "^17.
|
|
114
|
+
"release-it": "^17.4.0",
|
|
115
115
|
"sinon": "^18.0.0",
|
|
116
116
|
"supertest": "^7.0.0",
|
|
117
117
|
"test-console": "^2.0.0",
|
|
118
118
|
"ts-node": "^10.9.2",
|
|
119
|
-
"typescript": "^5.
|
|
119
|
+
"typescript": "^5.5.2"
|
|
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",
|
|
@@ -203,6 +203,9 @@
|
|
|
203
203
|
"tagAnnotation": "v${version}",
|
|
204
204
|
"tagName": "v${version}"
|
|
205
205
|
},
|
|
206
|
+
"hooks": {
|
|
207
|
+
"after:init": "npm test"
|
|
208
|
+
},
|
|
206
209
|
"github": {
|
|
207
210
|
"release": true,
|
|
208
211
|
"releaseName": "v${version}",
|