appwrite-utils-cli 0.10.63 → 0.10.64
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 +19 -3
- package/package.json +1 -1
- package/src/functions/deployments.ts +26 -6
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.64: Fixed `Deploy Function(s)` not ignoring things properly
|
150
151
|
- 0.10.63: My `collectLocalFunctions` function was failing to add the `scopes` and a few others to the function, accidentally, fixed now
|
151
152
|
- 0.10.62: Made `Deploy Function(s)` also update the functions, as not all things (timeout, specification, etc.) are updated via deploy
|
152
153
|
- 0.10.61: Fixed ignore haha, also added `ignore` to the `Functions` config, to specify what to ignore when creating the `.tar.gz` file
|
@@ -33,6 +33,15 @@ export const deployFunction = async (client, functionId, codePath, activate = tr
|
|
33
33
|
// Convert ignored patterns to lowercase for case-insensitive comparison
|
34
34
|
const ignoredLower = ignored.map((pattern) => pattern.toLowerCase());
|
35
35
|
const tarPath = join(process.cwd(), `function-${functionId}.tar.gz`);
|
36
|
+
// Verify codePath exists and is a directory
|
37
|
+
if (!fs.existsSync(codePath)) {
|
38
|
+
throw new Error(`Function directory not found at ${codePath}`);
|
39
|
+
}
|
40
|
+
const stats = await fs.promises.stat(codePath);
|
41
|
+
if (!stats.isDirectory()) {
|
42
|
+
throw new Error(`${codePath} is not a directory`);
|
43
|
+
}
|
44
|
+
console.log(chalk.blue(`Creating tarball from ${codePath}`));
|
36
45
|
const progressBar = new cliProgress.SingleBar({
|
37
46
|
format: "Uploading |" +
|
38
47
|
chalk.cyan("{bar}") +
|
@@ -47,10 +56,17 @@ export const deployFunction = async (client, functionId, codePath, activate = tr
|
|
47
56
|
cwd: codePath,
|
48
57
|
filter: (path, stat) => {
|
49
58
|
const relativePath = relative(codePath, join(codePath, path)).toLowerCase();
|
50
|
-
|
51
|
-
|
59
|
+
// Skip if path matches any ignored pattern
|
60
|
+
if (ignoredLower.some((pattern) => relativePath.startsWith(pattern) ||
|
61
|
+
relativePath.includes(`/${pattern}`) ||
|
62
|
+
relativePath.includes(`\\${pattern}`))) {
|
63
|
+
console.log(chalk.gray(`Ignoring ${path}`));
|
64
|
+
return false;
|
65
|
+
}
|
66
|
+
return true;
|
52
67
|
},
|
53
|
-
}, ["."]
|
68
|
+
}, ["."] // This now only includes contents of codePath since we set cwd to codePath
|
69
|
+
);
|
54
70
|
const fileBuffer = await fs.promises.readFile(tarPath);
|
55
71
|
const fileObject = InputFile.fromBuffer(new Uint8Array(fileBuffer), `function-${functionId}.tar.gz`);
|
56
72
|
try {
|
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.64",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -57,6 +57,18 @@ export const deployFunction = async (
|
|
57
57
|
|
58
58
|
const tarPath = join(process.cwd(), `function-${functionId}.tar.gz`);
|
59
59
|
|
60
|
+
// Verify codePath exists and is a directory
|
61
|
+
if (!fs.existsSync(codePath)) {
|
62
|
+
throw new Error(`Function directory not found at ${codePath}`);
|
63
|
+
}
|
64
|
+
|
65
|
+
const stats = await fs.promises.stat(codePath);
|
66
|
+
if (!stats.isDirectory()) {
|
67
|
+
throw new Error(`${codePath} is not a directory`);
|
68
|
+
}
|
69
|
+
|
70
|
+
console.log(chalk.blue(`Creating tarball from ${codePath}`));
|
71
|
+
|
60
72
|
const progressBar = new cliProgress.SingleBar({
|
61
73
|
format:
|
62
74
|
"Uploading |" +
|
@@ -77,14 +89,22 @@ export const deployFunction = async (
|
|
77
89
|
codePath,
|
78
90
|
join(codePath, path)
|
79
91
|
).toLowerCase();
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
92
|
+
// Skip if path matches any ignored pattern
|
93
|
+
if (
|
94
|
+
ignoredLower.some(
|
95
|
+
(pattern) =>
|
96
|
+
relativePath.startsWith(pattern) ||
|
97
|
+
relativePath.includes(`/${pattern}`) ||
|
98
|
+
relativePath.includes(`\\${pattern}`)
|
99
|
+
)
|
100
|
+
) {
|
101
|
+
console.log(chalk.gray(`Ignoring ${path}`));
|
102
|
+
return false;
|
103
|
+
}
|
104
|
+
return true;
|
85
105
|
},
|
86
106
|
},
|
87
|
-
["."]
|
107
|
+
["."] // This now only includes contents of codePath since we set cwd to codePath
|
88
108
|
);
|
89
109
|
|
90
110
|
const fileBuffer = await fs.promises.readFile(tarPath);
|