From 9a644baeae7c46250ced9942ce30f3f8694efe7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bene=C5=A1?= Date: Tue, 7 May 2024 12:17:07 +0200 Subject: [PATCH] fix: various aztec-builder issues (#6233) Fixing random aztec-builder issues. --- yarn-project/builder/package.json | 2 +- yarn-project/builder/src/cli.ts | 29 +++++-------------- yarn-project/builder/src/cli/update/update.ts | 1 - 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/yarn-project/builder/package.json b/yarn-project/builder/package.json index cb01a3034bc..29b648700ff 100644 --- a/yarn-project/builder/package.json +++ b/yarn-project/builder/package.json @@ -10,7 +10,7 @@ "entryPoints": [ "./src/index.ts" ], - "name": "Aztec.nr compiler", + "name": "Aztec builder", "tsconfig": "./tsconfig.json" }, "bin": { diff --git a/yarn-project/builder/src/cli.ts b/yarn-project/builder/src/cli.ts index a8d2faf4d6a..9dea06bba50 100644 --- a/yarn-project/builder/src/cli.ts +++ b/yarn-project/builder/src/cli.ts @@ -1,30 +1,13 @@ #!/usr/bin/env node import { createConsoleLogger } from '@aztec/foundation/log'; -import { Command, Option } from 'commander'; -import { lookup } from 'dns/promises'; +import { Command } from 'commander'; import { dirname } from 'path'; const program = new Command(); -const log = createConsoleLogger('aztec:compiler-cli'); - -/** - * If we can successfully resolve 'host.docker.internal', then we are running in a container, and we should treat - * localhost as being host.docker.internal. - */ -const getLocalhost = () => - lookup('host.docker.internal') - .then(() => 'host.docker.internal') - .catch(() => 'localhost'); - -const LOCALHOST = await getLocalhost(); +const log = createConsoleLogger('aztec:builder'); const main = async () => { - const pxeOption = new Option('-u, --rpc-url ', 'URL of the PXE') - .env('PXE_URL') - .default(`http://${LOCALHOST}:8080`) - .makeOptionMandatory(true); - program.name('aztec-builder'); program .command('codegen') @@ -43,14 +26,16 @@ const main = async () => { .argument('[projectPath]', 'Path to the project directory', process.cwd()) .option('--contract [paths...]', 'Paths to contracts to update dependencies', []) .option('--aztec-version ', 'The version to update Aztec packages to. Defaults to latest', 'latest') - .addOption(pxeOption) .action(async (projectPath: string, options) => { const { update } = await import('./cli/update/update.js'); - const { contract, aztecVersion, rpcUrl } = options; - await update(projectPath, contract, rpcUrl, aztecVersion, log); + const { contract, aztecVersion } = options; + await update(projectPath, contract, aztecVersion, log); }); await program.parseAsync(process.argv); + // I force exit here because spawnSync in npm.ts just blocks the process from exiting. Spent a bit of time debugging + // it without success and I think it doesn't make sense to invest more time in this. + process.exit(0); }; main().catch(err => { diff --git a/yarn-project/builder/src/cli/update/update.ts b/yarn-project/builder/src/cli/update/update.ts index 0bbe96639ad..5d518839ebb 100644 --- a/yarn-project/builder/src/cli/update/update.ts +++ b/yarn-project/builder/src/cli/update/update.ts @@ -15,7 +15,6 @@ const UPDATE_DOCS_URL = 'https://docs.aztec.network/developers/updating'; export async function update( projectPath: string, contracts: string[], - pxeUrl: string, aztecVersion: string, log: LogFn, ): Promise {