|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
789 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | import colors from 'picocolors'
|
|---|
| 2 |
|
|---|
| 3 | let alreadyShown = new Set()
|
|---|
| 4 |
|
|---|
| 5 | function log(type, messages, key) {
|
|---|
| 6 | if (typeof process !== 'undefined' && process.env.JEST_WORKER_ID) return
|
|---|
| 7 |
|
|---|
| 8 | if (key && alreadyShown.has(key)) return
|
|---|
| 9 | if (key) alreadyShown.add(key)
|
|---|
| 10 |
|
|---|
| 11 | console.warn('')
|
|---|
| 12 | messages.forEach((message) => console.warn(type, '-', message))
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | export function dim(input) {
|
|---|
| 16 | return colors.dim(input)
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | export default {
|
|---|
| 20 | info(key, messages) {
|
|---|
| 21 | log(colors.bold(colors.cyan('info')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
|---|
| 22 | },
|
|---|
| 23 | warn(key, messages) {
|
|---|
| 24 | log(colors.bold(colors.yellow('warn')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
|---|
| 25 | },
|
|---|
| 26 | risk(key, messages) {
|
|---|
| 27 | log(colors.bold(colors.magenta('risk')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
|---|
| 28 | },
|
|---|
| 29 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.