Skip to content

Conversation

@G-Rath
Copy link
Member

@G-Rath G-Rath commented Jan 8, 2021

This is branched off #252 to avoid me having to do an ugly rebase - ideally that should be merged first to make this review-able


What started as converting the scripts to TS ballooned slightly, so this includes a few other maintenance improvements:

  • moving all the scripts to TypeScript - this uncovered a few small nits, and also revealed that getSections doesn't need to be async which is cool 🎉
  • replacing fs-extra with native methods - most of the methods were passthroughs from fs, and the read & write for JSON wasn't being used
    • I did replace the use of exists with a try/catch - fs existence checks are usually not recommended as they're technically a race condition, so the throw could always happen
    • tbh I think its probably worth just inlining cache into get-html as thats the only place it's used
  • removed execa dev dependency as its unused
  • updating the workflows to all use the same node & action versions (node 12)
  • ran sort-package-json for consistency (happy to revert this if people want - I just find it nice to not have to worry about the order being consistent)

@G-Rath G-Rath added the Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR label Jan 8, 2021
@gr2m
Copy link
Contributor

gr2m commented Jan 8, 2021

  • moving all the scripts to TypeScript - this uncovered a few small nits, and also revealed that getSections doesn't need to be async which is cool 🎉

  • replacing fs-extra with native methods - most of the methods were passthroughs from fs, and the read & write for JSON wasn't being used

    • I did replace the use of exists with a try/catch - fs existence checks are usually not recommended as they're technically a race condition, so the throw could always happen
    • tbh I think its probably worth just inlining cache into get-html as thats the only place it's used
  • removed execa dev dependency as its unused

  • updating the workflows to all use the same node & action versions (node 12)

  • ran sort-package-json for consistency (happy to revert this if people want - I just find it nice to not have to worry about the order being consistent)

these all sound like great changes, thank you! I'm looking through it now. But I'd like @wolfy1339 and @oscard0m to give their thumbs up for this change before we move forward

@G-Rath
Copy link
Member Author

G-Rath commented Jan 8, 2021

No problem! I can break a few of these changes out into another PR if you'd like (specifically, removing execa, updating the workflows, and applying sort-package-json) :)

Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

just a few comments from me, thanks for all your help!

Copy link
Member

@oscard0m oscard0m left a comment

Choose a reason for hiding this comment

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

  • moving all the scripts to TypeScript - this uncovered a few small nits, and also revealed that getSections doesn't need to be async which is cool 🎉

Amazing Job! Thanks for your time and knowledge! It has been a pleasure reading your TS part 🤓

  • replacing fs-extra with native methods - most of the methods were passthroughs from fs, and the read & write for JSON wasn't being used

    • I did replace the use of exists with a try/catch - fs existence checks are usually not recommended as they're technically a race condition, so the throw could always happen

Didn't know about this. Adding a link just in case somebody want to take a look into it> https://nodejs.org/api/fs.html#fs_fs_exists_path_callback

  • tbh I think its probably worth just inlining cache into get-html as thats the only place it's used

Yep, to me has sense to unify files :)

  • removed execa dev dependency as its unused

  • updating the workflows to all use the same node & action versions (node 12)

🥳 🍾

  • ran sort-package-json for consistency (happy to revert this if people want - I just find it nice to not have to worry about the order being consistent)

✅ To me it's fine. Maybe we can open an issue to automate this step. What do you think? @G-Rath @gr2m @wolfy1339. I found this Prettier plugin for instance https://github.com/matzkoh/prettier-plugin-packagejson


💬 Left a comment regarding tsconfig.json. If you want to move forward and open a different issue to tackle that to me it's completely fine.


A general feedback:

  • 🥇 Amazing all the job you did here and other PR's. Congratulations and thanks for your effort and for sharing your knowledge with the community.

  • 💬 Personally as a contributor and as a reviewer I would prefer to get more PR's with a single purpose or change (just a personal preference 😃). It's easier to read and review, easy to categorize when using semantic versioning and, in case of a regression, easier to revert too. What are your thoughts on this @G-Rath ?

Comment on lines +1 to +23
{
"compilerOptions": {
"target": "es2019",
"module": "commonjs",
"moduleResolution": "node",
"lib": [ "es2020" ],
"rootDir": "./",
"allowJs": true,
"checkJs": true,
"noEmit": true,
"strict": true,
"resolveJsonModule": true,
"useDefineForClassFields": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noEmitOnError": true,
"removeComments": false,
"esModuleInterop": true
},
"exclude": ["cache", "coverage", "node_modules"],
"include": ["**/*.js", "**/*.ts"]
}
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to extend from https://github.com/octokit/tsconfig? We have some repositories pending to migrate to extend this tsconfig

@G-Rath
Copy link
Member Author

G-Rath commented Jan 9, 2021

@oscard0m thanks for such an awesome write-up!

I would prefer to get more PR's with a single purpose or change

Couldn't agree more - that ones totally on me! Usually I would've done it like that, but all the rebasing and creation/deletion of so many files very quickly tends to upset my file system (specifically the WSL-based watchers) 😬

Amazing all the job you did here and other PR's

No problem - thanks for being so engaging, it makes the contributions feel a lot more valuable. Feel free to ping me elsewhere if you'd like a hand or have questions, especially with Typescript-related stuff 😄 (that goes for @wolfy1339 & @gr2m too - you've all been really fun to work with!)

Maybe we can open an issue to automate this step

Can do! The prettier plugin you linked immediately came to mind - I'll set it up in a follow up PR.


Since this PR is branched off #252, I'll apply the changes we've discussed to this branch while that PR is still open, and then will open new PRs for whatever ones I don't get around to addressing when its merged :)

@G-Rath
Copy link
Member Author

G-Rath commented Jan 11, 2021

@gr2m @oscard0m I didn't realise that squashing was the merge method of choice for this repo so doubly sorry about not doing a pr for each commit 😱

Are you happy to merge via rebase? otherwise I'll do each commit via their own PR

@gr2m
Copy link
Contributor

gr2m commented Jan 11, 2021

no worries, PRs can be as messy as it makes sense. We can squash all the commits into a single one at the time of the merge, no need for rebases

@G-Rath
Copy link
Member Author

G-Rath commented Jan 11, 2021

I was meaning using "Rebase and Merge" rather than "Squash and Merge" into the base branch, since these commits are pretty unrelated to each other and so squashing them into a single commit would... well have them as a single big commit 😅

@gr2m
Copy link
Contributor

gr2m commented Jan 11, 2021

well have them as a single big commit 😅

that's all right, we still have the separate commits in the PR. Don't worry too much about it. If you like, we can do a rebase with cleaned up commits, but I think it's not the most fun thing to do ;) we'll be fine

@G-Rath
Copy link
Member Author

G-Rath commented Jan 11, 2021

Since #252 has been merged, this PR can be landed - I didn't get around to addressing the extras, so I'll do them in follow-up PRs.

@G-Rath G-Rath merged commit 0ea64da into octokit:master Jan 11, 2021
@G-Rath G-Rath deleted the convert-scripts-to-typescript branch January 11, 2021 18:06
@octokitbot
Copy link
Contributor

🎉 This PR is included in version 3.32.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants