diff --git a/.changeset/fix-directory-path.md b/.changeset/fix-directory-path.md new file mode 100644 index 0000000..f47cb18 --- /dev/null +++ b/.changeset/fix-directory-path.md @@ -0,0 +1,6 @@ +--- +'@powersync/cli-core': patch +'powersync': patch +--- + +fix `--directory` absolute path resolution in CLI diff --git a/cli/src/commands/pull/instance.ts b/cli/src/commands/pull/instance.ts index 9041ee6..0b3fca7 100644 --- a/cli/src/commands/pull/instance.ts +++ b/cli/src/commands/pull/instance.ts @@ -112,7 +112,7 @@ export default class PullInstance extends CloudInstanceCommand { orgId: resolvedLink.org_id, projectId: resolvedLink.project_id }); - this.log(`Created ${ux.colorize('blue', `${directory}/${CLI_FILENAME}`)} with Cloud instance link.`); + this.log(`Created ${ux.colorize('blue', join(projectDir, CLI_FILENAME))} with Cloud instance link.`); } const { linked } = await this.loadProject(flags); diff --git a/packages/cli-core/src/command-types/PowerSyncCommand.ts b/packages/cli-core/src/command-types/PowerSyncCommand.ts index 3685903..62825bf 100644 --- a/packages/cli-core/src/command-types/PowerSyncCommand.ts +++ b/packages/cli-core/src/command-types/PowerSyncCommand.ts @@ -1,6 +1,6 @@ import { JourneyError } from '@journeyapps-labs/micro-errors'; import { Command, ux } from '@oclif/core'; -import { join } from 'node:path'; +import { resolve } from 'node:path'; import { formatPowersyncServiceErrorDisplay, @@ -26,7 +26,7 @@ export abstract class PowerSyncCommand extends Command { /** Resolves the project directory path from the --directory flag (relative to cwd). */ resolveProjectDir(flags: { directory: string }): string { - return join(process.cwd(), flags.directory); + return resolve(process.cwd(), flags.directory); } /**