appwrite-utils-cli 0.10.3 → 0.10.4
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/README.md +1 -0
- package/dist/functions/deployments.js +12 -4
- package/dist/interactiveCLI.js +1 -2
- package/package.json +1 -1
- package/src/functions/deployments.ts +16 -4
- package/src/interactiveCLI.ts +1 -2
package/README.md
CHANGED
@@ -147,6 +147,7 @@ This updated CLI ensures that developers have robust tools at their fingertips t
|
|
147
147
|
|
148
148
|
## Changelog
|
149
149
|
|
150
|
+
- 0.10.04: Fixed stupid progress bar not updating -- also fixed double text
|
150
151
|
- 0.10.03: Fixed `syncDb` to push the configurations properly, accidentally hurt it during `synchronizeConfigurations`
|
151
152
|
- 0.10.02: Updated `wipeCollection` to handle errors gracefully
|
152
153
|
- 0.10.01: Fixed `predeployCommands` to work
|
@@ -47,25 +47,33 @@ export const deployFunction = async (client, functionId, codePath, activate = tr
|
|
47
47
|
const fileObject = InputFile.fromBuffer(new Uint8Array(fileBuffer), `function-${functionId}.tar.gz`);
|
48
48
|
try {
|
49
49
|
console.log(chalk.blue("🚀 Creating deployment..."));
|
50
|
+
// Start with 1 as default total since we don't know the chunk size yet
|
50
51
|
progressBar.start(1, 0);
|
51
52
|
const functionResponse = await functions.createDeployment(functionId, fileObject, activate, entrypoint, commands, (progress) => {
|
52
53
|
const chunks = progress.chunksUploaded;
|
53
54
|
const total = progress.chunksTotal;
|
54
|
-
if (chunks !== undefined && total) {
|
55
|
-
|
56
|
-
|
55
|
+
if (chunks !== undefined && total !== undefined) {
|
56
|
+
// First chunk, initialize the bar with correct total
|
57
|
+
if (chunks === 0) {
|
58
|
+
progressBar.start(total || 100, 0);
|
57
59
|
}
|
58
60
|
else {
|
59
61
|
progressBar.update(chunks);
|
62
|
+
// Check if upload is complete
|
60
63
|
if (chunks === total) {
|
64
|
+
progressBar.update(total);
|
61
65
|
progressBar.stop();
|
62
66
|
console.log(chalk.green("✅ Upload complete!"));
|
63
67
|
}
|
64
68
|
}
|
65
69
|
}
|
66
70
|
});
|
71
|
+
// Ensure progress bar completes even if callback never fired
|
72
|
+
if (progressBar.getProgress() === 0) {
|
73
|
+
progressBar.update(1);
|
74
|
+
progressBar.stop();
|
75
|
+
}
|
67
76
|
await fs.promises.unlink(tarPath);
|
68
|
-
console.log(chalk.green("✨ Function deployed successfully!"));
|
69
77
|
return functionResponse;
|
70
78
|
}
|
71
79
|
catch (error) {
|
package/dist/interactiveCLI.js
CHANGED
@@ -118,7 +118,7 @@ export class InteractiveCLI {
|
|
118
118
|
break;
|
119
119
|
case CHOICES.EXIT:
|
120
120
|
console.log(chalk.green("Goodbye!"));
|
121
|
-
|
121
|
+
process.exit(0);
|
122
122
|
}
|
123
123
|
}
|
124
124
|
}
|
@@ -388,7 +388,6 @@ export class InteractiveCLI {
|
|
388
388
|
console.log(chalk.yellow(`Function not found in primary location, searching subdirectories...`));
|
389
389
|
const foundPath = await this.findFunctionInSubdirectories(this.controller.getAppwriteFolderPath(), functionConfig.name.toLowerCase());
|
390
390
|
if (foundPath) {
|
391
|
-
console.log(chalk.green(`Found function at: ${foundPath}`));
|
392
391
|
functionPath = foundPath;
|
393
392
|
functionConfig.dirPath = foundPath;
|
394
393
|
}
|
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": "0.10.
|
4
|
+
"version": "0.10.04",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -77,7 +77,9 @@ export const deployFunction = async (
|
|
77
77
|
|
78
78
|
try {
|
79
79
|
console.log(chalk.blue("🚀 Creating deployment..."));
|
80
|
+
// Start with 1 as default total since we don't know the chunk size yet
|
80
81
|
progressBar.start(1, 0);
|
82
|
+
|
81
83
|
const functionResponse = await functions.createDeployment(
|
82
84
|
functionId,
|
83
85
|
fileObject,
|
@@ -87,12 +89,17 @@ export const deployFunction = async (
|
|
87
89
|
(progress) => {
|
88
90
|
const chunks = progress.chunksUploaded;
|
89
91
|
const total = progress.chunksTotal;
|
90
|
-
|
91
|
-
|
92
|
-
|
92
|
+
|
93
|
+
if (chunks !== undefined && total !== undefined) {
|
94
|
+
// First chunk, initialize the bar with correct total
|
95
|
+
if (chunks === 0) {
|
96
|
+
progressBar.start(total || 100, 0);
|
93
97
|
} else {
|
94
98
|
progressBar.update(chunks);
|
99
|
+
|
100
|
+
// Check if upload is complete
|
95
101
|
if (chunks === total) {
|
102
|
+
progressBar.update(total);
|
96
103
|
progressBar.stop();
|
97
104
|
console.log(chalk.green("✅ Upload complete!"));
|
98
105
|
}
|
@@ -101,8 +108,13 @@ export const deployFunction = async (
|
|
101
108
|
}
|
102
109
|
);
|
103
110
|
|
111
|
+
// Ensure progress bar completes even if callback never fired
|
112
|
+
if (progressBar.getProgress() === 0) {
|
113
|
+
progressBar.update(1);
|
114
|
+
progressBar.stop();
|
115
|
+
}
|
116
|
+
|
104
117
|
await fs.promises.unlink(tarPath);
|
105
|
-
console.log(chalk.green("✨ Function deployed successfully!"));
|
106
118
|
return functionResponse;
|
107
119
|
} catch (error) {
|
108
120
|
progressBar.stop();
|
package/src/interactiveCLI.ts
CHANGED
@@ -154,7 +154,7 @@ export class InteractiveCLI {
|
|
154
154
|
break;
|
155
155
|
case CHOICES.EXIT:
|
156
156
|
console.log(chalk.green("Goodbye!"));
|
157
|
-
|
157
|
+
process.exit(0);
|
158
158
|
}
|
159
159
|
}
|
160
160
|
}
|
@@ -533,7 +533,6 @@ export class InteractiveCLI {
|
|
533
533
|
);
|
534
534
|
|
535
535
|
if (foundPath) {
|
536
|
-
console.log(chalk.green(`Found function at: ${foundPath}`));
|
537
536
|
functionPath = foundPath;
|
538
537
|
functionConfig.dirPath = foundPath;
|
539
538
|
} else {
|