-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'ts-package-template/main'
- Loading branch information
Showing
13 changed files
with
1,181 additions
and
887 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
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,8 @@ | ||
import { readFile } from 'node:fs/promises'; | ||
import { dirname, resolve } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
const modulePath = fileURLToPath(import.meta.url); | ||
const packagePath = resolve(dirname(modulePath), '..', 'package.json'); | ||
const packageJson = await readFile(packagePath); | ||
export default JSON.parse(packageJson.toString()); |
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
extends: | ||
- '@comicrelief/eslint-config/mixins/mocha' | ||
|
||
overrides: | ||
- files: loader.js | ||
rules: | ||
jsdoc/require-jsdoc: off |
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
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,32 @@ | ||
/* | ||
Custom ESM loader to get TypeScript `paths` config working with `ts-node`. | ||
Based on https://github.com/TypeStrong/ts-node/discussions/1450 | ||
`ts-node` may support this natively if they eventually merge | ||
https://github.com/TypeStrong/ts-node/pull/1585 | ||
*/ | ||
|
||
import { pathToFileURL } from 'url'; | ||
|
||
import { resolve as resolveTs } from 'ts-node/esm'; | ||
import * as tsConfigPaths from 'tsconfig-paths'; | ||
|
||
const { absoluteBaseUrl, paths } = tsConfigPaths.loadConfig(); | ||
const matchPath = tsConfigPaths.createMatchPath(absoluteBaseUrl, paths); | ||
|
||
export function resolve(specifier, ctx, defaultResolve) { | ||
// remove `.js` extension before matching and add back on afterwards | ||
const match = specifier.endsWith('.js') | ||
? matchPath(specifier.slice(0, -3))?.concat('.js') | ||
: matchPath(specifier); | ||
|
||
return match | ||
? resolveTs(pathToFileURL(`${match}`).href, ctx, defaultResolve) | ||
: resolveTs(specifier, ctx, defaultResolve); | ||
} | ||
|
||
export { | ||
load, | ||
transformSource, | ||
} from 'ts-node/esm'; |
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