appwrite-cli 6.0.0-rc.5 → 6.0.0-rc.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 +2 -2
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +2 -2
- package/lib/commands/push.js +2 -2
- package/lib/commands/run.js +16 -14
- package/lib/emulation/docker.js +28 -30
- package/lib/parser.js +1 -1
- package/package.json +3 -2
- package/scoop/appwrite.json +3 -3
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
$ appwrite -v
|
|
32
|
-
6.0.0-rc.
|
|
32
|
+
6.0.0-rc.6
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Install using prebuilt binaries
|
|
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
|
|
|
60
60
|
Once the installation completes, you can verify your install using
|
|
61
61
|
```
|
|
62
62
|
$ appwrite -v
|
|
63
|
-
6.0.0-rc.
|
|
63
|
+
6.0.0-rc.6
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Getting Started
|
package/install.ps1
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
# You can use "View source" of this page to see the full script.
|
|
14
14
|
|
|
15
15
|
# REPO
|
|
16
|
-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.
|
|
17
|
-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.
|
|
16
|
+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.6/appwrite-cli-win-x64.exe"
|
|
17
|
+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.6/appwrite-cli-win-arm64.exe"
|
|
18
18
|
|
|
19
19
|
$APPWRITE_BINARY_NAME = "appwrite.exe"
|
|
20
20
|
|
package/install.sh
CHANGED
|
@@ -97,7 +97,7 @@ printSuccess() {
|
|
|
97
97
|
downloadBinary() {
|
|
98
98
|
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
|
|
99
99
|
|
|
100
|
-
GITHUB_LATEST_VERSION="6.0.0-rc.
|
|
100
|
+
GITHUB_LATEST_VERSION="6.0.0-rc.6"
|
|
101
101
|
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
|
|
102
102
|
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
|
|
103
103
|
|
package/lib/client.js
CHANGED
|
@@ -16,8 +16,8 @@ class Client {
|
|
|
16
16
|
'x-sdk-name': 'Command Line',
|
|
17
17
|
'x-sdk-platform': 'console',
|
|
18
18
|
'x-sdk-language': 'cli',
|
|
19
|
-
'x-sdk-version': '6.0.0-rc.
|
|
20
|
-
'user-agent' : `AppwriteCLI/6.0.0-rc.
|
|
19
|
+
'x-sdk-version': '6.0.0-rc.6',
|
|
20
|
+
'user-agent' : `AppwriteCLI/6.0.0-rc.6 (${os.type()} ${os.version()}; ${os.arch()})`,
|
|
21
21
|
'X-Appwrite-Response-Format' : '1.5.0',
|
|
22
22
|
};
|
|
23
23
|
}
|
package/lib/commands/push.js
CHANGED
|
@@ -341,7 +341,7 @@ const awaitPools = {
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural) => {
|
|
344
|
-
log('Checking for changes');
|
|
344
|
+
log('Checking for changes ...');
|
|
345
345
|
const changes = [];
|
|
346
346
|
|
|
347
347
|
await Promise.all(resource.map(async (localResource) => {
|
|
@@ -881,7 +881,7 @@ const pushSettings = async () => {
|
|
|
881
881
|
const remoteSettings = localConfig.createSettingsObject(response ?? {});
|
|
882
882
|
const localSettings = localConfig.getProject().projectSettings ?? {};
|
|
883
883
|
|
|
884
|
-
log('Checking for changes');
|
|
884
|
+
log('Checking for changes ...');
|
|
885
885
|
const changes = [];
|
|
886
886
|
|
|
887
887
|
changes.push(...(getObjectChanges(remoteSettings, localSettings, 'services', 'Service')));
|
package/lib/commands/run.js
CHANGED
|
@@ -17,7 +17,9 @@ const { systemHasCommand, isPortTaken, getAllFiles } = require('../utils');
|
|
|
17
17
|
const { runtimeNames, systemTools, JwtManager, Queue } = require('../emulation/utils');
|
|
18
18
|
const { dockerStop, dockerCleanup, dockerStart, dockerBuild, dockerPull } = require('../emulation/docker');
|
|
19
19
|
|
|
20
|
-
const runFunction = async ({ port, functionId,
|
|
20
|
+
const runFunction = async ({ port, functionId, variables, reload, userId } = {}) => {
|
|
21
|
+
console.log(variables);
|
|
22
|
+
console.log(reload);
|
|
21
23
|
// Selection
|
|
22
24
|
if(!functionId) {
|
|
23
25
|
const answers = await inquirer.prompt(questionsRunFunctions[0]);
|
|
@@ -113,9 +115,9 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
const userVariables = {};
|
|
116
|
-
const
|
|
118
|
+
const allVariables = {};
|
|
117
119
|
|
|
118
|
-
if(
|
|
120
|
+
if(variables) {
|
|
119
121
|
try {
|
|
120
122
|
const { variables: remoteVariables } = await paginate(functionsListVariables, {
|
|
121
123
|
functionId: func['$id'],
|
|
@@ -123,7 +125,7 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
|
|
|
123
125
|
}, 100, 'variables');
|
|
124
126
|
|
|
125
127
|
remoteVariables.forEach((v) => {
|
|
126
|
-
|
|
128
|
+
allVariables[v.key] = v.value;
|
|
127
129
|
userVariables[v.key] = v.value;
|
|
128
130
|
});
|
|
129
131
|
} catch(err) {
|
|
@@ -137,18 +139,18 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
|
|
|
137
139
|
const env = parseDotenv(fs.readFileSync(envPath).toString() ?? '');
|
|
138
140
|
|
|
139
141
|
Object.keys(env).forEach((key) => {
|
|
140
|
-
|
|
142
|
+
allVariables[key] = env[key];
|
|
141
143
|
userVariables[key] = env[key];
|
|
142
144
|
});
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
allVariables['APPWRITE_FUNCTION_API_ENDPOINT'] = globalConfig.getFrom('endpoint');
|
|
148
|
+
allVariables['APPWRITE_FUNCTION_ID'] = func.$id;
|
|
149
|
+
allVariables['APPWRITE_FUNCTION_NAME'] = func.name;
|
|
150
|
+
allVariables['APPWRITE_FUNCTION_DEPLOYMENT'] = ''; // TODO: Implement when relevant
|
|
151
|
+
allVariables['APPWRITE_FUNCTION_PROJECT_ID'] = localConfig.getProject().projectId;
|
|
152
|
+
allVariables['APPWRITE_FUNCTION_RUNTIME_NAME'] = runtimeNames[runtimeName] ?? '';
|
|
153
|
+
allVariables['APPWRITE_FUNCTION_RUNTIME_VERSION'] = func.runtime;
|
|
152
154
|
|
|
153
155
|
try {
|
|
154
156
|
await JwtManager.setup(userId, func.scopes ?? []);
|
|
@@ -162,7 +164,7 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
|
|
|
162
164
|
headers['x-appwrite-event'] = '';
|
|
163
165
|
headers['x-appwrite-user-id'] = userId ?? '';
|
|
164
166
|
headers['x-appwrite-user-jwt'] = JwtManager.userJwt ?? '';
|
|
165
|
-
|
|
167
|
+
allVariables['OPEN_RUNTIMES_HEADERS'] = JSON.stringify(headers);
|
|
166
168
|
|
|
167
169
|
if(Object.keys(userVariables).length > 0) {
|
|
168
170
|
drawTable(Object.keys(userVariables).map((key) => ({
|
|
@@ -180,7 +182,7 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
|
|
|
180
182
|
process.stdout.write(chalk.white(`${data}\n`));
|
|
181
183
|
});
|
|
182
184
|
|
|
183
|
-
if(
|
|
185
|
+
if(reload) {
|
|
184
186
|
const ignorer = ignore();
|
|
185
187
|
ignorer.add('.appwrite');
|
|
186
188
|
ignorer.add('code.tar.gz');
|
package/lib/emulation/docker.js
CHANGED
|
@@ -51,6 +51,31 @@ async function dockerBuild(func, variables) {
|
|
|
51
51
|
|
|
52
52
|
const id = func.$id;
|
|
53
53
|
|
|
54
|
+
const ignorer = ignore();
|
|
55
|
+
ignorer.add('.appwrite');
|
|
56
|
+
if (func.ignore) {
|
|
57
|
+
ignorer.add(func.ignore);
|
|
58
|
+
} else if (fs.existsSync(path.join(functionDir, '.gitignore'))) {
|
|
59
|
+
ignorer.add(fs.readFileSync(path.join(functionDir, '.gitignore')).toString());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const files = getAllFiles(functionDir).map((file) => path.relative(functionDir, file)).filter((file) => !ignorer.ignores(file));
|
|
63
|
+
const tmpBuildPath = path.join(functionDir, '.appwrite/tmp-build');
|
|
64
|
+
if (!fs.existsSync(tmpBuildPath)) {
|
|
65
|
+
fs.mkdirSync(tmpBuildPath, { recursive: true });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for(const f of files) {
|
|
69
|
+
const filePath = path.join(tmpBuildPath, f);
|
|
70
|
+
const fileDir = path.dirname(filePath);
|
|
71
|
+
if (!fs.existsSync(fileDir)) {
|
|
72
|
+
fs.mkdirSync(fileDir, { recursive: true });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const sourcePath = path.join(functionDir, f);
|
|
76
|
+
fs.copyFileSync(sourcePath, filePath);
|
|
77
|
+
}
|
|
78
|
+
|
|
54
79
|
const params = [ 'run' ];
|
|
55
80
|
params.push('--name', id);
|
|
56
81
|
params.push('-v', `${tmpBuildPath}/:/mnt/code:rw`);
|
|
@@ -131,40 +156,13 @@ async function dockerStart(func, variables, port) {
|
|
|
131
156
|
// Pack function files
|
|
132
157
|
const functionDir = path.join(process.cwd(), func.path);
|
|
133
158
|
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
ignorer.add(func.ignore);
|
|
138
|
-
} else if (fs.existsSync(path.join(functionDir, '.gitignore'))) {
|
|
139
|
-
ignorer.add(fs.readFileSync(path.join(functionDir, '.gitignore')).toString());
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const files = getAllFiles(functionDir).map((file) => path.relative(functionDir, file)).filter((file) => !ignorer.ignores(file));
|
|
143
|
-
const tmpBuildPath = path.join(functionDir, '.appwrite/tmp-build');
|
|
144
|
-
if (!fs.existsSync(tmpBuildPath)) {
|
|
145
|
-
fs.mkdirSync(tmpBuildPath, { recursive: true });
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
for(const f of files) {
|
|
149
|
-
const filePath = path.join(tmpBuildPath, f);
|
|
150
|
-
const fileDir = path.dirname(filePath);
|
|
151
|
-
if (!fs.existsSync(fileDir)) {
|
|
152
|
-
fs.mkdirSync(fileDir, { recursive: true });
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const sourcePath = path.join(functionDir, f);
|
|
156
|
-
fs.copyFileSync(sourcePath, filePath);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const runtimeChunks = func.runtime.split("-");
|
|
160
|
-
const runtimeVersion = runtimeChunks.pop();
|
|
161
|
-
const runtimeName = runtimeChunks.join("-");
|
|
159
|
+
const runtimeChunks = func.runtime.split("-");
|
|
160
|
+
const runtimeVersion = runtimeChunks.pop();
|
|
161
|
+
const runtimeName = runtimeChunks.join("-");
|
|
162
162
|
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
163
163
|
|
|
164
164
|
const tool = systemTools[runtimeName];
|
|
165
165
|
|
|
166
|
-
const functionDir = path.join(process.cwd(), func.path);
|
|
167
|
-
|
|
168
166
|
const id = func.$id;
|
|
169
167
|
|
|
170
168
|
const params = [ 'run' ];
|
package/lib/parser.js
CHANGED
|
@@ -120,7 +120,7 @@ const parseError = (err) => {
|
|
|
120
120
|
} catch {
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const version = '6.0.0-rc.
|
|
123
|
+
const version = '6.0.0-rc.6';
|
|
124
124
|
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
|
|
125
125
|
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;
|
|
126
126
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "appwrite-cli",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"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",
|
|
5
|
-
"version": "6.0.0-rc.
|
|
5
|
+
"version": "6.0.0-rc.6",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"bin": {
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"tar": "^6.1.11",
|
|
35
35
|
"ignore": "^5.2.0",
|
|
36
36
|
"chokidar": "^3.6.0",
|
|
37
|
-
"tail": "^2.2.6"
|
|
37
|
+
"tail": "^2.2.6",
|
|
38
|
+
"dotenv": "^16.3.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"pkg": "5.8.1"
|
package/scoop/appwrite.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
|
|
3
|
-
"version": "6.0.0-rc.
|
|
3
|
+
"version": "6.0.0-rc.6",
|
|
4
4
|
"description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
|
|
5
5
|
"homepage": "https://github.com/appwrite/sdk-for-cli",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"architecture": {
|
|
8
8
|
"64bit": {
|
|
9
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.
|
|
9
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.6/appwrite-cli-win-x64.exe",
|
|
10
10
|
"bin": [
|
|
11
11
|
[
|
|
12
12
|
"appwrite-cli-win-x64.exe",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"arm64": {
|
|
18
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.
|
|
18
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.6/appwrite-cli-win-arm64.exe",
|
|
19
19
|
"bin": [
|
|
20
20
|
[
|
|
21
21
|
"appwrite-cli-win-arm64.exe",
|