Skip to content

Commit c91aa21

Browse files
Merge pull request #843 from appwrite/feat-async-function-deployments
Feat Async function deployments
2 parents b54147d + 6d98968 commit c91aa21

File tree

7 files changed

+287
-78
lines changed

7 files changed

+287
-78
lines changed

src/SDK/Language/CLI.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ public function getFiles(): array
132132
'destination' => 'lib/validations.js',
133133
'template' => 'cli/lib/validations.js.twig',
134134
],
135+
[
136+
'scope' => 'default',
137+
'destination' => 'lib/spinner.js',
138+
'template' => 'cli/lib/spinner.js.twig',
139+
],
135140
[
136141
'scope' => 'default',
137142
'destination' => 'lib/parser.js',

templates/cli/base/params.twig

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@
1111
if (!fs.lstatSync(folderPath).isDirectory()) {
1212
throw new Error('The path is not a directory.');
1313
}
14-
14+
1515
const ignorer = ignore();
1616

1717
const func = localConfig.getFunction(functionId);
1818

1919
if (func.ignore) {
2020
ignorer.add(func.ignore);
21-
log('Ignoring files using configuration from appwrite.json');
2221
} else if (fs.existsSync(pathLib.join({{ parameter.name | caseCamel | escapeKeyword }}, '.gitignore'))) {
2322
ignorer.add(fs.readFileSync(pathLib.join({{ parameter.name | caseCamel | escapeKeyword }}, '.gitignore')).toString());
24-
log('Ignoring files in .gitignore');
2523
}
26-
24+
2725
const files = getAllFiles({{ parameter.name | caseCamel | escapeKeyword }}).map((file) => pathLib.relative({{ parameter.name | caseCamel | escapeKeyword }}, file)).filter((file) => !ignorer.ignores(file));
2826

2927
await tar
@@ -81,4 +79,4 @@
8179
payload['key'] = globalConfig.getKey();
8280
const queryParams = new URLSearchParams(payload);
8381
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
84-
{% endif %}
82+
{% endif %}

templates/cli/base/requests/file.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% for parameter in method.parameters.all %}
22
{% if parameter.type == 'file' %}
33
const size = {{ parameter.name | caseCamel | escapeKeyword }}.size;
4-
4+
55
const apiHeaders = {
66
{% for parameter in method.parameters.header %}
77
'{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }},
@@ -45,7 +45,7 @@
4545
}
4646

4747
let uploadableChunkTrimmed;
48-
48+
4949
if(currentPosition + 1 >= client.CHUNK_SIZE) {
5050
uploadableChunkTrimmed = uploadableChunk;
5151
} else {
@@ -99,17 +99,17 @@
9999
}
100100

101101
{% if method.packaging %}
102-
fs.unlinkSync(filePath);
102+
await fs.unlink(filePath,()=>{});
103103
{% endif %}
104104
{% if method.type == 'location' %}
105105
fs.writeFileSync(destination, response);
106106
{% endif %}
107-
107+
108108
if (parseOutput) {
109109
parse(response)
110110
success()
111111
}
112112

113113
return response;
114114
{% endif %}
115-
{% endfor %}
115+
{% endfor %}

0 commit comments

Comments
 (0)