aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2024-02-10 18:37:40 -0700
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2024-02-13 06:59:44 +0530
commite1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch)
tree2dccff36a441916d7014037cef3f7ce84a790cad /bin
parentrefactor: project maintenance (diff)
downloadferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.gz
ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.zst
ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.zip
updates
Diffstat (limited to 'bin')
-rw-r--r--bin/console.ts30
-rw-r--r--bin/server.ts30
-rw-r--r--bin/test.ts42
3 files changed, 51 insertions, 51 deletions
diff --git a/bin/console.ts b/bin/console.ts
index 4b102ee..c92f633 100644
--- a/bin/console.ts
+++ b/bin/console.ts
@@ -11,14 +11,14 @@
11| 11|
12*/ 12*/
13 13
14import 'reflect-metadata' 14import 'reflect-metadata';
15import { Ignitor, prettyPrintError } from '@adonisjs/core' 15import { Ignitor, prettyPrintError } from '@adonisjs/core';
16 16
17/** 17/**
18 * URL to the application root. AdonisJS need it to resolve 18 * URL to the application root. AdonisJS need it to resolve
19 * paths to file and directories for scaffolding commands 19 * paths to file and directories for scaffolding commands
20 */ 20 */
21const APP_ROOT = new URL('../', import.meta.url) 21const APP_ROOT = new URL('../', import.meta.url);
22 22
23/** 23/**
24 * The importer is used to import files in context of the 24 * The importer is used to import files in context of the
@@ -26,22 +26,22 @@ const APP_ROOT = new URL('../', import.meta.url)
26 */ 26 */
27const IMPORTER = (filePath: string) => { 27const IMPORTER = (filePath: string) => {
28 if (filePath.startsWith('./') || filePath.startsWith('../')) { 28 if (filePath.startsWith('./') || filePath.startsWith('../')) {
29 return import(new URL(filePath, APP_ROOT).href) 29 return import(new URL(filePath, APP_ROOT).href);
30 } 30 }
31 return import(filePath) 31 return import(filePath);
32} 32};
33 33
34new Ignitor(APP_ROOT, { importer: IMPORTER }) 34new Ignitor(APP_ROOT, { importer: IMPORTER })
35 .tap((app) => { 35 .tap(app => {
36 app.booting(async () => { 36 app.booting(async () => {
37 await import('#start/env') 37 await import('#start/env');
38 }) 38 });
39 app.listen('SIGTERM', () => app.terminate()) 39 app.listen('SIGTERM', () => app.terminate());
40 app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate()) 40 app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate());
41 }) 41 })
42 .ace() 42 .ace()
43 .handle(process.argv.splice(2)) 43 .handle(process.argv.splice(2))
44 .catch((error) => { 44 .catch(error => {
45 process.exitCode = 1 45 process.exitCode = 1;
46 prettyPrintError(error) 46 prettyPrintError(error);
47 }) 47 });
diff --git a/bin/server.ts b/bin/server.ts
index fe0fefb..40789e3 100644
--- a/bin/server.ts
+++ b/bin/server.ts
@@ -9,14 +9,14 @@
9| 9|
10*/ 10*/
11 11
12import 'reflect-metadata' 12import 'reflect-metadata';
13import { Ignitor, prettyPrintError } from '@adonisjs/core' 13import { Ignitor, prettyPrintError } from '@adonisjs/core';
14 14
15/** 15/**
16 * URL to the application root. AdonisJS need it to resolve 16 * URL to the application root. AdonisJS need it to resolve
17 * paths to file and directories for scaffolding commands 17 * paths to file and directories for scaffolding commands
18 */ 18 */
19const APP_ROOT = new URL('../', import.meta.url) 19const APP_ROOT = new URL('../', import.meta.url);
20 20
21/** 21/**
22 * The importer is used to import files in context of the 22 * The importer is used to import files in context of the
@@ -24,22 +24,22 @@ const APP_ROOT = new URL('../', import.meta.url)
24 */ 24 */
25const IMPORTER = (filePath: string) => { 25const IMPORTER = (filePath: string) => {
26 if (filePath.startsWith('./') || filePath.startsWith('../')) { 26 if (filePath.startsWith('./') || filePath.startsWith('../')) {
27 return import(new URL(filePath, APP_ROOT).href) 27 return import(new URL(filePath, APP_ROOT).href);
28 } 28 }
29 return import(filePath) 29 return import(filePath);
30} 30};
31 31
32new Ignitor(APP_ROOT, { importer: IMPORTER }) 32new Ignitor(APP_ROOT, { importer: IMPORTER })
33 .tap((app) => { 33 .tap(app => {
34 app.booting(async () => { 34 app.booting(async () => {
35 await import('#start/env') 35 await import('#start/env');
36 }) 36 });
37 app.listen('SIGTERM', () => app.terminate()) 37 app.listen('SIGTERM', () => app.terminate());
38 app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate()) 38 app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate());
39 }) 39 })
40 .httpServer() 40 .httpServer()
41 .start() 41 .start()
42 .catch((error) => { 42 .catch(error => {
43 process.exitCode = 1 43 process.exitCode = 1;
44 prettyPrintError(error) 44 prettyPrintError(error);
45 }) 45 });
diff --git a/bin/test.ts b/bin/test.ts
index fe7e950..abdfb72 100644
--- a/bin/test.ts
+++ b/bin/test.ts
@@ -10,17 +10,17 @@
10| 10|
11*/ 11*/
12 12
13process.env.NODE_ENV = 'test' 13process.env.NODE_ENV = 'test';
14 14
15import 'reflect-metadata' 15import 'reflect-metadata';
16import { Ignitor, prettyPrintError } from '@adonisjs/core' 16import { Ignitor, prettyPrintError } from '@adonisjs/core';
17import { configure, processCLIArgs, run } from '@japa/runner' 17import { configure, processCLIArgs, run } from '@japa/runner';
18 18
19/** 19/**
20 * URL to the application root. AdonisJS need it to resolve 20 * URL to the application root. AdonisJS need it to resolve
21 * paths to file and directories for scaffolding commands 21 * paths to file and directories for scaffolding commands
22 */ 22 */
23const APP_ROOT = new URL('../', import.meta.url) 23const APP_ROOT = new URL('../', import.meta.url);
24 24
25/** 25/**
26 * The importer is used to import files in context of the 26 * The importer is used to import files in context of the
@@ -28,33 +28,33 @@ const APP_ROOT = new URL('../', import.meta.url)
28 */ 28 */
29const IMPORTER = (filePath: string) => { 29const IMPORTER = (filePath: string) => {
30 if (filePath.startsWith('./') || filePath.startsWith('../')) { 30 if (filePath.startsWith('./') || filePath.startsWith('../')) {
31 return import(new URL(filePath, APP_ROOT).href) 31 return import(new URL(filePath, APP_ROOT).href);
32 } 32 }
33 return import(filePath) 33 return import(filePath);
34} 34};
35 35
36new Ignitor(APP_ROOT, { importer: IMPORTER }) 36new Ignitor(APP_ROOT, { importer: IMPORTER })
37 .tap((app) => { 37 .tap(app => {
38 app.booting(async () => { 38 app.booting(async () => {
39 await import('#start/env') 39 await import('#start/env');
40 }) 40 });
41 app.listen('SIGTERM', () => app.terminate()) 41 app.listen('SIGTERM', () => app.terminate());
42 app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate()) 42 app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate());
43 }) 43 })
44 .testRunner() 44 .testRunner()
45 .configure(async (app) => { 45 .configure(async app => {
46 const { runnerHooks, ...config } = await import('../tests/bootstrap.js') 46 const { runnerHooks, ...config } = await import('../tests/bootstrap.js');
47 47
48 processCLIArgs(process.argv.splice(2)) 48 processCLIArgs(process.argv.splice(2));
49 configure({ 49 configure({
50 ...app.rcFile.tests, 50 ...app.rcFile.tests,
51 ...config, 51 ...config,
52 setup: runnerHooks.setup, 52 setup: runnerHooks.setup,
53 teardown: [...runnerHooks.teardown, () => app.terminate()], 53 teardown: [...runnerHooks.teardown, () => app.terminate()],
54 }) 54 });
55 }) 55 })
56 .run(() => run()) 56 .run(() => run())
57 .catch((error) => { 57 .catch(error => {
58 process.exitCode = 1 58 process.exitCode = 1;
59 prettyPrintError(error) 59 prettyPrintError(error);
60 }) 60 });