-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: typescript rewrite #560
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very excited about this! some interim comments/questions
@@ -20,7 +20,7 @@ module.exports = async function getCategories(key, selectedVersion) { | |||
}), | |||
}) | |||
.then(res => { | |||
totalCount = Math.ceil(res.headers.get('x-total-count') / 20); | |||
totalCount = Math.ceil(parseInt(res.headers.get('x-total-count'), 10) / 20); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woooooof
* @param {String} folderToSearch path to directory | ||
* @returns {String[]} array of files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need these types I wrote in the JSDocs now 😅
Saw the following error: ``` jest-haste-map: Haste module naming collision: rdme The following files share their name; please adjust your hasteImpl: * <rootDir>/dist/package.json * <rootDir>/package.json ``` this is a fix for that, stolen from here: jestjs/jest#8114 (comment)
/** | ||
* Because our command classes have a `run` method that might not always call `this` we need to | ||
* explicitly exclude `run` from this rule. | ||
*/ | ||
"class-methods-use-this": ["error", { "exceptMethods": ["run"] }], | ||
|
||
"import/order": ["error", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hell yeah
this was bugging me in the diff lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥹
🧰 Changes
After marinating on #558 over the weekend I decided that it'd be best for the codebase if we finally migrated it over to TypeScript before making any ESM decisions.
Command
class that every command extends from.versions.test.ts
is nowversions/index.test.ts, versions/create.test.ts
, etc`)🐛 Known Issues
The mainindex.test.ts
test is failing.There's some funk with thetypings.d.ts
file. Might need to move those into thetsconfig.json
sink
config I have set up. I had a lot of problems withtypings.d.ts
files over inapi
too.npm run build
and then./bin/rdme
no commands show up. I think this is because the way the help tool work is that it looks atsrc/cmds
, which doesn't exist in thedist/
directory. There was a similar problem in feat: refactoring the codebase to be ESM #558 around this dynamic command setup and it might be worth replacing it with asrc/cmds/index.ts
file that loads and exports every available command.~~if no key throw an error
flow in each command by moving that into theCommand.run()
super
but strangely promises that would get rejected fromsuper.run()
would immediately throw an uncaught promise exception. I'm not sure why, but figuring this out would remove a handful of boilerplate from every command that requires auth.🧬 QA & Testing