@web42/cli 0.1.8 → 0.1.11
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 +23 -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,27 @@ 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 avatarPaths = [
|
|
103
|
+
join(cwd, "avatar/avatar.png"),
|
|
104
|
+
join(cwd, "avatars/avatar.png"),
|
|
105
|
+
join(cwd, "avatar.png"),
|
|
106
|
+
];
|
|
107
|
+
for (const ap of avatarPaths) {
|
|
108
|
+
if (existsSync(ap)) {
|
|
109
|
+
try {
|
|
110
|
+
const stats = statSync(ap);
|
|
111
|
+
if (stats.size <= 2 * 1024 * 1024) {
|
|
112
|
+
profile_image_data = readFileSync(ap).toString("base64");
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
// Skip
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
100
121
|
const agentResult = await apiPost("/api/agents", {
|
|
101
122
|
slug: manifest.name,
|
|
102
123
|
name: manifest.name,
|
|
@@ -104,6 +125,7 @@ export const pushCommand = new Command("push")
|
|
|
104
125
|
readme,
|
|
105
126
|
manifest,
|
|
106
127
|
demo_video_url: manifest.demoVideoUrl,
|
|
128
|
+
profile_image_data,
|
|
107
129
|
});
|
|
108
130
|
agentId = agentResult.agent.id;
|
|
109
131
|
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.11";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.1.
|
|
1
|
+
export const CLI_VERSION = "0.1.11";
|