load-tsconfig
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -126,7 +126,17 @@ var __create = Object.create; | ||
// src/index.ts | ||
var findUp = (name, startDir, stopDir = import_path.default.parse(startDir).root) => { | ||
let dir = startDir; | ||
while (dir !== stopDir) { | ||
const file = import_path.default.join(dir, name); | ||
if (import_fs.default.existsSync(file)) | ||
return file; | ||
dir = import_path.default.dirname(dir); | ||
} | ||
return null; | ||
}; | ||
var resolveTsConfig = (cwd, name) => { | ||
if (import_path.default.isAbsolute(name)) | ||
return name; | ||
return import_fs.default.existsSync(name) ? name : null; | ||
if (name.startsWith(".")) | ||
return import_path.default.join(cwd, name); | ||
return findUp(name, cwd); | ||
const id = require.resolve(name, { paths: [cwd] }); | ||
@@ -133,0 +143,0 @@ return id; |
{ | ||
"name": "load-tsconfig", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Load tsconfig.json", | ||
@@ -22,4 +22,4 @@ "publishConfig": { | ||
"@egoist/prettier-config": "1.0.0", | ||
"@types/node": "^14.0.0", | ||
"kanpai": "^0.10.1", | ||
"@types/node": "14.18.9", | ||
"kanpai": "0.10.1", | ||
"prettier": "2.5.1", | ||
@@ -26,0 +26,0 @@ "strip-json-comments": "4.0.0", |
@@ -30,4 +30,16 @@ **💛 You can help the author become a full-time open-source maintainer by [sponsoring him on GitHub](https://github.com/sponsors/egoist).** | ||
Full documentation: https://paka.dev/npm/load-tsconfig | ||
By default it loads `./tsconfig.json`, but you can use a custom filename: | ||
```ts | ||
loadTsConfig(".", "./tsconfig.build.json") | ||
``` | ||
You can also load a package: | ||
```ts | ||
loadTsConfig(".", "my-tsconfig-package") | ||
``` | ||
Full type documentation: https://paka.dev/npm/load-tsconfig | ||
## Sponsors | ||
@@ -34,0 +46,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9845
175
51