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

Prevent non-terminating build #5485

Merged
merged 3 commits into from
Jun 28, 2022
Merged

Conversation

Zeta611
Copy link
Contributor

@Zeta611 Zeta611 commented Jun 28, 2022

using generatedFileExtension in gentypeconfig

This can fix non-terminating build due to custom generated file extensions (#5303).

using generatedFileExtension in gentypeconfig
rescript Outdated
@@ -28,6 +28,8 @@ var lockFileName = path.join(cwd, ".bsb.lock");
process.env.BSB_PROJECT_ROOT = cwd;
// console.log('BSB_PROJECT_ROOT:', process.env.BSB_PROJECT_ROOT)

var generatedFileExtension = require(path.join(cwd, "bsconfig.json")).gentypeconfig.generatedFileExtension;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if gentypeconfig does not exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is undefined, and fileName.endsWith(undefined) evaluates to false. I can add a guard and provide a default value, e.g., .gen.tsx, if this seems too dangerous, though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's actually going to crash if gentypeconfig is not specified in bsconfig.json.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is my bad. I'll fix it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you also rename it? Should indicate it's for gentype.

Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

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

Did you manage to reproduce the issue, and verify that it does not happen anymore after this?

@Zeta611
Copy link
Contributor Author

Zeta611 commented Jun 28, 2022

@cristianoc Yes, I did reproduce and verified that it did fix the error. I personally suffered from this issue and found the issue mentioned above from searching. I'm currently not in front of the computer, and I'll resolve the issues mentioned above when I get back.

I'm sorry for the inconvenience!

@Zeta611 Zeta611 marked this pull request as draft June 28, 2022 11:27
@cristianoc
Copy link
Collaborator

Thanks a lot for doing the fix!

@cristianoc cristianoc marked this pull request as ready for review June 28, 2022 15:32
Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

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

Looking great!
Ready to merge? Is it tested?

@Zeta611
Copy link
Contributor Author

Zeta611 commented Jun 28, 2022

Yes, it does work for bsconfig.json with or without gentypeconfig, and with or without generatedFileExtension.

@cristianoc cristianoc merged commit 18dade7 into rescript-lang:master Jun 28, 2022
mununki pushed a commit to mununki/rescript-compiler that referenced this pull request Jul 15, 2022
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