Skip to content

Commit c1a63bd

Browse files
committed
Use package.json & pnpm
- Use package.json to get hugo - Update site building instructions - Update GitHub workflow to use the tooling Signed-off-by: Aesara Binder <[email protected]>
1 parent d28f7cb commit c1a63bd

File tree

5 files changed

+59
-17
lines changed

5 files changed

+59
-17
lines changed

.github/workflows/hugo.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,34 @@ jobs:
3030
# Build job
3131
build:
3232
runs-on: ubuntu-latest
33-
env:
34-
HUGO_VERSION: 0.133.0
3533
steps:
36-
- name: Install Hugo CLI
37-
run: |
38-
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
39-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
40-
- name: Install Dart Sass
41-
run: sudo snap install dart-sass
4234
- name: Checkout
4335
uses: actions/checkout@v4
4436
with:
4537
submodules: recursive
4638
lfs: true
4739
fetch-depth: 0
40+
- name: Setup dependencies
41+
uses: pnpm/action-setup@v4
42+
with:
43+
version: 'latest'
44+
run_install: false
45+
- name: Copy package.json
46+
run: cp package.hugo.json package.json
47+
- name: Install project dependencies
48+
run: pnpm install
49+
- name: Collect submodule dependencies
50+
run: pnpm run npm-pack
51+
- name: Install submodule dependencies
52+
run: pnpm update
4853
- name: Setup Pages
4954
id: pages
5055
uses: actions/configure-pages@v4
5156
- name: Build with Hugo
52-
env:
53-
# For maximum backward compatibility with Hugo modules
54-
HUGO_ENVIRONMENT: production
55-
HUGO_ENV: production
5657
run: |
57-
hugo \
58+
pnpm exec hugo \
5859
--minify \
60+
--environment "production" \
5961
--baseURL "${{ steps.pages.outputs.base_url }}/"
6062
- name: Upload artifact
6163
uses: actions/upload-pages-artifact@v3

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
/.hugo_build.lock
66
hugo_stats.json
77
# Sass
8-
.sass-cache/
8+
/.sass-cache/
99
*.css.map
1010
*.sass.map
1111
*.scss.map
12+
# pnpm
13+
/node_modules/
14+
/package.json

package.hugo.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"author": {
3+
"email": "[email protected]",
4+
"name": "Aesara Binder",
5+
"url": "https://www.aesara.org"
6+
},
7+
"description": "MyPaint's official website",
8+
"devDependencies": {
9+
"hugo-extended": "latest",
10+
"sass-embedded": "latest"
11+
},
12+
"files": [
13+
"public/"
14+
],
15+
"homepage": "https://www.mypaint.org",
16+
"license": "SEE LICENSE IN README.md",
17+
"name": "mypaint-website",
18+
"private": true,
19+
"repository": {
20+
"type": "git",
21+
"url": "https://gitlab.com/mypaint/website"
22+
},
23+
"scripts": {
24+
"npm-pack": "hugo mod npm pack",
25+
"build-dev": "hugo --environment development",
26+
"build-prod": "hugo --environment production",
27+
"postpack": "rm -rfv public",
28+
"prepack": "hugo --environment production",
29+
"start": "hugo server"
30+
}
31+
}

pages/docs/contributing/documentation.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,16 @@ They may be created:
103103
case 2 or 3.**{{< /colour >}}
104104

105105
## Build the Site Locally
106-
1. Install [hugo-extended][hugo-release], [dart sass][sass-release], and [git-lfs][git-lfs]
106+
107+
To perform initial setup for the site:
108+
1. Ensure ``git``, ``git-lfs``, and ``pnpm`` are installed
107109
2. Clone the website [repository][website]
108110
3. Run ``git submodule update --init``
109-
4. Run ``hugo`` or ``hugo server``
111+
4. Copy ``package.hugo.json`` to ``package.json`` if the latter does not already exist
112+
5. Install project dependencies: ``pnpm install``
113+
6. Collect submodule dependencies: ``pnpm run npm-pack``
114+
7. Install subproject dependencies: ``pnpm install``
115+
8. Start the server: ``pnpm start``
110116

111117
### Update Submodules
112118
When the [website-theme][website-theme] or other submodules are updated, use

0 commit comments

Comments
 (0)