Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
feat: support .tsx files with JSX syntax (#96)
Browse files Browse the repository at this point in the history
* Configure ts-node to transpile JSX for React

This allows oclif to parse jsx found in .tsx files.

* Allow oclif to discover .tsx files

Notably does _not_ add support for .jsx files yet since this will
require a separate tool chain to work with something like Babel as a
transpiler for JSX in Javascript files.

Also ensures that test files that are .tsx are still ignored.
  • Loading branch information
ryanwilsonperkin authored and RasPhilCo committed Jan 28, 2020
1 parent b7c6c78 commit 6c800f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ export class Plugin implements IPlugin {
}
this._debug(`loading IDs from ${this.commandsDir}`)
const patterns = [
'**/*.+(js|ts)',
'!**/*.+(d.ts|test.ts|test.js|spec.ts|spec.js)',
'**/*.+(js|ts|tsx)',
'!**/*.+(d.ts|test.ts|test.js|spec.ts|spec.js)?(x)',
]
const ids = globby.sync(patterns, {cwd: this.commandsDir})
.map(file => {
Expand Down
1 change: 1 addition & 0 deletions src/ts-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function registerTSNode(root: string) {
sourceMap: true,
rootDirs,
typeRoots,
jsx: 'react',
},
})
} finally {
Expand Down

0 comments on commit 6c800f2

Please sign in to comment.