-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from samchon/features/yarn
Fix #251 - support yarn monorepo in setup wizard
- Loading branch information
Showing
12 changed files
with
118 additions
and
58 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
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,33 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
export namespace FileRetriever { | ||
export const directory = | ||
(name: string) => | ||
(directory: string, depth: number = 0): string | null => { | ||
const location: string = path.join(directory, name); | ||
if (fs.existsSync(location)) return directory; | ||
else if (depth > 2) return null; | ||
return file(name)(path.join(directory, ".."), depth + 1); | ||
}; | ||
|
||
export const file = | ||
(name: string) => | ||
(directory: string, depth: number = 0): string | null => { | ||
const location: string = path.join(directory, name); | ||
if (fs.existsSync(location)) return location; | ||
else if (depth > 2) return null; | ||
return file(name)(path.join(directory, ".."), depth + 1); | ||
}; | ||
|
||
export const require = | ||
(name: string) => | ||
async (directory: string, depth: number = 0) => { | ||
const location: string | null = file(name)(directory, depth); | ||
if (location === null) | ||
throw new Error( | ||
`Unable to find installed module. Please report to the nestia - https://github.com/samchon/nestia/issues`, | ||
); | ||
return import(location); | ||
}; | ||
} |
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
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,33 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
export namespace FileRetriever { | ||
export const directory = | ||
(name: string) => | ||
(directory: string, depth: number = 0): string | null => { | ||
const location: string = path.join(directory, name); | ||
if (fs.existsSync(location)) return directory; | ||
else if (depth > 2) return null; | ||
return file(name)(path.join(directory, ".."), depth + 1); | ||
}; | ||
|
||
export const file = | ||
(name: string) => | ||
(directory: string, depth: number = 0): string | null => { | ||
const location: string = path.join(directory, name); | ||
if (fs.existsSync(location)) return location; | ||
else if (depth > 2) return null; | ||
return file(name)(path.join(directory, ".."), depth + 1); | ||
}; | ||
|
||
export const require = | ||
(name: string) => | ||
async (directory: string, depth: number = 0) => { | ||
const location: string | null = file(name)(directory, depth); | ||
if (location === null) | ||
throw new Error( | ||
`Unable to find installed module. Please report to the nestia - https://github.com/samchon/nestia/issues`, | ||
); | ||
return import(location); | ||
}; | ||
} |
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