From 5a4334a35aa4fda0f1810aead0c22ef979773403 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 5 Apr 2018 16:32:46 +0530 Subject: [PATCH] Add error logs in rollup watch (#5385) * Add error logs in rollup watch * Show frame when it is available --- frappe/public/css/email.css | 172 +++++++++++++++++++++++++++++++++++- rollup/config.js | 1 - rollup/watch.js | 19 ++++ 3 files changed, 190 insertions(+), 2 deletions(-) diff --git a/frappe/public/css/email.css b/frappe/public/css/email.css index 2151dfd8d5..67a4b4d597 100644 --- a/frappe/public/css/email.css +++ b/frappe/public/css/email.css @@ -1 +1,171 @@ -body{line-height:1.5;color:#36414c}p{margin:1em 0!important}hr{border-top:1px solid #d1d8dd}.body-table,.body-table td{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.email-body,.email-footer,.email-header{width:100%!important;min-width:100%!important}.email-body{font-size:14px}.email-footer{border-top:1px solid #d1d8dd;font-size:12px}.email-header{border:1px solid #d1d8dd;border-radius:4px 4px 0 0}.email-header .brand-image{width:24px;height:24px;display:block}.email-header-title{font-weight:700}.body-table.has-header .email-body{border:1px solid #d1d8dd;border-radius:0 0 4px 4px;border-top:none}.body-table.has-header .email-footer{border-top:none}.email-footer-container{margin-top:30px}.email-footer-container>div:not(:last-child){margin-bottom:5px}.email-unsubscribe a{color:#8d99a6;text-decoration:underline}.btn{text-decoration:none;padding:7px 10px;font-size:12px;border:1px solid;border-radius:3px}.btn.btn-default{color:#fff;background-color:#f0f4f7;border-color:transparent}.btn.btn-primary{color:#fff;background-color:#5e64ff;border-color:#444bff}.table{width:100%;border-collapse:collapse}.table td,.table th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #d1d8dd;text-align:left}.table th{font-weight:700}.table>thead>tr>th{vertical-align:middle;border-bottom:2px solid #d1d8dd}.table>thead:first-child>tr:first-child>th{border-top:none}.table.table-bordered,.table.table-bordered td,.table.table-bordered th{border:1px solid #d1d8dd}.more-info{font-size:80%!important;color:#8d99a6!important;border-top:1px solid #ebeff2;padding-top:10px}.text-right{text-align:right!important}.text-center{text-align:center!important}.text-muted{color:#8d99a6!important}.text-extra-muted{color:#d1d8dd!important}.text-regular{font-size:14px}.text-medium{font-size:12px}.text-small{font-size:10px}.text-bold{font-weight:700}.indicator{width:8px;height:8px;border-radius:8px;background-color:#b8c2cc;display:inline-block;margin-right:5px}.indicator.indicator-blue{background-color:#5e64ff}.indicator.indicator-green{background-color:#98d85b}.indicator.indicator-orange{background-color:#ffa00a}.indicator.indicator-red{background-color:#ff5858}.indicator.indicator-yellow{background-color:#feef72}.screenshot{box-shadow:0 3px 6px rgba(0,0,0,.1);border:1px solid #d1d8dd;margin:8px 0;max-width:100%}.report-title{margin-bottom:20px} \ No newline at end of file +/* csslint ignore:start */ +/* palette colors*/ +body { + line-height: 1.5; + color: #36414c; +} +p { + margin: 1em 0 !important; +} +hr { + border-top: 1px solid #d1d8dd; +} +.body-table { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; +} +.body-table td { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; +} +.email-header, +.email-body, +.email-footer { + width: 100% !important; + min-width: 100% !important; +} +.email-body { + font-size: 14px; +} +.email-footer { + border-top: 1px solid #d1d8dd; + font-size: 12px; +} +.email-header { + border: 1px solid #d1d8dd; + border-radius: 4px 4px 0 0; +} +.email-header .brand-image { + width: 24px; + height: 24px; + display: block; +} +.email-header-title { + font-weight: bold; +} +.body-table.has-header .email-body { + border: 1px solid #d1d8dd; + border-radius: 0 0 4px 4px; + border-top: none; +} +.body-table.has-header .email-footer { + border-top: none; +} +.email-footer-container { + margin-top: 30px; +} +.email-footer-container > div:not(:last-child) { + margin-bottom: 5px; +} +.email-unsubscribe a { + color: #8d99a6; + text-decoration: underline; +} +.btn { + text-decoration: none; + padding: 7px 10px; + font-size: 12px; + border: 1px solid; + border-radius: 3px; +} +.btn.btn-default { + color: #fff; + background-color: #f0f4f7; + border-color: transparent; +} +.btn.btn-primary { + color: #fff; + background-color: #5e64ff; + border-color: #444bff; +} +.table { + width: 100%; + border-collapse: collapse; +} +.table td, +.table th { + padding: 8px; + line-height: 1.42857143; + vertical-align: top; + border-top: 1px solid #d1d8dd; + text-align: left; +} +.table th { + font-weight: bold; +} +.table > thead > tr > th { + vertical-align: middle; + border-bottom: 2px solid #d1d8dd; +} +.table > thead:first-child > tr:first-child > th { + border-top: none; +} +.table.table-bordered { + border: 1px solid #d1d8dd; +} +.table.table-bordered td, +.table.table-bordered th { + border: 1px solid #d1d8dd; +} +.more-info { + font-size: 80% !important; + color: #8d99a6 !important; + border-top: 1px solid #ebeff2; + padding-top: 10px; +} +.text-right { + text-align: right !important; +} +.text-center { + text-align: center !important; +} +.text-muted { + color: #8d99a6 !important; +} +.text-extra-muted { + color: #d1d8dd !important; +} +.text-regular { + font-size: 14px; +} +.text-medium { + font-size: 12px; +} +.text-small { + font-size: 10px; +} +.text-bold { + font-weight: bold; +} +.indicator { + width: 8px; + height: 8px; + border-radius: 8px; + background-color: #b8c2cc; + display: inline-block; + margin-right: 5px; +} +.indicator.indicator-blue { + background-color: #5e64ff; +} +.indicator.indicator-green { + background-color: #98d85b; +} +.indicator.indicator-orange { + background-color: #ffa00a; +} +.indicator.indicator-red { + background-color: #ff5858; +} +.indicator.indicator-yellow { + background-color: #feef72; +} +.screenshot { + box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1); + border: 1px solid #d1d8dd; + margin: 8px 0; + max-width: 100%; +} +/* auto email report */ +.report-title { + margin-bottom: 20px; +} +/* csslint ignore:end */ diff --git a/rollup/config.js b/rollup/config.js index 538d17877b..d8b6a27be6 100644 --- a/rollup/config.js +++ b/rollup/config.js @@ -29,7 +29,6 @@ function get_rollup_options(output_file, input_files) { } function get_rollup_options_for_js(output_file, input_files) { - const css_output_file = path.resolve(assets_path, 'css', path.basename(output_file).split('.js')[0] + '.css'); const plugins = [ // enables array of inputs diff --git a/rollup/watch.js b/rollup/watch.js index 11bef4cd17..9d025d067a 100644 --- a/rollup/watch.js +++ b/rollup/watch.js @@ -35,6 +35,16 @@ function watch_assets() { break; } + case 'ERROR': { + log_error(event.error); + break; + } + + case 'FATAL': { + log_error(event.error); + break; + } + default: break; } }); @@ -61,3 +71,12 @@ function log_css_change({output}) { } }; } + +function log_error(error) { + log(chalk.yellow('Error in: ' + error.id)); + log(chalk.red(error.toString())); + + if (error.frame) { + log(chalk.red(error.frame)); + } +}