Skip to content

Changes #355

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Changes #355

wants to merge 2 commits into from

Conversation

VictorBravo9er
Copy link

@VictorBravo9er VictorBravo9er commented Jul 10, 2025

Summary

  • Update Dockerfile to run pre-built JavaScript output (dist/src/index.js) instead of TypeScript sources.
  • Minor performance improvement in production as Bun now runs compiled JS rather than transpiling TypeScript on the fly.

Details

  • Updated the build process so that TypeScript code is compiled to JavaScript during the build stage.
  • Changed the Dockerfile ENTRYPOINT to reference the built JS output (dist/src/index.js).
  • Added logic (and/or instructions) to ensure the data/ directory is present before SQLite attempts to create/use the database file.
  • The production Docker image is now slimmer, as it only contains what’s needed to run the app(not really...).

Motivation

  • Running compiled JS improves startup reliability and (even slightly) cold start performance and potential runtime errors while pursing ts.
  • Follows best practices for production Docker images by avoiding unnecessary files and dev dependencies(it was perfectly fine though).

Notes

  • No changes were made to the application’s runtime logic outside of build and deployment configuration.
  • No updates CHANGELOG.md, as there is no release.

Summary by Sourcery

Enable TypeScript compilation and update Docker setup to run prebuilt JavaScript output and ensure the runtime directory is prepared

Bug Fixes:

  • Create the data directory in the Docker image to avoid SQLite startup errors

Enhancements:

  • Run compiled JavaScript in production to improve startup performance
  • Slim down the production image by copying only required assets from build stages

Build:

  • Enable TS emit to dist and add build:js (tsc) step in package.json
  • Update build script to run Tailwind CSS and compile TypeScript

Deployment:

  • Copy compiled dist output into the Docker image and adjust ENTRYPOINT

- Ensure /data directory exists for SQLite database creation
- Remove unnecessary config files from final image
Copy link
Contributor

sourcery-ai bot commented Jul 10, 2025

Reviewer's Guide

Streamlines the build and deployment by compiling TypeScript to JavaScript and updating Docker to run the compiled output, while ensuring a clean production image with required runtime directories and extended NPM scripts.

File-Level Changes

Change Details Files
Emit compiled JavaScript from TypeScript sources to a distribution directory with module interoperability
  • Disabled noEmit and set outDir to 'dist'
  • Commented out allowImportingTsExtensions
  • Added resolveJsonModule and esModuleInterop
  • Included 'src' and 'package.json' in compilation scope
tsconfig.json
Configure Docker image to use pre-built JS and prepare runtime environment
  • Copied /app/dist instead of source files
  • Created 'data' directory before SQLite initialization
  • Replaced ENTRYPOINT to run built JS file
Dockerfile
Extend build process to compile TypeScript prior to CSS generation
  • Added 'build:js' script invoking 'tsc'
  • Updated 'build' script to run JS compilation then Tailwind
package.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @VictorBravo9er - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `Dockerfile:81` </location>
<code_context>
+COPY --from=prerelease /app/dist /app/dist
+
+# COPY . .
+RUN mkdir data

 EXPOSE 3000/tcp
</code_context>

<issue_to_address>
Creating a data directory without specifying permissions or ownership may lead to permission issues.

Explicitly set permissions and ownership for the data directory to prevent runtime errors, particularly in containerized deployments.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
RUN mkdir data
=======
RUN mkdir data && chown node:node data && chmod 755 data
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@C4illin
Copy link
Owner

C4illin commented Jul 10, 2025

Didn't even think of this, looks good to me!

@VictorBravo9er
Copy link
Author

This was my first  into open source contributions, and I found the experience incredibly rewarding. I've learned a great deal throughout the process, and I truly appreciate the opportunity you've provided.

@C4illin
Copy link
Owner

C4illin commented Jul 14, 2025

Makes me happy to hear that!

If you want another challenge you could attempt to rename the commits following "conventional commits", otherwise all is good as it is!

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