-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TS_CONFIG_PATH):
TS_CONFIG_PATH
environment variable for forci…
…ng tsconfig loading (#64) * feat(TS_PROJECT): Add option to override path to search for `tsconfig.json` * feat(TSProjectPath): Rename env, and add tests * feat: Refactor tsconfig parsing to allow for "extends"
- Loading branch information
Showing
21 changed files
with
434 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "tsconfig-test", | ||
"version": "0.0.0", | ||
"description": "", | ||
"main": "src/index.ts", | ||
"type": "module", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^16.9.35", | ||
"@types/react-dom": "^16.9.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Testing/Tests/TSConfig/src/App.tsx | ||
import React from 'react'; | ||
|
||
export function App(): React.ReactElement { | ||
return <div>HelloAppWorld</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Testing/Tests/TSConfig/src/Components/Title.tsx | ||
import React from 'react'; | ||
|
||
export function Title(): React.ReactElement { | ||
return <h1>Title!</h1>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Testing/Tests/TSConfig/src/Main.tsx | ||
import React from 'react'; | ||
import { Title } from 'app/Components/Title'; | ||
|
||
export function Main(): React.ReactElement { | ||
return ( | ||
<div> | ||
<Title /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Testing/Tests/TSConfig/src/Render.tsx | ||
import React from 'react'; | ||
import { renderToStaticMarkup } from 'react-dom/server'; | ||
|
||
export async function renderModule( | ||
Component: () => React.ReactElement, | ||
): Promise<string> { | ||
return renderToStaticMarkup(<Component />); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Template/src/index.ts | ||
import { strictEqual } from 'assert'; | ||
import { renderModule } from './Render'; | ||
import { resolve } from 'path'; | ||
|
||
async function startApp(): Promise<void> { | ||
console.log('Starting App'); | ||
|
||
const { App } = await import('./App'); | ||
const appHTML1 = await renderModule(App); | ||
|
||
strictEqual(appHTML1, '<div>HelloAppWorld</div>'); | ||
|
||
process.env.TS_CONFIG_PATH = resolve( | ||
'Testing/Tests/TSConfig/tsconfig.random.json', | ||
); | ||
|
||
const { Main } = await import('./Main'); | ||
const mainHTML1 = await renderModule(Main); | ||
|
||
strictEqual(mainHTML1, '<div><h1>Title!</h1></div>'); | ||
} | ||
/** | ||
* Insert example/test here | ||
*/ | ||
console.log('Hello World'); | ||
|
||
startApp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"allowSyntheticDefaultImports": true, | ||
|
||
"jsx": "react" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"allowSyntheticDefaultImports": true, | ||
|
||
"jsx": "react", | ||
"baseUrl": "./src", | ||
"paths": { | ||
"app/*": ["./*"] | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "tsconfig-extends-test", | ||
"version": "0.0.0", | ||
"description": "", | ||
"main": "src/index.ts", | ||
"type": "module", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^16.9.35", | ||
"@types/react-dom": "^16.9.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Testing/Tests/TSConfig/src/App.tsx | ||
import React from 'react'; | ||
|
||
export function App(): React.ReactElement { | ||
return <div>HelloAppWorld</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Testing/Tests/TSConfig/src/Components/Title.tsx | ||
import React from 'react'; | ||
|
||
export function Title(): React.ReactElement { | ||
return <h1>Title!</h1>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Testing/Tests/TSConfig/src/Main.tsx | ||
import React from 'react'; | ||
import { Title } from 'app/Components/Title'; | ||
|
||
export function Main(): React.ReactElement { | ||
return ( | ||
<div> | ||
<Title /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Testing/Tests/TSConfig/src/Render.tsx | ||
import React from 'react'; | ||
import { renderToStaticMarkup } from 'react-dom/server'; | ||
|
||
export async function renderModule( | ||
Component: () => React.ReactElement, | ||
): Promise<string> { | ||
return renderToStaticMarkup(<Component />); | ||
} |
Oops, something went wrong.