Skip to content

Commit

Permalink
fix(api): fix the json import
Browse files Browse the repository at this point in the history
  • Loading branch information
theotime2005 committed Feb 14, 2025
1 parent 55f2027 commit 257e22b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.18.2
22.13.0
2 changes: 1 addition & 1 deletion api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "AGPL-3.0",
"author": "GIP Pix",
"engines": {
"node": "^20.18.2"
"node": "^22.13.0"
},
"type": "module",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readdir } from 'node:fs/promises';
import { readdir, readFile } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';

Expand Down Expand Up @@ -30,8 +30,8 @@ async function importModules() {

for (const file of files) {
const fileURL = pathToFileURL(join(path, file.name));
const module = await import(fileURL, { assert: { type: 'json' } });
imports.modules.push(module.default);
const module = await readFile(fileURL, 'utf-8');
imports.modules.push(JSON.parse(module));
}

return imports;
Expand Down

0 comments on commit 257e22b

Please sign in to comment.