Skip to content

If controller is started with --preserve-symlinks, pass flags to adapters #2103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/common/src/lib/common/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3198,10 +3198,16 @@ export async function resolveAdapterMainFile(adapter: string): Promise<string> {
* @returns default node args for cli
*/
export function getDefaultNodeArgs(mainFile: string): string[] {
const ret: string[] = [];
// Support executing TypeScript files directly
if (mainFile.endsWith('.ts')) {
return ['-r', '@alcalzone/esbuild-register'];
ret.push('-r', '@alcalzone/esbuild-register');
}
return [];
// If JS-controller was started with --preserve-symlinks, do the same for adapters
if (process.execArgv.includes('--preserve-symlinks')) {
ret.push('--preserve-symlinks-main', '--preserve-symlinks');
}
return ret;
}

/** This is used for the short github URL format that NPM accepts (<githubname>/<githubrepo>[#<commit-ish>]) */
Expand Down