-
Notifications
You must be signed in to change notification settings - Fork 293
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
Change source code to TypeScript #343
Comments
Hey are you looking for help ? |
@fkhadra Yes, if you are interested. I was going to use this {
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"lib": ["esnext"],
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "./dist",
"types": ["node"],
"strict": true,
"target": "esnext",
"typeRoots": [
"./types",
"./node_modules/@types"
]
}
} Do you want to make a PR? |
There is no doubt that Typescript is undoubtedly the best programming method at this moment. you can consider refactoring with Typescript before project become bigger and bigger. |
Hey @styfle sure for the PR, it would be nice. Is there a commit convention that I have to follow ? Thank you |
@fkhadra No, we squash on merge |
Hey @styfle, I started to work on it. https://github.com/fkhadra/ncc/tree/move-to-ts I took your tsconfig and changed the When I migrate a file to typescript I require the compiled version as shown below then I run all the test suite to ensure that nothing is broken. const { shebangRegExp } = require('../tsbuild/utils/shebang'); I saw that the default export of get-package-base file was not used so I removed it. I have migrated the files inside the src/utils directory to TS at that time. What do you think about that workflow ? Do you have a better idea ? Thank you |
@fkhadra That sound about right. Can you submit the PR so I can review? |
FYI, we don't need to change the source code of tests right now. Let's prove that tests still work without changing them. |
@styfle I underestimated the work needed to migrate to typescript 😭, I think that some task needs to be done up front. There are 2 tests that fail when I add the latest version of typescript 3.4.1 or @types/node. The test that failing are the one related to typescript. I'm trying to find why. The issue can be reproduced as follow:
Ncc uses arg v2, we can upgrade to the latest version(v4) without touching a single line of code. The nice thing is that the v4 ship with a ts definition file. I can make a separate PR for that one if you want to. PS: Should I open an issue for the typescript dependency ? |
Yes please upgrade |
This version include a type definition for typescript. This will help for #343
@fkhadra Any update on this? We had to add types to the node builder recently because |
Hey @styfle, I still have the issue #343 (comment) regarding the tests. |
@fkhadra I thought the problem was with Where is the repo? The link you posted above is dead: https://github.com/fkhadra/ncc/tree/move-to-ts Maybe you could submit a PR? |
@styfle you can reproduce the issue with the current master branch. You don't even need to change a single line of code :(. I deleted my repo since I wanted to fix this issue first. |
Hey @styfle were you able to reproduce the issue ? |
@fkhadra Sorry, too busy to look into this one since its lower priority right now. |
FYI, if I'm understanding this correctly, I have a bit of a package that allows default exports to be imported normally, with |
We like TypeScript. Let's write the source code for ncc in TypeScript.
Note: default exports are painful to deal with CJS/ESM interop so maybe use a named export instead.
The text was updated successfully, but these errors were encountered: