@zodic/shared 0.0.417 → 0.0.420
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/app/services/ConceptService.ts +2 -2
- package/package.json +3 -2
- package/release.ts +137 -0
- package/utils/faceSwapHelpers.ts +2 -2
|
@@ -1632,9 +1632,9 @@ export class ConceptService {
|
|
|
1632
1632
|
|
|
1633
1633
|
if (!user || !user.language) {
|
|
1634
1634
|
console.warn(
|
|
1635
|
-
`⚠️ [LANG WARNING] No language preference found for user: ${userId}, defaulting to '
|
|
1635
|
+
`⚠️ [LANG WARNING] No language preference found for user: ${userId}, defaulting to 'en-us'`
|
|
1636
1636
|
);
|
|
1637
|
-
return '
|
|
1637
|
+
return 'en-us';
|
|
1638
1638
|
}
|
|
1639
1639
|
|
|
1640
1640
|
console.log(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zodic/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.420",
|
|
4
4
|
"module": "index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"pub:db:stg": "ENV=staging npm run db:generate && npm run db:up && npm run migrate-latest-stg && npm version patch && npm publish",
|
|
18
18
|
"pub:db:dev": "ENV=development npm run db:generate && npm run db:up && npm run migrate-latest-dev && npm version patch && npm publish",
|
|
19
19
|
"pub": "npm version patch && npm publish",
|
|
20
|
-
"reset-db": "wrangler d1 execute DB --command \"DROP TABLE IF EXISTS migrations;\" --env ${ENV:-development} && npm run db:up && npm run migrate-latest"
|
|
20
|
+
"reset-db": "wrangler d1 execute DB --command \"DROP TABLE IF EXISTS migrations;\" --env ${ENV:-development} && npm run db:up && npm run migrate-latest",
|
|
21
|
+
"release": "bun release.ts"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/inversify": "^2.0.33",
|
package/release.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { $ } from "bun";
|
|
2
|
+
import { readdirSync } from "fs";
|
|
3
|
+
import { join, dirname } from "path";
|
|
4
|
+
|
|
5
|
+
// Script runs from shared/ via `bun run release` — root is one level up
|
|
6
|
+
const sharedDir = process.cwd();
|
|
7
|
+
const rootDir = dirname(sharedDir);
|
|
8
|
+
|
|
9
|
+
// ─── Step 1: Bump version ─────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
console.log("📦 Step 1: Bumping version (npm version patch)...");
|
|
12
|
+
|
|
13
|
+
let newVersion: string;
|
|
14
|
+
try {
|
|
15
|
+
// --no-git-tag-version: suppress npm's auto-commit/tag so we control the
|
|
16
|
+
// commit ourselves in step 3
|
|
17
|
+
const output = await $`npm version patch --no-git-tag-version`.text();
|
|
18
|
+
newVersion = output.trim().replace(/^v/, "");
|
|
19
|
+
console.log(`✅ New version: ${newVersion}`);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error("❌ Step 1 failed: npm version patch", error);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ─── Step 2: Stage all changes from shared/ ──────────────────────────────────
|
|
26
|
+
|
|
27
|
+
console.log("\n📝 Step 2: Staging all changes...");
|
|
28
|
+
try {
|
|
29
|
+
await $`cd ${sharedDir} && git add .`;
|
|
30
|
+
console.log("✅ Changes staged");
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error("❌ Step 2 failed: git add .", error);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ─── Step 3: Commit ───────────────────────────────────────────────────────────
|
|
37
|
+
|
|
38
|
+
console.log(`\n💾 Step 3: Committing release...`);
|
|
39
|
+
try {
|
|
40
|
+
const commitMsg = `chore: release v${newVersion}`;
|
|
41
|
+
await $`cd ${sharedDir} && git commit -m ${commitMsg}`;
|
|
42
|
+
console.log(`✅ Committed: "${commitMsg}"`);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error("❌ Step 3 failed: git commit", error);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ─── Step 4: Publish to npm ───────────────────────────────────────────────────
|
|
49
|
+
|
|
50
|
+
console.log("\n🚀 Step 4: Publishing to npm...");
|
|
51
|
+
try {
|
|
52
|
+
await $`npm publish`;
|
|
53
|
+
console.log("✅ Published @zodic/shared to npm");
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error("❌ Step 4 failed: npm publish", error);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ─── Step 5: Poll registry until new version is live ─────────────────────────
|
|
60
|
+
|
|
61
|
+
console.log(`\n⏳ Step 5: Waiting for v${newVersion} on npm registry...`);
|
|
62
|
+
const POLL_INTERVAL_MS = 3000;
|
|
63
|
+
const MAX_ATTEMPTS = 20; // 20 × 3s = 60s total
|
|
64
|
+
let found = false;
|
|
65
|
+
|
|
66
|
+
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
67
|
+
try {
|
|
68
|
+
const registryVersion = (
|
|
69
|
+
await $`npm show @zodic/shared version --prefer-online`.text()
|
|
70
|
+
).trim();
|
|
71
|
+
|
|
72
|
+
console.log(
|
|
73
|
+
` Waiting for v${newVersion} on registry... attempt ${attempt}/${MAX_ATTEMPTS} (currently: v${registryVersion})`
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
if (registryVersion === newVersion) {
|
|
77
|
+
console.log(`✅ v${newVersion} is live on npm registry`);
|
|
78
|
+
found = true;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
} catch {
|
|
82
|
+
console.log(
|
|
83
|
+
` Waiting for v${newVersion} on registry... attempt ${attempt}/${MAX_ATTEMPTS} (registry query failed, retrying)`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (attempt < MAX_ATTEMPTS) {
|
|
88
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!found) {
|
|
93
|
+
console.error(
|
|
94
|
+
`❌ Step 5 failed: v${newVersion} did not appear on npm registry within ${
|
|
95
|
+
(MAX_ATTEMPTS * POLL_INTERVAL_MS) / 1000
|
|
96
|
+
} seconds. Workers have NOT been updated.`
|
|
97
|
+
);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Give bun's registry a moment to catch up with npm
|
|
102
|
+
console.log("\n⏳ Waiting 5s for bun registry propagation...");
|
|
103
|
+
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
104
|
+
|
|
105
|
+
// ─── Step 6: Run `bun upshare` in all zodic- workers ─────────────────────────
|
|
106
|
+
|
|
107
|
+
const workerFolders = readdirSync(rootDir, { withFileTypes: true })
|
|
108
|
+
.filter(
|
|
109
|
+
(dir) =>
|
|
110
|
+
dir.isDirectory() &&
|
|
111
|
+
dir.name.startsWith("zodic-") &&
|
|
112
|
+
dir.name !== "zodic-image-handler" &&
|
|
113
|
+
dir.name !== "zodic-astro-engine"
|
|
114
|
+
)
|
|
115
|
+
.map((dir) => dir.name);
|
|
116
|
+
|
|
117
|
+
if (workerFolders.length === 0) {
|
|
118
|
+
console.error("❌ Step 6 failed: no zodic- worker folders found in root.");
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.log(
|
|
123
|
+
`\n📦 Step 6: Running 'bun upshare' in ${workerFolders.length} workers...`
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
for (const folder of workerFolders) {
|
|
127
|
+
console.log(` 📦 Updating ${folder}...`);
|
|
128
|
+
try {
|
|
129
|
+
await $`cd ${join(rootDir, folder)} && bun upshare`;
|
|
130
|
+
console.log(` ✅ ${folder} updated to v${newVersion}`);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error(`❌ Step 6 failed in ${folder}:`, error);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
console.log(`\n🎉 Release v${newVersion} complete! All workers updated.`);
|
package/utils/faceSwapHelpers.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Service } from '@cloudflare/workers-types';
|
|
2
2
|
import { ApidogModel, BackendBindings, Status } from '../types';
|
|
3
3
|
|
|
4
4
|
export const validateImageUrl = async (
|
|
@@ -26,7 +26,7 @@ export const validateImageUrl = async (
|
|
|
26
26
|
|
|
27
27
|
// Helper function to resize an image via the IMAGE_HANDLER service binding
|
|
28
28
|
export const resizeImage = async (
|
|
29
|
-
imageHandler:
|
|
29
|
+
imageHandler: Service,
|
|
30
30
|
url: string,
|
|
31
31
|
label: string
|
|
32
32
|
): Promise<ArrayBuffer> => {
|