-
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(paths): Allow usage of TSConfig Paths (#76)
* feat(paths): Allow usage of TSConfig Paths * fix: Okay apparently GitHub Actions testing doesn't like the optional chaining * fix?: Fix windows path issue? * fix?: Fix windows path? * chore(debugging): Remove debug console.log * fix(target): Change output target to ES2019 to supoprt Node.JS 13.9+ * lint(index): Fix lint errrors on unused imports
- Loading branch information
Showing
10 changed files
with
111 additions
and
10 deletions.
There are no files selected for viewing
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
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,12 @@ | ||
{ | ||
"name": "paths", | ||
"type": "module", | ||
"main": "./src/index.ts", | ||
"NODE_OPTIONS": "--harmony-top-level-await", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "node --loader ../../../out/dist/index.js --experimental-specifier-resolution=node --experimental-import-meta-resolve --harmony-optional-chaining --harmony-top-level-await src/index.ts" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
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/src/Module/HelloWorld/index.ts | ||
import { add } from '@paths/Utils/Math'; | ||
|
||
export async function testingSubPath(): Promise<number> { | ||
return add(1, 5); | ||
} |
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,13 @@ | ||
// Testing/Tests/Lab/src/Utils/Math.ts | ||
|
||
export function add(x: number, y: number): number { | ||
console.debug(`Adding ${x} + ${y}`); | ||
|
||
return x + y; | ||
} | ||
|
||
export function divide(x: number, y: number): number { | ||
console.debug(`Dividing ${x} / ${y}`); | ||
|
||
return x / y; | ||
} |
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,22 @@ | ||
// Testing/Tests/Lab/src/index.ts | ||
import { add, divide } from '@paths/Utils/Math'; | ||
import { strictEqual } from 'assert'; | ||
|
||
export async function startApp(): Promise<void> { | ||
console.debug('Starting Application'); | ||
|
||
const sum = add(1, 1); | ||
strictEqual(sum, 2); | ||
|
||
const divideResult = divide(2, 2); | ||
strictEqual(divideResult, 1); | ||
|
||
const { testingSubPath } = await import('@paths/Module/HelloWorld'); | ||
|
||
const addSub = await testingSubPath(); | ||
strictEqual(addSub, 6); | ||
|
||
console.debug('Done'); | ||
} | ||
|
||
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,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"allowSyntheticDefaultImports": true, | ||
"baseUrl": "./src", | ||
|
||
"paths": { | ||
"@paths/*": ["./*"] | ||
} | ||
} | ||
} |
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
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
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