From 93d93abd8a83797560af61fbe0745b900ce3680b Mon Sep 17 00:00:00 2001 From: LongYinan Date: Mon, 28 Apr 2025 22:04:07 +0800 Subject: [PATCH] Fix cycle require yarn.js --- tools/cli/src/run.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/cli/src/run.ts b/tools/cli/src/run.ts index 23839083be..7dcfa41bde 100644 --- a/tools/cli/src/run.ts +++ b/tools/cli/src/run.ts @@ -1,3 +1,5 @@ +import path from 'node:path'; + import { execAsync } from '@affine-tools/utils/process'; import type { Package, PackageName } from '@affine-tools/utils/workspace'; @@ -173,16 +175,16 @@ export class RunCommand extends PackageCommand { NODE_OPTIONS.push(`--import=@oxc-node/core/register`); } - if (args[0] !== 'yarn') { - // add 'yarn' to the command so we can bypass bin execution to it - args.unshift('yarn'); - } - await execAsync(pkg.name, args, { cwd: pkg.path.value, env: { ...envs, NODE_OPTIONS: NODE_OPTIONS.join(' '), + PATH: `${path.join(pkg.nodeModulesPath.value, '.bin')}${path.delimiter}${path.join( + this.workspace.path.value, + 'node_modules', + '.bin' + )}${path.delimiter}${process.env.PATH}`, }, }); }