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: delete generated script file #52

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

ismailshak
Copy link
Contributor

@ismailshak ismailshak commented Oct 10, 2023

Hey all,

This PR deletes the generated file created to run the node script. The file has been giving us problems in CI (with prettier checks for example), and I think it would be best to clean up after the Nx script is finished. I also parameterized it, figured gets us closer if there's a feature request in the future (happy to undo that though)

In theory this is a patch-worthy change, but I'm curious if there's something I'm missing that might make this either an undesirable change or a breaking change.

@meeroslav
Copy link
Collaborator

Thank you for the PR. I would have to investigate if this doesn't break the orb - for example if you need to run this command multiple times.

The parametrization doesn't make sense since we will never change the file name - it's generated in the build time.

On a side note, how come your prettier on CI is parsing external orb's code? Isn't it simpler to just add exclusion rule to the prettier ignore file?

@ismailshak
Copy link
Contributor Author

ismailshak commented Nov 20, 2023

Thanks for taking a look at this @meeroslav

Thank you for the PR. I would have to investigate if this doesn't break the orb - for example if you need to run this command multiple times.

Yea makes sense, appreciate it.

Re: multiple runs of this command. I think my changes shouldn't interfere with that since we append to the file >> index.js. I assume that if someone tried to run this a second time (while this file already exists) node would probably error with invalid syntax or something, right?

On a side note, how come your prettier on CI is parsing external orb's code? Isn't it simpler to just add exclusion rule to the prettier ignore file?

That's what we started with, we added index.js then ./index.js to the root prettierignore. What ended up happening was those patterns matched against all index.js files that already existed and manual execution of prettier, or precommit hooks, stopped formatting anything named index.js regardless of nesting.

Similar story for gitignore-ing that file, we use changesets in CI to push back to main

@ismailshak
Copy link
Contributor Author

ismailshak commented Nov 27, 2023

After digging through docs a bit today, I came across the correct way to target the root index.js in a prettier/gitignore without it pattern matching the rest of the tree. First example in the gitignore docs /index.js

While this is a solution, I still think the orb should clean up after itself for better DX.

We could also skip the whole file and pass the stringified script directly to node using the eval flag

@ismailshak
Copy link
Contributor Author

@meeroslav bumping :)

@meeroslav
Copy link
Collaborator

Thank you for the Fix and sorry for the delay

@meeroslav meeroslav merged commit e85042a into nrwl:main Sep 4, 2024
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