Skip to content

Commit

Permalink
support node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
nichochar committed Jul 31, 2024
1 parent eb5250f commit f5fdff8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/api/session.mts
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,10 @@ async function load() {
const loadedSessions = srcbookDirs
.filter((entry) => entry.isDirectory())
.map(async (entry) => {
// .path -> .parentPath from node21 onwards.
const parentPath = entry.parentPath || entry.path;
try {
const session = await createSession(Path.join(entry.parentPath, entry.name));
const session = await createSession(Path.join(parentPath, entry.name));
sessions[session.id] = session;
return session;
} catch (e) {
Expand Down
6 changes: 4 additions & 2 deletions packages/api/utils.mts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ export async function disk(dirname: string, ext: string) {
return entry.isDirectory() || entry.name.endsWith(ext);
})
.map((entry) => {
// .path -> .parentPath from node21 onwards.
const parentPath = entry.parentPath || entry.path;
return {
path: Path.join(entry.parentPath, entry.name),
dirname: entry.parentPath,
path: Path.join(parentPath, entry.name),
dirname: entry.path,
basename: entry.name,
isDirectory: entry.isDirectory(),
};
Expand Down

0 comments on commit f5fdff8

Please sign in to comment.