fix: deps link

This commit is contained in:
DarkSky
2026-02-24 18:09:57 +08:00
parent 046e126054
commit 6aba4350ac
3 changed files with 10 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ const scriptsSrcFolder = join(scriptsFolder, 'src');
const projectRoot = join(scriptsFolder, '..', '..');
const serverRoot = join(projectRoot, 'packages', 'backend', 'server');
const tsRuntimeRegister = join(scriptsFolder, 'register.js');
const tsxRuntimeRegister = join(scriptsFolder, 'tsx-register.js');
const [node, _self, file, ...options] = process.argv;
@@ -64,7 +65,7 @@ if (
if (scriptLocation.startsWith(serverRoot)) {
nodeOptions.unshift(`--import=${pathToFileURL(tsRuntimeRegister)}`);
} else {
nodeOptions.unshift('--import=tsx');
nodeOptions.unshift(`--import=${pathToFileURL(tsxRuntimeRegister)}`);
}
} else {
nodeOptions.unshift('--experimental-specifier-resolution=node');

View File

@@ -15,6 +15,10 @@ const serverRuntimeLoader = currentDir
.join('../register.js')
.toFileUrl()
.toString();
const tsxRuntimeLoader = currentDir
.join('../tsx-register.js')
.toFileUrl()
.toString();
const ignoreLoaderScripts = [
'vitest',
@@ -165,9 +169,11 @@ export class RunCommand extends PackageCommand {
args = extractedArgs;
const bin = args[0] === 'yarn' ? args[1] : args[0];
const loader = pkg.name === '@affine/server' ? serverRuntimeLoader : 'tsx';
const loader =
pkg.name === '@affine/server' ? serverRuntimeLoader : tsxRuntimeLoader;
const hasKnownLoader =
process.env.NODE_OPTIONS?.includes('tsx') ||
process.env.NODE_OPTIONS?.includes(tsxRuntimeLoader) ||
process.env.NODE_OPTIONS?.includes(serverRuntimeLoader);
// very simple test for auto ts/mjs scripts

View File

@@ -0,0 +1 @@
import 'tsx';