Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion build.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import * as fs from 'fs-extra'
import * as path from 'path'
import * as util from 'util'
import * as glob from 'glob'
import chalk from 'chalk'
import gzipSize from 'gzip-size'
import brotliSize from 'brotli-size'
import formatNumber from 'format-number'
import { getBorderCharacters, table } from 'table'
// @ts-ignore
import validateHtml from 'html-tag-validator'

const sourceFolder = 'src'
const distFolder = 'dist'
Expand Down Expand Up @@ -41,7 +44,15 @@ async function buildAll (sourceFolder: string, distFolder: string) {
}

async function buildHtml (sourceFolder: string, distFolder: string) {
fs.copySync(`${sourceFolder}/index.html`, `${distFolder}/index.html`)
const sourceFilePath = `${sourceFolder}/index.html`
const sourceFileContent = fs.readFileSync(sourceFilePath, 'utf-8')
try {
const result = await util.promisify(validateHtml)(sourceFileContent)
console.log(result)
fs.copySync(sourceFilePath, `${distFolder}/index.html`)
} catch (e) {
console.error(e)
}
}

async function buildJavaScript (sourceFolder: string, distFolder: string) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"fs-extra": "^7.0.0",
"glob": "^7.1.2",
"gzip-size": "^5.0.0",
"html-tag-validator": "^1.6.0",
"node-sass": "^4.9.3",
"table": "^4.0.3",
"typescript": "^3.0.1"
Expand Down
6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<svg width="308" height="308" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path d="M158.76 34.093C139.763 69.863 129 110.675 129 154s10.763 84.137 29.76 119.907c-1.579.062-3.166.093-4.76.093-66.274 0-120-53.726-120-120S87.726 34 154 34c1.594 0 3.181.031 4.76.093z"
fill="currentcolor" fill-rule="nonzero" mask="url(#b)"/>
<circle stroke="#1e1e1e" stroke-width="6" cx="154" cy="154" r="120"/>
<circle stroke="#7c203a" stroke-width="6" cx="385" cy="154" r="256"/>
fill="currentcolor" fill-rule="nonzero" mask="url(#b)"></path>
<circle stroke="#1e1e1e" stroke-width="6" cx="154" cy="154" r="120"></circle>
<circle stroke="#7c203a" stroke-width="6" cx="385" cy="154" r="256"></circle>
</g>
</svg>
<h1>Wane</h1>
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ hosted-git-info@^2.1.4:
version "2.7.1"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047"

html-tag-validator@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/html-tag-validator/-/html-tag-validator-1.6.0.tgz#ccd115ec3063595e2240985525d39732040f9b43"

http-signature@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
Expand Down