@@ -112,14 +112,10 @@ function shellScript(command: string, cwd: string): string {
112112
113113function buildPinnedGlobalCliPlatformLinkScript ( ) : string {
114114 return [
115- 'GLOBAL_ROOT="$(pnpm root -g)"' ,
116- 'MAIN_PACKAGE_DIR="$GLOBAL_ROOT/@truenine/memory-sync-cli"' ,
117- 'PLATFORM_PACKAGE_DIR="$GLOBAL_ROOT/@truenine/memory-sync-cli-linux-x64-gnu"' ,
118- 'test -d "$MAIN_PACKAGE_DIR"' ,
119- 'test -d "$PLATFORM_PACKAGE_DIR"' ,
120- 'mkdir -p "$MAIN_PACKAGE_DIR/node_modules/@truenine"' ,
121- 'rm -rf "$MAIN_PACKAGE_DIR/node_modules/@truenine/memory-sync-cli-linux-x64-gnu"' ,
122- 'ln -s "$PLATFORM_PACKAGE_DIR" "$MAIN_PACKAGE_DIR/node_modules/@truenine/memory-sync-cli-linux-x64-gnu"' ,
115+ 'MAIN_PACKAGE_JSON="$(find -L /pnpm/global -path \'*/@truenine/memory-sync-cli/package.json\' -print -quit)"' ,
116+ 'PLATFORM_PACKAGE_JSON="$(find -L /pnpm/global -path \'*/@truenine/memory-sync-cli-linux-x64-gnu/package.json\' -print -quit)"' ,
117+ 'test -n "$MAIN_PACKAGE_JSON"' ,
118+ 'test -n "$PLATFORM_PACKAGE_JSON"' ,
123119 ] . join ( "\n" ) ;
124120}
125121
@@ -160,14 +156,13 @@ export class PreparedCliIntegrationContainer {
160156
161157 inspectInstalledCliResolution ( ) : InstalledCliResolution {
162158 const script = [
163- 'const { createRequire } = require("node:module");' ,
164159 'const fs = require("node:fs");' ,
165160 'const path = require("node:path");' ,
166- "const mainDir = process.argv[1];" ,
167- ' const requireFromMain = createRequire(path.join(mainDir, "dist", "index.mjs"));' ,
168- ' const resolvedPackageJson = requireFromMain.resolve("@truenine/memory-sync-cli-linux-x64-gnu/package.json");' ,
169- "const platformDir = path.dirname(resolvedPackageJson );" ,
170- 'const binaryPath = path.join(platformDir, "tnmsc");' ,
161+ "const mainPackageJson = process.argv[1];" ,
162+ " const platformPackageJson = process.argv[2];" ,
163+ " const mainDir = path.dirname(mainPackageJson);" ,
164+ "const platformDir = path.dirname(platformPackageJson );" ,
165+ 'const binaryPath = path.join(platformDir, "bin", " tnmsc");' ,
171166 "const binaryExists = fs.existsSync(binaryPath);" ,
172167 "process.stdout.write(JSON.stringify({" ,
173168 " mainPackageDir: mainDir," ,
@@ -177,15 +172,19 @@ export class PreparedCliIntegrationContainer {
177172 ] . join ( " " ) ;
178173
179174 const result = this . assertExecSuccess (
180- [ 'GLOBAL_ROOT="$(pnpm root -g)"' , 'MAIN_PACKAGE_DIR="$GLOBAL_ROOT/@truenine/memory-sync-cli"' , `node -e ${ quoteShell ( script ) } "$MAIN_PACKAGE_DIR"` ] . join (
181- " && " ,
182- ) ,
175+ [
176+ 'MAIN_PACKAGE_JSON="$(find -L /pnpm/global -path \'*/@truenine/memory-sync-cli/package.json\' -print -quit)"' ,
177+ 'PLATFORM_PACKAGE_JSON="$(find -L /pnpm/global -path \'*/@truenine/memory-sync-cli-linux-x64-gnu/package.json\' -print -quit)"' ,
178+ 'test -n "$MAIN_PACKAGE_JSON"' ,
179+ 'test -n "$PLATFORM_PACKAGE_JSON"' ,
180+ `node -e ${ quoteShell ( script ) } "$MAIN_PACKAGE_JSON" "$PLATFORM_PACKAGE_JSON"` ,
181+ ] . join ( " && " ) ,
183182 ) ;
184183
185184 const parsed = JSON . parse ( result . stdout ) ;
186185
187186 if ( ! parsed . binaryExists ) {
188- throw new Error ( `Expected tnmsc binary at "${ parsed . platformPackageDir } /tnmsc" but it does not exist.` ) ;
187+ throw new Error ( `Expected tnmsc binary at "${ parsed . platformPackageDir } /bin/ tnmsc" but it does not exist.` ) ;
189188 }
190189
191190 return {
0 commit comments