chirag-appwrite-cli 0.2.0 → 0.2.1
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/cli.ts +168 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +145 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -144
- package/dist/index.js.map +1 -1
- package/dist/package.json +9 -9
- package/index.ts +5 -167
- package/package.json +9 -9
package/cli.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/** Required to set max width of the help commands */
|
|
4
|
+
const oldWidth = process.stdout.columns;
|
|
5
|
+
process.stdout.columns = 100;
|
|
6
|
+
/** ---------------------------------------------- */
|
|
7
|
+
|
|
8
|
+
import { program } from "commander";
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
import packageJson from "./package.json" with { type: "json" };
|
|
11
|
+
const { version } = packageJson;
|
|
12
|
+
import { commandDescriptions, cliConfig } from "./lib/parser.js";
|
|
13
|
+
import { client } from "./lib/commands/generic.js";
|
|
14
|
+
import { getLatestVersion, compareVersions } from "./lib/utils.js";
|
|
15
|
+
import inquirer from "inquirer";
|
|
16
|
+
import {
|
|
17
|
+
login,
|
|
18
|
+
logout,
|
|
19
|
+
whoami,
|
|
20
|
+
migrate,
|
|
21
|
+
register,
|
|
22
|
+
} from "./lib/commands/generic.js";
|
|
23
|
+
import { init } from "./lib/commands/init.js";
|
|
24
|
+
import { types } from "./lib/commands/types.js";
|
|
25
|
+
import { pull } from "./lib/commands/pull.js";
|
|
26
|
+
import { run } from "./lib/commands/run.js";
|
|
27
|
+
import { push, deploy } from "./lib/commands/push.js";
|
|
28
|
+
import { update } from "./lib/commands/update.js";
|
|
29
|
+
import { account } from "./lib/commands/services/account.js";
|
|
30
|
+
import { console } from "./lib/commands/services/console.js";
|
|
31
|
+
import { databases } from "./lib/commands/services/databases.js";
|
|
32
|
+
import { functions } from "./lib/commands/services/functions.js";
|
|
33
|
+
import { graphql } from "./lib/commands/services/graphql.js";
|
|
34
|
+
import { health } from "./lib/commands/services/health.js";
|
|
35
|
+
import { locale } from "./lib/commands/services/locale.js";
|
|
36
|
+
import { messaging } from "./lib/commands/services/messaging.js";
|
|
37
|
+
import { migrations } from "./lib/commands/services/migrations.js";
|
|
38
|
+
import { project } from "./lib/commands/services/project.js";
|
|
39
|
+
import { projects } from "./lib/commands/services/projects.js";
|
|
40
|
+
import { proxy } from "./lib/commands/services/proxy.js";
|
|
41
|
+
import { sites } from "./lib/commands/services/sites.js";
|
|
42
|
+
import { storage } from "./lib/commands/services/storage.js";
|
|
43
|
+
import { tablesdb } from "./lib/commands/services/tablesdb.js";
|
|
44
|
+
import { teams } from "./lib/commands/services/teams.js";
|
|
45
|
+
import { tokens } from "./lib/commands/services/tokens.js";
|
|
46
|
+
import { users } from "./lib/commands/services/users.js";
|
|
47
|
+
import { vcs } from "./lib/commands/services/vcs.js";
|
|
48
|
+
import searchList from "inquirer-search-list";
|
|
49
|
+
|
|
50
|
+
inquirer.registerPrompt("search-list", searchList);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Check for updates and show version information
|
|
54
|
+
*/
|
|
55
|
+
async function checkVersion(): Promise<void> {
|
|
56
|
+
process.stdout.write(chalk.bold(`appwrite version ${version}`) + "\n");
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const latestVersion = await getLatestVersion();
|
|
60
|
+
const comparison = compareVersions(version, latestVersion);
|
|
61
|
+
|
|
62
|
+
if (comparison > 0) {
|
|
63
|
+
// Current version is older than latest
|
|
64
|
+
process.stdout.write(
|
|
65
|
+
chalk.yellow(
|
|
66
|
+
`\n⚠️ A newer version is available: ${chalk.bold(latestVersion)}`,
|
|
67
|
+
) + "\n",
|
|
68
|
+
);
|
|
69
|
+
process.stdout.write(
|
|
70
|
+
chalk.cyan(
|
|
71
|
+
`💡 Run '${chalk.bold("appwrite update")}' to update to the latest version.`,
|
|
72
|
+
) + "\n",
|
|
73
|
+
);
|
|
74
|
+
} else if (comparison === 0) {
|
|
75
|
+
process.stdout.write(
|
|
76
|
+
chalk.green("\n✅ You are running the latest version!") + "\n",
|
|
77
|
+
);
|
|
78
|
+
} else {
|
|
79
|
+
// Current version is newer than latest (pre-release/dev)
|
|
80
|
+
process.stdout.write(
|
|
81
|
+
chalk.blue(
|
|
82
|
+
"\n🚀 You are running a pre-release or development version.",
|
|
83
|
+
) + "\n",
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
} catch (error) {
|
|
87
|
+
// Silently fail version check, just show current version
|
|
88
|
+
process.stdout.write(chalk.gray("\n(Unable to check for updates)") + "\n");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Intercept version flag before Commander.js processes it
|
|
93
|
+
if (process.argv.includes("-v") || process.argv.includes("--version")) {
|
|
94
|
+
(async () => {
|
|
95
|
+
await checkVersion();
|
|
96
|
+
process.exit(0);
|
|
97
|
+
})();
|
|
98
|
+
} else {
|
|
99
|
+
program
|
|
100
|
+
.description(commandDescriptions["main"])
|
|
101
|
+
.configureHelp({
|
|
102
|
+
helpWidth: process.stdout.columns || 80,
|
|
103
|
+
sortSubcommands: true,
|
|
104
|
+
})
|
|
105
|
+
.helpOption("-h, --help", "Display help for command")
|
|
106
|
+
.version(version, "-v, --version", "Output the version number")
|
|
107
|
+
.option("-V, --verbose", "Show complete error log")
|
|
108
|
+
.option("-j, --json", "Output in JSON format")
|
|
109
|
+
.hook("preAction", migrate)
|
|
110
|
+
.option("-f,--force", "Flag to confirm all warnings")
|
|
111
|
+
.option("-a,--all", "Flag to push all resources")
|
|
112
|
+
.option("--id [id...]", "Flag to pass a list of ids for a given action")
|
|
113
|
+
.option("--report", "Enable reporting in case of CLI errors")
|
|
114
|
+
.on("option:json", () => {
|
|
115
|
+
cliConfig.json = true;
|
|
116
|
+
})
|
|
117
|
+
.on("option:verbose", () => {
|
|
118
|
+
cliConfig.verbose = true;
|
|
119
|
+
})
|
|
120
|
+
.on("option:report", function () {
|
|
121
|
+
cliConfig.report = true;
|
|
122
|
+
cliConfig.reportData = { data: this };
|
|
123
|
+
})
|
|
124
|
+
.on("option:force", () => {
|
|
125
|
+
cliConfig.force = true;
|
|
126
|
+
})
|
|
127
|
+
.on("option:all", () => {
|
|
128
|
+
cliConfig.all = true;
|
|
129
|
+
})
|
|
130
|
+
.on("option:id", function () {
|
|
131
|
+
cliConfig.ids = (this as any).opts().id;
|
|
132
|
+
})
|
|
133
|
+
.showSuggestionAfterError()
|
|
134
|
+
.addCommand(whoami)
|
|
135
|
+
.addCommand(register)
|
|
136
|
+
.addCommand(login)
|
|
137
|
+
.addCommand(init)
|
|
138
|
+
.addCommand(pull)
|
|
139
|
+
.addCommand(push)
|
|
140
|
+
.addCommand(types)
|
|
141
|
+
.addCommand(deploy)
|
|
142
|
+
.addCommand(run)
|
|
143
|
+
.addCommand(update)
|
|
144
|
+
.addCommand(logout)
|
|
145
|
+
.addCommand(account)
|
|
146
|
+
.addCommand(console)
|
|
147
|
+
.addCommand(databases)
|
|
148
|
+
.addCommand(functions)
|
|
149
|
+
.addCommand(graphql)
|
|
150
|
+
.addCommand(health)
|
|
151
|
+
.addCommand(locale)
|
|
152
|
+
.addCommand(messaging)
|
|
153
|
+
.addCommand(migrations)
|
|
154
|
+
.addCommand(project)
|
|
155
|
+
.addCommand(projects)
|
|
156
|
+
.addCommand(proxy)
|
|
157
|
+
.addCommand(sites)
|
|
158
|
+
.addCommand(storage)
|
|
159
|
+
.addCommand(tablesdb)
|
|
160
|
+
.addCommand(teams)
|
|
161
|
+
.addCommand(tokens)
|
|
162
|
+
.addCommand(users)
|
|
163
|
+
.addCommand(vcs)
|
|
164
|
+
.addCommand(client)
|
|
165
|
+
.parse(process.argv);
|
|
166
|
+
|
|
167
|
+
process.stdout.columns = oldWidth;
|
|
168
|
+
}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
/** Required to set max width of the help commands */
|
|
3
|
+
const oldWidth = process.stdout.columns;
|
|
4
|
+
process.stdout.columns = 100;
|
|
5
|
+
/** ---------------------------------------------- */
|
|
6
|
+
import { program } from "commander";
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
import packageJson from "./package.json" with { type: "json" };
|
|
9
|
+
const { version } = packageJson;
|
|
10
|
+
import { commandDescriptions, cliConfig } from "./lib/parser.js";
|
|
11
|
+
import { client } from "./lib/commands/generic.js";
|
|
12
|
+
import { getLatestVersion, compareVersions } from "./lib/utils.js";
|
|
13
|
+
import inquirer from "inquirer";
|
|
14
|
+
import { login, logout, whoami, migrate, register, } from "./lib/commands/generic.js";
|
|
15
|
+
import { init } from "./lib/commands/init.js";
|
|
16
|
+
import { types } from "./lib/commands/types.js";
|
|
17
|
+
import { pull } from "./lib/commands/pull.js";
|
|
18
|
+
import { run } from "./lib/commands/run.js";
|
|
19
|
+
import { push, deploy } from "./lib/commands/push.js";
|
|
20
|
+
import { update } from "./lib/commands/update.js";
|
|
21
|
+
import { account } from "./lib/commands/services/account.js";
|
|
22
|
+
import { console } from "./lib/commands/services/console.js";
|
|
23
|
+
import { databases } from "./lib/commands/services/databases.js";
|
|
24
|
+
import { functions } from "./lib/commands/services/functions.js";
|
|
25
|
+
import { graphql } from "./lib/commands/services/graphql.js";
|
|
26
|
+
import { health } from "./lib/commands/services/health.js";
|
|
27
|
+
import { locale } from "./lib/commands/services/locale.js";
|
|
28
|
+
import { messaging } from "./lib/commands/services/messaging.js";
|
|
29
|
+
import { migrations } from "./lib/commands/services/migrations.js";
|
|
30
|
+
import { project } from "./lib/commands/services/project.js";
|
|
31
|
+
import { projects } from "./lib/commands/services/projects.js";
|
|
32
|
+
import { proxy } from "./lib/commands/services/proxy.js";
|
|
33
|
+
import { sites } from "./lib/commands/services/sites.js";
|
|
34
|
+
import { storage } from "./lib/commands/services/storage.js";
|
|
35
|
+
import { tablesdb } from "./lib/commands/services/tablesdb.js";
|
|
36
|
+
import { teams } from "./lib/commands/services/teams.js";
|
|
37
|
+
import { tokens } from "./lib/commands/services/tokens.js";
|
|
38
|
+
import { users } from "./lib/commands/services/users.js";
|
|
39
|
+
import { vcs } from "./lib/commands/services/vcs.js";
|
|
40
|
+
import searchList from "inquirer-search-list";
|
|
41
|
+
inquirer.registerPrompt("search-list", searchList);
|
|
42
|
+
/**
|
|
43
|
+
* Check for updates and show version information
|
|
44
|
+
*/
|
|
45
|
+
async function checkVersion() {
|
|
46
|
+
process.stdout.write(chalk.bold(`appwrite version ${version}`) + "\n");
|
|
47
|
+
try {
|
|
48
|
+
const latestVersion = await getLatestVersion();
|
|
49
|
+
const comparison = compareVersions(version, latestVersion);
|
|
50
|
+
if (comparison > 0) {
|
|
51
|
+
// Current version is older than latest
|
|
52
|
+
process.stdout.write(chalk.yellow(`\n⚠️ A newer version is available: ${chalk.bold(latestVersion)}`) + "\n");
|
|
53
|
+
process.stdout.write(chalk.cyan(`💡 Run '${chalk.bold("appwrite update")}' to update to the latest version.`) + "\n");
|
|
54
|
+
}
|
|
55
|
+
else if (comparison === 0) {
|
|
56
|
+
process.stdout.write(chalk.green("\n✅ You are running the latest version!") + "\n");
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Current version is newer than latest (pre-release/dev)
|
|
60
|
+
process.stdout.write(chalk.blue("\n🚀 You are running a pre-release or development version.") + "\n");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
// Silently fail version check, just show current version
|
|
65
|
+
process.stdout.write(chalk.gray("\n(Unable to check for updates)") + "\n");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Intercept version flag before Commander.js processes it
|
|
69
|
+
if (process.argv.includes("-v") || process.argv.includes("--version")) {
|
|
70
|
+
(async () => {
|
|
71
|
+
await checkVersion();
|
|
72
|
+
process.exit(0);
|
|
73
|
+
})();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
program
|
|
77
|
+
.description(commandDescriptions["main"])
|
|
78
|
+
.configureHelp({
|
|
79
|
+
helpWidth: process.stdout.columns || 80,
|
|
80
|
+
sortSubcommands: true,
|
|
81
|
+
})
|
|
82
|
+
.helpOption("-h, --help", "Display help for command")
|
|
83
|
+
.version(version, "-v, --version", "Output the version number")
|
|
84
|
+
.option("-V, --verbose", "Show complete error log")
|
|
85
|
+
.option("-j, --json", "Output in JSON format")
|
|
86
|
+
.hook("preAction", migrate)
|
|
87
|
+
.option("-f,--force", "Flag to confirm all warnings")
|
|
88
|
+
.option("-a,--all", "Flag to push all resources")
|
|
89
|
+
.option("--id [id...]", "Flag to pass a list of ids for a given action")
|
|
90
|
+
.option("--report", "Enable reporting in case of CLI errors")
|
|
91
|
+
.on("option:json", () => {
|
|
92
|
+
cliConfig.json = true;
|
|
93
|
+
})
|
|
94
|
+
.on("option:verbose", () => {
|
|
95
|
+
cliConfig.verbose = true;
|
|
96
|
+
})
|
|
97
|
+
.on("option:report", function () {
|
|
98
|
+
cliConfig.report = true;
|
|
99
|
+
cliConfig.reportData = { data: this };
|
|
100
|
+
})
|
|
101
|
+
.on("option:force", () => {
|
|
102
|
+
cliConfig.force = true;
|
|
103
|
+
})
|
|
104
|
+
.on("option:all", () => {
|
|
105
|
+
cliConfig.all = true;
|
|
106
|
+
})
|
|
107
|
+
.on("option:id", function () {
|
|
108
|
+
cliConfig.ids = this.opts().id;
|
|
109
|
+
})
|
|
110
|
+
.showSuggestionAfterError()
|
|
111
|
+
.addCommand(whoami)
|
|
112
|
+
.addCommand(register)
|
|
113
|
+
.addCommand(login)
|
|
114
|
+
.addCommand(init)
|
|
115
|
+
.addCommand(pull)
|
|
116
|
+
.addCommand(push)
|
|
117
|
+
.addCommand(types)
|
|
118
|
+
.addCommand(deploy)
|
|
119
|
+
.addCommand(run)
|
|
120
|
+
.addCommand(update)
|
|
121
|
+
.addCommand(logout)
|
|
122
|
+
.addCommand(account)
|
|
123
|
+
.addCommand(console)
|
|
124
|
+
.addCommand(databases)
|
|
125
|
+
.addCommand(functions)
|
|
126
|
+
.addCommand(graphql)
|
|
127
|
+
.addCommand(health)
|
|
128
|
+
.addCommand(locale)
|
|
129
|
+
.addCommand(messaging)
|
|
130
|
+
.addCommand(migrations)
|
|
131
|
+
.addCommand(project)
|
|
132
|
+
.addCommand(projects)
|
|
133
|
+
.addCommand(proxy)
|
|
134
|
+
.addCommand(sites)
|
|
135
|
+
.addCommand(storage)
|
|
136
|
+
.addCommand(tablesdb)
|
|
137
|
+
.addCommand(teams)
|
|
138
|
+
.addCommand(tokens)
|
|
139
|
+
.addCommand(users)
|
|
140
|
+
.addCommand(vcs)
|
|
141
|
+
.addCommand(client)
|
|
142
|
+
.parse(process.argv);
|
|
143
|
+
process.stdout.columns = oldWidth;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AAEA,qDAAqD;AACrD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;AACxC,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;AAC7B,qDAAqD;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;AAChC,OAAO,EAAE,mBAAmB,EA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U,CAAC,MAAM,CAAC;SAClB,UAAU,CAAC,SAAS,CAAC;SACrB,UAAU,CAAC,UAAU,CAAC;SACtB,UAAU,CAAC,OAAO,CAAC;SACnB,UAAU,CAAC,QAAQ,CAAC;SACpB,UAAU,CAAC,KAAK,CAAC;SACjB,UAAU,CAAC,KAAK,CAAC;SACjB,UAAU,CAAC,OAAO,CAAC;SACnB,UAAU,CAAC,QAAQ,CAAC;SACpB,UAAU,CAAC,KAAK,CAAC;SACjB,UAAU,CAAC,MAAM,CAAC;SAClB,UAAU,CAAC,KAAK,CAAC;SACjB,UAAU,CAAC,GAAG,CAAC;SACf,UAAU,CAAC,MAAM,CAAC;SAClB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;AACpC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Library exports for programmatic use of the Appwrite CLI
|
|
3
|
+
*
|
|
4
|
+
* For CLI usage, run the 'appwrite' command directly.
|
|
5
|
+
*/
|
|
2
6
|
import { Push } from "./lib/commands/push.js";
|
|
3
7
|
import { Pull } from "./lib/commands/pull.js";
|
|
4
8
|
import { Schema } from "./lib/commands/schema.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC9B,YAAY,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,GACf,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,149 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { program } from "commander";
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
import packageJson from "./package.json" with { type: "json" };
|
|
9
|
-
const { version } = packageJson;
|
|
10
|
-
import { commandDescriptions, cliConfig } from "./lib/parser.js";
|
|
11
|
-
import { client } from "./lib/commands/generic.js";
|
|
12
|
-
import { getLatestVersion, compareVersions } from "./lib/utils.js";
|
|
13
|
-
import inquirer from "inquirer";
|
|
14
|
-
import { login, logout, whoami, migrate, register, } from "./lib/commands/generic.js";
|
|
15
|
-
import { init } from "./lib/commands/init.js";
|
|
16
|
-
import { types } from "./lib/commands/types.js";
|
|
17
|
-
import { pull } from "./lib/commands/pull.js";
|
|
18
|
-
import { run } from "./lib/commands/run.js";
|
|
19
|
-
import { push, deploy } from "./lib/commands/push.js";
|
|
20
|
-
import { update } from "./lib/commands/update.js";
|
|
21
|
-
import { account } from "./lib/commands/services/account.js";
|
|
22
|
-
import { console } from "./lib/commands/services/console.js";
|
|
23
|
-
import { databases } from "./lib/commands/services/databases.js";
|
|
24
|
-
import { functions } from "./lib/commands/services/functions.js";
|
|
25
|
-
import { graphql } from "./lib/commands/services/graphql.js";
|
|
26
|
-
import { health } from "./lib/commands/services/health.js";
|
|
27
|
-
import { locale } from "./lib/commands/services/locale.js";
|
|
28
|
-
import { messaging } from "./lib/commands/services/messaging.js";
|
|
29
|
-
import { migrations } from "./lib/commands/services/migrations.js";
|
|
30
|
-
import { project } from "./lib/commands/services/project.js";
|
|
31
|
-
import { projects } from "./lib/commands/services/projects.js";
|
|
32
|
-
import { proxy } from "./lib/commands/services/proxy.js";
|
|
33
|
-
import { sites } from "./lib/commands/services/sites.js";
|
|
34
|
-
import { storage } from "./lib/commands/services/storage.js";
|
|
35
|
-
import { tablesdb } from "./lib/commands/services/tablesdb.js";
|
|
36
|
-
import { teams } from "./lib/commands/services/teams.js";
|
|
37
|
-
import { tokens } from "./lib/commands/services/tokens.js";
|
|
38
|
-
import { users } from "./lib/commands/services/users.js";
|
|
39
|
-
import { vcs } from "./lib/commands/services/vcs.js";
|
|
40
|
-
import searchList from "inquirer-search-list";
|
|
1
|
+
/**
|
|
2
|
+
* Library exports for programmatic use of the Appwrite CLI
|
|
3
|
+
*
|
|
4
|
+
* For CLI usage, run the 'appwrite' command directly.
|
|
5
|
+
*/
|
|
41
6
|
import { Push } from "./lib/commands/push.js";
|
|
42
7
|
import { Pull } from "./lib/commands/pull.js";
|
|
43
8
|
import { Schema } from "./lib/commands/schema.js";
|
|
44
|
-
inquirer.registerPrompt("search-list", searchList);
|
|
45
|
-
/**
|
|
46
|
-
* Check for updates and show version information
|
|
47
|
-
*/
|
|
48
|
-
async function checkVersion() {
|
|
49
|
-
process.stdout.write(chalk.bold(`appwrite version ${version}`) + "\n");
|
|
50
|
-
try {
|
|
51
|
-
const latestVersion = await getLatestVersion();
|
|
52
|
-
const comparison = compareVersions(version, latestVersion);
|
|
53
|
-
if (comparison > 0) {
|
|
54
|
-
// Current version is older than latest
|
|
55
|
-
process.stdout.write(chalk.yellow(`\n⚠️ A newer version is available: ${chalk.bold(latestVersion)}`) + "\n");
|
|
56
|
-
process.stdout.write(chalk.cyan(`💡 Run '${chalk.bold("appwrite update")}' to update to the latest version.`) + "\n");
|
|
57
|
-
}
|
|
58
|
-
else if (comparison === 0) {
|
|
59
|
-
process.stdout.write(chalk.green("\n✅ You are running the latest version!") + "\n");
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
// Current version is newer than latest (pre-release/dev)
|
|
63
|
-
process.stdout.write(chalk.blue("\n🚀 You are running a pre-release or development version.") + "\n");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
// Silently fail version check, just show current version
|
|
68
|
-
process.stdout.write(chalk.gray("\n(Unable to check for updates)") + "\n");
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Intercept version flag before Commander.js processes it
|
|
72
|
-
if (process.argv.includes("-v") || process.argv.includes("--version")) {
|
|
73
|
-
(async () => {
|
|
74
|
-
await checkVersion();
|
|
75
|
-
process.exit(0);
|
|
76
|
-
})();
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
program
|
|
80
|
-
.description(commandDescriptions["main"])
|
|
81
|
-
.configureHelp({
|
|
82
|
-
helpWidth: process.stdout.columns || 80,
|
|
83
|
-
sortSubcommands: true,
|
|
84
|
-
})
|
|
85
|
-
.helpOption("-h, --help", "Display help for command")
|
|
86
|
-
.version(version, "-v, --version", "Output the version number")
|
|
87
|
-
.option("-V, --verbose", "Show complete error log")
|
|
88
|
-
.option("-j, --json", "Output in JSON format")
|
|
89
|
-
.hook("preAction", migrate)
|
|
90
|
-
.option("-f,--force", "Flag to confirm all warnings")
|
|
91
|
-
.option("-a,--all", "Flag to push all resources")
|
|
92
|
-
.option("--id [id...]", "Flag to pass a list of ids for a given action")
|
|
93
|
-
.option("--report", "Enable reporting in case of CLI errors")
|
|
94
|
-
.on("option:json", () => {
|
|
95
|
-
cliConfig.json = true;
|
|
96
|
-
})
|
|
97
|
-
.on("option:verbose", () => {
|
|
98
|
-
cliConfig.verbose = true;
|
|
99
|
-
})
|
|
100
|
-
.on("option:report", function () {
|
|
101
|
-
cliConfig.report = true;
|
|
102
|
-
cliConfig.reportData = { data: this };
|
|
103
|
-
})
|
|
104
|
-
.on("option:force", () => {
|
|
105
|
-
cliConfig.force = true;
|
|
106
|
-
})
|
|
107
|
-
.on("option:all", () => {
|
|
108
|
-
cliConfig.all = true;
|
|
109
|
-
})
|
|
110
|
-
.on("option:id", function () {
|
|
111
|
-
cliConfig.ids = this.opts().id;
|
|
112
|
-
})
|
|
113
|
-
.showSuggestionAfterError()
|
|
114
|
-
.addCommand(whoami)
|
|
115
|
-
.addCommand(register)
|
|
116
|
-
.addCommand(login)
|
|
117
|
-
.addCommand(init)
|
|
118
|
-
.addCommand(pull)
|
|
119
|
-
.addCommand(push)
|
|
120
|
-
.addCommand(types)
|
|
121
|
-
.addCommand(deploy)
|
|
122
|
-
.addCommand(run)
|
|
123
|
-
.addCommand(update)
|
|
124
|
-
.addCommand(logout)
|
|
125
|
-
.addCommand(account)
|
|
126
|
-
.addCommand(console)
|
|
127
|
-
.addCommand(databases)
|
|
128
|
-
.addCommand(functions)
|
|
129
|
-
.addCommand(graphql)
|
|
130
|
-
.addCommand(health)
|
|
131
|
-
.addCommand(locale)
|
|
132
|
-
.addCommand(messaging)
|
|
133
|
-
.addCommand(migrations)
|
|
134
|
-
.addCommand(project)
|
|
135
|
-
.addCommand(projects)
|
|
136
|
-
.addCommand(proxy)
|
|
137
|
-
.addCommand(sites)
|
|
138
|
-
.addCommand(storage)
|
|
139
|
-
.addCommand(tablesdb)
|
|
140
|
-
.addCommand(teams)
|
|
141
|
-
.addCommand(tokens)
|
|
142
|
-
.addCommand(users)
|
|
143
|
-
.addCommand(vcs)
|
|
144
|
-
.addCommand(client)
|
|
145
|
-
.parse(process.argv);
|
|
146
|
-
process.stdout.columns = oldWidth;
|
|
147
|
-
}
|
|
148
9
|
export { Schema, Push, Pull };
|
|
149
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"homepage": "https://appwrite.io/support",
|
|
5
5
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.1",
|
|
7
7
|
"license": "BSD-3-Clause",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"bin": {
|
|
11
|
-
"appwrite": "dist/
|
|
11
|
+
"appwrite": "dist/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"generate": "tsx scripts/generate-commands.ts",
|
|
21
21
|
"prepublishOnly": "npm run build",
|
|
22
22
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
23
|
-
"linux-x64": "bun run build && bun build ./dist/
|
|
24
|
-
"linux-arm64": "bun run build && bun build ./dist/
|
|
25
|
-
"mac-x64": "bun run build && bun build ./dist/
|
|
26
|
-
"mac-arm64": "bun run build && bun build ./dist/
|
|
27
|
-
"windows-x64": "bun run build && bun build ./dist/
|
|
28
|
-
"windows-arm64": "bun run build && esbuild dist/
|
|
23
|
+
"linux-x64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-linux-x64 --outfile build/appwrite-cli-linux-x64",
|
|
24
|
+
"linux-arm64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-linux-arm64 --outfile build/appwrite-cli-linux-arm64",
|
|
25
|
+
"mac-x64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-darwin-x64 --outfile build/appwrite-cli-darwin-x64",
|
|
26
|
+
"mac-arm64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-darwin-arm64 --outfile build/appwrite-cli-darwin-arm64",
|
|
27
|
+
"windows-x64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-windows-x64 --outfile build/appwrite-cli-win-x64.exe",
|
|
28
|
+
"windows-arm64": "bun run build && esbuild dist/cli.js --bundle --platform=node --format=cjs --outfile=dist/bundle.cjs --external:@appwrite.io/console --external:fsevents && pkg dist/bundle.cjs -t node18-win-arm64 -o build/appwrite-cli-win-arm64.exe"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@appwrite.io/console": "^2.1.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"pkg": {
|
|
63
63
|
"scripts": [
|
|
64
|
-
"dist/
|
|
64
|
+
"dist/cli.js",
|
|
65
65
|
"dist/lib/**/*.js"
|
|
66
66
|
]
|
|
67
67
|
}
|
package/index.ts
CHANGED
|
@@ -1,175 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** ---------------------------------------------- */
|
|
1
|
+
/**
|
|
2
|
+
* Library exports for programmatic use of the Appwrite CLI
|
|
3
|
+
*
|
|
4
|
+
* For CLI usage, run the 'appwrite' command directly.
|
|
5
|
+
*/
|
|
7
6
|
|
|
8
|
-
import { program } from "commander";
|
|
9
|
-
import chalk from "chalk";
|
|
10
|
-
import packageJson from "./package.json" with { type: "json" };
|
|
11
|
-
const { version } = packageJson;
|
|
12
|
-
import { commandDescriptions, cliConfig } from "./lib/parser.js";
|
|
13
|
-
import { client } from "./lib/commands/generic.js";
|
|
14
|
-
import { getLatestVersion, compareVersions } from "./lib/utils.js";
|
|
15
|
-
import inquirer from "inquirer";
|
|
16
|
-
import {
|
|
17
|
-
login,
|
|
18
|
-
logout,
|
|
19
|
-
whoami,
|
|
20
|
-
migrate,
|
|
21
|
-
register,
|
|
22
|
-
} from "./lib/commands/generic.js";
|
|
23
|
-
import { init } from "./lib/commands/init.js";
|
|
24
|
-
import { types } from "./lib/commands/types.js";
|
|
25
|
-
import { pull } from "./lib/commands/pull.js";
|
|
26
|
-
import { run } from "./lib/commands/run.js";
|
|
27
|
-
import { push, deploy } from "./lib/commands/push.js";
|
|
28
|
-
import { update } from "./lib/commands/update.js";
|
|
29
|
-
import { account } from "./lib/commands/services/account.js";
|
|
30
|
-
import { console } from "./lib/commands/services/console.js";
|
|
31
|
-
import { databases } from "./lib/commands/services/databases.js";
|
|
32
|
-
import { functions } from "./lib/commands/services/functions.js";
|
|
33
|
-
import { graphql } from "./lib/commands/services/graphql.js";
|
|
34
|
-
import { health } from "./lib/commands/services/health.js";
|
|
35
|
-
import { locale } from "./lib/commands/services/locale.js";
|
|
36
|
-
import { messaging } from "./lib/commands/services/messaging.js";
|
|
37
|
-
import { migrations } from "./lib/commands/services/migrations.js";
|
|
38
|
-
import { project } from "./lib/commands/services/project.js";
|
|
39
|
-
import { projects } from "./lib/commands/services/projects.js";
|
|
40
|
-
import { proxy } from "./lib/commands/services/proxy.js";
|
|
41
|
-
import { sites } from "./lib/commands/services/sites.js";
|
|
42
|
-
import { storage } from "./lib/commands/services/storage.js";
|
|
43
|
-
import { tablesdb } from "./lib/commands/services/tablesdb.js";
|
|
44
|
-
import { teams } from "./lib/commands/services/teams.js";
|
|
45
|
-
import { tokens } from "./lib/commands/services/tokens.js";
|
|
46
|
-
import { users } from "./lib/commands/services/users.js";
|
|
47
|
-
import { vcs } from "./lib/commands/services/vcs.js";
|
|
48
|
-
import searchList from "inquirer-search-list";
|
|
49
7
|
import { Push } from "./lib/commands/push.js";
|
|
50
8
|
import { Pull } from "./lib/commands/pull.js";
|
|
51
9
|
import { Schema } from "./lib/commands/schema.js";
|
|
52
10
|
|
|
53
|
-
inquirer.registerPrompt("search-list", searchList);
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Check for updates and show version information
|
|
57
|
-
*/
|
|
58
|
-
async function checkVersion(): Promise<void> {
|
|
59
|
-
process.stdout.write(chalk.bold(`appwrite version ${version}`) + "\n");
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
const latestVersion = await getLatestVersion();
|
|
63
|
-
const comparison = compareVersions(version, latestVersion);
|
|
64
|
-
|
|
65
|
-
if (comparison > 0) {
|
|
66
|
-
// Current version is older than latest
|
|
67
|
-
process.stdout.write(
|
|
68
|
-
chalk.yellow(
|
|
69
|
-
`\n⚠️ A newer version is available: ${chalk.bold(latestVersion)}`,
|
|
70
|
-
) + "\n",
|
|
71
|
-
);
|
|
72
|
-
process.stdout.write(
|
|
73
|
-
chalk.cyan(
|
|
74
|
-
`💡 Run '${chalk.bold("appwrite update")}' to update to the latest version.`,
|
|
75
|
-
) + "\n",
|
|
76
|
-
);
|
|
77
|
-
} else if (comparison === 0) {
|
|
78
|
-
process.stdout.write(
|
|
79
|
-
chalk.green("\n✅ You are running the latest version!") + "\n",
|
|
80
|
-
);
|
|
81
|
-
} else {
|
|
82
|
-
// Current version is newer than latest (pre-release/dev)
|
|
83
|
-
process.stdout.write(
|
|
84
|
-
chalk.blue(
|
|
85
|
-
"\n🚀 You are running a pre-release or development version.",
|
|
86
|
-
) + "\n",
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
} catch (error) {
|
|
90
|
-
// Silently fail version check, just show current version
|
|
91
|
-
process.stdout.write(chalk.gray("\n(Unable to check for updates)") + "\n");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Intercept version flag before Commander.js processes it
|
|
96
|
-
if (process.argv.includes("-v") || process.argv.includes("--version")) {
|
|
97
|
-
(async () => {
|
|
98
|
-
await checkVersion();
|
|
99
|
-
process.exit(0);
|
|
100
|
-
})();
|
|
101
|
-
} else {
|
|
102
|
-
program
|
|
103
|
-
.description(commandDescriptions["main"])
|
|
104
|
-
.configureHelp({
|
|
105
|
-
helpWidth: process.stdout.columns || 80,
|
|
106
|
-
sortSubcommands: true,
|
|
107
|
-
})
|
|
108
|
-
.helpOption("-h, --help", "Display help for command")
|
|
109
|
-
.version(version, "-v, --version", "Output the version number")
|
|
110
|
-
.option("-V, --verbose", "Show complete error log")
|
|
111
|
-
.option("-j, --json", "Output in JSON format")
|
|
112
|
-
.hook("preAction", migrate)
|
|
113
|
-
.option("-f,--force", "Flag to confirm all warnings")
|
|
114
|
-
.option("-a,--all", "Flag to push all resources")
|
|
115
|
-
.option("--id [id...]", "Flag to pass a list of ids for a given action")
|
|
116
|
-
.option("--report", "Enable reporting in case of CLI errors")
|
|
117
|
-
.on("option:json", () => {
|
|
118
|
-
cliConfig.json = true;
|
|
119
|
-
})
|
|
120
|
-
.on("option:verbose", () => {
|
|
121
|
-
cliConfig.verbose = true;
|
|
122
|
-
})
|
|
123
|
-
.on("option:report", function () {
|
|
124
|
-
cliConfig.report = true;
|
|
125
|
-
cliConfig.reportData = { data: this };
|
|
126
|
-
})
|
|
127
|
-
.on("option:force", () => {
|
|
128
|
-
cliConfig.force = true;
|
|
129
|
-
})
|
|
130
|
-
.on("option:all", () => {
|
|
131
|
-
cliConfig.all = true;
|
|
132
|
-
})
|
|
133
|
-
.on("option:id", function () {
|
|
134
|
-
cliConfig.ids = (this as any).opts().id;
|
|
135
|
-
})
|
|
136
|
-
.showSuggestionAfterError()
|
|
137
|
-
.addCommand(whoami)
|
|
138
|
-
.addCommand(register)
|
|
139
|
-
.addCommand(login)
|
|
140
|
-
.addCommand(init)
|
|
141
|
-
.addCommand(pull)
|
|
142
|
-
.addCommand(push)
|
|
143
|
-
.addCommand(types)
|
|
144
|
-
.addCommand(deploy)
|
|
145
|
-
.addCommand(run)
|
|
146
|
-
.addCommand(update)
|
|
147
|
-
.addCommand(logout)
|
|
148
|
-
.addCommand(account)
|
|
149
|
-
.addCommand(console)
|
|
150
|
-
.addCommand(databases)
|
|
151
|
-
.addCommand(functions)
|
|
152
|
-
.addCommand(graphql)
|
|
153
|
-
.addCommand(health)
|
|
154
|
-
.addCommand(locale)
|
|
155
|
-
.addCommand(messaging)
|
|
156
|
-
.addCommand(migrations)
|
|
157
|
-
.addCommand(project)
|
|
158
|
-
.addCommand(projects)
|
|
159
|
-
.addCommand(proxy)
|
|
160
|
-
.addCommand(sites)
|
|
161
|
-
.addCommand(storage)
|
|
162
|
-
.addCommand(tablesdb)
|
|
163
|
-
.addCommand(teams)
|
|
164
|
-
.addCommand(tokens)
|
|
165
|
-
.addCommand(users)
|
|
166
|
-
.addCommand(vcs)
|
|
167
|
-
.addCommand(client)
|
|
168
|
-
.parse(process.argv);
|
|
169
|
-
|
|
170
|
-
process.stdout.columns = oldWidth;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
11
|
export { Schema, Push, Pull };
|
|
174
12
|
export type {
|
|
175
13
|
ConfigType,
|
package/package.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"homepage": "https://appwrite.io/support",
|
|
5
5
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.1",
|
|
7
7
|
"license": "BSD-3-Clause",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"bin": {
|
|
11
|
-
"appwrite": "dist/
|
|
11
|
+
"appwrite": "dist/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"generate": "tsx scripts/generate-commands.ts",
|
|
21
21
|
"prepublishOnly": "npm run build",
|
|
22
22
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
23
|
-
"linux-x64": "bun run build && bun build ./dist/
|
|
24
|
-
"linux-arm64": "bun run build && bun build ./dist/
|
|
25
|
-
"mac-x64": "bun run build && bun build ./dist/
|
|
26
|
-
"mac-arm64": "bun run build && bun build ./dist/
|
|
27
|
-
"windows-x64": "bun run build && bun build ./dist/
|
|
28
|
-
"windows-arm64": "bun run build && esbuild dist/
|
|
23
|
+
"linux-x64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-linux-x64 --outfile build/appwrite-cli-linux-x64",
|
|
24
|
+
"linux-arm64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-linux-arm64 --outfile build/appwrite-cli-linux-arm64",
|
|
25
|
+
"mac-x64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-darwin-x64 --outfile build/appwrite-cli-darwin-x64",
|
|
26
|
+
"mac-arm64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-darwin-arm64 --outfile build/appwrite-cli-darwin-arm64",
|
|
27
|
+
"windows-x64": "bun run build && bun build ./dist/cli.js --compile --sourcemap=inline --target=bun-windows-x64 --outfile build/appwrite-cli-win-x64.exe",
|
|
28
|
+
"windows-arm64": "bun run build && esbuild dist/cli.js --bundle --platform=node --format=cjs --outfile=dist/bundle.cjs --external:@appwrite.io/console --external:fsevents && pkg dist/bundle.cjs -t node18-win-arm64 -o build/appwrite-cli-win-arm64.exe"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@appwrite.io/console": "^2.1.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"pkg": {
|
|
63
63
|
"scripts": [
|
|
64
|
-
"dist/
|
|
64
|
+
"dist/cli.js",
|
|
65
65
|
"dist/lib/**/*.js"
|
|
66
66
|
]
|
|
67
67
|
}
|