@web42/cli 0.1.9 → 0.1.12
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/push.js +25 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/push.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, statSync } from "fs";
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import chalk from "chalk";
|
|
@@ -97,6 +97,29 @@ export const pushCommand = new Command("push")
|
|
|
97
97
|
if (existsSync(readmePath)) {
|
|
98
98
|
readme = readFileSync(readmePath, "utf-8");
|
|
99
99
|
}
|
|
100
|
+
let profile_image_data = undefined;
|
|
101
|
+
// Check for avatar/avatar.png or avatars/avatar.png
|
|
102
|
+
const avatarSearchPaths = [
|
|
103
|
+
join(cwd, "avatar/avatar.png"),
|
|
104
|
+
join(cwd, "avatars/avatar.png"),
|
|
105
|
+
join(cwd, "avatar.png"),
|
|
106
|
+
// Also check .web42/ for the one managed by build/pack
|
|
107
|
+
join(cwd, ".web42/avatar.png"),
|
|
108
|
+
];
|
|
109
|
+
for (const ap of avatarSearchPaths) {
|
|
110
|
+
if (existsSync(ap)) {
|
|
111
|
+
try {
|
|
112
|
+
const stats = statSync(ap);
|
|
113
|
+
if (stats.size <= 5 * 1024 * 1024) {
|
|
114
|
+
profile_image_data = readFileSync(ap).toString("base64");
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
// Skip
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
100
123
|
const agentResult = await apiPost("/api/agents", {
|
|
101
124
|
slug: manifest.name,
|
|
102
125
|
name: manifest.name,
|
|
@@ -104,6 +127,7 @@ export const pushCommand = new Command("push")
|
|
|
104
127
|
readme,
|
|
105
128
|
manifest,
|
|
106
129
|
demo_video_url: manifest.demoVideoUrl,
|
|
130
|
+
profile_image_data,
|
|
107
131
|
});
|
|
108
132
|
agentId = agentResult.agent.id;
|
|
109
133
|
isCreated = !!agentResult.created;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.1.
|
|
1
|
+
export declare const CLI_VERSION = "0.1.12";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.1.
|
|
1
|
+
export const CLI_VERSION = "0.1.12";
|