openfork 1.17.19 → 1.17.20
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/package.json +1 -1
- package/script/publish.ts +17 -6
package/package.json
CHANGED
package/script/publish.ts
CHANGED
|
@@ -17,13 +17,25 @@ async function publish(dir: string, name: string, version: string) {
|
|
|
17
17
|
console.log(`already published ${name}@${version}`)
|
|
18
18
|
return
|
|
19
19
|
}
|
|
20
|
+
await $`find . -maxdepth 1 -name '*.tgz' -delete`.cwd(dir)
|
|
20
21
|
await $`bun pm pack`.cwd(dir)
|
|
21
|
-
|
|
22
|
+
for (let attempt = 1; attempt <= 5; attempt++) {
|
|
23
|
+
try {
|
|
24
|
+
await $`npm publish *.tgz --access public --tag ${Script.channel}`.cwd(dir)
|
|
25
|
+
return
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (attempt === 5) throw error
|
|
28
|
+
const delayMs = 1500 * attempt
|
|
29
|
+
console.warn(`publish failed for ${name}@${version} (attempt ${attempt}); retrying in ${delayMs}ms`)
|
|
30
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs))
|
|
31
|
+
}
|
|
32
|
+
}
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
const binaries: Record<string, string> = {}
|
|
25
36
|
for (const filepath of new Bun.Glob("dist/*/package.json").scanSync()) {
|
|
26
37
|
const pkg = await Bun.file(filepath).json()
|
|
38
|
+
if (pkg.name === "openfork") continue
|
|
27
39
|
binaries[pkg.name] = pkg.version
|
|
28
40
|
}
|
|
29
41
|
console.log("binaries", binaries)
|
|
@@ -72,11 +84,10 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write(
|
|
|
72
84
|
),
|
|
73
85
|
)
|
|
74
86
|
|
|
75
|
-
// Publish
|
|
76
|
-
const
|
|
77
|
-
await publish(`./dist/${name}`, name,
|
|
78
|
-
}
|
|
79
|
-
await Promise.all(tasks)
|
|
87
|
+
// Publish platform-specific packages serially to avoid registry flakiness, then the wrapper
|
|
88
|
+
for (const [name, version] of Object.entries(binaries)) {
|
|
89
|
+
await publish(`./dist/${name}`, name, version)
|
|
90
|
+
}
|
|
80
91
|
await publish(`./dist/${pkg.name}`, pkg.name, version)
|
|
81
92
|
|
|
82
93
|
console.log(`Published ${pkg.name}@${version}`)
|