2022-09-26 16:29:56 +03:00
|
|
|
import { LogHelper } from '@/helpers/log-helper'
|
2022-09-26 16:24:07 +03:00
|
|
|
import { LoaderHelper } from '@/helpers/loader-helper'
|
2019-02-10 15:26:50 +03:00
|
|
|
|
|
|
|
import updateVersion from './update-version'
|
2021-03-02 12:02:55 +03:00
|
|
|
import generateChangelog from './generate-changelog'
|
2019-02-10 15:26:50 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-02 12:02:55 +03:00
|
|
|
* Main entry of the release preparation
|
2019-02-10 15:26:50 +03:00
|
|
|
*/
|
2022-09-03 14:12:41 +03:00
|
|
|
;(async () => {
|
2022-09-26 16:24:07 +03:00
|
|
|
LoaderHelper.start()
|
2022-09-26 16:29:56 +03:00
|
|
|
LogHelper.info('Preparing for release...')
|
2019-02-10 15:26:50 +03:00
|
|
|
|
|
|
|
const { argv } = process
|
|
|
|
const version = argv[2].toLowerCase()
|
2022-09-03 14:12:41 +03:00
|
|
|
const semverRegex =
|
|
|
|
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/
|
2019-02-10 15:26:50 +03:00
|
|
|
|
|
|
|
if (version.match(semverRegex) !== null) {
|
|
|
|
try {
|
|
|
|
await updateVersion(version)
|
|
|
|
await generateChangelog(version)
|
|
|
|
|
2022-09-26 16:29:56 +03:00
|
|
|
LogHelper.success('Hooray! Leon is ready to be released!')
|
2022-09-26 16:24:07 +03:00
|
|
|
LoaderHelper.stop()
|
2019-02-10 15:26:50 +03:00
|
|
|
} catch (e) {
|
2022-09-26 16:29:56 +03:00
|
|
|
LogHelper.error(e)
|
2022-09-26 16:24:07 +03:00
|
|
|
LoaderHelper.stop()
|
2019-02-10 15:26:50 +03:00
|
|
|
}
|
|
|
|
} else {
|
2022-09-26 16:29:56 +03:00
|
|
|
LogHelper.error(
|
2022-09-03 14:12:41 +03:00
|
|
|
'The version number does match the Semantic Versioning rules (https://semver.org)'
|
|
|
|
)
|
2022-09-26 16:24:07 +03:00
|
|
|
LoaderHelper.stop()
|
2019-02-10 15:26:50 +03:00
|
|
|
}
|
|
|
|
})()
|