2022-04-15 15:19:05 +00:00
|
|
|
import { execSync } from 'node:child_process'
|
2022-11-15 14:33:43 +00:00
|
|
|
import { $fetch } from 'ofetch'
|
2022-08-31 19:17:42 +00:00
|
|
|
import { inc } from 'semver'
|
2023-04-20 09:40:07 +00:00
|
|
|
import { determineBumpType, loadWorkspace } from './_utils'
|
2021-07-01 12:58:27 +00:00
|
|
|
|
|
|
|
async function main () {
|
|
|
|
const workspace = await loadWorkspace(process.cwd())
|
|
|
|
|
2023-03-06 22:20:07 +00:00
|
|
|
const commit = execSync('git rev-parse --short HEAD').toString('utf-8').trim().slice(0, 8)
|
2021-07-01 12:58:27 +00:00
|
|
|
const date = Math.round(Date.now() / (1000 * 60))
|
|
|
|
|
2022-08-30 08:40:09 +00:00
|
|
|
const nuxtPkg = workspace.find('nuxt')
|
2023-07-31 13:32:14 +00:00
|
|
|
const { version: latestNitro } = await $fetch<{ version: string }>('https://registry.npmjs.org/nitropack-edge/latest')
|
2022-08-30 08:40:09 +00:00
|
|
|
nuxtPkg.data.dependencies.nitropack = `npm:nitropack-edge@^${latestNitro}`
|
|
|
|
|
2023-07-31 13:32:14 +00:00
|
|
|
const { version: latestNuxi } = await $fetch<{ version: string }>('https://registry.npmjs.org/nuxi-ng/latest')
|
|
|
|
nuxtPkg.data.dependencies.nuxi = `npm:nuxi-ng@^${latestNuxi}`
|
|
|
|
|
2023-04-20 09:40:07 +00:00
|
|
|
const bumpType = await determineBumpType()
|
2023-03-02 16:57:55 +00:00
|
|
|
|
2021-07-01 12:58:27 +00:00
|
|
|
for (const pkg of workspace.packages.filter(p => !p.data.private)) {
|
2023-03-07 21:36:58 +00:00
|
|
|
const newVersion = inc(pkg.data.version, bumpType || 'patch')
|
2023-03-28 15:53:00 +00:00
|
|
|
workspace.setVersion(pkg.data.name, `${newVersion}-${date}.${commit}`, {
|
|
|
|
updateDeps: true
|
|
|
|
})
|
2022-04-20 08:52:39 +00:00
|
|
|
const newname = pkg.data.name === 'nuxt' ? 'nuxt3' : (pkg.data.name + '-edge')
|
|
|
|
workspace.rename(pkg.data.name, newname)
|
2021-07-01 12:58:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
await workspace.save()
|
|
|
|
}
|
|
|
|
|
|
|
|
main().catch((err) => {
|
|
|
|
console.error(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|