Add in fusionConfig: jsExtPattern, resolveExtensions (enable typescript)#411
Add in fusionConfig: jsExtPattern, resolveExtensions (enable typescript)#411Monar wants to merge 7 commits intofusionjs:masterfrom
Conversation
|
|
bc8c284 to
1af5ddb
Compare
71fdfb1 to
0ae280d
Compare
4ce9f0f to
ee0b7e9
Compare
|
|
||
| ```js | ||
| module.exports = { | ||
| jsExtPattern: \[jt]sx?$\, |
There was a problem hiding this comment.
Should this be forward slashes?
|
|
||
| ## `resolveExtensions` | ||
|
|
||
| By default this is webpack default witch is: `['.wasm', '.mjs', '.js', '.json']` |
There was a problem hiding this comment.
Grammar nitpick:
By default this is the Webpack default which is:
|
|
||
| By default this is `/\.jsx?$/` | ||
|
|
||
| For example, this enables to handle typescript files with addition to Babel plugins/preset: |
There was a problem hiding this comment.
Grammar nitpick:
For example, this enables Typescript support by adding the appropriate Babel preset:
|
any update for this PR? really need typescript support |
|
I'll try to update this PR this week. Regarding those changes they do not cover running tests of typescript files. We have it working out of our own fork. I could update this PR with those changes or should I propose separate PR ? |
ee0b7e9 to
be48fc1
Compare
|
I was a little bit overload recently, but here I am back to work with this PR. This change also incorporates minimal changes that allows us to have tests up and running for typescript code base. |
| ? [`**/${process.env.TEST_FOLDER || '__tests__'}/**/*${testFileExt}`] | ||
| : process.env.TEST_REGEX || | ||
| (process.env.TEST_MATCH || '**/__tests__/**/*.js').split(','); | ||
| (process.env.TEST_MATCH || `**/__tests__/**/*${testFileExt}`).split(','); |
There was a problem hiding this comment.
I'm not sure using testFileExt will work within a glob here since jsExtPattern is regex
There was a problem hiding this comment.
Yep you are right, I'll address this, there will be case where source out of regexp wont work. Good catch thx, I've overlooked this.
dd89df7 to
5e57cef
Compare
This change is enabling test configuration for typescript projects.
5e57cef to
b404074
Compare
|
!import Edit: Opening a mirrored internal PR. |
|
This pull request has been imported. If you have access to the parent repo, you can view the imported change here. |
|
A canary release ( |
|
Thank you @Monar for the contribution and thanks to @AlexMSmithCA for cutting the canary release. My team has been using it for our migration from Flow to Typescript and that has been very useful. One small thing to note - |
|
|
||
| ```js | ||
| module.exports = { | ||
| jsExtPattern: /[jt]sx?$/, |
There was a problem hiding this comment.
Add a dot before [jt] please.
There was a problem hiding this comment.
I don't know what should be a flow now, as this PR was forked (imported) to the internal github repository... is updating this PR still something valuable ? @AlexMSmithCA
There was a problem hiding this comment.
Feel free to make these changes in this PR. We can re-import any additional commits once this has been fully reviewed.
|
|
||
| ```js | ||
| module.exports = { | ||
| resolveExtensions: ['.wasm', '.mjs', '.js', '.json', '.ts', '.tsx'], |
There was a problem hiding this comment.
Add the following to enable Typescript-compatible tests.
jest: {
globFileExt: '!(.d).(ts|tsx)'
}
There was a problem hiding this comment.
I don't know what should be a flow now, as this PR was forked (imported) to the internal github repository... is updating this PR still something valuable ? @AlexMSmithCA
|
I just now found this PR and realized there's some overlap with the PR I'm working on #736. As this PR is much nicer in terms of changing the file extensions I'd like to build upon this and then add the ability to override the entry point on top. What's the procedure here? It's kind of hard to know what to expect if part of the work is being done behind closed doors. What needs to happen for this to land on the master branch on this public repo? |
This is change proposed in here: fusionjs/fusion-cli#705
We are using typescript with fusionjs for last 3 month and its working smoothly, this is minimal (generic) change that allows to embrace typescript for the app code.