diff --git a/examples/docs-examples/examples/composing-tasks/alert-code.mjs b/examples/docs-examples/examples/composing-tasks/alert-code.mjs new file mode 100644 index 000000000..dde33f6a8 --- /dev/null +++ b/examples/docs-examples/examples/composing-tasks/alert-code.mjs @@ -0,0 +1,23 @@ +import { TaskExecutor } from "@golem-sdk/golem-js"; +(async () => { + const executor = await TaskExecutor.create({ + package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4", + yagnaOptions: { apiKey: "try_golem" }, + }); + + const result = await executor.run(async (ctx) => { + const res = await ctx + .beginBatch() + .uploadFile("./worker.mjs", "/golem/input/worker.mjs") + .run("node /golem/input/worker.mjs > /golem/input/output.txt") + .run("cat /golem/input/output.txt") + .downloadFile("/golem/input/output.txt", "./output.txt") + .endStream(); + + for await (const chunk of res) { + chunk.index == 2 ? console.log(chunk.stdout) : ""; + } + }); + + await executor.end(); +})(); diff --git a/package.json b/package.json index bec8994fa..2733d5b46 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@typescript-eslint/parser": "^6.0.0", "buffer": "^6.0.3", "cypress": "13.3.1", - "eslint": "~8.50.0", + "eslint": "~8.51.0", "eslint-config-prettier": "^9.0.0", "express": "^4.18.2", "husky": "^8.0.3", @@ -101,7 +101,7 @@ "typedoc": "^0.25.1", "typedoc-plugin-markdown": "^3.14.0", "typedoc-plugin-merge-modules": "^5.0.1", - "typedoc-theme-hierarchy": "4.1.1", + "typedoc-theme-hierarchy": "4.1.2", "typescript": "^5.1.6", "webpack": "^5.75.0" } diff --git a/tests/examples/examples.json b/tests/examples/examples.json index 39f7bc056..5723f3d99 100644 --- a/tests/examples/examples.json +++ b/tests/examples/examples.json @@ -14,6 +14,7 @@ { "cmd": "node", "path": "examples/docs-examples/examples/composing-tasks/single-command.mjs" }, { "cmd": "node", "path": "examples/docs-examples/examples/composing-tasks/single-command.cjs" }, { "cmd": "ts-node", "path": "examples/docs-examples/examples/composing-tasks/single-command.ts" }, + { "cmd": "ts-node", "path": "examples/docs-examples/examples/composing-tasks/alert-code.mjs" }, { "cmd": "node", "path": "examples/docs-examples/examples/executing-tasks/before-each.mjs" }, { "cmd": "node", "path": "examples/docs-examples/examples/executing-tasks/foreach.mjs" },