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

fix: removes warning about --experimental flags #1

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

Conversation

lizard-boy
Copy link

Tested locally with node 18 and 20

Tested in platform with a starter site as well.

PR that added this code initially

asanehisa and others added 12 commits July 24, 2024 17:27
…t#531)

Adds the templatesJson to the header so that we can access it in the
Visual Editor.

Tested locally and verified that the templatesJson was present in a
script tag in the header.

Also verified that `npm run prod` still works as expected and the
templatesJson is not present.
…#533)

dependent on yext#532 

view changes made in last commit for actual PR. The rest of commits are
from PR#532
This provides a post request option for `serverRenderRoute` which
overrides the c_visualLayouts field of the pulled document with the
overrides that are passed in from the request.

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
@lizard-boy
Copy link
Author

@greptileai

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces significant changes to the @yext/pages package, focusing on template generation, hydration process improvements, and server-side rendering enhancements. Here are the key points:

  • Removed custom loader and experimental flags from Node.js process spawn, simplifying execution and eliminating warnings.
  • Added new template generation functionality, including support for Visual Editor, dynamic, and static templates.
  • Enhanced hydration process to include template configurations in the client-side code.
  • Modified server-side rendering to allow document overrides via POST requests.
  • Introduced new parsers for Puck configuration files and improved source file parsing capabilities.
  • Updated the scaffold command to include a new 'template' subcommand for easier template creation.

22 file(s) reviewed, 16 comment(s)
Edit PR Review Bot Settings

Comment on lines +20 to +21
* [email protected] (2953ca7a)
* [email protected] (dfb04527)
Copy link

Choose a reason for hiding this comment

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

style: Duplicate version entry. Consider removing one

Comment on lines +27 to +29
if (fs.existsSync("test.tsx")) {
fs.unlinkSync("test.tsx");
}
Copy link

Choose a reason for hiding this comment

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

style: Use fs.promises.unlink for consistent async operations

Comment on lines +13 to +15
if (!fs.existsSync(filepath)) {
throw new Error(`Filepath "${filepath}" is invalid.`);
}
Copy link

Choose a reason for hiding this comment

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

style: Consider using a more specific error message that includes the expected file path format.

Comment on lines +20 to +21
const formattedTemplateName =
fileName.charAt(0).toUpperCase() + fileName.slice(1);
Copy link

Choose a reason for hiding this comment

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

style: Consider using fileName.charAt(0).toUpperCase() + fileName.slice(1).toLowerCase() to ensure consistent formatting.

Comment on lines +285 to +291
getVariableStatement(variableName: string) {
return this.sourceFile.getVariableStatementOrThrow(variableName);
}

getVariableDeclaration(variableName: string) {
return this.sourceFile.getVariableDeclarationOrThrow(variableName);
}
Copy link

Choose a reason for hiding this comment

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

style: These methods throw errors if the variable is not found. Consider adding error handling or returning undefined instead

Comment on lines +8 to +9
import fs from "node:fs";
import { Project } from "ts-morph";
Copy link

Choose a reason for hiding this comment

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

style: Consider using fs/promises for asynchronous file operations

Comment on lines +31 to +33
if (fs.existsSync("test.tsx")) {
fs.unlinkSync("test.tsx");
}
Copy link

Choose a reason for hiding this comment

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

style: Move file cleanup to a separate function for reusability

);
const filePath = "test.tsx";

try {
Copy link

Choose a reason for hiding this comment

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

style: Duplicate code structure across tests. Consider extracting to a helper function

} catch (error) {
logErrorAndExit(error);
}
process.exit(0);
Copy link

Choose a reason for hiding this comment

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

style: Consider removing explicit process.exit(0). Node.js will exit automatically when the event loop is empty.

{
"$id": "closed-location-redirects",
"fields": [
"slug"
Copy link

Choose a reason for hiding this comment

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

style: Consider including more fields for closed locations if needed for redirect logic

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.

6 participants