mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 02:35:58 +08:00
fix: deps link
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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
|
||||
|
||||
1
tools/cli/tsx-register.js
Normal file
1
tools/cli/tsx-register.js
Normal file
@@ -0,0 +1 @@
|
||||
import 'tsx';
|
||||
Reference in New Issue
Block a user