Skip to content

Commit 8e96e04

Browse files
committed
Clean code, separate HTML, Javascript and CSS code, add linters, support claim format v0.0.2
1 parent f7a8791 commit 8e96e04

File tree

12 files changed

+1393
-4145
lines changed

12 files changed

+1393
-4145
lines changed

.github/workflows/checkbuild.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: check result.html
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
workflow_dispatch:
8+
9+
jobs:
10+
check-result-html:
11+
name: check if result.html is up to date with index.html
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: install nodejs
16+
run: sudo apt-get update; sudo apt-get -y install nodejs npm; npm install inline-source
17+
- name: modify build sccript
18+
run: sed -i 's/results.html/test.html/g' html/build.js
19+
- name: generate test.html
20+
run: cd html; node build.js
21+
- name: compare results.html with test.html
22+
run: cd html;diff results.html test.html

.github/workflows/linters.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: linters
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
workflow_dispatch:
8+
9+
jobs:
10+
js-linter:
11+
name: Javascript linter (standard)
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Init yarn
16+
run: yarn init -y
17+
- name: Install standard modules
18+
run: yarn add standard
19+
- name: Run Standard
20+
run: yarn standard html/index.js
21+
css-linter:
22+
name: CSS linter (stylelint)
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Init yarn
27+
run: yarn init -y
28+
- name: Install standard modules
29+
run: yarn add stylelint stylelint-config-standard
30+
- name: create stylelint config file
31+
run: |
32+
cat << EOF > .stylelintrc
33+
{ "extends": ["stylelint-config-standard"] }
34+
EOF
35+
- name: Run stylelint
36+
run: yarn stylelint html/*.css
37+
html-linter:
38+
name: HTML linter (html5validator)
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: Cyb3r-Jak3/[email protected]
43+
with:
44+
root: html/
45+
extra: --ignore inline

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build:
2+
cd html;node build.js

html/build.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const fs = require('fs');
2+
const inline = require('inline-source');
3+
4+
const htmlFile = 'index.html';
5+
const options = {
6+
compress: true, // minify
7+
};
8+
9+
inline.inlineSource(htmlFile, options)
10+
.then((html) => {
11+
fs.writeFileSync('results.html', html);
12+
console.log('Build successful!');
13+
})
14+
.catch((err) => {
15+
console.error('Error during build:', err);
16+
});

0 commit comments

Comments
 (0)