Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support node 20 #162

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you upgrade and are having trouble launching the application, you can `rm -rf

## Requirements

Srcbook requires node v22+. We highly recommend using [nvm](https://github.com/nvm-sh/nvm) to manage local node versions.
Srcbook requires node v20+. We highly recommend using [nvm](https://github.com/nvm-sh/nvm) to manage local node versions.

## Install

Expand Down
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
4 changes: 4 additions & 0 deletions srcbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ npm uninstall -g srcbook
# Clear up srcbook files on disk
rm -rf ~/.srcbook/
```

## Requirements

Srcbook requires node v20+. We highly recommend using [nvm](https://github.com/nvm-sh/nvm) to manage local node versions.
Loading