appwrite-utils-cli 1.2.25 → 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.
- package/dist/interactiveCLI.js +29 -3
- package/package.json +1 -1
- package/src/interactiveCLI.ts +32 -3
package/dist/interactiveCLI.js
CHANGED
@@ -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";
|
@@ -473,10 +474,30 @@ export class InteractiveCLI {
|
|
473
474
|
const functionNameLower = functionConfig.name
|
474
475
|
.toLowerCase()
|
475
476
|
.replace(/\s+/g, "-");
|
477
|
+
// Debug logging
|
478
|
+
console.log(chalk.blue(`🔍 Function deployment debug:`));
|
479
|
+
console.log(chalk.gray(` Function name: ${functionConfig.name}`));
|
480
|
+
console.log(chalk.gray(` Function ID: ${functionConfig.$id}`));
|
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
|
+
}
|
488
|
+
console.log(chalk.gray(` Appwrite folder: ${this.controller.getAppwriteFolderPath()}`));
|
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
|
+
};
|
476
497
|
// Check locations in priority order:
|
477
498
|
const priorityLocations = [
|
478
|
-
// 1. Config dirPath if specified
|
479
|
-
functionConfig.dirPath,
|
499
|
+
// 1. Config dirPath if specified (with tilde expansion)
|
500
|
+
functionConfig.dirPath ? expandTildePath(functionConfig.dirPath) : undefined,
|
480
501
|
// 2. Appwrite config folder/functions/name
|
481
502
|
join(this.controller.getAppwriteFolderPath(), "functions", functionNameLower),
|
482
503
|
// 3. Current working directory/functions/name
|
@@ -484,11 +505,16 @@ export class InteractiveCLI {
|
|
484
505
|
// 4. Current working directory/name
|
485
506
|
join(process.cwd(), functionNameLower),
|
486
507
|
].filter((val) => val !== undefined); // Remove undefined entries (in case dirPath is undefined)
|
508
|
+
console.log(chalk.blue(`🔍 Priority locations to check:`));
|
509
|
+
priorityLocations.forEach((loc, i) => {
|
510
|
+
console.log(chalk.gray(` ${i + 1}. ${loc}`));
|
511
|
+
});
|
487
512
|
let functionPath = null;
|
488
513
|
// Check each priority location
|
489
514
|
for (const location of priorityLocations) {
|
515
|
+
console.log(chalk.gray(` Checking: ${location} - ${fs.existsSync(location) ? 'EXISTS' : 'NOT FOUND'}`));
|
490
516
|
if (fs.existsSync(location)) {
|
491
|
-
console.log(chalk.green(
|
517
|
+
console.log(chalk.green(`✅ Found function at: ${location}`));
|
492
518
|
functionPath = location;
|
493
519
|
break;
|
494
520
|
}
|
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.
|
4
|
+
"version": "1.2.27",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
package/src/interactiveCLI.ts
CHANGED
@@ -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";
|
@@ -620,10 +621,32 @@ export class InteractiveCLI {
|
|
620
621
|
.toLowerCase()
|
621
622
|
.replace(/\s+/g, "-");
|
622
623
|
|
624
|
+
// Debug logging
|
625
|
+
console.log(chalk.blue(`🔍 Function deployment debug:`));
|
626
|
+
console.log(chalk.gray(` Function name: ${functionConfig.name}`));
|
627
|
+
console.log(chalk.gray(` Function ID: ${functionConfig.$id}`));
|
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
|
+
}
|
635
|
+
console.log(chalk.gray(` Appwrite folder: ${this.controller.getAppwriteFolderPath()}`));
|
636
|
+
console.log(chalk.gray(` Current working dir: ${process.cwd()}`));
|
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
|
+
|
623
646
|
// Check locations in priority order:
|
624
647
|
const priorityLocations = [
|
625
|
-
// 1. Config dirPath if specified
|
626
|
-
functionConfig.dirPath,
|
648
|
+
// 1. Config dirPath if specified (with tilde expansion)
|
649
|
+
functionConfig.dirPath ? expandTildePath(functionConfig.dirPath) : undefined,
|
627
650
|
// 2. Appwrite config folder/functions/name
|
628
651
|
join(
|
629
652
|
this.controller.getAppwriteFolderPath()!,
|
@@ -636,12 +659,18 @@ export class InteractiveCLI {
|
|
636
659
|
join(process.cwd(), functionNameLower),
|
637
660
|
].filter((val): val is string => val !== undefined); // Remove undefined entries (in case dirPath is undefined)
|
638
661
|
|
662
|
+
console.log(chalk.blue(`🔍 Priority locations to check:`));
|
663
|
+
priorityLocations.forEach((loc, i) => {
|
664
|
+
console.log(chalk.gray(` ${i + 1}. ${loc}`));
|
665
|
+
});
|
666
|
+
|
639
667
|
let functionPath: string | null = null;
|
640
668
|
|
641
669
|
// Check each priority location
|
642
670
|
for (const location of priorityLocations) {
|
671
|
+
console.log(chalk.gray(` Checking: ${location} - ${fs.existsSync(location) ? 'EXISTS' : 'NOT FOUND'}`));
|
643
672
|
if (fs.existsSync(location)) {
|
644
|
-
console.log(chalk.green(
|
673
|
+
console.log(chalk.green(`✅ Found function at: ${location}`));
|
645
674
|
functionPath = location;
|
646
675
|
break;
|
647
676
|
}
|