fix(vscode): semver-safe sanitization of git user.name in snapshot version

This commit is contained in:
kirillk
2026-03-13 12:35:35 -04:00
parent e47e6efd18
commit d434c42e6f
+6 -1
View File
@@ -12,7 +12,12 @@ const pkgPath = join(root, "package.json")
const pkg = await Bun.file(pkgPath).json()
const sha = (await $`git rev-parse --short HEAD`.text()).trim()
const user = (await $`git config user.name`.text()).trim().toLowerCase().replace(/\s+/g, "-")
const user =
(await $`git config user.name`.text())
.trim()
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "") || "local"
const snapshotVersion = `${pkg.version}-snapshot+${sha}.${user}`
console.log(`Building snapshot version: ${snapshotVersion}`)