1
1
import now from '~build/time' ;
2
2
import {
3
- CI ,
4
3
github ,
5
4
branch ,
6
5
sha ,
@@ -13,9 +12,10 @@ import {
13
12
author ,
14
13
authorDate ,
15
14
commitMessage
16
- } from '~build/info ' ;
15
+ } from '~build/git ' ;
17
16
import { message } from '~build/meta' ;
18
17
import { name , version } from '~build/package' ;
18
+ import { isCI , name as ciName } from '~build/ci' ;
19
19
20
20
import { format } from 'date-fns' ;
21
21
@@ -39,7 +39,7 @@ h1.innerHTML = `<a href="${github}" target="_blank">unplugin-info<a>`;
39
39
buildTime . appendChild ( h1 ) ;
40
40
41
41
append ( 'Build time: ' , format ( now , 'yyyy-MM-dd hh:mm' ) ) ;
42
- append ( 'CI: ' , CI ? CI : 'Not a CI env' ) ;
42
+ append ( 'CI: ' , isCI ? ciName : 'Not a CI env' ) ;
43
43
append ( 'Github: ' , github ? github : 'Not a github' ) ;
44
44
append ( 'Branch: ' , branch ) ;
45
45
append ( 'SHA: ' , sha ) ;
@@ -60,3 +60,19 @@ append('Package version: ', version);
60
60
append ( '' , '' ) ;
61
61
62
62
append ( 'You can also open console and play around with it.' , '' ) ;
63
+
64
+ const printBuildInfo = ( ) => {
65
+ if ( process . env . NODE_ENV === 'development' ) {
66
+ return ;
67
+ }
68
+ console . group ( 'Build info' ) ;
69
+ console . log ( 'Project:' , name ) ;
70
+ console . log ( 'Build date:' , now ? now . toLocaleString ( ) : 'Unknown' ) ;
71
+ console . log ( 'Environment:' , `${ process . env . NODE_ENV } ${ isCI ? '(ci)' : '' } ` ) ;
72
+ console . log ( 'Version:' , version ) ;
73
+ console . log ( `${ name } is an open source project, you can view its source code on Github!` ) ;
74
+ console . log ( github ) ;
75
+ console . groupEnd ( ) ;
76
+ } ;
77
+
78
+ printBuildInfo ( ) ;
0 commit comments