diff --git a/package-lock.json b/package-lock.json index 497af859..0660a887 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,8 @@ "portfinder": "^1.0.38", "prompts": "^2.4.2", "semver": "^7.7.2", - "terminal-link": "^5.0.0" + "terminal-link": "^5.0.0", + "zod": "^4.1.11" }, "bin": { "juno": "dist/index.js" @@ -6488,7 +6489,6 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-4.1.11.tgz", "integrity": "sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==", "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } @@ -10428,8 +10428,7 @@ "zod": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/zod/-/zod-4.1.11.tgz", - "integrity": "sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==", - "peer": true + "integrity": "sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==" } } } diff --git a/package.json b/package.json index 0bd2b648..c29f0fac 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "portfinder": "^1.0.38", "prompts": "^2.4.2", "semver": "^7.7.2", - "terminal-link": "^5.0.0" + "terminal-link": "^5.0.0", + "zod": "^4.1.11" }, "devDependencies": { "@eslint/eslintrc": "^3.3.1", diff --git a/src/configs/emulator.config.ts b/src/configs/emulator.config.ts index 3e27c440..7c7d77dc 100644 --- a/src/configs/emulator.config.ts +++ b/src/configs/emulator.config.ts @@ -1,5 +1,6 @@ import {type EmulatorConfig, EmulatorConfigSchema} from '@junobuild/config'; import {red} from 'kleur'; +import * as z from 'zod'; import {DEPLOY_LOCAL_REPLICA_PATH} from '../constants/dev.constants'; import {EMULATOR_SKYLAB} from '../constants/emulator.constants'; import {ENV} from '../env'; @@ -16,11 +17,15 @@ export const readEmulatorConfig = async (): Promise< > => { const config = await getEmulatorConfig(); - const {success} = EmulatorConfigSchema.safeParse(config); + const {success, error} = EmulatorConfigSchema.safeParse(config); if (!success) { console.log( red('Invalid configuration: please check the emulator options of your config file.') ); + + const prettyError = z.prettifyError(error); + console.log(prettyError); + return {success: false}; }