blokctl 0.6.1 → 0.6.2
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/dist/commands/create/project.js +20 -24
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@ const exec = util.promisify(child_process.exec);
|
|
|
17
17
|
const HOME_DIR = `${os.homedir()}/.blok`;
|
|
18
18
|
const GITHUB_REPO_LOCAL = `${HOME_DIR}/blok`;
|
|
19
19
|
const GITHUB_REPO_REMOTE = "https://github.com/well-prado/blok.git";
|
|
20
|
-
const GITHUB_REPO_RELEASE_TAG = "v0.6.
|
|
20
|
+
const GITHUB_REPO_RELEASE_TAG = "v0.6.2";
|
|
21
21
|
fsExtra.ensureDirSync(HOME_DIR);
|
|
22
22
|
const options = {
|
|
23
23
|
baseDir: HOME_DIR,
|
|
@@ -417,7 +417,7 @@ export async function createProject(opts, version, currentPath = false, localRep
|
|
|
417
417
|
"@blokjs/trigger-pubsub": "triggers/pubsub",
|
|
418
418
|
"@blokjs/trigger-queue": "triggers/queue",
|
|
419
419
|
};
|
|
420
|
-
const BLOKJS_DEP_RANGE = "^0.6.
|
|
420
|
+
const BLOKJS_DEP_RANGE = "^0.6.2";
|
|
421
421
|
for (const depGroup of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
422
422
|
const deps = packageJsonContent[depGroup];
|
|
423
423
|
if (!deps)
|
|
@@ -484,12 +484,12 @@ export async function createProject(opts, version, currentPath = false, localRep
|
|
|
484
484
|
if (selectedTriggers.includes("pubsub")) {
|
|
485
485
|
triggerPackageDeps["@blokjs/trigger-pubsub"] = localRepoPath
|
|
486
486
|
? `file:${path.resolve(repoSource, "triggers/pubsub")}`
|
|
487
|
-
:
|
|
487
|
+
: BLOKJS_DEP_RANGE;
|
|
488
488
|
}
|
|
489
489
|
if (selectedTriggers.includes("queue")) {
|
|
490
490
|
triggerPackageDeps["@blokjs/trigger-queue"] = localRepoPath
|
|
491
491
|
? `file:${path.resolve(repoSource, "triggers/queue")}`
|
|
492
|
-
:
|
|
492
|
+
: BLOKJS_DEP_RANGE;
|
|
493
493
|
}
|
|
494
494
|
if (Object.keys(triggerPackageDeps).length > 0) {
|
|
495
495
|
packageJsonContent.dependencies = {
|
|
@@ -716,10 +716,10 @@ if (process.env.DISABLE_TRIGGER_RUN !== "true") {
|
|
|
716
716
|
if (triggerKind === "sse") {
|
|
717
717
|
return `import { DefaultLogger } from "@blokjs/runner";
|
|
718
718
|
import { type Span, metrics, trace } from "@opentelemetry/api";
|
|
719
|
-
import
|
|
719
|
+
import SSETrigger from "./SSETrigger";
|
|
720
720
|
|
|
721
721
|
export default class App {
|
|
722
|
-
private
|
|
722
|
+
private sseTrigger: SSETrigger = <SSETrigger>{};
|
|
723
723
|
protected trigger_initializer = 0;
|
|
724
724
|
protected initializer = 0;
|
|
725
725
|
protected tracer = trace.getTracer(
|
|
@@ -733,12 +733,12 @@ export default class App {
|
|
|
733
733
|
|
|
734
734
|
constructor() {
|
|
735
735
|
this.initializer = performance.now();
|
|
736
|
-
this.
|
|
736
|
+
this.sseTrigger = new SSETrigger();
|
|
737
737
|
}
|
|
738
738
|
|
|
739
739
|
async run() {
|
|
740
740
|
this.tracer.startActiveSpan("initialization", async (span: Span) => {
|
|
741
|
-
await this.
|
|
741
|
+
await this.sseTrigger.listen();
|
|
742
742
|
this.initializer = performance.now() - this.initializer;
|
|
743
743
|
|
|
744
744
|
this.logger.log(\`Server initialized in \${(this.initializer).toFixed(2)}ms\`);
|
|
@@ -750,13 +750,9 @@ export default class App {
|
|
|
750
750
|
span.end();
|
|
751
751
|
});
|
|
752
752
|
}
|
|
753
|
-
|
|
754
|
-
getApp() {
|
|
755
|
-
return this.sseServer.getApp();
|
|
756
|
-
}
|
|
757
753
|
}
|
|
758
754
|
|
|
759
|
-
{
|
|
755
|
+
if (process.env.DISABLE_TRIGGER_RUN !== "true") {
|
|
760
756
|
new App().run();
|
|
761
757
|
}
|
|
762
758
|
`;
|
|
@@ -873,26 +869,26 @@ function replaceBlokImportsInDirectory(dirPath) {
|
|
|
873
869
|
}
|
|
874
870
|
}
|
|
875
871
|
function fixRunnerImportPaths(triggerDestDir, triggerKind) {
|
|
876
|
-
const
|
|
872
|
+
const fileFixes = [];
|
|
877
873
|
if (triggerKind === "http") {
|
|
878
|
-
|
|
874
|
+
fileFixes.push({ file: `${triggerDestDir}/runner/HttpTrigger.ts`, up: "../../../" });
|
|
879
875
|
}
|
|
880
876
|
else if (triggerKind === "sse") {
|
|
881
|
-
|
|
877
|
+
fileFixes.push({ file: `${triggerDestDir}/SSETrigger.ts`, up: "../../" });
|
|
882
878
|
}
|
|
883
879
|
else if (triggerKind === "pubsub") {
|
|
884
|
-
|
|
880
|
+
fileFixes.push({ file: `${triggerDestDir}/runner/PubSubServer.ts`, up: "../../../" });
|
|
885
881
|
}
|
|
886
882
|
else if (triggerKind === "queue") {
|
|
887
|
-
|
|
883
|
+
fileFixes.push({ file: `${triggerDestDir}/runner/QueueServer.ts`, up: "../../../" });
|
|
888
884
|
}
|
|
889
|
-
for (const
|
|
890
|
-
if (!fsExtra.existsSync(
|
|
885
|
+
for (const { file, up } of fileFixes) {
|
|
886
|
+
if (!fsExtra.existsSync(file))
|
|
891
887
|
continue;
|
|
892
|
-
let content = fsExtra.readFileSync(
|
|
893
|
-
content = content.replace(/from ["']\.\.\/Nodes["']/g,
|
|
894
|
-
content = content.replace(/from ["']\.\.\/Workflows["']/g,
|
|
895
|
-
fsExtra.writeFileSync(
|
|
888
|
+
let content = fsExtra.readFileSync(file, "utf8");
|
|
889
|
+
content = content.replace(/from ["']\.\.\/Nodes["']/g, `from "${up}Nodes"`);
|
|
890
|
+
content = content.replace(/from ["']\.\.\/Workflows["']/g, `from "${up}Workflows"`);
|
|
891
|
+
fsExtra.writeFileSync(file, content);
|
|
896
892
|
}
|
|
897
893
|
}
|
|
898
894
|
function updatePubSubProvider(triggerDestDir, provider) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blokctl",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"author": "Deskree Technologies Inc.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "cli for blok",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"keywords": ["blokctl", "cli", "blok", "blok"],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@ai-sdk/openai": "^1.3.22",
|
|
33
|
-
"@blokjs/runner": "^0.6.
|
|
33
|
+
"@blokjs/runner": "^0.6.2",
|
|
34
34
|
"@clack/prompts": "^1.0.0",
|
|
35
35
|
"ai": "^4.3.16",
|
|
36
36
|
"better-sqlite3": "^12.6.2",
|