appwrite-utils-cli 0.10.5 → 0.10.6
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 +13 -2
- package/dist/main.js +0 -0
- package/package.json +58 -57
- package/src/functions/deployments.ts +16 -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.051: Added `node_modules` and a few others to the ignore
|
150
151
|
- 0.10.05: Made deploy function into deploy function(s) -- so you can do more than one at a time
|
151
152
|
- 0.10.04: Fixed stupid progress bar not updating -- also fixed double text
|
152
153
|
- 0.10.03: Fixed `syncDb` to push the configurations properly, accidentally hurt it during `synchronizeConfigurations`
|
@@ -9,6 +9,7 @@ import chalk from "chalk";
|
|
9
9
|
import cliProgress from "cli-progress";
|
10
10
|
import { execSync } from "child_process";
|
11
11
|
import { createFunction, getFunction, updateFunctionSpecifications, } from "./methods.js";
|
12
|
+
import ignore from "ignore";
|
12
13
|
const findFunctionDirectory = (basePath, functionName) => {
|
13
14
|
const normalizedName = functionName.toLowerCase().replace(/\s+/g, "-");
|
14
15
|
const dirs = fs.readdirSync(basePath, { withFileTypes: true });
|
@@ -26,9 +27,18 @@ const findFunctionDirectory = (basePath, functionName) => {
|
|
26
27
|
}
|
27
28
|
return undefined;
|
28
29
|
};
|
29
|
-
export const deployFunction = async (client, functionId, codePath, activate = true, entrypoint = "index.js", commands
|
30
|
+
export const deployFunction = async (client, functionId, codePath, activate = true, entrypoint = "index.js", commands) => {
|
30
31
|
const functions = new Functions(client);
|
31
|
-
console.log(chalk.blue("
|
32
|
+
console.log(chalk.blue("Preparing function deployment..."));
|
33
|
+
// Setup ignore rules
|
34
|
+
const ig = ignore.default();
|
35
|
+
ig.add(["node_modules", ".git", ".vscode", ".DS_Store"]); // Common directories to ignore
|
36
|
+
// Read .gitignore if it exists
|
37
|
+
const gitignorePath = join(codePath, ".gitignore");
|
38
|
+
if (fs.existsSync(gitignorePath)) {
|
39
|
+
const gitignoreContent = fs.readFileSync(gitignorePath, "utf8");
|
40
|
+
ig.add(gitignoreContent);
|
41
|
+
}
|
32
42
|
const progressBar = new cliProgress.SingleBar({
|
33
43
|
format: "Uploading |" +
|
34
44
|
chalk.cyan("{bar}") +
|
@@ -42,6 +52,7 @@ export const deployFunction = async (client, functionId, codePath, activate = tr
|
|
42
52
|
gzip: true,
|
43
53
|
file: tarPath,
|
44
54
|
cwd: codePath,
|
55
|
+
filter: (path) => !ig.ignores(path), // Use ignore to filter files
|
45
56
|
}, ["."]);
|
46
57
|
const fileBuffer = await fs.promises.readFile(tarPath);
|
47
58
|
const fileObject = InputFile.fromBuffer(new Uint8Array(fileBuffer), `function-${functionId}.tar.gz`);
|
package/dist/main.js
CHANGED
File without changes
|
package/package.json
CHANGED
@@ -1,57 +1,58 @@
|
|
1
|
-
{
|
2
|
-
"name": "appwrite-utils-cli",
|
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.
|
5
|
-
"main": "src/main.ts",
|
6
|
-
"type": "module",
|
7
|
-
"repository": {
|
8
|
-
"type": "git",
|
9
|
-
"url": "https://github.com/zachhandley/AppwriteUtils"
|
10
|
-
},
|
11
|
-
"author": "Zach Handley <zach@blackleafdigital.com> (https://zachhandley.com)",
|
12
|
-
"keywords": [
|
13
|
-
"appwrite",
|
14
|
-
"cli",
|
15
|
-
"utils",
|
16
|
-
"migrations",
|
17
|
-
"data",
|
18
|
-
"database",
|
19
|
-
"import",
|
20
|
-
"migration",
|
21
|
-
"utility"
|
22
|
-
],
|
23
|
-
"bin": {
|
24
|
-
"appwrite-migrate": "./dist/main.js"
|
25
|
-
},
|
26
|
-
"scripts": {
|
27
|
-
"build": "bun run tsc",
|
28
|
-
"start": "tsx --no-cache src/main.ts",
|
29
|
-
"deploy": "bun run build && npm publish --access public",
|
30
|
-
"postinstall": "echo 'This package is intended for CLI use only and should not be added as a dependency in other projects.'"
|
31
|
-
},
|
32
|
-
"dependencies": {
|
33
|
-
"@types/inquirer": "^9.0.7",
|
34
|
-
"appwrite-utils": "^0.3.97",
|
35
|
-
"chalk": "^5.3.0",
|
36
|
-
"cli-progress": "^3.12.0",
|
37
|
-
"commander": "^12.1.0",
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
"@types/
|
53
|
-
"@types/
|
54
|
-
"@types/
|
55
|
-
"
|
56
|
-
|
57
|
-
}
|
1
|
+
{
|
2
|
+
"name": "appwrite-utils-cli",
|
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.06",
|
5
|
+
"main": "src/main.ts",
|
6
|
+
"type": "module",
|
7
|
+
"repository": {
|
8
|
+
"type": "git",
|
9
|
+
"url": "https://github.com/zachhandley/AppwriteUtils"
|
10
|
+
},
|
11
|
+
"author": "Zach Handley <zach@blackleafdigital.com> (https://zachhandley.com)",
|
12
|
+
"keywords": [
|
13
|
+
"appwrite",
|
14
|
+
"cli",
|
15
|
+
"utils",
|
16
|
+
"migrations",
|
17
|
+
"data",
|
18
|
+
"database",
|
19
|
+
"import",
|
20
|
+
"migration",
|
21
|
+
"utility"
|
22
|
+
],
|
23
|
+
"bin": {
|
24
|
+
"appwrite-migrate": "./dist/main.js"
|
25
|
+
},
|
26
|
+
"scripts": {
|
27
|
+
"build": "bun run tsc",
|
28
|
+
"start": "tsx --no-cache src/main.ts",
|
29
|
+
"deploy": "bun run build && npm publish --access public",
|
30
|
+
"postinstall": "echo 'This package is intended for CLI use only and should not be added as a dependency in other projects.'"
|
31
|
+
},
|
32
|
+
"dependencies": {
|
33
|
+
"@types/inquirer": "^9.0.7",
|
34
|
+
"appwrite-utils": "^0.3.97",
|
35
|
+
"chalk": "^5.3.0",
|
36
|
+
"cli-progress": "^3.12.0",
|
37
|
+
"commander": "^12.1.0",
|
38
|
+
"ignore": "^6.0.2",
|
39
|
+
"inquirer": "^9.3.6",
|
40
|
+
"js-yaml": "^4.1.0",
|
41
|
+
"lodash": "^4.17.21",
|
42
|
+
"luxon": "^3.5.0",
|
43
|
+
"nanostores": "^0.10.3",
|
44
|
+
"node-appwrite": "^14.1.0",
|
45
|
+
"tar": "^7.4.3",
|
46
|
+
"tsx": "^4.17.0",
|
47
|
+
"ulidx": "^2.4.0",
|
48
|
+
"winston": "^3.14.2",
|
49
|
+
"zod": "^3.23.8"
|
50
|
+
},
|
51
|
+
"devDependencies": {
|
52
|
+
"@types/cli-progress": "^3.11.6",
|
53
|
+
"@types/js-yaml": "^4.0.9",
|
54
|
+
"@types/lodash": "^4.17.7",
|
55
|
+
"@types/luxon": "^3.4.2",
|
56
|
+
"typescript": "^5.5.4"
|
57
|
+
}
|
58
|
+
}
|
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
getFunction,
|
14
14
|
updateFunctionSpecifications,
|
15
15
|
} from "./methods.js";
|
16
|
+
import ignore from "ignore";
|
16
17
|
|
17
18
|
const findFunctionDirectory = (
|
18
19
|
basePath: string,
|
@@ -44,10 +45,21 @@ export const deployFunction = async (
|
|
44
45
|
codePath: string,
|
45
46
|
activate: boolean = true,
|
46
47
|
entrypoint: string = "index.js",
|
47
|
-
commands
|
48
|
+
commands?: string
|
48
49
|
) => {
|
49
50
|
const functions = new Functions(client);
|
50
|
-
console.log(chalk.blue("
|
51
|
+
console.log(chalk.blue("Preparing function deployment..."));
|
52
|
+
|
53
|
+
// Setup ignore rules
|
54
|
+
const ig = ignore.default();
|
55
|
+
ig.add(["node_modules", ".git", ".vscode", ".DS_Store"]); // Common directories to ignore
|
56
|
+
|
57
|
+
// Read .gitignore if it exists
|
58
|
+
const gitignorePath = join(codePath, ".gitignore");
|
59
|
+
if (fs.existsSync(gitignorePath)) {
|
60
|
+
const gitignoreContent = fs.readFileSync(gitignorePath, "utf8");
|
61
|
+
ig.add(gitignoreContent);
|
62
|
+
}
|
51
63
|
|
52
64
|
const progressBar = new cliProgress.SingleBar({
|
53
65
|
format:
|
@@ -60,11 +72,13 @@ export const deployFunction = async (
|
|
60
72
|
});
|
61
73
|
|
62
74
|
const tarPath = join(process.cwd(), `function-${functionId}.tar.gz`);
|
75
|
+
|
63
76
|
await createTarball(
|
64
77
|
{
|
65
78
|
gzip: true,
|
66
79
|
file: tarPath,
|
67
80
|
cwd: codePath,
|
81
|
+
filter: (path) => !ig.ignores(path), // Use ignore to filter files
|
68
82
|
},
|
69
83
|
["."]
|
70
84
|
);
|