diff --git a/package-lock.json b/package-lock.json index 4300da6..f323392 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,8 +15,8 @@ "@icp-sdk/core": "^5.0.0", "@junobuild/admin": "^4.0.0", "@junobuild/cdn": "^2.2.1", - "@junobuild/cli-tools": "^0.10.0", - "@junobuild/config": "^2.9.0", + "@junobuild/cli-tools": "^0.10.1-next-2026-02-08", + "@junobuild/config": "^2.10.1-next-2026-02-08", "@junobuild/config-loader": "^0.4.7", "@junobuild/core": "^3.4.1", "@junobuild/did-tools": "^0.3.8", @@ -1470,9 +1470,9 @@ } }, "node_modules/@isaacs/brace-expansion": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", - "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.1.tgz", + "integrity": "sha512-WMz71T1JS624nWj2n2fnYAuPovhv7EUhk69R6i9dsVyzxt5eM3bjwvgk9L+APE1TRscGysAVMANkB0jh0LQZrQ==", "license": "MIT", "dependencies": { "@isaacs/balanced-match": "^4.0.1" @@ -1569,34 +1569,34 @@ } }, "node_modules/@junobuild/cli-tools": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@junobuild/cli-tools/-/cli-tools-0.10.0.tgz", - "integrity": "sha512-bIXAswwyBbji+Owtnrfz4mrfwbfoL5E/2BveTg3C22e4oNjFNVLuWAQ3dIf3NRYPbTMaXBPWAGyDRp8t/JYrCA==", + "version": "0.10.1-next-2026-02-08", + "resolved": "https://registry.npmjs.org/@junobuild/cli-tools/-/cli-tools-0.10.1-next-2026-02-08.tgz", + "integrity": "sha512-K1ykaUufwKCq3XuhPtxR1EnS/hrBXaMsWHj1gJHQKucjnylq+mmdJoVlGwN3IjfsgTTHe4gRY1Jkn7fM8006RA==", "license": "MIT", "dependencies": { "file-type": "^21.1.1", "listr2": "^9.0.5", "mime-types": "^3.0.2", - "minimatch": "^10.1.1" + "minimatch": "^10.1.2" }, "peerDependencies": { - "@dfinity/utils": "^4.1", - "@junobuild/cdn": "^2", - "@junobuild/config": "^2.7", - "@junobuild/storage": "^2.2", - "esbuild": "^0.27.0", - "ora": "^9" + "@dfinity/utils": "*", + "@junobuild/cdn": "*", + "@junobuild/config": "*", + "@junobuild/storage": "*", + "esbuild": "*", + "ora": "*" } }, "node_modules/@junobuild/config": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/@junobuild/config/-/config-2.9.0.tgz", - "integrity": "sha512-Ej4Y2FIZ7rEKNFcTg81zTLpdidPyfxj6cibMuZbuDXWhCzHDJjq8mTP1pbOu3OiRWVyJFbbafuS7LtqT5b/8vA==", + "version": "2.10.1-next-2026-02-08", + "resolved": "https://registry.npmjs.org/@junobuild/config/-/config-2.10.1-next-2026-02-08.tgz", + "integrity": "sha512-NhEfyau0yXPqyPdkj3pH0kn2Hi6LFfuE+XUDfkA24FmIXXvwxOT7dS7D+OrLYDqvm5V7HOpvDyuae4lH3HrAhw==", "license": "MIT", "peer": true, "peerDependencies": { - "@dfinity/zod-schemas": "^3", - "zod": "^4" + "@dfinity/zod-schemas": "*", + "zod": "*" } }, "node_modules/@junobuild/config-loader": { @@ -1729,7 +1729,6 @@ "integrity": "sha512-6LdVIUERWxQMmUSSQi0I53GgCBYgM2RpGngCPY7hSeju+VrKjq3lvs7HpJoPbDiY5QM5EYRtRX5fvrinnMAz3w==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "playwright": "1.58.1" }, @@ -3704,9 +3703,9 @@ } }, "node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", "license": "MIT" }, "node_modules/fast-deep-equal": { @@ -4946,12 +4945,12 @@ } }, "node_modules/minimatch": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", - "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.2.tgz", + "integrity": "sha512-fu656aJ0n2kcXwsnwnv9g24tkU5uSmOlTjd6WyyaKm2Z+h1qmY6bAjrcaIxF/BslFqbZ8UBtbJi7KgQOZD2PTw==", "license": "BlueOak-1.0.0", "dependencies": { - "@isaacs/brace-expansion": "^5.0.0" + "@isaacs/brace-expansion": "^5.0.1" }, "engines": { "node": "20 || >=22" @@ -7375,9 +7374,9 @@ "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==" }, "@isaacs/brace-expansion": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", - "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.1.tgz", + "integrity": "sha512-WMz71T1JS624nWj2n2fnYAuPovhv7EUhk69R6i9dsVyzxt5eM3bjwvgk9L+APE1TRscGysAVMANkB0jh0LQZrQ==", "requires": { "@isaacs/balanced-match": "^4.0.1" } @@ -7439,20 +7438,20 @@ "requires": {} }, "@junobuild/cli-tools": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@junobuild/cli-tools/-/cli-tools-0.10.0.tgz", - "integrity": "sha512-bIXAswwyBbji+Owtnrfz4mrfwbfoL5E/2BveTg3C22e4oNjFNVLuWAQ3dIf3NRYPbTMaXBPWAGyDRp8t/JYrCA==", + "version": "0.10.1-next-2026-02-08", + "resolved": "https://registry.npmjs.org/@junobuild/cli-tools/-/cli-tools-0.10.1-next-2026-02-08.tgz", + "integrity": "sha512-K1ykaUufwKCq3XuhPtxR1EnS/hrBXaMsWHj1gJHQKucjnylq+mmdJoVlGwN3IjfsgTTHe4gRY1Jkn7fM8006RA==", "requires": { "file-type": "^21.1.1", "listr2": "^9.0.5", "mime-types": "^3.0.2", - "minimatch": "^10.1.1" + "minimatch": "^10.1.2" } }, "@junobuild/config": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/@junobuild/config/-/config-2.9.0.tgz", - "integrity": "sha512-Ej4Y2FIZ7rEKNFcTg81zTLpdidPyfxj6cibMuZbuDXWhCzHDJjq8mTP1pbOu3OiRWVyJFbbafuS7LtqT5b/8vA==", + "version": "2.10.1-next-2026-02-08", + "resolved": "https://registry.npmjs.org/@junobuild/config/-/config-2.10.1-next-2026-02-08.tgz", + "integrity": "sha512-NhEfyau0yXPqyPdkj3pH0kn2Hi6LFfuE+XUDfkA24FmIXXvwxOT7dS7D+OrLYDqvm5V7HOpvDyuae4lH3HrAhw==", "peer": true, "requires": {} }, @@ -7531,7 +7530,6 @@ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.58.1.tgz", "integrity": "sha512-6LdVIUERWxQMmUSSQi0I53GgCBYgM2RpGngCPY7hSeju+VrKjq3lvs7HpJoPbDiY5QM5EYRtRX5fvrinnMAz3w==", "dev": true, - "peer": true, "requires": { "playwright": "1.58.1" } @@ -8799,9 +8797,9 @@ "dev": true }, "eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==" }, "fast-deep-equal": { "version": "3.1.3", @@ -9548,11 +9546,11 @@ "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==" }, "minimatch": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", - "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.2.tgz", + "integrity": "sha512-fu656aJ0n2kcXwsnwnv9g24tkU5uSmOlTjd6WyyaKm2Z+h1qmY6bAjrcaIxF/BslFqbZ8UBtbJi7KgQOZD2PTw==", "requires": { - "@isaacs/brace-expansion": "^5.0.0" + "@isaacs/brace-expansion": "^5.0.1" } }, "minimist": { diff --git a/package.json b/package.json index cb55f64..07a3644 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "@icp-sdk/core": "^5.0.0", "@junobuild/admin": "^4.0.0", "@junobuild/cdn": "^2.2.1", - "@junobuild/cli-tools": "^0.10.0", - "@junobuild/config": "^2.9.0", + "@junobuild/cli-tools": "^0.10.1-next-2026-02-08", + "@junobuild/config": "^2.10.1-next-2026-02-08", "@junobuild/config-loader": "^0.4.7", "@junobuild/core": "^3.4.1", "@junobuild/did-tools": "^0.3.8", diff --git a/src/services/emulator/_runner.services.ts b/src/services/emulator/_runner.services.ts index 81948f2..826bf02 100644 --- a/src/services/emulator/_runner.services.ts +++ b/src/services/emulator/_runner.services.ts @@ -2,10 +2,9 @@ import {nonNullish} from '@dfinity/utils'; import {assertAnswerCtrlC, execute, spawn} from '@junobuild/cli-tools'; import {type EmulatorPorts} from '@junobuild/config'; import {red, yellow} from 'kleur'; -import {basename, join} from 'node:path'; import prompts from 'prompts'; import {readEmulatorConfig} from '../../configs/emulator.config'; -import {junoConfigExist, junoConfigFile} from '../../configs/juno.config'; +import {junoConfigExist} from '../../configs/juno.config'; import { EMULATOR_PORT_ADMIN, EMULATOR_PORT_CONSOLE, @@ -100,9 +99,10 @@ const promptRunnerType = async (): Promise<{runnerType: EmulatorRunnerType}> => choices: [ { title: 'Docker', - value: `docker` + value: 'docker' }, - {title: `Podman`, value: `podman`} + {title: 'Podman', value: 'podman'}, + {title: 'Apple container', value: 'container'} ] }); @@ -202,12 +202,6 @@ const startEmulator = async ({config: extendedConfig}: {config: CliEmulatorConfi const volume = config.runner?.volume ?? containerName.replaceAll('-', '_'); - const detectedConfig = junoConfigFile(); - const configFile = nonNullish(detectedConfig.configPath) - ? basename(detectedConfig.configPath) - : undefined; - const configFilePath = nonNullish(configFile) ? join(process.cwd(), configFile) : undefined; - // Podman does not auto create the path folders. await createDeployTargetDir({targetDeploy}); @@ -237,9 +231,6 @@ const startEmulator = async ({config: extendedConfig}: {config: CliEmulatorConfi : []), '-v', `${volume}:/juno/.juno`, - ...(nonNullish(configFile) && nonNullish(configFilePath) - ? ['-v', `${configFilePath}:/juno/${configFile}`] - : []), '-v', `${targetDeploy}:/juno/target/deploy`, ...(nonNullish(platform) ? [`--platform=${platform}`] : []), diff --git a/src/utils/runner.utils.ts b/src/utils/runner.utils.ts index 1847cc8..ce4a425 100644 --- a/src/utils/runner.utils.ts +++ b/src/utils/runner.utils.ts @@ -1,3 +1,4 @@ +import {notEmptyString} from '@dfinity/utils'; import {spawn} from '@junobuild/cli-tools'; import {green, red, yellow} from 'kleur'; import {lt} from 'semver'; @@ -35,9 +36,13 @@ export const assertContainerRunnerRunning = async ({ runner }: Pick) => { try { + // container does not support ps + // Reference: https://github.com/apple/container/pull/299 + const args = runner === 'container' ? ['ls', '--quiet'] : ['ps', '--quiet']; + await spawn({ command: runner, - args: ['ps', '--quiet'], + args, silentOut: true }); } catch (_e: unknown) { @@ -54,13 +59,27 @@ export const hasExistingContainer = async ({ > => { try { let output = ''; + + const args = + runner === 'container' ? ['ls', '-aq'] : ['ps', '-aq', '-f', `name=^/${containerName}$`]; + await spawn({ command: runner, - args: ['ps', '-aq', '-f', `name=^/${containerName}$`], + args, stdout: (o) => (output += o), silentOut: true }); + if (runner === 'container') { + const exist = output + .split(/\r?\n/) + .map((line) => line.trim()) + .filter(notEmptyString) + .some((name) => name === containerName); + + return {exist}; + } + return {exist: output.trim().length > 0}; } catch (err: unknown) { return {err}; @@ -75,13 +94,29 @@ export const isContainerRunning = async ({ > => { try { let output = ''; + + const args = + runner === 'container' + ? ['ls', '--quiet'] + : ['ps', '--quiet', '-f', `name=^/${containerName}$`]; + await spawn({ command: runner, - args: ['ps', '--quiet', '-f', `name=^/${containerName}$`], + args, stdout: (o) => (output += o), silentOut: true }); + if (runner === 'container') { + const running = output + .split(/\r?\n/) + .map((line) => line.trim()) + .filter(notEmptyString) + .some((name) => name === containerName); + + return {running}; + } + return {running: output.trim().length > 0}; } catch (err: unknown) { return {err};