generateUpdate.js 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. const marked = require('marked')
  2. const fs = require('fs')
  3. const changelog = fs.readFileSync('./CHANGELOG.md', 'utf-8')
  4. const markdownChangelog = marked(changelog)
  5. fs.writeFileSync('./public/update.html',
  6. `
  7. <!DOCTYPE html>
  8. <html lang="en">
  9. <head>
  10. <meta charset="UTF-8" />
  11. <link rel="icon" href="/favicon.ico" />
  12. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  13. <title>商户平台-更新日志</title>
  14. <script src="./config.js"></script>
  15. <style>
  16. h1 {
  17. color: #6699cc;
  18. font-size: 2.2857em;
  19. line-height: .6563em;
  20. margin: .6563em 0;
  21. }
  22. h2 {
  23. color: #6699cc;
  24. font-size: 1.75em;
  25. line-height: 1.225;
  26. border-bottom: 1px solid #eee;
  27. margin-top:30px;
  28. }
  29. h3 {
  30. color: #6699cc;
  31. font-size: 1.5em;
  32. line-height: 1.43;
  33. }
  34. h4 {
  35. color: #6699cc;
  36. font-size: 1.2857em;
  37. line-height: 1.1667em;
  38. margin: 1.1667em 0;
  39. }
  40. h5 {
  41. color: #6699cc;
  42. font-size: 1.15em;
  43. line-height: 1.3em;
  44. margin: 1.3em 0;
  45. }
  46. h6 {
  47. color: #6699cc;
  48. font-size: 1em;
  49. line-height: 1.5em;
  50. margin: 1.5em 0;
  51. }
  52. h1,h2,h3,h4,h5,h6 {
  53. line-height: 1.5em;
  54. }
  55. body,p,td,div {
  56. color: #515151;
  57. font-family: "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
  58. word-wrap: break-word;
  59. }
  60. a {
  61. -webkit-transition: color .2s ease-in-out;
  62. -moz-transition: color .2s ease-in-out;
  63. -o-transition: color .2s ease-in-out;
  64. -ms-transition: color .2s ease-in-out;
  65. transition: color .2s ease-in-out;
  66. color: #f99157;
  67. text-decoration: none;
  68. }
  69. a[href^="mailto"] {
  70. color: #66cccc;
  71. }
  72. a:hover {
  73. color: #f99157;
  74. }
  75. ul{
  76. padding-left: 30px; margin:0.8em 0
  77. }
  78. li {
  79. font-size: 110%;margin-bottom: 5px;
  80. }
  81. li li {
  82. font-size: 100%;
  83. }
  84. li p {
  85. font-size: 100%;
  86. margin: .5em 0;
  87. }
  88. .footnote {
  89. color: #a09f93;
  90. font-size: .8em;
  91. vertical-align: super;
  92. }
  93. hr {
  94. height: 10px;
  95. border: none;
  96. background-color: #d3d0c8;
  97. color: #515151;
  98. }
  99. #wrapper img {
  100. max-width: 100%;
  101. height: auto;
  102. }
  103. strong, b {
  104. color: #ffcc66;
  105. }
  106. em, i {
  107. color: #cc99cc;
  108. }
  109. dd {
  110. margin-bottom: 1em;
  111. }
  112. li {
  113. list-style: none;
  114. position: relative;
  115. }
  116. li::before {
  117. position: absolute;
  118. top: 0;
  119. left: -17px;
  120. color: #f2777a;
  121. }
  122. ul li::before {
  123. font-size: 160%;
  124. content: '\\2022';
  125. }
  126. ol {
  127. counter-reset: index;
  128. }
  129. ol li {
  130. counter-increment: index;
  131. }
  132. ol li::before {
  133. content: counter(index) ".";
  134. }
  135. li > p:first-child {
  136. margin: 0;
  137. }
  138. ul ul,ul ol {
  139. margin-bottom: .4em;
  140. }
  141. caption,col,colgroup,table,tbody,td,tfoot,th,thead,tr {
  142. border-spacing: 0;
  143. }
  144. table {
  145. border: 1px solid rgba(0,0,0,0.25);
  146. border-collapse: collapse;
  147. display: table;
  148. empty-cells: hide;
  149. margin: -1px 0 23px;
  150. padding: 0;
  151. table-layout: fixed;
  152. }
  153. caption {
  154. display: table-caption;
  155. font-weight: 700;
  156. }
  157. col {
  158. display: table-column;
  159. }
  160. colgroup {
  161. display: table-column-group;
  162. }
  163. tbody {
  164. display: table-row-group;
  165. }
  166. tfoot {
  167. display: table-footer-group;
  168. }
  169. thead {
  170. display: table-header-group;
  171. }
  172. td,th {
  173. display: table-cell;
  174. }
  175. tr {
  176. display: table-row;
  177. }
  178. table th,table td {
  179. font-size: 1.1em;
  180. line-height: 23px;
  181. padding: 0 1em;
  182. }
  183. table thead {
  184. background: rgba(0,0,0,0.15);
  185. border: 1px solid rgba(0,0,0,0.15);
  186. border-bottom: 1px solid rgba(0,0,0,0.2);
  187. }
  188. table tbody {
  189. background: rgba(0,0,0,0.05);
  190. }
  191. table tfoot {
  192. background: rgba(0,0,0,0.15);
  193. border: 1px solid rgba(0,0,0,0.15);
  194. border-top: 1px solid rgba(0,0,0,0.2);
  195. }
  196. figure {
  197. display: inline-block;
  198. position: relative;
  199. margin: 1em 0 2em;
  200. }
  201. figcaption {
  202. font-style: italic;
  203. text-align: center;
  204. background: white;
  205. color: #66cccc;
  206. position: absolute;
  207. left: 0;
  208. bottom: -24px;
  209. width: 98%;
  210. padding: 1%;
  211. -webkit-transition: all .2s ease-in-out;
  212. -moz-transition: all .2s ease-in-out;
  213. -o-transition: all .2s ease-in-out;
  214. -ms-transition: all .2s ease-in-out;
  215. transition: all .2s ease-in-out;
  216. }
  217. figure:hover>figcaption {
  218. background: rgba(0,0,0,1)
  219. }
  220. code {
  221. color: #99cc99;
  222. }
  223. .poetry pre {
  224. display: block;
  225. font-family: Georgia, Garamond, serif !important;
  226. font-size: 110% !important;
  227. font-style: italic;
  228. line-height: 1.6em;
  229. margin-left: 1em;
  230. }
  231. .poetry pre code {
  232. font-family: Georgia, Garamond, serif !important;
  233. }
  234. blockquote p {
  235. font-size: 110%;
  236. font-style: italic;
  237. line-height: 1.6em;
  238. }
  239. sup,sub,a.footnote {
  240. font-size: 1.4ex;
  241. height: 0;
  242. line-height: 1;
  243. position: relative;
  244. vertical-align: super;
  245. }
  246. sub {
  247. vertical-align: sub;
  248. top: -1px;
  249. }
  250. p,h5 {
  251. font-size: 1.1429em;
  252. line-height: 1.3125em;
  253. margin: 1.3125em 0;
  254. }
  255. dt,th {
  256. font-weight: 700;
  257. }
  258. table tr:nth-child(odd),table th:nth-child(odd),table td:nth-child(odd) {
  259. background: rgba(255,255,255,0.06);
  260. }
  261. table tr:nth-child(even),table td:nth-child(even) {
  262. background: rgba(200,200,200,0.25);
  263. }
  264. @media print {
  265. body {
  266. overflow: auto;
  267. }
  268. img,pre,blockquote,table,figure,p {
  269. page-break-inside: avoid;
  270. }
  271. #wrapper {
  272. background-color: #f2f0ec;
  273. color: #515151;
  274. font-size: 85%;
  275. padding: 10px;
  276. position: relative;
  277. text-indent: 0;
  278. }
  279. }
  280. @media screen {
  281. .inverted #wrapper,.inverted {
  282. background: #2d2d2d;
  283. }
  284. .inverted hr {
  285. color: #d3d0c8;
  286. background-color: 515151
  287. }
  288. .inverted p,.inverted td, .inverted div {
  289. color: #d3d0c8 !important;
  290. }
  291. .inverted table tr:nth-child(odd),.inverted table th:nth-child(odd),.inverted table td:nth-child(odd) {
  292. background: none;
  293. }
  294. #wrapper {
  295. padding: 20px;
  296. }
  297. ::selection {
  298. background: #d3d0c8;
  299. color: #515151;
  300. }
  301. .inverted::selection {
  302. color: #d3d0c8;
  303. background: #515151;
  304. }
  305. h1::selection {
  306. background-color: rgba(45, 156, 208, .3);
  307. }
  308. h2::selection {
  309. background-color: rgba(90, 182, 224, .3);
  310. }
  311. h3::selection,h4::selection,h5::selection,h6::selection,li::selection,ol::selection {
  312. background-color: rgba(133, 201, 232, .3);
  313. }
  314. code::selection {
  315. background-color: rgba(0,0,0,.7);
  316. color: #eee;
  317. }
  318. code span::selection {
  319. background-color: rgba(0,0,0,.7) !important;
  320. color: #eee !important;
  321. }
  322. a::selection {
  323. background-color: rgba(255, 230, 102,.2);
  324. }
  325. .inverted a::selection {
  326. background-color: rgba(255, 230, 102,.6);
  327. }
  328. td::selection,th::selection,caption::selection {
  329. background-color: rgba(180, 237, 95, .5);
  330. }
  331. }
  332. </style>
  333. </head>
  334. <body>
  335. ${markdownChangelog}
  336. </body>
  337. </html>
  338. `
  339. )