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

Migrate to react router 7, typescript, and misc. refactoring #27

Open
wants to merge 74 commits into
base: master
Choose a base branch
from

Conversation

chrzrdx
Copy link
Contributor

@chrzrdx chrzrdx commented Oct 28, 2024

Major changes:

  • Migrate to React Router 7
  • Migrate to React 19 & Vite 6
  • Migrate to Typescript
  • Switch out custom express server for the react-router server
  • Replace flawed implementation of etags with an in-memory cache for now

Minor:

  • Add a floating table of contents to the news articles
  • Refactor server code, and some components
  • Upgrade dependencies

Pre-release steps (in dev and in prod):

  • Update node to 22+
  • Update bun to 1.1.36+ (bun upgrade)

Known issues:

  • Sometimes, the types for the Route module can get out of sync when developing. Run rm -rf .react-router && bun run dev to generate types again.

app/.server/content.ts Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
.gitignore Show resolved Hide resolved
app/entry.server.tsx Outdated Show resolved Hide resolved
@chrzrdx
Copy link
Contributor Author

chrzrdx commented Dec 4, 2024

@sorokya did you get a chance to look at this yet?

Copy link
Owner

@sorokya sorokya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. I still need to test it locally but changes generally look good. I think there's a few comments from your self review that need action. I left a few comments and questions as well.

I'll test this locally some time in the next week 😊

README.md Outdated Show resolved Hide resolved
import { glob } from 'glob';
import { parseMarkdown } from './utils/parse-markdown';

type Content = Awaited<ReturnType<typeof parseMarkdown>>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Awaited a built in typescript type to describe an "awaited" value? Neat. Not sure why it's needed though really

Copy link
Contributor Author

@chrzrdx chrzrdx Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we lose the Awaited, the type becomes wrapped in Promise<>, feels less "clean".

}

const fileContents = fs.readFileSync(DATA_FILE_PATH, { encoding: 'utf8' });
const json = JSON.parse(fileContents);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't fileContents be json and this variable be named something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave it as it is. fs.readFileSync outputs a string, which we parse as JSON in the second step.

@chrzrdx chrzrdx requested a review from sorokya December 31, 2024 21:54
@chrzrdx
Copy link
Contributor Author

chrzrdx commented Jan 7, 2025

@sorokya Anything else you'd like to see here before we get this merged in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants