Skip to content

Commit 2bd24a3

Browse files
committed
feat: Add npm tests and update github ci
1 parent 1588552 commit 2bd24a3

File tree

11 files changed

+4963
-1
lines changed

11 files changed

+4963
-1
lines changed

.eslintrc.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
env:
2+
browser: true
3+
es2021: true
4+
5+
extends:
6+
- standard
7+
- prettier
8+
9+
parserOptions:
10+
ecmaVersion: latest
11+
12+
rules:
13+
# best practices
14+
arrow-parens:
15+
- 2
16+
- as-needed
17+
semi:
18+
- 2
19+
- always
20+
class-methods-use-this: 0
21+
comma-dangle:
22+
- 2
23+
- always-multiline
24+
no-console:
25+
- 2
26+
no-unused-expressions: 0
27+
no-param-reassign:
28+
- 2
29+
- props: false
30+
no-useless-escape: 0
31+
func-names: 0
32+
quotes:
33+
- 2
34+
- double
35+
- allowTemplateLiterals: true
36+
no-underscore-dangle: 0
37+
object-curly-newline: 0
38+
function-paren-newline: 0
39+
operator-linebreak:
40+
- 2
41+
- after
42+
no-unused-vars:
43+
- 2
44+
- argsIgnorePattern: "^_"
45+
46+
globals:
47+
document: true
48+
requestAnimationFrame: true
49+
window: true
50+
self: true
51+
fetch: true
52+
Headers: true

.github/workflows/hugo.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,21 @@ defaults:
2626
shell: bash
2727

2828
jobs:
29+
test:
30+
runs-on: ubuntu-22.04
31+
steps:
32+
- name: Install test dependencies
33+
run: |
34+
sudo apt-get update && \
35+
sudo apt-get -y install npm tzdata && \
36+
npm ci
37+
38+
- name: Run tests
39+
run: |
40+
npm run test
41+
2942
build:
43+
needs: test
3044
runs-on: ubuntu-22.04
3145
env:
3246
HUGO_VERSION: 0.115.2
@@ -53,6 +67,7 @@ jobs:
5367
HUGO_ENVIRONMENT: production
5468
HUGO_ENV: production
5569
run: |
70+
source ./exampleSite/scripts/hugo-env && \
5671
hugo --source exampleSite
5772
5873
- name: Upload artifact

.linkinator.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"silent": true,
3+
"timeout": 10000,
4+
"retryErrors": false,
5+
"skip": ["^(?!http://localhost)"]
6+
}

.markdownlint.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"default": true,
3+
"heading-style": {
4+
"style": "setext_with_atx"
5+
},
6+
"hr-style": {
7+
"style": "---"
8+
},
9+
"code-block-style": {
10+
"style": "fenced"
11+
},
12+
"code-fence-style": {
13+
"style": "backtick"
14+
},
15+
"no-hard-tabs": {
16+
"code_blocks": false
17+
},
18+
"fenced-code-language": {
19+
"allowed_languages": [
20+
"bash",
21+
"c",
22+
"cpp",
23+
"css",
24+
"html",
25+
"js",
26+
"json",
27+
"lua",
28+
"md",
29+
"py",
30+
"scss",
31+
"sh",
32+
"text",
33+
"toml",
34+
"vim",
35+
"xml",
36+
"yml",
37+
"zsh"
38+
],
39+
"language_only": true
40+
},
41+
"emphasis-style": {
42+
"style": "underscore"
43+
},
44+
"strong-style": {
45+
"style": "underscore"
46+
},
47+
"ul-style": {
48+
"style": "sublist"
49+
},
50+
"line-length": {
51+
"line_length": 78,
52+
"heading_line_length": 72,
53+
"code_block_line_length": 78,
54+
"tables": false,
55+
"strict": true
56+
}
57+
}

.prettier.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"printWidth": 78,
3+
"trailingComma": "all",
4+
"arrowParens": "avoid",
5+
"overrides": [
6+
{
7+
"files": ["*.html"],
8+
"options": {
9+
"printWidth": 180,
10+
"parser": "go-template"
11+
}
12+
}
13+
]
14+
}

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ignore this file as there is an issue with prettier go-template formatter
2+
render-heading.html

.stylelintrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": "stylelint-config-standard-scss",
3+
"quiet": true,
4+
"rules": {
5+
"declaration-empty-line-before": [
6+
"always",
7+
{
8+
"ignore": [
9+
"after-comment",
10+
"after-declaration",
11+
"first-nested",
12+
"inside-single-line-block"
13+
]
14+
}
15+
],
16+
"scss/no-global-function-names": null,
17+
"scss/dollar-variable-pattern": "^([a-z][a-z0-9]*)(-[a-z0-9]+)*(--[a-z0-9]+)?"
18+
}
19+
}

exampleSite/content/slides/hugo-xterm-slides.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ Features
1818
* Slides using [reveal.js][1].
1919
* Designed for blog and personal websites for professionals.
2020
* Support for online CV and documentation.
21-
21+
2222
[1]: https://revealjs.com/

exampleSite/scripts/hugo-env

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
HUGOxPARAMSxGITxLAST_COMMITxHASH=$(git log -1 --format=%H)
4+
HUGOxPARAMSxGITxLAST_COMMITxSHORT_HASH=$(git log -1 --format=%h)
5+
HUGOxPARAMSxGITxLAST_COMMITxSUBJECT=$(git log -1 --format=%s)
6+
7+
export HUGOxPARAMSxGITxLAST_COMMITxHASH
8+
export HUGOxPARAMSxGITxLAST_COMMITxSHORT_HASH
9+
export HUGOxPARAMSxGITxLAST_COMMITxSUBJECT
10+
11+
export TZ='Asia/Kolkata'

0 commit comments

Comments
 (0)