appwrite-utils-cli 1.2.26 → 1.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,7 @@ import { deployLocalFunction } from "./functions/deployments.js";
16
16
  import { join } from "node:path";
17
17
  import path from "path";
18
18
  import fs from "node:fs";
19
+ import os from "node:os";
19
20
  import { SchemaGenerator } from "./shared/schemaGenerator.js";
20
21
  import { ConfirmationDialogs } from "./shared/confirmationDialogs.js";
21
22
  import { MessageFormatter } from "./shared/messageFormatter.js";
@@ -478,12 +479,25 @@ export class InteractiveCLI {
478
479
  console.log(chalk.gray(` Function name: ${functionConfig.name}`));
479
480
  console.log(chalk.gray(` Function ID: ${functionConfig.$id}`));
480
481
  console.log(chalk.gray(` Config dirPath: ${functionConfig.dirPath || 'undefined'}`));
482
+ if (functionConfig.dirPath) {
483
+ const expandedPath = functionConfig.dirPath.startsWith('~/')
484
+ ? functionConfig.dirPath.replace('~', os.homedir())
485
+ : functionConfig.dirPath;
486
+ console.log(chalk.gray(` Expanded dirPath: ${expandedPath}`));
487
+ }
481
488
  console.log(chalk.gray(` Appwrite folder: ${this.controller.getAppwriteFolderPath()}`));
482
489
  console.log(chalk.gray(` Current working dir: ${process.cwd()}`));
490
+ // Helper function to expand tilde in paths
491
+ const expandTildePath = (path) => {
492
+ if (path.startsWith('~/')) {
493
+ return path.replace('~', os.homedir());
494
+ }
495
+ return path;
496
+ };
483
497
  // Check locations in priority order:
484
498
  const priorityLocations = [
485
- // 1. Config dirPath if specified
486
- functionConfig.dirPath,
499
+ // 1. Config dirPath if specified (with tilde expansion)
500
+ functionConfig.dirPath ? expandTildePath(functionConfig.dirPath) : undefined,
487
501
  // 2. Appwrite config folder/functions/name
488
502
  join(this.controller.getAppwriteFolderPath(), "functions", functionNameLower),
489
503
  // 3. Current working directory/functions/name
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "appwrite-utils-cli",
3
3
  "description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
4
- "version": "1.2.26",
4
+ "version": "1.2.27",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -44,6 +44,7 @@ import { deployLocalFunction } from "./functions/deployments.js";
44
44
  import { join } from "node:path";
45
45
  import path from "path";
46
46
  import fs from "node:fs";
47
+ import os from "node:os";
47
48
  import { SchemaGenerator } from "./shared/schemaGenerator.js";
48
49
  import { ConfirmationDialogs } from "./shared/confirmationDialogs.js";
49
50
  import { MessageFormatter } from "./shared/messageFormatter.js";
@@ -625,13 +626,27 @@ export class InteractiveCLI {
625
626
  console.log(chalk.gray(` Function name: ${functionConfig.name}`));
626
627
  console.log(chalk.gray(` Function ID: ${functionConfig.$id}`));
627
628
  console.log(chalk.gray(` Config dirPath: ${functionConfig.dirPath || 'undefined'}`));
629
+ if (functionConfig.dirPath) {
630
+ const expandedPath = functionConfig.dirPath.startsWith('~/')
631
+ ? functionConfig.dirPath.replace('~', os.homedir())
632
+ : functionConfig.dirPath;
633
+ console.log(chalk.gray(` Expanded dirPath: ${expandedPath}`));
634
+ }
628
635
  console.log(chalk.gray(` Appwrite folder: ${this.controller.getAppwriteFolderPath()}`));
629
636
  console.log(chalk.gray(` Current working dir: ${process.cwd()}`));
630
637
 
638
+ // Helper function to expand tilde in paths
639
+ const expandTildePath = (path: string): string => {
640
+ if (path.startsWith('~/')) {
641
+ return path.replace('~', os.homedir());
642
+ }
643
+ return path;
644
+ };
645
+
631
646
  // Check locations in priority order:
632
647
  const priorityLocations = [
633
- // 1. Config dirPath if specified
634
- functionConfig.dirPath,
648
+ // 1. Config dirPath if specified (with tilde expansion)
649
+ functionConfig.dirPath ? expandTildePath(functionConfig.dirPath) : undefined,
635
650
  // 2. Appwrite config folder/functions/name
636
651
  join(
637
652
  this.controller.getAppwriteFolderPath()!,