@solcreek/cli 0.4.1 → 0.4.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/deploy.js +4 -0
- package/dist/commands/status.js +29 -16
- package/dist/utils/worker-bundle.js +18 -0
- package/package.json +2 -2
package/dist/commands/deploy.js
CHANGED
|
@@ -736,6 +736,7 @@ async function deployAuthenticated(cwd, resolved, token, skipBuild, jsonMode = f
|
|
|
736
736
|
...resolved.compatibilityFlags.filter((f) => f !== "nodejs_compat"),
|
|
737
737
|
] }),
|
|
738
738
|
...(resolved.cron.length > 0 ? { cron: resolved.cron } : {}),
|
|
739
|
+
...(resolved.queue ? { queue: true } : {}),
|
|
739
740
|
};
|
|
740
741
|
await client.uploadDeploymentBundle(project.id, deployment.id, bundle);
|
|
741
742
|
// Poll for async deploy progress
|
|
@@ -785,6 +786,9 @@ async function deployAuthenticated(cwd, resolved, token, skipBuild, jsonMode = f
|
|
|
785
786
|
if (resolved.cron.length > 0) {
|
|
786
787
|
consola.info(` Cron: ${resolved.cron.join(", ")}`);
|
|
787
788
|
}
|
|
789
|
+
if (resolved.queue) {
|
|
790
|
+
consola.info(" Queue: enabled");
|
|
791
|
+
}
|
|
788
792
|
// Contextual next-step hints (non-JSON only)
|
|
789
793
|
if (!jsonMode) {
|
|
790
794
|
printNextStepHint(renderMode, resolved);
|
package/dist/commands/status.js
CHANGED
|
@@ -2,9 +2,7 @@ import { defineCommand } from "citty";
|
|
|
2
2
|
import consola from "consola";
|
|
3
3
|
import { CreekClient } from "@solcreek/sdk";
|
|
4
4
|
import { getToken, getApiUrl, getSandboxApiUrl } from "../utils/config.js";
|
|
5
|
-
import {
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { parseConfig } from "@solcreek/sdk";
|
|
5
|
+
import { resolveConfig, formatDetectionSummary, ConfigNotFoundError } from "@solcreek/sdk";
|
|
8
6
|
import { globalArgs, resolveJsonMode, jsonOutput, AUTH_BREADCRUMBS, NO_PROJECT_BREADCRUMBS } from "../utils/output.js";
|
|
9
7
|
export const statusCommand = defineCommand({
|
|
10
8
|
meta: {
|
|
@@ -78,27 +76,32 @@ async function projectStatus(jsonMode) {
|
|
|
78
76
|
consola.info("To check a sandbox: creek status <sandboxId>");
|
|
79
77
|
process.exit(1);
|
|
80
78
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
let resolved;
|
|
80
|
+
try {
|
|
81
|
+
resolved = resolveConfig(process.cwd());
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
if (err instanceof ConfigNotFoundError) {
|
|
85
|
+
if (jsonMode)
|
|
86
|
+
jsonOutput({ ok: false, error: "no_project", message: "No project config found" }, 1, NO_PROJECT_BREADCRUMBS);
|
|
87
|
+
consola.error("No project config found.");
|
|
88
|
+
consola.info("To check a sandbox: creek status <sandboxId>");
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
throw err;
|
|
88
92
|
}
|
|
89
|
-
const config = parseConfig(readFileSync(configPath, "utf-8"));
|
|
90
93
|
const client = new CreekClient(getApiUrl(), token);
|
|
91
94
|
let project;
|
|
92
95
|
try {
|
|
93
|
-
project = await client.getProject(
|
|
96
|
+
project = await client.getProject(resolved.projectName);
|
|
94
97
|
}
|
|
95
98
|
catch {
|
|
96
99
|
if (jsonMode)
|
|
97
|
-
jsonOutput({ ok: false, error: "not_found", message: `Project "${
|
|
100
|
+
jsonOutput({ ok: false, error: "not_found", message: `Project "${resolved.projectName}" not found` }, 1, [
|
|
98
101
|
{ command: "creek deploy", description: "Deploy to create the project" },
|
|
99
102
|
{ command: "creek projects", description: "List existing projects" },
|
|
100
103
|
]);
|
|
101
|
-
consola.error(`Project "${
|
|
104
|
+
consola.error(`Project "${resolved.projectName}" not found.`);
|
|
102
105
|
process.exit(1);
|
|
103
106
|
}
|
|
104
107
|
if (jsonMode) {
|
|
@@ -106,8 +109,12 @@ async function projectStatus(jsonMode) {
|
|
|
106
109
|
ok: true,
|
|
107
110
|
type: "project",
|
|
108
111
|
project: project.slug,
|
|
112
|
+
config: resolved.source,
|
|
109
113
|
framework: project.framework,
|
|
110
114
|
productionDeploymentId: project.production_deployment_id,
|
|
115
|
+
bindings: resolved.bindings.map((b) => b.type),
|
|
116
|
+
cron: resolved.cron,
|
|
117
|
+
queue: resolved.queue,
|
|
111
118
|
createdAt: project.created_at,
|
|
112
119
|
}, 0, [
|
|
113
120
|
{ command: `creek deployments --project ${project.slug}`, description: "List deployment history" },
|
|
@@ -115,12 +122,18 @@ async function projectStatus(jsonMode) {
|
|
|
115
122
|
]);
|
|
116
123
|
}
|
|
117
124
|
const deployed = project.production_deployment_id ? "deployed" : "not deployed";
|
|
118
|
-
|
|
119
|
-
consola.log(
|
|
125
|
+
consola.log(`\n Project ${project.slug}`);
|
|
126
|
+
consola.log(` Config: ${formatDetectionSummary(resolved)}`);
|
|
120
127
|
consola.log(` Status: ${deployed}`);
|
|
121
128
|
if (project.production_deployment_id) {
|
|
122
129
|
consola.log(` Deploy: ${project.production_deployment_id.slice(0, 8)}`);
|
|
123
130
|
}
|
|
131
|
+
if (resolved.cron.length > 0) {
|
|
132
|
+
consola.log(` Cron: ${resolved.cron.join(", ")}`);
|
|
133
|
+
}
|
|
134
|
+
if (resolved.queue) {
|
|
135
|
+
consola.log(" Queue: enabled");
|
|
136
|
+
}
|
|
124
137
|
consola.log("");
|
|
125
138
|
}
|
|
126
139
|
//# sourceMappingURL=status.js.map
|
|
@@ -86,6 +86,8 @@ export default {
|
|
|
86
86
|
return new Response("Not Found", { status: 404 });
|
|
87
87
|
});
|
|
88
88
|
},
|
|
89
|
+
${generateScheduledHandler()}
|
|
90
|
+
${generateQueueHandler()}
|
|
89
91
|
};
|
|
90
92
|
`;
|
|
91
93
|
}
|
|
@@ -114,9 +116,25 @@ export default {
|
|
|
114
116
|
throw new Error("[creek] Worker must export default a fetch handler, Hono app, or { fetch() } object.");
|
|
115
117
|
});
|
|
116
118
|
},
|
|
119
|
+
${generateScheduledHandler()}
|
|
120
|
+
${generateQueueHandler()}
|
|
117
121
|
};
|
|
118
122
|
`;
|
|
119
123
|
}
|
|
124
|
+
function generateScheduledHandler() {
|
|
125
|
+
return `async scheduled(event, env, ctx) {
|
|
126
|
+
if (typeof handler.scheduled === "function") {
|
|
127
|
+
return _runRequest(env, ctx, () => handler.scheduled(event, env, ctx));
|
|
128
|
+
}
|
|
129
|
+
},`;
|
|
130
|
+
}
|
|
131
|
+
function generateQueueHandler() {
|
|
132
|
+
return `async queue(batch, env, ctx) {
|
|
133
|
+
if (typeof handler.queue === "function") {
|
|
134
|
+
return _runRequest(env, ctx, () => handler.queue(batch, env, ctx));
|
|
135
|
+
}
|
|
136
|
+
},`;
|
|
137
|
+
}
|
|
120
138
|
/**
|
|
121
139
|
* Bundle a Worker entry point with Creek runtime auto-injection.
|
|
122
140
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solcreek/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "CLI for the Creek deployment platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"homepage": "https://creek.dev",
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "https://github.com/solcreek/creek.git",
|
|
31
|
+
"url": "git+https://github.com/solcreek/creek.git",
|
|
32
32
|
"directory": "packages/cli"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|