@@ -10,7 +10,7 @@ const log = require('./util/log');
10
10
const _ = ' ' ;
11
11
const gutter = _ . repeat ( 4 ) ;
12
12
const levels = [ 'cyan' , 'yellow' , 'red' ] ; // sizes
13
- const th = str => colors . dim . bold . italic . underline ( str ) ;
13
+ const th = colors . dim ( ) . bold ( ) . italic ( ) . underline ;
14
14
const lpad = ( str , max ) => _ . repeat ( max - str . length ) + str ;
15
15
const rpad = ( str , max ) => str + _ . repeat ( max - str . length ) ;
16
16
@@ -49,7 +49,7 @@ module.exports = function (src, opts) {
49
49
let dest = ctx . options . output . path ;
50
50
51
51
del . sync ( dest ) ;
52
- log . log ( `Deleted existing ${ colors . bold . italic ( opts . dest ) } directory` ) ;
52
+ log . log ( `Deleted existing ${ colors . bold ( ) . italic ( opts . dest ) } directory` ) ;
53
53
54
54
ctx . run ( ( err , stats ) => {
55
55
let errors = [ ] ;
@@ -65,14 +65,14 @@ module.exports = function (src, opts) {
65
65
66
66
if ( errors . length > 0 ) {
67
67
let sfx = errors . length > 1 ? 's' : '' ;
68
- let out = `Failed to compile! Found ${ colors . red . bold ( errors . length ) } error${ sfx } :` ;
68
+ let out = `Failed to compile! Found ${ colors . red ( ) . bold ( errors . length ) } error${ sfx } :` ;
69
69
errors . forEach ( x => ( out += '\n' + x ) ) ;
70
70
return log . error ( out ) ;
71
71
}
72
72
73
73
if ( warnings . length > 0 ) {
74
74
let sfx = warnings . length > 1 ? 's' : '' ;
75
- let tmp = `Compiled with ${ colors . yellow . bold ( warnings . length ) } warning${ sfx } :` ;
75
+ let tmp = `Compiled with ${ colors . yellow ( ) . bold ( warnings . length ) } warning${ sfx } :` ;
76
76
warnings . forEach ( x => ( tmp += '\n' + x ) ) ;
77
77
log . warn ( tmp ) ;
78
78
}
@@ -100,16 +100,16 @@ module.exports = function (src, opts) {
100
100
max . size += 4 ;
101
101
102
102
// table headers
103
- out += ( '\n\n' + th ( rpad ( 'Filename' , max . file ) ) + gutter + th ( lpad ( 'Filesize' , max . size ) ) + _ + _ + colors . dim . bold . italic ( lpad ( '(gzip)' , max . gzip ) ) ) ;
103
+ out += ( '\n\n' + th ( rpad ( 'Filename' , max . file ) ) + gutter + th ( lpad ( 'Filesize' , max . size ) ) + _ + _ + colors . dim ( ) . bold ( ) . italic ( lpad ( '(gzip)' , max . gzip ) ) ) ;
104
104
105
105
assets . forEach ( obj => {
106
106
let fn = levels [ obj . notice ] ;
107
- let gz = colors . italic [ obj . notice ? fn : 'dim' ] ( _ + _ + lpad ( obj . gzip , max . gzip ) ) ;
107
+ let gz = colors . italic ( ) [ obj . notice ? fn : 'dim' ] ( _ + _ + lpad ( obj . gzip , max . gzip ) ) ;
108
108
out += ( '\n' + colors . white ( rpad ( obj . file , max . file ) ) + gutter + colors [ fn ] ( lpad ( obj . size , max . size ) ) + gz ) ;
109
109
} ) ;
110
110
111
111
log . success ( out + '\n' ) ;
112
- log . success ( `Build complete!\nYour ${ colors . bold . italic . green ( opts . dest ) } directory is ready for deployment 🎉` ) ;
112
+ log . success ( `Build complete!\nYour ${ colors . bold ( ) . italic ( ) . green ( opts . dest ) } directory is ready for deployment 🎉` ) ;
113
113
114
114
if ( opts . export && ! opts . analyze ) {
115
115
console . log ( ) ; // newline
@@ -140,9 +140,9 @@ module.exports = function (src, opts) {
140
140
routes . sort ( ( a , b ) => b . length - a . length ) ; // root is last (TODO)
141
141
} else {
142
142
routes = [ '/' ] ;
143
- let msg = `Exporting the "${ colors . bold . yellow ( '/' ) } " route only!\nNo other routes found or specified:` ;
144
- msg += `\n– Your ${ colors . bold . italic ( '@pages' ) } directory is empty.` ;
145
- if ( ctx . PWA_CONFIG ) msg += `\n– Your ${ colors . underline . magenta ( 'pwa.config.js' ) } is missing a "${ colors . bold ( 'routes' ) } " key.` ;
143
+ let msg = `Exporting the "${ colors . bold ( ) . yellow ( '/' ) } " route only!\nNo other routes found or specified:` ;
144
+ msg += `\n– Your ${ colors . bold ( ) . italic ( '@pages' ) } directory is empty.` ;
145
+ if ( ctx . PWA_CONFIG ) msg += `\n– Your ${ colors . underline ( ) . magenta ( 'pwa.config.js' ) } is missing a "${ colors . bold ( 'routes' ) } " key.` ;
146
146
msg += `\n– Your ${ colors . dim ( '$ pwa export' ) } is missing the ${ colors . cyan ( '--routes' ) } argument.` ;
147
147
msg += `\n Please run ${ colors . dim ( '$ pwa export --help' ) } for more info\n` ;
148
148
log . warn ( msg ) ;
@@ -158,14 +158,14 @@ module.exports = function (src, opts) {
158
158
if ( opts . insecure ) chromeFlags . push ( '--no-sandbox' ) ;
159
159
160
160
let base = 'http://localhost:' + server . address ( ) . port ;
161
- log . log ( `Started local server on ${ colors . white . bold . underline ( base ) } ` ) ;
161
+ log . log ( `Started local server on ${ colors . white ( ) . bold ( ) . underline ( base ) } ` ) ;
162
162
163
163
let toHTML = x => x . constructor . name === 'HtmlWebpackPlugin' ;
164
164
let minify_opts = ctx . options . plugins . find ( toHTML ) . options . minify ;
165
165
166
166
function print ( obj ) {
167
167
writer ( join ( dest , obj . file ) ) . end ( '<!DOCTYPE html>' + minify ( obj . html , minify_opts ) ) ;
168
- log . info ( `Wrote file: ${ colors . bold . magenta ( obj . file ) } ` ) ;
168
+ log . info ( `Wrote file: ${ colors . bold ( ) . magenta ( obj . file ) } ` ) ;
169
169
}
170
170
171
171
launch ( { chromeFlags } ) . then ( proc => {
@@ -179,7 +179,7 @@ module.exports = function (src, opts) {
179
179
server . close ( ) ;
180
180
log . log ( 'Shutdown local server\n' ) ;
181
181
let sfx = arr . length > 1 ? 's' : '' ;
182
- let num = colors . italic . bold . green ( arr . length ) ;
182
+ let num = colors . italic ( ) . bold ( ) . green ( arr . length ) ;
183
183
log . success ( `Export complete!\nGenerated ${ num } page${ sfx } 🙌🏼` ) ;
184
184
} ) . catch ( err => {
185
185
console . log ( '> error' , err ) ; //TODO
0 commit comments