jsonresume / jsonresume.org

The mono repo that builds the homepage, utils, ui components, registry and anything else
https://jsonresume.org
66 stars 17 forks source link

fix: full theme #47

Closed thomasdavis closed 8 months ago

thomasdavis commented 8 months ago

So we can actually render handle bar templates on the server.

readFileSync works, but cannot for the life of me figure out how to get the relative pathing working.

Also should of moved the themes into a themes/packages folder but it was giving me grief.

Going to merge this manually, but will make improvements to it.

Also need a nice way to give credit to the original author.

Edit: actually the readFileSync doesn't work when deployed to vercel

https://github.com/vercel/next.js/discussions/32236

When calling path.resolve, vercel should bundle the files but it doesn't.

Something to do with turbo i think

Summary by CodeRabbit

changeset-bot[bot] commented 8 months ago

⚠️ No Changeset found

Latest commit: 5b76460c160adcd642511b04a38100a036065d4c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

coderabbitai[bot] commented 8 months ago

[!WARNING]

Rate Limit Exceeded

@thomasdavis has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 8 minutes and 21 seconds before requesting another review.

How to resolve this issue? After the wait time has elapsed, a review can be triggered using the @coderabbitai review command. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.
How do rate limits work? CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.
Commits Files that changed from the base of the PR and between 0d88e398822573e4d7b6d8e02ec09305e1d485b7 and 5b76460c160adcd642511b04a38100a036065d4c.

Walkthrough

The updates introduce a comprehensive jsonresume-theme-full package, which includes a new full theme for rendering resumes. This theme is integrated into the registry app and utilizes Handlebars for templating. It features a variety of partials for different resume sections, extensive CSS for styling, and additional Handlebars helpers to support the rendering process. The changes are primarily additive, providing new functionalities for resume presentation.

Changes

File(s) Summary
apps/registry/pages/api/formatters/template.js Added 'full' theme using 'jsonresume-theme-full' package.
packages/jsonresume-theme-full/... Added new JSON Resume theme 'Full' with instructions, features, and usage details.
packages/jsonresume-theme-full/partials/... Added various .hbs partials for resume sections like work, education, awards, etc., with conditional rendering logic.
packages/jsonresume-theme-full/public/..., packages/jsonresume-theme-full/dev/... Added HTML documents with structured resume layout and inline CSS styles.
packages/jsonresume-theme-full/index.js Introduced module for rendering resumes with render function and Handlebars helpers.
packages/jsonresume-theme-full/style.css, packages/jsonresume-theme-full/dev/style.css Modified CSS custom properties, media queries, and various selectors for layout adjustments.
.gitignore, .npmignore, .nvmrc Updated ignore files and specified Node version.
packages/jsonresume-theme-full/resume.hbs Added HTML template for rendering a resume with various sections.
packages/jsonresume-theme-full/style.js Updated CSS file with changes to variables, media queries, and element styles.

Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - If you reply to a *review comment* from CodeRabbit, the bot will automatically respond. - To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment - Note: Review comments are made on code diffs or files, not on the PR overview. - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Note: For conversation with the bot, please use the review comments on code diffs or files. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`
vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jsonresume-org-homepage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 2, 2023 4:47am
jsonresume-org-registry ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 2, 2023 4:47am
levino commented 8 months ago

I do not think that this is turbo related. These functions will and should be packaged with webpack into one single .js file, probably compressed and minified etc. Hopefully sourcemaps are also present for debugging purposes. Using "readFile" in a serverless environment is simply "dirty" imo. Even if it would work, I would think of it as a hack, not using a real feature.

I have toyed with this and I think, there are certain problems to the current setup: We use nextjs to transpile the individual theme packages. However in order to publish them to npm, we need to transpile / bundle them with webpack / esbuild / rollup, you name it. These bundle steps will need certain configurations and potentially loaders like handlebars-loader which the registry package should not be aware of.

So in order to have things clean, I suggest to not have nextjs transpile the individual packages, but have nextjs use the output of the individual transpilation jobs. One would have to run the build --watch script for all of these packages then, before one can dev for the registry. This might eventually be a lot of jobs. There is also certain support from some of the packagers, at least there is from typescript, but setting this up is a little tricky and I could not find a proper example for a nextjs or typescript monorepo with turbo. Will keep an eye out. Until then I vote for running the build --watch task on all the templates and during build of the registry, we first need to build all the packages, which is quite easy with turbo and "dep": "^build" (or something close to that).