-
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.
- Loading branch information
Showing
4 changed files
with
47 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { parse } from 'node:path' | ||
export function loadRecipeConfig(recipePath: string) { | ||
try { | ||
const configPath = `${recipePath}/package.json`; | ||
// Delete module from cache | ||
delete require.cache[require.resolve(configPath)]; | ||
|
||
// eslint-disable-next-line import/no-dynamic-require | ||
const config = require(configPath); | ||
|
||
const moduleConfigPath = require.resolve(configPath); | ||
config.path = parse(moduleConfigPath).dir; | ||
console.log(config, 'config loadRecipe') | ||
return config; | ||
} catch (error) { | ||
console.error(error); | ||
return null; | ||
} | ||
} |
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