From 4122e0c8e950977ff6fa2366c4001ba9d3d980cf Mon Sep 17 00:00:00 2001 From: Chafik H'nini Date: Mon, 5 Aug 2024 10:54:12 +0200 Subject: [PATCH] chore: convert to esm --- package.json | 1 + spec/controllers/DashboardsController.ts | 11 +++++++---- spec/controllers/RunnablesController.ts | 8 ++++---- spec/data/dashboard.ts | 2 +- spec/data/index.ts | 6 +++--- spec/data/runnable.ts | 2 +- spec/model/dashboard.ts | 2 +- spec/model/index.ts | 4 ++-- spec/model/runnnable.ts | 2 +- spec/schema/index.ts | 4 ++-- spec/services/DashboardService.ts | 5 ++++- spec/services/RunnableService.ts | 2 +- spec/services/index.ts | 4 ++-- tsconfig.json | 6 +++--- 14 files changed, 33 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index d65b40e..0627594 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "rebootx-on-prem", "version": "0.3.0", + "type": "module", "scripts": { "lint": "eslint . --ext .js,.jsx,.ts,.tsx --cache --debug --fix && prettier --write '**/*.json'", "lint:ci": "eslint . --ext .js,.jsx,.ts,.tsx && prettier '**/*.json'", diff --git a/spec/controllers/DashboardsController.ts b/spec/controllers/DashboardsController.ts index 0bb3c34..8fd807e 100644 --- a/spec/controllers/DashboardsController.ts +++ b/spec/controllers/DashboardsController.ts @@ -12,10 +12,13 @@ import { Tags, } from 'tsoa'; -import { DASHBOARDS, ERR_401, ERR_403 } from '../data'; -import { ListDashboardsQueryParams, ListDashboardsRes } from '../model'; -import { ErrorRes } from '../schema'; -import { DashboardService } from '../services'; +import { DASHBOARDS, ERR_401, ERR_403 } from '../data/index.js'; +import { + ListDashboardsQueryParams, + ListDashboardsRes, +} from '../model/index.js'; +import { ErrorRes } from '../schema/index.js'; +import { DashboardService } from '../services/index.js'; @Route('dashboards') @Produces('application/json') diff --git a/spec/controllers/RunnablesController.ts b/spec/controllers/RunnablesController.ts index 1e0d16d..a99c78a 100644 --- a/spec/controllers/RunnablesController.ts +++ b/spec/controllers/RunnablesController.ts @@ -23,15 +23,15 @@ import { RUNNABLE_OP_ASYNC_RES, RUNNABLE_OP_SYNC_DESC, RUNNABLE_OP_SYNC_RES, -} from '../data'; +} from '../data/index.js'; import { ListRunnablesQueryParams, ListRunnablesRes, Runnable, RunnableOperationRes, -} from '../model'; -import { ErrorRes } from '../schema'; -import { RunnableService } from '../services'; +} from '../model/index.js'; +import { ErrorRes } from '../schema/index.js'; +import { RunnableService } from '../services/index.js'; @Route('runnables') @Produces('application/json') diff --git a/spec/data/dashboard.ts b/spec/data/dashboard.ts index b20177e..c3e87ca 100644 --- a/spec/data/dashboard.ts +++ b/spec/data/dashboard.ts @@ -1,4 +1,4 @@ -import { ListDashboardsRes } from '../model'; +import { ListDashboardsRes } from '../model/index.js'; export const DASHBOARDS: ListDashboardsRes = { items: [ diff --git a/spec/data/index.ts b/spec/data/index.ts index 0b25f69..685c5dc 100644 --- a/spec/data/index.ts +++ b/spec/data/index.ts @@ -1,3 +1,3 @@ -export * from './dashboard'; -export * from './error'; -export * from './runnable'; +export * from './dashboard.js'; +export * from './error.js'; +export * from './runnable.js'; diff --git a/spec/data/runnable.ts b/spec/data/runnable.ts index de89365..ff3b3b0 100644 --- a/spec/data/runnable.ts +++ b/spec/data/runnable.ts @@ -2,7 +2,7 @@ import { ListRunnablesRes, RunnableOperationRes, RunnableStatus, -} from '../model'; +} from '../model/index.js'; export const RUNNABLE_OP_ASYNC_DESC: string = 'The operation has been executed asynchronously and will eventually succeed'; diff --git a/spec/model/dashboard.ts b/spec/model/dashboard.ts index b5b7f61..120180d 100644 --- a/spec/model/dashboard.ts +++ b/spec/model/dashboard.ts @@ -1,4 +1,4 @@ -import { ListQueryParams, ListRes } from '../schema'; +import { ListQueryParams, ListRes } from '../schema/index.js'; /** * A collection of metrics diff --git a/spec/model/index.ts b/spec/model/index.ts index 87d0886..1736009 100644 --- a/spec/model/index.ts +++ b/spec/model/index.ts @@ -1,2 +1,2 @@ -export * from './dashboard'; -export * from './runnnable'; +export * from './dashboard.js'; +export * from './runnnable.js'; diff --git a/spec/model/runnnable.ts b/spec/model/runnnable.ts index 0239dd4..b800160 100644 --- a/spec/model/runnnable.ts +++ b/spec/model/runnnable.ts @@ -1,4 +1,4 @@ -import { ListQueryParams, ListRes } from '../schema'; +import { ListQueryParams, ListRes } from '../schema/index.js'; export interface ListRunnablesQueryParams extends ListQueryParams { /** diff --git a/spec/schema/index.ts b/spec/schema/index.ts index bc0f6ec..0a6e9f3 100644 --- a/spec/schema/index.ts +++ b/spec/schema/index.ts @@ -1,2 +1,2 @@ -export * from './error'; -export * from './list'; +export * from './error.js'; +export * from './list.js'; diff --git a/spec/services/DashboardService.ts b/spec/services/DashboardService.ts index 7b47ba5..de97266 100644 --- a/spec/services/DashboardService.ts +++ b/spec/services/DashboardService.ts @@ -1,4 +1,7 @@ -import { ListDashboardsQueryParams, ListDashboardsRes } from '../model'; +import { + ListDashboardsQueryParams, + ListDashboardsRes, +} from '../model/index.js'; export interface DashboardService { list(params: ListDashboardsQueryParams): Promise; diff --git a/spec/services/RunnableService.ts b/spec/services/RunnableService.ts index 284190f..e318059 100644 --- a/spec/services/RunnableService.ts +++ b/spec/services/RunnableService.ts @@ -3,7 +3,7 @@ import { ListRunnablesRes, Runnable, RunnableOperationRes, -} from '../model'; +} from '../model/index.js'; export interface RunnableService { list(params: ListRunnablesQueryParams): Promise; diff --git a/spec/services/index.ts b/spec/services/index.ts index ce8cde7..34042c0 100644 --- a/spec/services/index.ts +++ b/spec/services/index.ts @@ -1,2 +1,2 @@ -export * from './DashboardService'; -export * from './RunnableService'; +export * from './DashboardService.js'; +export * from './RunnableService.js'; diff --git a/tsconfig.json b/tsconfig.json index ffa7ba0..4d6d13d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,12 +5,12 @@ "declaration": true, "experimentalDecorators": true, "lib": ["esnext"], - "module": "esnext", - "moduleResolution": "node", + "module": "NodeNext", + "moduleResolution": "NodeNext", "noEmit": true, "skipLibCheck": true, "sourceMap": true, - "target": "esnext", + "target": "ESNext", /* Type checking */ "strict": true,