UNPKG

ncahec-northwest-theme

Version:

theme for northwest ahec

350 lines (334 loc) 31.8 kB
const exportCg3Template= require("./exportCg3Template").loadCg3Template; const theme = require("./package").name; const version = require("./package").version; const region = theme.replace(/(ncahec-|-theme)/gi, ""); const fs = require("fs-extra"); const replace = require("replace-in-file"); // templates used to generate an index file for each application const apps = [ { name: "auth", code: ` <div ng-app="auth" class="main container ${region}"> <base href="/admin/auth/"> <div ng-view></div> </div> <script type="text/javascript" src="/admin/auth/dist/bundle.js"></script> ` }, { name: "checkout", code: ` <div class="main container ${region}"> <base href="/"> <app-root></app-root> </div> <script type="text/javascript" src="/checkout/dist/vendor.js"></script> <script type="text/javascript" src="/checkout/dist/main.js"></script> <script type="text/javascript" src="/checkout/dist/polyfills.js"></script> <script type="text/javascript" src="/checkout/dist/runtime.js"></script> <script type="text/javascript" src="/checkout/dist/scripts.js"></script> <script type="text/javascript" src="/checkout/dist/styles.js"></script> `, }, { name: "courses", code: ` <div ng-app="courses" class="main container ${region}"> <base href="/"> <div ng-view></div> </div> <script type="text/javascript" src="/courses/dist/bundle.js"></script> ` }, { name: "courses-v2", code: ` <div class="main container ${region}"> <base href="/"> <app-root></app-root> </div> <script type="text/javascript" src="/courses/v2/dist/vendor.js"></script> <script type="text/javascript" src="/courses/v2/dist/main.js"></script> <script type="text/javascript" src="/courses/v2/dist/polyfills.js"></script> <script type="text/javascript" src="/courses/v2/dist/runtime.js"></script> <script type="text/javascript" src="/courses/v2/dist/scripts.js"></script> <script type="text/javascript" src="/courses/v2/dist/styles.js"></script> `, }, { name: "evaluations", code: ` <div class="main container ${region}"> <base href="/admin/evaluations/"> <app-root></app-root> <script type="text/javascript" src="/admin/evaluations/dist/runtime.js"></script> <script type="text/javascript" src="/admin/evaluations/dist/es2015-polyfills.js" nomodule></script> <script type="text/javascript" src="/admin/evaluations/dist/polyfills.js"></script> <script type="text/javascript" src="/admin/evaluations/dist/styles.js"></script> <script type="text/javascript" src="/admin/evaluations/dist/main.js"></script> </div> ` }, { name: "housing", code: ` <div class="main container ${region}"> <base href="/admin/housing/"> <app-root></app-root> </div> <script type="text/javascript" src="/admin/housing/dist/runtime.js"></script> <script type="text/javascript" src="/admin/housing/dist/es2015-polyfills.js" nomodule></script> <script type="text/javascript" src="/admin/housing/dist/polyfills.js"></script> <script type="text/javascript" src="/admin/housing/dist/styles.js"></script> <script type="text/javascript" src="/admin/housing/dist/main.js"></script> `, }, { name: "images", code: ` <div ng-app="images" class="main container ${region}"> <base href="/"> <div ng-view></div> </div> <script type="text/javascript" src="/admin/images/dist/bundle.js"></script> ` }, { name: "login", code: ` <div ng-app="login" class="main container ${region}"> <base href="/"> <div ng-view></div> </div> <script type="text/javascript" src="/login/dist/bundle.js"></script> ` }, { name: "users", code: ` <div ng-app="users" class="main container ${region}"> <base href="/"> <div ng-view></div> </div> <script type="text/javascript" src="/users/dist/bundle.js"></script> ` }, { name: "users-v2", code: ` <div class="main container ${region}"> <base href="/admin/users/"> <app-root></app-root> </div> <script type="text/javascript" src="/admin/users/dist/runtime.js"></script> <script type="text/javascript" src="/admin/users/dist/es2015-polyfills.js" nomodule></script> <script type="text/javascript" src="/admin/users/dist/polyfills.js"></script> <script type="text/javascript" src="/admin/users/dist/styles.js"></script> <script type="text/javascript" src="/admin/users/dist/main.js"></script> `, } ]; // templates to generate each error page const errorPages = [ { name: "403.html", message: `<style> .main.${theme}{text-align:center; padding:2.0em 0 4.0em 0; font-size:1.2em; color:#444444} .main.${theme} svg{width:128px; height:128px; opacity:0.8; margin-top:2.0em;} .main.${theme} svg path{fill:#444444;} </style> <div class="main container ${theme}"> <div><?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="64px" height="64px" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!-- Generator: Sketch 3.7.2 (28276) - http://www.bohemiancoding.com/sketch --><title>com-bug</title><desc>Created with Sketch.</desc><defs></defs><g id="64px-Line" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="com-bug"></g><path d="M59,34 L47.986,34 C47.924,29.934 47.49,26.598 46.765,23.879 C53.157,23.02 58,17.587 58,11 C58,10.447 57.553,10 57,10 C56.447,10 56,10.447 56,11 C56,16.688 51.729,21.349 46.157,21.928 C44.707,17.876 42.517,15.434 40,13.988 L40,13.5 C40,9.364 35.963,6 31,6 C26.037,6 22,9.364 22,13.5 L22,13.988 C19.483,15.434 17.293,17.876 15.843,21.928 C10.271,21.35 6,16.688 6,11 C6,10.447 5.553,10 5,10 C4.447,10 4,10.447 4,11 C4,17.587 8.843,23.021 15.236,23.879 C14.51,26.598 14.077,29.933 14.015,34 L3,34 C2.447,34 2,34.447 2,35 C2,35.553 2.447,36 3,36 L14.006,36 C14.045,39.504 14.309,42.998 15.112,46.137 C8.783,47.051 4,52.464 4,59 C4,59.553 4.447,60 5,60 C5.553,60 6,59.553 6,59 C6,53.367 10.199,48.729 15.699,48.085 C17.73,53.85 22.052,58 31,58 C36.744,58 43.1,56.616 46.157,48.072 C51.729,48.65 56,53.315 56,59 C56,59.553 56.447,60 57,60 C57.553,60 58,59.553 58,59 C58,52.416 53.156,46.98 46.764,46.121 C47.49,43.402 47.923,40.066 47.985,36 L59,36 C59.553,36 60,35.553 60,35 C60,34.447 59.553,34 59,34 L59,34 Z M31,8 C34.666,8 37.677,10.227 37.971,13.049 C35.717,12.227 33.309,12 31,12 C28.691,12 26.283,12.227 24.029,13.049 C24.323,10.227 27.334,8 31,8 L31,8 Z M31,14 C36.116,14 41.311,15.19 44.041,22 L17.958,22 C20.689,15.19 25.884,14 31,14 L31,14 Z M16,35 C16,30.42 16.466,26.823 17.277,24 L30,24 L30,55.983 C22.603,55.75 16,52.663 16,35 L16,35 Z M32,55.983 L32,24 L44.723,24 C45.535,26.823 46,30.42 46,35 C46,39.891 45.49,43.655 44.601,46.56 C44.58,46.603 44.574,46.651 44.559,46.696 C42.22,54.166 37.317,55.815 32,55.983 L32,55.983 Z" id="Shape" fill="#000000"></path></g></svg></div> <div style="margin-top:1.0em">This page request is being blocked.</div> <div>Please contact us if this presents an issue.</div> </div>` }, { name: "500.html", message: `<style> .main.${theme}{text-align:center; padding:2.0em 0 4.0em 0; font-size:1.2em; color:#444444} .main.${theme} svg{width:128px; height:128px; opacity:0.8; margin-top:2.0em;} .main.${theme} svg path{fill:#444444;} </style> <div class="main container ${theme}"> <div><?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="64px" height="64px" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!-- Generator: Sketch 3.7.2 (28276) - http://www.bohemiancoding.com/sketch --><title>con-warning</title><desc>Created with Sketch.</desc><defs></defs><g id="64px-Line" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="con-warning"></g><path d="M31,42 C29.346,42 28,43.346 28,45 C28,46.654 29.346,48 31,48 C32.654,48 34,46.654 34,45 C34,43.346 32.654,42 31,42 L31,42 Z M31,46 C30.449,46 30,45.552 30,45 C30,44.448 30.449,44 31,44 C31.551,44 32,44.448 32,45 C32,45.552 31.551,46 31,46 L31,46 Z" id="Shape" fill="#000000"></path><path d="M28.001,37.091 C28.049,38.703 29.376,40 31,40 C32.624,40 33.951,38.703 33.999,37.091 L35.987,25.165 C35.996,25.11 36,25.055 36,25 C36,22.243 33.757,20 31,20 C28.243,20 26,22.243 26,25 C26,25.055 26.004,25.11 26.014,25.165 L28.001,37.091 L28.001,37.091 Z M31,22 C32.628,22 33.958,23.304 33.999,24.923 L32.014,36.836 C32.004,36.89 32,36.945 32,37 C32,37.552 31.551,38 31,38 C30.449,38 30,37.552 30,37 C30,36.945 29.996,36.89 29.986,36.836 L28.001,24.923 C28.042,23.304 29.372,22 31,22 L31,22 Z" id="Shape" fill="#000000"></path><path d="M9,56 L53,56 C56.86,56 60,52.859 60,49 C60,47.581 59.348,46.063 59.273,45.895 C59.252,45.847 59.227,45.8 59.198,45.756 L36.754,11.023 C36.735,10.99 36.715,10.958 36.692,10.927 C35.379,9.094 33.25,8 31,8 C28.75,8 26.621,9.094 25.308,10.926 C25.286,10.957 25.266,10.989 25.247,11.022 L2.802,45.756 C2.773,45.8 2.748,45.847 2.727,45.895 C2.652,46.063 2,47.581 2,49 C2,52.859 5.14,56 9,56 L9,56 Z M4.528,46.77 L26.962,12.053 C26.964,12.05 26.966,12.046 26.968,12.043 C27.909,10.763 29.412,10 31,10 C32.588,10 34.09,10.763 35.032,12.043 C35.034,12.046 35.036,12.049 35.038,12.053 L57.472,46.77 C57.643,47.181 58,48.206 58,49 C58,51.757 55.757,54 53,54 L9,54 C6.243,54 4,51.757 4,49 C4,48.205 4.357,47.181 4.528,46.77 L4.528,46.77 Z" id="Shape" fill="#000000"></path></g></svg></div> <div style="margin-top:1.0em">Internal Server Error</div> <div>Error received from upstream server</div> </div>` }, { name: "502.html", message: `<style> .main.${theme}{text-align:center; padding:2.0em 0 4.0em 0; font-size:1.2em; color:#444444} .main.${theme} svg{width:128px; height:128px; opacity:0.8; margin-top:2.0em;} .main.${theme} svg path{fill:#444444;} </style> <div class="main container ${theme}"> <div><?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="64px" height="64px" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!-- Generator: Sketch 3.7.2 (28276) - http://www.bohemiancoding.com/sketch --><title>con-warning</title><desc>Created with Sketch.</desc><defs></defs><g id="64px-Line" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="con-warning"></g><path d="M31,42 C29.346,42 28,43.346 28,45 C28,46.654 29.346,48 31,48 C32.654,48 34,46.654 34,45 C34,43.346 32.654,42 31,42 L31,42 Z M31,46 C30.449,46 30,45.552 30,45 C30,44.448 30.449,44 31,44 C31.551,44 32,44.448 32,45 C32,45.552 31.551,46 31,46 L31,46 Z" id="Shape" fill="#000000"></path><path d="M28.001,37.091 C28.049,38.703 29.376,40 31,40 C32.624,40 33.951,38.703 33.999,37.091 L35.987,25.165 C35.996,25.11 36,25.055 36,25 C36,22.243 33.757,20 31,20 C28.243,20 26,22.243 26,25 C26,25.055 26.004,25.11 26.014,25.165 L28.001,37.091 L28.001,37.091 Z M31,22 C32.628,22 33.958,23.304 33.999,24.923 L32.014,36.836 C32.004,36.89 32,36.945 32,37 C32,37.552 31.551,38 31,38 C30.449,38 30,37.552 30,37 C30,36.945 29.996,36.89 29.986,36.836 L28.001,24.923 C28.042,23.304 29.372,22 31,22 L31,22 Z" id="Shape" fill="#000000"></path><path d="M9,56 L53,56 C56.86,56 60,52.859 60,49 C60,47.581 59.348,46.063 59.273,45.895 C59.252,45.847 59.227,45.8 59.198,45.756 L36.754,11.023 C36.735,10.99 36.715,10.958 36.692,10.927 C35.379,9.094 33.25,8 31,8 C28.75,8 26.621,9.094 25.308,10.926 C25.286,10.957 25.266,10.989 25.247,11.022 L2.802,45.756 C2.773,45.8 2.748,45.847 2.727,45.895 C2.652,46.063 2,47.581 2,49 C2,52.859 5.14,56 9,56 L9,56 Z M4.528,46.77 L26.962,12.053 C26.964,12.05 26.966,12.046 26.968,12.043 C27.909,10.763 29.412,10 31,10 C32.588,10 34.09,10.763 35.032,12.043 C35.034,12.046 35.036,12.049 35.038,12.053 L57.472,46.77 C57.643,47.181 58,48.206 58,49 C58,51.757 55.757,54 53,54 L9,54 C6.243,54 4,51.757 4,49 C4,48.205 4.357,47.181 4.528,46.77 L4.528,46.77 Z" id="Shape" fill="#000000"></path></g></svg></div> <div style="margin-top:1.0em">Bad Gateway</div> <div>Invalid response received from upstream server</div> </div>` }, { name: "503.html", message: `<style> .main.${theme}{text-align:center; padding:2.0em 0 4.0em 0; font-size:1.2em; color:#444444} .main.${theme} svg{width:128px; height:128px; opacity:0.8; margin-top:2.0em;} .main.${theme} svg path{fill:#444444;} </style> <div class="main container ${theme}"> <div><?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width= "64px" height= "64px" viewBox= "0 0 64 64" version= "1.1" xmlns= "http://www.w3.org/2000/svg" xmlns: xlink = "http://www.w3.org/1999/xlink" ><title>con-barrier</title><desc>Created with Sketch.</desc><defs></defs><g id="64px-Line" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="con-barrier"></g><path d="M7,28 L11.78,28 L6.019,56.804 C5.96,57.098 6.036,57.403 6.226,57.634 C6.417,57.866 6.7,58 7,58 L13,58 C13.477,58 13.887,57.664 13.98,57.196 L16.62,44 L47.38,44 L50.019,57.196 C50.113,57.664 50.523,58 51,58 L57,58 C57.3,58 57.583,57.866 57.773,57.634 C57.963,57.403 58.039,57.098 57.98,56.804 L52.22,28 L57,28 C58.654,28 60,26.654 60,24.999 L60,19 C60,17.346 58.654,16 57,16 L49,16 L15,16 L7,16 C5.346,16 4,17.346 4,19 L4,24.999 C4,26.654 5.346,28 7,28 L7,28 Z M24.586,18 L16.586,26 L9.414,26 L17.414,18 L24.586,18 L24.586,18 Z M34.586,18 L26.586,26 L19.414,26 L27.414,18 L34.586,18 L34.586,18 Z M44.586,18 L36.586,26 L29.414,26 L37.414,18 L44.586,18 L44.586,18 Z M44.18,28 L46.18,38 L17.82,38 L19.82,28 L44.18,28 L44.18,28 Z M12.18,56 L8.22,56 L13.82,28 L17.781,28 L12.18,56 L12.18,56 Z M17.02,42 L17.42,40 L46.581,40 L46.981,42 L17.02,42 L17.02,42 Z M55.78,56 L51.82,56 L46.22,28 L50.181,28 L55.78,56 L55.78,56 Z M58,24.999 C58,25.551 57.551,26 57,26 L49.414,26 L57.344,18.07 C57.725,18.211 58,18.571 58,19 L58,24.999 L58,24.999 Z M54.586,18 L46.586,26 L39.414,26 L47.414,18 L54.586,18 L54.586,18 Z M6,19 C6,18.449 6.449,18 7,18 L14.586,18 L6.656,25.93 C6.275,25.788 6,25.429 6,24.999 L6,19 L6,19 Z" id="Shape" fill="#000000"></path><path d="M20,11 C20,8.243 17.757,6 15,6 C12.243,6 10,8.243 10,11 C10,13.757 12.243,16 15,16 C17.757,16 20,13.757 20,11 L20,11 Z M15,14 C13.346,14 12,12.654 12,11 C12,9.346 13.346,8 15,8 C16.654,8 18,9.346 18,11 C18,12.654 16.654,14 15,14 L15,14 Z" id="Shape" fill="#000000"></path><path d="M54,11 C54,8.243 51.757,6 49,6 C46.243,6 44,8.243 44,11 C44,13.757 46.243,16 49,16 C51.757,16 54,13.757 54,11 L54,11 Z M49,14 C47.346,14 46,12.654 46,11 C46,9.346 47.346,8 49,8 C50.654,8 52,9.346 52,11 C52,12.654 50.654,14 49,14 L49,14 Z" id="Shape" fill="#000000"></path></g></svg ></div> <div style="margin-top:1.0em">This service is down temporarily.</div> <div>Thank you for your patience.</div> </div>` }, { name: "504.html", message: `<style> .main.${theme}{text-align:center; padding:2.0em 0 4.0em 0; font-size:1.2em; color:#444444} .main.${theme} svg{width:128px; height:128px; opacity:0.8; margin-top:2.0em;} .main.${theme} svg path{fill:#444444;} </style> <div class="main container ${theme}"> <div><?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="64px" height="64px" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!-- Generator: Sketch 3.7.2 (28276) - http://www.bohemiancoding.com/sketch --><title>tim-clock</title><desc>Created with Sketch.</desc><defs></defs><g id="64px-Line" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="tim-clock"></g><path d="M31,6 C16.112,6 4,18.112 4,33 C4,47.888 16.112,60 31,60 C45.888,60 58,47.888 58,33 C58,18.112 45.888,6 31,6 L31,6 Z M31,58 C17.215,58 6,46.785 6,33 C6,19.215 17.215,8 31,8 C44.785,8 56,19.215 56,33 C56,46.785 44.785,58 31,58 L31,58 Z" id="Shape" fill="#000000"></path><path d="M30.068,33.337 C30.092,33.405 30.13,33.462 30.168,33.521 C30.192,33.56 30.202,33.604 30.232,33.64 L40.232,45.64 C40.43,45.877 40.714,46 41,46 C41.226,46 41.453,45.924 41.64,45.768 C42.064,45.414 42.121,44.784 41.768,44.36 L32,32.638 L32,17 C32,16.448 31.552,16 31,16 C30.448,16 30,16.448 30,17 L30,33 C30,33.048 30.021,33.088 30.027,33.134 C30.037,33.203 30.044,33.271 30.068,33.337 L30.068,33.337 Z" id="Shape" fill="#000000"></path><path d="M31,14 C31.552,14 32,13.552 32,13 L32,11 C32,10.448 31.552,10 31,10 C30.448,10 30,10.448 30,11 L30,13 C30,13.552 30.448,14 31,14 L31,14 Z" id="Shape" fill="#000000"></path><path d="M31,52 C30.448,52 30,52.448 30,53 L30,55 C30,55.552 30.448,56 31,56 C31.552,56 32,55.552 32,55 L32,53 C32,52.448 31.552,52 31,52 L31,52 Z" id="Shape" fill="#000000"></path><path d="M20.866,13.447 C20.589,12.968 19.978,12.804 19.5,13.081 C19.022,13.357 18.858,13.969 19.134,14.447 L20.134,16.179 C20.32,16.5 20.655,16.679 21.001,16.679 C21.17,16.679 21.342,16.636 21.5,16.545 C21.978,16.269 22.142,15.657 21.866,15.179 L20.866,13.447 L20.866,13.447 Z" id="Shape" fill="#000000"></path><path d="M41.866,49.82 C41.589,49.341 40.979,49.177 40.5,49.454 C40.022,49.73 39.858,50.342 40.134,50.82 L41.134,52.552 C41.32,52.873 41.655,53.052 42.001,53.052 C42.17,53.052 42.342,53.009 42.5,52.918 C42.978,52.642 43.142,52.03 42.866,51.552 L41.866,49.82 L41.866,49.82 Z" id="Shape" fill="#000000"></path><path d="M14.18,22.134 L12.448,21.134 C11.967,20.857 11.358,21.022 11.082,21.5 C10.806,21.979 10.97,22.59 11.448,22.866 L13.18,23.866 C13.337,23.957 13.509,24 13.679,24 C14.025,24 14.361,23.821 14.546,23.5 C14.822,23.021 14.658,22.41 14.18,22.134 L14.18,22.134 Z" id="Shape" fill="#000000"></path><path d="M50.553,43.134 L48.821,42.134 C48.342,41.857 47.731,42.022 47.455,42.5 C47.179,42.978 47.343,43.59 47.821,43.866 L49.553,44.866 C49.71,44.957 49.882,45 50.052,45 C50.398,45 50.734,44.821 50.919,44.5 C51.195,44.021 51.031,43.41 50.553,43.134 L50.553,43.134 Z" id="Shape" fill="#000000"></path><path d="M12,33 C12,32.448 11.552,32 11,32 L9,32 C8.448,32 8,32.448 8,33 C8,33.552 8.448,34 9,34 L11,34 C11.552,34 12,33.552 12,33 L12,33 Z" id="Shape" fill="#000000"></path><path d="M50,33 C50,33.552 50.448,34 51,34 L53,34 C53.552,34 54,33.552 54,33 C54,32.448 53.552,32 53,32 L51,32 C50.448,32 50,32.448 50,33 L50,33 Z" id="Shape" fill="#000000"></path><path d="M13.18,42.134 L11.448,43.134 C10.97,43.41 10.806,44.022 11.082,44.5 C11.268,44.821 11.603,45 11.949,45 C12.118,45 12.29,44.957 12.448,44.866 L14.18,43.866 C14.658,43.59 14.822,42.978 14.546,42.5 C14.269,42.021 13.659,41.857 13.18,42.134 L13.18,42.134 Z" id="Shape" fill="#000000"></path><path d="M47.454,23.5 C47.64,23.821 47.975,24 48.321,24 C48.49,24 48.662,23.957 48.82,23.866 L50.552,22.866 C51.03,22.59 51.194,21.978 50.918,21.5 C50.641,21.022 50.031,20.857 49.552,21.134 L47.82,22.134 C47.342,22.41 47.178,23.021 47.454,23.5 L47.454,23.5 Z" id="Shape" fill="#000000"></path><path d="M21.5,49.454 C21.019,49.177 20.41,49.342 20.134,49.82 L19.134,51.552 C18.858,52.031 19.022,52.642 19.5,52.918 C19.658,53.009 19.83,53.052 19.999,53.052 C20.345,53.052 20.681,52.873 20.866,52.552 L21.866,50.82 C22.142,50.342 21.978,49.73 21.5,49.454 L21.5,49.454 Z" id="Shape" fill="#000000"></path><path d="M42.5,13.081 C42.02,12.805 41.41,12.969 41.134,13.447 L40.134,15.179 C39.858,15.658 40.022,16.269 40.5,16.545 C40.658,16.636 40.83,16.679 40.999,16.679 C41.345,16.679 41.681,16.5 41.866,16.179 L42.866,14.447 C43.142,13.969 42.978,13.357 42.5,13.081 L42.5,13.081 Z" id="Shape" fill="#000000"></path></g></svg></div> <div style="margin-top:1.0em">Gateway Timeout</div> <div>This request has timed out.</div> </div>` }, { name: "index-placeholder.html", message: `<style> .main.${theme}{text-align:center; padding:2.0em 0 4.0em 0; font-size:1.2em; color:#444444} .main.${theme} svg{width:128px; height:128px; opacity:0.8; margin-top:2.0em;} .main.${theme} svg path{fill:#444444;} .main.${theme} a{text-decoration:none; color:#444444;} </style> <div class="main container ${theme}"> <div><?xml version= "1.0" encoding= "UTF-8" standalone= "no" ?><svg width="64px" height="64px" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>use-user-reply</title><defs></defs><g id="64px-Line" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="use-user-reply"></g><path d="M41,18.002 C42.654,18.002 44,16.656 44,15.002 C44,13.348 42.654,12.002 41,12.002 C39.346,12.002 38,13.348 38,15.002 C38,16.656 39.346,18.002 41,18.002 L41,18.002 Z M41,14.002 C41.552,14.002 42,14.45 42,15.002 C42,15.554 41.552,16.002 41,16.002 C40.448,16.002 40,15.554 40,15.002 C40,14.45 40.448,14.002 41,14.002 L41,14.002 Z" id="Shape" fill="#000000"></path><path d="M49,18.002 C50.654,18.002 52,16.656 52,15.002 C52,13.348 50.654,12.002 49,12.002 C47.346,12.002 46,13.348 46,15.002 C46,16.656 47.346,18.002 49,18.002 L49,18.002 Z M49,14.002 C49.552,14.002 50,14.45 50,15.002 C50,15.554 49.552,16.002 49,16.002 C48.448,16.002 48,15.554 48,15.002 C48,14.45 48.448,14.002 49,14.002 L49,14.002 Z" id="Shape" fill="#000000"></path><path d="M36,15.002 C36,13.348 34.654,12.002 33,12.002 C31.346,12.002 30,13.348 30,15.002 C30,16.656 31.346,18.002 33,18.002 C34.654,18.002 36,16.656 36,15.002 L36,15.002 Z M32,15.002 C32,14.45 32.448,14.002 33,14.002 C33.552,14.002 34,14.45 34,15.002 C34,15.554 33.552,16.002 33,16.002 C32.448,16.002 32,15.554 32,15.002 L32,15.002 Z" id="Shape" fill="#000000"></path><path d="M32.582,31.908 C32.716,31.97 32.858,32 33,32 C33.234,32 33.466,31.918 33.65,31.759 L40.37,26 L54,26 C56.206,26 58,24.206 58,22 L58,8 C58,5.794 56.206,4 54,4 L28,4 C25.794,4 24,5.794 24,8 L24,22 C24,24.206 25.794,26 28,26 L32,26 L32,31 C32,31.391 32.228,31.745 32.582,31.908 L32.582,31.908 Z M28,24 C26.897,24 26,23.103 26,22 L26,8 C26,6.897 26.897,6 28,6 L54,6 C55.103,6 56,6.897 56,8 L56,22 C56,23.103 55.103,24 54,24 L40,24 C39.762,24 39.53,24.085 39.35,24.241 L34,28.826 L34,25 C34,24.447 33.553,24 33,24 L28,24 L28,24 Z" id="Shape" fill="#000000"></path><path d="M5,58 C5.553,58 6,57.553 6,57 C6,46.523 14.523,38 25,38 C35.477,38 44,46.523 44,57 C44,57.553 44.447,58 45,58 C45.553,58 46,57.553 46,57 C46,47.225 39.276,39.012 30.217,36.683 C30.69,36.427 31.149,36.139 31.587,35.811 C32.029,35.48 32.119,34.853 31.788,34.411 C31.456,33.971 30.831,33.88 30.388,34.21 C28.825,35.381 26.961,36 25,36 C20.037,36 16,31.963 16,27 C16,23.422 18.119,20.184 21.398,18.75 C21.904,18.529 22.135,17.939 21.914,17.434 C21.694,16.929 21.106,16.695 20.598,16.918 C16.59,18.669 14,22.626 14,27 C14,31.179 16.344,34.821 19.785,36.682 C10.725,39.01 4,47.224 4,57 C4,57.553 4.447,58 5,58 L5,58 Z" id="Shape" fill="#000000"></path></g></svg></div> <div style="margin-top:1.0em">Please note, this page is not available in this NC AHEC Web Services <span id="wsEnv"></span> environment.</div> <div>This page will be available in the production environment.</div> <div style="margin-top:1.0em; font-size: 0.9em;"><a href="/sign-in">Return to NC AHEC Web Services</a></div> </div> <script> var a, env; a = window.location.hostname; env = (/^stage./.test(a)) ? "staging" : ((/^dev./.test(a)) ? "development" : "local"); document.getElementById("wsEnv").innerHTML = env; </script>` } ]; // function to create themed pages async function exportTheme() { console.log("export theme"); await fs.remove("dist"); // copy all to dist folder console.log("copy generated files to dist"); try { await fs.copy("assets/dist", "dist"); console.log("copy generated files to dist"); await fs.copy("assets", "dist", { filter: file => { const result = file == "assets" || (file.indexOf("assets") == 0 && file.indexOf(".html") > 0); return result; } }); } catch (error) { console.log("Error Occurred:", error); } var changes = []; try { // update the css/image/fonts/js paths in the index file to /dist/ console.log("update image paths"); changes = await replace({ files: "dist/*.html", from: /(src|href)\=(\'|\")?dist\/(css|fonts|js|images)(\/)/g, // to: (m) => `${m.split('=')[0]}=${m.split('=')[1].substring(0, 1)}/dist/${m.split('=')[1].substring(1, m.split('=')[1].length)}`, to: "$1=$2/dist/$3$4" // to: '$1=$2/northwest-theme/$3$4' }); console.log(changes); } catch (error) { console.log("Error Occurred:", error); } // menu included in template // try { // console.log("menu-bar"); // changes = await replace({ // files: "dist/index.html", // from: /\<\/body\>/g, // to: `<script type='text/javascript' src='/dist/js/menu-bar/bundle.js' id='ahec-menu-bar-script'></script>\n</body>` // }); // console.log(changes); // } catch (error) { // console.log("Error Occurred:", error); // } const cg3Template = await exportCg3Template(); fs.writeFileSync(`./dist/index-cg3.html`,cg3Template); // copy index file and add app placeholder content for (i in apps) { // create a copy of index.html for each app await fs.copy(`dist/index.html`, `dist/index-${apps[i].name}.html`); // replace placeholder with app code console.log('updating index template ' + `dist/index-${apps[i].name}`); try { changes = await replace({ files: `dist/index-${apps[i].name}.html`, from: /\<ncahec\-component\>\<\/ncahec\-component\>/g, to: apps[i].code }); console.log(changes); } catch (error) { console.log("Error Occurred:", error); } } // copy index file for each error page and update the placeholder content for (i in errorPages) { if (errorPages[i].name != "index.html") await fs.copy(`dist/index.html`, `dist/${errorPages[i].name}`); try { changes = await replace({ files: `dist/${errorPages[i].name}`, from: /\<ncahec\-component\>\<\/ncahec\-component\>/g, to: errorPages[i].message }); console.log(changes); } catch (error) { console.log("Error Occurred:", error); } } // copy the original index.html file to the dist folder await fs.copy("assets/index.html", "dist/index.html"); // replace the placeholder content try { console.log("ncahec-component"); changes = await replace({ files: "dist/index.html", from: /(src|href)\=(\'|\")?dist\/(css|fonts|js|images)(\/)/g, // to: (m) => `${m.split('=')[0]}=${m.split('=')[1].substring(0, 1)}/dist/${m.split('=')[1].substring(1, m.split('=')[1].length)}`, to: "$1=$2$3$4" }); console.log(changes); changes = await replace({ files: "dist/index.html", from: /\<ncahec\-component\>\<\/ncahec\-component\>/g, to: ` <style> .main.container{text-align:center; padding:2.0em 0 4.0em 0; font-size:1.2em; color:#444444; min-height:800px;border:1px solid #b5b5b5;} .main.container svg{width:128px; height:128px; opacity:0.8; margin-top:2.0em;} .main.container svg path{fill:#444444;} </style> <div class="main container"> <div><?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="64px" height="64px" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!-- Generator: Sketch 3.7.2 (28276) - http://www.bohemiancoding.com/sketch --><title>ui-window-code</title><desc>Created with Sketch.</desc><defs></defs><g id="64px-Line" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="ui-window-code"></g><path d="M56,10 L8,10 C5.794,10 4,11.794 4,14 L4,52 C4,54.206 5.794,56 8,56 L56,56 C58.206,56 60,54.206 60,52 L60,14 C60,11.794 58.206,10 56,10 L56,10 Z M8,12 L56,12 C57.103,12 58,12.897 58,14 L58,20 L6,20 L6,14 C6,12.897 6.897,12 8,12 L8,12 Z M56,54 L8,54 C6.897,54 6,53.103 6,52 L6,22 L58,22 L58,52 C58,53.103 57.103,54 56,54 L56,54 Z" id="Shape" fill="#000000"></path><circle id="Oval" fill="#000000" cx="24" cy="16" r="2"></circle><circle id="Oval" fill="#000000" cx="18" cy="16" r="2"></circle><circle id="Oval" fill="#000000" cx="12" cy="16" r="2"></circle><path d="M25.769,32.36 C25.415,31.936 24.786,31.878 24.36,32.232 L18.36,37.232 C18.132,37.422 18.001,37.703 18.001,38 C18.001,38.297 18.133,38.578 18.36,38.768 L24.36,43.768 C24.548,43.924 24.774,44 25,44 C25.287,44 25.571,43.877 25.77,43.64 C26.124,43.216 26.066,42.585 25.642,42.232 L20.562,38 L25.64,33.768 C26.064,33.415 26.122,32.784 25.769,32.36 L25.769,32.36 Z" id="Shape" fill="#000000"></path><path d="M39.641,32.232 C39.214,31.878 38.586,31.936 38.232,32.36 C37.878,32.784 37.936,33.415 38.36,33.768 L43.438,38 L38.36,42.232 C37.936,42.586 37.879,43.216 38.232,43.64 C38.43,43.877 38.714,44 39.002,44 C39.228,44 39.454,43.924 39.642,43.768 L45.642,38.768 C45.87,38.578 46.001,38.297 46.001,38 C46.001,37.703 45.869,37.422 45.642,37.232 L39.641,32.232 L39.641,32.232 Z" id="Shape" fill="#000000"></path><path d="M35.316,28.051 C34.788,27.876 34.226,28.16 34.051,28.683 L28.051,46.683 C27.876,47.207 28.159,47.773 28.683,47.948 C28.788,47.983 28.895,48 28.999,48 C29.418,48 29.808,47.735 29.947,47.316 L35.947,29.316 C36.123,28.792 35.84,28.226 35.316,28.051 L35.316,28.051 Z" id="Shape" fill="#000000"></path></g></svg></div> <div>Frontend Application</div> </div>` }); console.log(changes); } catch (error) { console.log("Error Occurred:", error); } } // generate all pages for this theme exportTheme();