Skip to content

Feat Async function deployments #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5ad093c
Beginning async function deployment
byawitz May 17, 2024
0bbcafb
Merge branch 'refs/heads/feat-cli-g2' into feat-async-statsful-functi…
byawitz May 17, 2024
6dc761b
feat(cli): Deploy function in parallelism.
byawitz May 17, 2024
32f9de3
wip: Deploy function in parallelism.
byawitz May 19, 2024
209c3fe
feat(cli): Async deploy with status updates
byawitz May 19, 2024
9318d48
chore(cli): Cleaning added functions
byawitz May 19, 2024
901e045
feat(cli): Validation function possible path before deploying
byawitz May 19, 2024
d8e22d7
feat(cli): Updating function deployment status
byawitz May 19, 2024
cd273d0
Merge branch 'refs/heads/feat-cli-g2' into feat-async-function-deploy…
byawitz May 20, 2024
3e9d58c
refactoring(cli): deploy to push
byawitz May 20, 2024
3868a80
refactoring(cli): conventions and messages
byawitz May 20, 2024
6023e52
Merge branch 'refs/heads/feat-async-function-deployments' into feat-f…
byawitz May 20, 2024
1fb5d09
refactoring(cli): conventions and messages
byawitz May 20, 2024
836e79c
refactor(cli): Updater -> Spinner, and refactoring
byawitz May 20, 2024
d816f79
Merge branch 'refs/heads/feat-async-function-deployments' into feat-f…
byawitz May 20, 2024
bd4c054
feat(cli): Adding link to failed deployments
byawitz May 20, 2024
b33054e
feat(cli): Ignore function deployment status
byawitz May 20, 2024
23523be
Update templates/cli/lib/commands/push.js.twig
christyjacob4 May 20, 2024
f029919
Merge pull request #844 from appwrite/feat-functions-deployment-status
christyjacob4 May 20, 2024
6d98968
Update templates/cli/lib/commands/push.js.twig
christyjacob4 May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/SDK/Language/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public function getFiles(): array
'destination' => 'lib/validations.js',
'template' => 'cli/lib/validations.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/spinner.js',
'template' => 'cli/lib/spinner.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/parser.js',
Expand Down
8 changes: 3 additions & 5 deletions templates/cli/base/params.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@
if (!fs.lstatSync(folderPath).isDirectory()) {
throw new Error('The path is not a directory.');
}

const ignorer = ignore();

const func = localConfig.getFunction(functionId);

if (func.ignore) {
ignorer.add(func.ignore);
log('Ignoring files using configuration from appwrite.json');
} else if (fs.existsSync(pathLib.join({{ parameter.name | caseCamel | escapeKeyword }}, '.gitignore'))) {
ignorer.add(fs.readFileSync(pathLib.join({{ parameter.name | caseCamel | escapeKeyword }}, '.gitignore')).toString());
log('Ignoring files in .gitignore');
}

const files = getAllFiles({{ parameter.name | caseCamel | escapeKeyword }}).map((file) => pathLib.relative({{ parameter.name | caseCamel | escapeKeyword }}, file)).filter((file) => !ignorer.ignores(file));

await tar
Expand Down Expand Up @@ -81,4 +79,4 @@
payload['key'] = globalConfig.getKey();
const queryParams = new URLSearchParams(payload);
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
{% endif %}
{% endif %}
10 changes: 5 additions & 5 deletions templates/cli/base/requests/file.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% for parameter in method.parameters.all %}
{% if parameter.type == 'file' %}
const size = {{ parameter.name | caseCamel | escapeKeyword }}.size;

const apiHeaders = {
{% for parameter in method.parameters.header %}
'{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }},
Expand Down Expand Up @@ -45,7 +45,7 @@
}

let uploadableChunkTrimmed;

if(currentPosition + 1 >= client.CHUNK_SIZE) {
uploadableChunkTrimmed = uploadableChunk;
} else {
Expand Down Expand Up @@ -99,17 +99,17 @@
}

{% if method.packaging %}
fs.unlinkSync(filePath);
await fs.unlink(filePath,()=>{});
{% endif %}
{% if method.type == 'location' %}
fs.writeFileSync(destination, response);
{% endif %}

if (parseOutput) {
parse(response)
success()
}

return response;
{% endif %}
{% endfor %}
{% endfor %}
Loading