feat(bin): 增加打包耗时
This commit is contained in:
@@ -12,20 +12,42 @@ const upload_url = 'http://132.126.207.124:36800'
|
||||
const upload_username = 'AxhEbscwsJDbYMH2'
|
||||
const upload_password = 'cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4'
|
||||
|
||||
const millisecondToString = (timestamp) => {
|
||||
const totalSeconds = Math.floor(parseFloat(timestamp) / 1000)
|
||||
if (isNaN(totalSeconds) || totalSeconds < 0) {
|
||||
return "0秒";
|
||||
}
|
||||
|
||||
const days = Math.floor(totalSeconds / 86400)
|
||||
let remaining = totalSeconds % 86400
|
||||
const hours = Math.floor(remaining / 3600)
|
||||
remaining %= 3600
|
||||
const minutes = Math.floor(remaining / 60)
|
||||
const seconds = remaining % 60
|
||||
|
||||
const parts = []
|
||||
if (days > 0) parts.push(`${days}天`)
|
||||
if (days > 0 || hours > 0) parts.push(`${hours}小时`)
|
||||
if (days > 0 || hours > 0 || minutes > 0) parts.push(`${minutes}分钟`)
|
||||
parts.push(`${seconds}秒`)
|
||||
|
||||
return parts.join('')
|
||||
}
|
||||
|
||||
export const run_deploy = async (project) => {
|
||||
await spinner(
|
||||
let output = await spinner(
|
||||
`Deploying project ${project}`,
|
||||
() => $`mvn -pl ${project} clean deploy -D skipTests -s ${maven_setting}`
|
||||
)
|
||||
console.log(`✅ Finish deploy ${project}`)
|
||||
console.log(`✅ Finish deploy ${project} (${millisecondToString(output['duration'])})`)
|
||||
}
|
||||
|
||||
export const run_deploy_root = async () => {
|
||||
await spinner(
|
||||
let output = await spinner(
|
||||
`Deploying root`,
|
||||
() => $`mvn clean deploy -N -D skipTests -s ${maven_setting}`
|
||||
)
|
||||
console.log(`✅ Finish deploy root`)
|
||||
console.log(`✅ Finish deploy root (${millisecondToString(output['duration'])})`)
|
||||
}
|
||||
|
||||
export const run_deploy_batch = async (projects) => {
|
||||
@@ -35,11 +57,11 @@ export const run_deploy_batch = async (projects) => {
|
||||
}
|
||||
|
||||
export const run_package = async (project, profile = 'b2b12') => {
|
||||
await spinner(
|
||||
`Packaging project ${project} ${isEqual(profile, 'b2b12') ? '' : profile}`,
|
||||
let output = await spinner(
|
||||
`Packaging project ${project}${isEqual(profile, 'b2b12') ? '' : ` ${profile}`}`,
|
||||
() => $`mvn -pl ${project} clean package -D skipTests -P ${profile} -s ${maven_setting}`
|
||||
)
|
||||
console.log(`✅ Finish package ${project} ${isEqual(profile, 'b2b12') ? '' : profile}`)
|
||||
console.log(`✅ Finish package ${project}${isEqual(profile, 'b2b12') ? '' : ` ${profile}`} (${millisecondToString(output['duration'])})`)
|
||||
}
|
||||
|
||||
export const run_package_batch = async (projects) => {
|
||||
|
||||
Reference in New Issue
Block a user