Skip to content

Commit

Permalink
fix: scope package resolve logic in monorepo (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: anson <ansonwang@futunn.com>
  • Loading branch information
anson09 and anson authored Jan 12, 2024
1 parent 07864bf commit f4a47b9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,19 @@ function assertAndReturn(frameworkName: string, moduleDir: string) {
]);
try {
// find framework from global, especially for monorepo
const globalModuleDir = path.join(require.resolve(`${frameworkName}/package.json`), '../..');
let globalModuleDir;
// if frameworkName is scoped package, like @ali/egg
if (frameworkName.startsWith('@') && frameworkName.includes('/')) {
globalModuleDir = path.join(
require.resolve(`${frameworkName}/package.json`),
'../../..',
);
} else {
globalModuleDir = path.join(
require.resolve(`${frameworkName}/package.json`),
'../..',
);
}
moduleDirs.add(globalModuleDir);
} catch (err) {
// ignore
Expand Down

1 comment on commit f4a47b9

@vercel
Copy link

@vercel vercel bot commented on f4a47b9 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

egg-utils – ./

egg-utils-no-veronica.vercel.app
egg-utils.vercel.app
egg-utils-git-master-no-veronica.vercel.app

Please sign in to comment.