mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
chore(project): enhance logging in github actions (#5425)
This commit is contained in:
parent
58c4040b45
commit
7ddb04b36c
2
.github/workflows/preview-build.yml
vendored
2
.github/workflows/preview-build.yml
vendored
@ -38,6 +38,8 @@ jobs:
|
||||
|
||||
- name: Build Element Plus
|
||||
run: pnpm build
|
||||
env:
|
||||
FORCE_COLOR: 2
|
||||
|
||||
- name: Build website
|
||||
run: pnpm docs:build
|
||||
|
1
.github/workflows/publish-npm.yml
vendored
1
.github/workflows/publish-npm.yml
vendored
@ -54,3 +54,4 @@ jobs:
|
||||
TAG_VERSION: ${{env.TAG_VERSION}}
|
||||
GIT_HEAD: ${{env.GIT_HEAD}}
|
||||
REGISTRY: https://registry.npmjs.com/
|
||||
FORCE_COLOR: 2
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { cyan, bold, yellow, green } from 'chalk'
|
||||
|
||||
import { command } from '../utils/log'
|
||||
import type { FileSizeReporter } from 'rollup-plugin-filesize'
|
||||
|
||||
export const reporter: FileSizeReporter = (opt, outputOptions, info) => {
|
||||
return `${cyan(bold(info.fileName))}: bundle size ${yellow(
|
||||
info.bundleSize
|
||||
)} -> minified ${green(info.minSize)}`
|
||||
return command(
|
||||
`${cyan(bold(info.fileName))}: bundle size ${yellow(
|
||||
info.bundleSize
|
||||
)} -> minified ${green(info.minSize)}`
|
||||
)
|
||||
}
|
||||
|
@ -1,23 +1,36 @@
|
||||
import process from 'process'
|
||||
import chalk from 'chalk'
|
||||
|
||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||
const [command, info, error] = ['command', 'info', 'error'].map(
|
||||
(symbol: string) => {
|
||||
return (msg: string) => `[${symbol}] ${msg}`
|
||||
}
|
||||
)
|
||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||
const [group, endGroup] = ['group', 'endgroup'].map((symbol) => {
|
||||
return (groupMsg: string) => `##[${symbol}] ${groupMsg}`
|
||||
})
|
||||
|
||||
export function cyan(str: string) {
|
||||
console.log(chalk.cyan(str))
|
||||
console.log(command(chalk.cyan(str)))
|
||||
}
|
||||
|
||||
export function yellow(str: string) {
|
||||
console.log(chalk.yellow(str))
|
||||
console.log(command(chalk.yellow(str)))
|
||||
}
|
||||
|
||||
export function green(str: string) {
|
||||
console.log(chalk.green(str))
|
||||
console.log(command(chalk.green(str)))
|
||||
}
|
||||
|
||||
export function red(str: string) {
|
||||
console.error(chalk.red(str))
|
||||
console.log(error(chalk.red(str)))
|
||||
}
|
||||
|
||||
export function errorAndExit(e: Error): never {
|
||||
red(e.stack ?? e.message)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
export { command, info, error, group, endGroup }
|
||||
|
Loading…
Reference in New Issue
Block a user