diff --git a/.changeset/pretty-buckets-return.md b/.changeset/pretty-buckets-return.md new file mode 100644 index 000000000..cb16b291f --- /dev/null +++ b/.changeset/pretty-buckets-return.md @@ -0,0 +1,6 @@ +--- +'@hypermod/fetcher': patch +'@hypermod/cli': patch +--- + +Fixes logic to locate configs when bundled in deeply nested directories diff --git a/packages/cli/src/main.ts b/packages/cli/src/main.ts index f49b86077..6e3efb306 100644 --- a/packages/cli/src/main.ts +++ b/packages/cli/src/main.ts @@ -17,11 +17,19 @@ import { getConfigPrompt, getMultiConfigPrompt } from './prompt'; const ExperimentalModuleLoader = () => ({ install: async (packageName: string) => - await installPackage(packageName, { cwd: __dirname }), + await installPackage(packageName, { + cwd: __dirname, + packageManager: 'npm', + additionalArgs: ['--force'], + }), require: (packageName: string) => require(packageName), - getInfo: (packageName: string) => ({ - location: require.resolve(packageName), - }), + getInfo: (packageName: string) => { + const entryPath = require.resolve(packageName); + return { + location: entryPath.split(packageName)[0] + packageName, + entryPath: entryPath, + }; + }, }); export default async function main( diff --git a/packages/fetcher/src/index.ts b/packages/fetcher/src/index.ts index d1d1e1c87..11774d82a 100644 --- a/packages/fetcher/src/index.ts +++ b/packages/fetcher/src/index.ts @@ -150,7 +150,7 @@ export async function fetchRemotePackage( if (configExport.transforms || configExport.presets) { return { filePath: info.location, - config: resolveConfigExport(pkg), + config: configExport, }; } } catch (e) {