| ... | @@ -78,32 +78,11 @@ const makeFakeNpmToolchain = Effect.fn("AcpRegistrySupport.test.makeFakeNpmToolc | ... | @@ -78,32 +78,11 @@ const makeFakeNpmToolchain = Effect.fn("AcpRegistrySupport.test.makeFakeNpmToolc |
| 78 | yield* fileSystem.makeDirectory(toolchainBin, { recursive: true }); | 78 | yield* fileSystem.makeDirectory(toolchainBin, { recursive: true }); |
| 79 | yield* fileSystem.makeDirectory(globalPrefix, { recursive: true }); | 79 | yield* fileSystem.makeDirectory(globalPrefix, { recursive: true }); |
| 80 | yield* fileSystem.writeFileString(logPath, ""); | 80 | yield* fileSystem.writeFileString(logPath, ""); |
| 81 | yield* fileSystem.writeFileString( | 81 | yield* fileSystem.copyFile( |
| | 82 | yield* path.fromFileUrl( |
| | 83 | new URL("./testing/AcpRegistrySupport.npm.fixture.sh", import.meta.url), |
| | 84 | ), |
| 82 | npmPath, | 85 | npmPath, |
| 83 | [ | | |
| 84 | "#!/bin/sh", | | |
| 85 | 'printf \'%s\\n\' "$*" >> "$FAKE_NPM_LOG"', | | |
| 86 | 'prefix="${npm_config_prefix:-$FAKE_NPM_PREFIX}"', | | |
| 87 | 'if [ "$1" = "root" ] && [ "$2" = "--global" ]; then', | | |
| 88 | " printf '%s\\n' \"$prefix/lib/node_modules\"", | | |
| 89 | " exit 0", | | |
| 90 | "fi", | | |
| 91 | 'if [ "$1" = "prefix" ] && [ "$2" = "--global" ]; then', | | |
| 92 | " printf '%s\\n' \"$prefix\"", | | |
| 93 | " exit 0", | | |
| 94 | "fi", | | |
| 95 | 'if [ "$1" = "install" ] && [ "$2" = "--global" ]; then', | | |
| 96 | ' package_root="$prefix/lib/node_modules/@example/acp"', | | |
| 97 | ' executable="$prefix/bin/example-agent"', | | |
| 98 | ' mkdir -p "$package_root" "$prefix/bin"', | | |
| 99 | ' printf \'%s\' "$FAKE_NPM_MANIFEST" > "$package_root/package.json"', | | |
| 100 | " printf '#!/bin/sh\\n' > \"$executable\"", | | |
| 101 | ' chmod 755 "$executable"', | | |
| 102 | " exit 0", | | |
| 103 | "fi", | | |
| 104 | "exit 64", | | |
| 105 | "", | | |
| 106 | ].join("\n"), | | |
| 107 | ); | 86 | ); |
| 108 | yield* fileSystem.chmod(npmPath, 0o755); | 87 | yield* fileSystem.chmod(npmPath, 0o755); |
| 109 | return { | 88 | return { |