improve nuxt-edge auto-publish versioning

This commit is contained in:
Pooya Parsa 2018-01-08 20:47:32 +03:30
parent 12830e306f
commit c316be20ef

View File

@ -23,7 +23,10 @@ p.name = 'nuxt-edge'
const gitCommit = String(spawnSync('git', 'rev-parse --short HEAD'.split(' ')).stdout).trim()
// Version with latest git commit id
p.version = p.version.split('-')[0] + gitCommit
// Using date.now() so latest push will be always choosen by npm/yarn
const date = Math.round(Date.now() / (1000 * 60))
const baseVersion = p.version.split('-')[0]
p.version = `${baseVersion}-${date}.${gitCommit}`
// Write package.json
writeFileSync(packagePath, JSON.stringify(p, null, 2) + '\r\n')