mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
enh: add mothership update-versions command
This commit is contained in:
parent
0830491192
commit
ed47618d5f
5
.changeset/green-foxes-jam.md
Normal file
5
.changeset/green-foxes-jam.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'pockethost': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Add mothership update-versions command
|
@ -28,6 +28,11 @@ module.exports = {
|
|||||||
restart_delay: 60 * 60 * 1000, // 1 hour
|
restart_delay: 60 * 60 * 1000, // 1 hour
|
||||||
script: 'pnpm prod:cli pocketbase update',
|
script: 'pnpm prod:cli pocketbase update',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: `mothership-update-versions`,
|
||||||
|
restart_delay: 60 * 60 * 1000, // 1 hour
|
||||||
|
script: 'pnpm prod:cli mothership update-versions',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: `health-check`,
|
name: `health-check`,
|
||||||
restart_delay: 60 * 1000, // 1 minute
|
restart_delay: 60 * 1000, // 1 minute
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
import {
|
||||||
|
GobotService,
|
||||||
|
LoggerService,
|
||||||
|
MOTHERSHIP_HOOKS_DIR,
|
||||||
|
PH_ALLOWED_POCKETBASE_SEMVER,
|
||||||
|
stringify,
|
||||||
|
} from '@'
|
||||||
|
import { uniq } from '@s-libs/micro-dash'
|
||||||
|
import { Command } from 'commander'
|
||||||
|
import { writeFileSync } from 'fs'
|
||||||
|
import { compare, parse, prerelease, satisfies } from 'semver'
|
||||||
|
|
||||||
|
export const UpdateVersionsCommand = () => {
|
||||||
|
const cmd = new Command(`update-versions`)
|
||||||
|
.description(`Update pocketbase versions`)
|
||||||
|
.action(async () => {
|
||||||
|
await freshenPocketbaseVersions()
|
||||||
|
})
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function freshenPocketbaseVersions() {
|
||||||
|
const { info } = LoggerService().create(`freshenPocketbaseVersions`)
|
||||||
|
|
||||||
|
const { gobot } = await GobotService()
|
||||||
|
|
||||||
|
info(`Updating pocketbase`)
|
||||||
|
const bot = await gobot(`pocketbase`)
|
||||||
|
const versions = uniq(
|
||||||
|
(await bot.versions())
|
||||||
|
.map((v) => parse(v))
|
||||||
|
.filter((v) => !!v)
|
||||||
|
.filter(
|
||||||
|
(v) =>
|
||||||
|
satisfies(v, PH_ALLOWED_POCKETBASE_SEMVER()) &&
|
||||||
|
prerelease(v) === null,
|
||||||
|
)
|
||||||
|
.sort(compare)
|
||||||
|
.reverse()
|
||||||
|
.map((v) => `${v.major}.${v.minor}.*`),
|
||||||
|
)
|
||||||
|
const cjs = `module.exports = ${stringify(versions, null, 2)}`
|
||||||
|
|
||||||
|
const path = MOTHERSHIP_HOOKS_DIR(`versions.cjs`)
|
||||||
|
info(`Writing to ${path}`, { versions })
|
||||||
|
writeFileSync(path, cjs)
|
||||||
|
|
||||||
|
return cjs
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
import { SchemaCommand } from './SchemaCommand'
|
import { SchemaCommand } from './SchemaCommand'
|
||||||
import { ServeCommand } from './ServeCommand'
|
import { ServeCommand } from './ServeCommand'
|
||||||
|
import { UpdateVersionsCommand } from './UpdateVersionsCommand'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
debug: boolean
|
debug: boolean
|
||||||
@ -11,6 +12,7 @@ export const MothershipCommand = () => {
|
|||||||
.description(`Mothership commands`)
|
.description(`Mothership commands`)
|
||||||
.addCommand(ServeCommand())
|
.addCommand(ServeCommand())
|
||||||
.addCommand(SchemaCommand())
|
.addCommand(SchemaCommand())
|
||||||
|
.addCommand(UpdateVersionsCommand())
|
||||||
.action(() => {
|
.action(() => {
|
||||||
cmd.help()
|
cmd.help()
|
||||||
})
|
})
|
||||||
|
@ -1,167 +1,24 @@
|
|||||||
module.exports = [
|
module.exports = [
|
||||||
"0.22.*",
|
"0.22.*",
|
||||||
"0.22.27",
|
|
||||||
"0.22.26",
|
|
||||||
"0.22.25",
|
|
||||||
"0.22.24",
|
|
||||||
"0.22.23",
|
|
||||||
"0.22.22",
|
|
||||||
"0.22.21",
|
|
||||||
"0.22.20",
|
|
||||||
"0.22.19",
|
|
||||||
"0.22.18",
|
|
||||||
"0.22.17",
|
|
||||||
"0.22.16",
|
|
||||||
"0.22.15",
|
|
||||||
"0.22.14",
|
|
||||||
"0.22.13",
|
|
||||||
"0.22.12",
|
|
||||||
"0.22.11",
|
|
||||||
"0.22.10",
|
|
||||||
"0.22.9",
|
|
||||||
"0.22.8",
|
|
||||||
"0.22.7",
|
|
||||||
"0.22.6",
|
|
||||||
"0.22.5",
|
|
||||||
"0.22.4",
|
|
||||||
"0.22.3",
|
|
||||||
"0.22.2",
|
|
||||||
"0.22.1",
|
|
||||||
"0.22.0",
|
|
||||||
"0.21.*",
|
"0.21.*",
|
||||||
"0.21.3",
|
|
||||||
"0.21.2",
|
|
||||||
"0.21.1",
|
|
||||||
"0.21.0",
|
|
||||||
"0.20.*",
|
"0.20.*",
|
||||||
"0.20.7",
|
|
||||||
"0.20.6",
|
|
||||||
"0.20.5",
|
|
||||||
"0.20.4",
|
|
||||||
"0.20.3",
|
|
||||||
"0.20.2",
|
|
||||||
"0.20.1",
|
|
||||||
"0.20.0",
|
|
||||||
"0.19.*",
|
"0.19.*",
|
||||||
"0.19.4",
|
|
||||||
"0.19.3",
|
|
||||||
"0.19.2",
|
|
||||||
"0.19.1",
|
|
||||||
"0.19.0",
|
|
||||||
"0.18.*",
|
"0.18.*",
|
||||||
"0.18.10",
|
|
||||||
"0.18.9",
|
|
||||||
"0.18.8",
|
|
||||||
"0.18.7",
|
|
||||||
"0.18.6",
|
|
||||||
"0.18.5",
|
|
||||||
"0.18.4",
|
|
||||||
"0.18.3",
|
|
||||||
"0.18.2",
|
|
||||||
"0.18.1",
|
|
||||||
"0.18.0",
|
|
||||||
"0.17.*",
|
"0.17.*",
|
||||||
"0.17.7",
|
|
||||||
"0.17.6",
|
|
||||||
"0.17.5",
|
|
||||||
"0.17.4",
|
|
||||||
"0.17.3",
|
|
||||||
"0.17.2",
|
|
||||||
"0.17.1",
|
|
||||||
"0.17.0",
|
|
||||||
"0.16.*",
|
"0.16.*",
|
||||||
"0.16.10",
|
|
||||||
"0.16.9",
|
|
||||||
"0.16.8",
|
|
||||||
"0.16.7",
|
|
||||||
"0.16.6",
|
|
||||||
"0.16.5",
|
|
||||||
"0.16.4",
|
|
||||||
"0.16.3",
|
|
||||||
"0.16.2",
|
|
||||||
"0.16.1",
|
|
||||||
"0.16.0",
|
|
||||||
"0.15.*",
|
"0.15.*",
|
||||||
"0.15.3",
|
|
||||||
"0.15.2",
|
|
||||||
"0.15.1",
|
|
||||||
"0.15.0",
|
|
||||||
"0.14.*",
|
"0.14.*",
|
||||||
"0.14.5",
|
|
||||||
"0.14.4",
|
|
||||||
"0.14.3",
|
|
||||||
"0.14.2",
|
|
||||||
"0.14.1",
|
|
||||||
"0.14.0",
|
|
||||||
"0.13.*",
|
"0.13.*",
|
||||||
"0.13.4",
|
|
||||||
"0.13.3",
|
|
||||||
"0.13.2",
|
|
||||||
"0.13.1",
|
|
||||||
"0.13.0",
|
|
||||||
"0.12.*",
|
"0.12.*",
|
||||||
"0.12.3",
|
|
||||||
"0.12.2",
|
|
||||||
"0.12.1",
|
|
||||||
"0.12.0",
|
|
||||||
"0.11.*",
|
"0.11.*",
|
||||||
"0.11.4",
|
|
||||||
"0.11.3",
|
|
||||||
"0.11.2",
|
|
||||||
"0.11.1",
|
|
||||||
"0.11.0",
|
|
||||||
"0.10.*",
|
"0.10.*",
|
||||||
"0.10.4",
|
|
||||||
"0.10.3",
|
|
||||||
"0.10.2",
|
|
||||||
"0.10.1",
|
|
||||||
"0.10.0",
|
|
||||||
"0.9.*",
|
"0.9.*",
|
||||||
"0.9.2",
|
|
||||||
"0.9.1",
|
|
||||||
"0.9.0",
|
|
||||||
"0.8.*",
|
"0.8.*",
|
||||||
"0.8.0",
|
|
||||||
"0.7.*",
|
"0.7.*",
|
||||||
"0.7.10",
|
|
||||||
"0.7.9",
|
|
||||||
"0.7.8",
|
|
||||||
"0.7.7",
|
|
||||||
"0.7.6",
|
|
||||||
"0.7.5",
|
|
||||||
"0.7.4",
|
|
||||||
"0.7.3",
|
|
||||||
"0.7.2",
|
|
||||||
"0.7.1",
|
|
||||||
"0.7.0",
|
|
||||||
"0.6.*",
|
"0.6.*",
|
||||||
"0.6.0",
|
|
||||||
"0.5.*",
|
"0.5.*",
|
||||||
"0.5.2",
|
|
||||||
"0.5.1",
|
|
||||||
"0.5.0",
|
|
||||||
"0.4.*",
|
"0.4.*",
|
||||||
"0.4.2",
|
|
||||||
"0.4.1",
|
|
||||||
"0.4.0",
|
|
||||||
"0.3.*",
|
"0.3.*",
|
||||||
"0.3.4",
|
|
||||||
"0.3.3",
|
|
||||||
"0.3.2",
|
|
||||||
"0.3.1",
|
|
||||||
"0.3.0",
|
|
||||||
"0.2.*",
|
"0.2.*",
|
||||||
"0.2.8",
|
"0.1.*"
|
||||||
"0.2.7",
|
|
||||||
"0.2.6",
|
|
||||||
"0.2.5",
|
|
||||||
"0.2.4",
|
|
||||||
"0.2.3",
|
|
||||||
"0.2.2",
|
|
||||||
"0.2.1",
|
|
||||||
"0.2.0",
|
|
||||||
"0.1.*",
|
|
||||||
"0.1.2",
|
|
||||||
"0.1.1",
|
|
||||||
"0.1.0"
|
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user