diff --git a/commitlint.config.js b/commitlint.config.cjs similarity index 100% rename from commitlint.config.js rename to commitlint.config.cjs diff --git a/package.json b/package.json index ca27ed65..4bc2dee2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@graasp/translations", "version": "1.23.0", + "type": "module", "engines": { "node": ">=20.0.0" }, @@ -23,9 +24,6 @@ "Julien Torrent", "Jérémy La Scala" ], - "dependencies": { - "i18next": "23.8.2" - }, "scripts": { "prepack": "yarn build", "prepare": "yarn build && yarn hooks:install", @@ -42,6 +40,9 @@ "post-commit": "git status", "build": "tsc" }, + "peerDependencies": { + "i18next": "^23.8.1" + }, "devDependencies": { "@commitlint/cli": "18.6.1", "@commitlint/config-conventional": "18.6.2", @@ -53,6 +54,7 @@ "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.29.1", "husky": "9.0.11", + "i18next": "23.8.2", "jest": "29.7.0", "prettier": "3.2.5", "ts-jest": "29.1.2", diff --git a/src/constants/index.ts b/src/constants/index.ts deleted file mode 100644 index 349c03de..00000000 --- a/src/constants/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './association'; -export * from './categories'; -export * from './common'; -export * from './chatbox'; -export * from './messages'; diff --git a/src/i18n.ts b/src/i18n.ts index e2e4c43a..1e447b47 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -1,6 +1,6 @@ import i18n from 'i18next'; -import { ar, de, en, fr, it, namespaces } from './langs'; +import { ar, de, en, fr, it, namespaces } from './langs/index.js'; export const DEFAULT_LANG = 'en'; diff --git a/src/index.ts b/src/index.ts index f233c1bc..01294e03 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,8 @@ -export * from './constants'; -export { namespaces } from './langs'; -export { default, langs, DEFAULT_LANG } from './i18n'; +export { namespaces } from './langs/index.js'; +export { default, langs, DEFAULT_LANG } from './i18n.js'; + +export * from './constants/association.js'; +export * from './constants/categories.js'; +export * from './constants/common.js'; +export * from './constants/chatbox.js'; +export * from './constants/messages.js'; diff --git a/tsconfig.json b/tsconfig.json index f54b33af..b70f7180 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,15 @@ { "compilerOptions": { - "target": "es6", - "module": "commonjs", + "target": "es2015", + "module": "NodeNext", "strict": true, "outDir": "dist", "esModuleInterop": true, "skipLibCheck": true, "declaration": true, - "resolveJsonModule": true + "moduleResolution": "NodeNext", + "resolveJsonModule": true, }, "include": ["src/**/*"], - "exclude": ["test", "src/**/*.test.ts"] + "exclude": ["test", "src/**/*.test.ts"], } diff --git a/yarn.lock b/yarn.lock index 2f79f648..ced12fe4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -698,6 +698,8 @@ __metadata: ts-jest: "npm:29.1.2" ts-node: "npm:10.9.2" typescript: "npm:5.3.3" + peerDependencies: + i18next: ^23.8.1 languageName: unknown linkType: soft