MCPcopy
hub / github.com/codeceptjs/CodeceptJS / versioning

Function versioning

runok.cjs:485–520  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

483 },
484
485 async versioning() {
486 const semver = require('semver')
487
488 if (fs.existsSync('./package.json')) {
489 const packageFile = require('./package.json')
490 const currentVersion = packageFile.version
491 let type = process.argv[3]
492 if (!['major', 'minor', 'patch'].includes(type)) {
493 type = 'patch'
494 }
495
496 const newVersion = semver.inc(packageFile.version, type)
497 packageFile.version = newVersion
498 fs.writeFileSync('./package.json', JSON.stringify(packageFile, null, 2).replace(/(^[ \t]*\n)/gm, ''))
499 console.log('Version updated', currentVersion, '=>', newVersion)
500
501 const file = 'CHANGELOG.md'
502 const changelog = fs.readFileSync(file).toString()
503
504 const _changelog = `## ${newVersion}\n
505❤️ Thanks all to those who contributed to make this release! ❤️
506
507🛩️ *Features*
508
509🐛 *Bug Fixes*
510
511📖 *Documentation*
512
513${changelog}`
514
515 fs.writeFileSync(`./${file}`, _changelog)
516
517 console.log('Creating and switching to release branch...')
518 await exec(`git checkout -b release-${newVersion}`)
519 }
520 },
521
522 async getCommitLog() {
523 console.log('Gathering commits...')

Callers

nothing calls this directly

Calls 3

includesMethod · 0.80
logMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected