-
Notifications
You must be signed in to change notification settings - Fork 34
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
Migrate frint-cli to TypeScript #400
Conversation
packages/frint-cli/package.json
Outdated
"test": "cross-env ../../node_modules/.bin/mocha --colors --recursive ./commands/*.spec.js", | ||
"lint": "cross-env ./node_modules/.bin/tslint -p .", | ||
"transpile": "cross-env ./node_modules/.bin/tsc", | ||
"test": "cross-env ../../node_modules/.bin/mocha --require ts-node/register --colors --recursive ./src/**/*.spec.ts", |
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.
There are multiple ways to run TS unit tests.
We could also simply transpile
first and then run mocha
on the transpiled JS, but this option to use ts-node
seems to be more popular (and this way watch
can work properly too).
@@ -3,7 +3,7 @@ | |||
"description": "Framework for building front-end apps", | |||
"private": true, | |||
"scripts": { | |||
"bootstrap": "lerna bootstrap", | |||
"bootstrap": "lerna bootstrap --hoist", |
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.
The --hoist
flag is needed due to microsoft/TypeScript#20945
The CI build is failing due to linting, I'll check that when I'll have time. |
Codecov Report
@@ Coverage Diff @@
## master #400 +/- ##
=======================================
Coverage 97.39% 97.39%
=======================================
Files 101 101
Lines 3992 3992
=======================================
Hits 3888 3888
Misses 104 104 Continue to review full report at Codecov.
|
💖💖💖 Many thanks for leading this TypeScript initiative, @markvincze!!! (Will check this PR out in more details toorrow) |
245da28
to
33be8d5
Compare
Refs #388 |
This is a starting point to move
frint
to TypeScript.I started with
frint-cli
, because it's less critical, and it's self-contained. If this looks good and we agree to start moving to TS, then the corefrint
package would be a good next candidate.Although
frint-cli
is really simple and its code itself is not really utilizing TS, the tooling is already valuable. For example these are producing errors at compile time without running any tests, while when using JS, we don't see anything.And we get proper autocomplete too out of the box, and we don't have to maintain
d.ts
files manually:The exciting part is going to be migrating
frint
, because there we'll have to make interesting decisions about how to design the TS type model.