Simpler and faster builds

This commit is contained in:
Stefan 2024-11-08 03:28:08 +00:00
parent 465f2266fc
commit 592fa6d673
13 changed files with 266 additions and 977 deletions

View file

@ -1,27 +1,9 @@
image: nixos/latest
packages:
- nixos.html-minifier
- nixos.lightningcss
- nixos.neocities-cli
- nixos.nodejs
- nixos.nodePackages.pnpm
- nixos.sass
environment:
repo: vegan-prestwich
sources:
- https://git.sr.ht/~stfn/vegan-prestwich
secrets:
- ff7f6e84-35b9-4aa9-afa1-1fbc3fe6a2d1 # ~/.neocities/$repo
- ff7f6e84-35b9-4aa9-afa1-1fbc3fe6a2d1 # ~/.neocities/vegan-prestwich
tasks:
- build: |
cd vegan-prestwich
pnpm add fast-glob @11ty/eleventy
mkdir -p _site/style
sass style/style.scss _site/style/style.css
lightningcss --minify --targets '> 0.25%, not IE 11' _site/style/*.css -o _site/style/*.css
pnpm eleventy
html-minifier --input-dir _site --output-dir _site --collapse-whitespace --file-ext html
set +x
export NEOCITIES_API_KEY=$(cat /home/build/.neocities/vegan-prestwich)
set -x
neocities push --prune _site
sh bin/build

1
.envrc
View file

@ -1 +0,0 @@
use nix

18
.gitignore vendored
View file

@ -1,21 +1,5 @@
_site
.bundle
.DS_Store
.eleventy.js.swp
.jekyll-cache
.jekyll-metadata
.neocities
.nix-gems
.nova
.sass-cache
.jampack
nix-profile*
Cache
Gemfile.lock
_site
node_modules
package-lock.json
package.json
vendor
venv
.direnv/bin/nix-direnv-reload
.idea

View file

@ -1 +0,0 @@
3.1.2

34
bin/build Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env bash
rm -rf _site
mkdir -p _site/style
nix-shell -p sass --pure --command "
echo 'Compiling SCSS'
sass style/style.scss _site/style/style.css
"
nix-shell -p lightningcss --pure --command "
echo 'Minifying CSS'
lightningcss --minify --targets '> 0.25%, not IE 11' _site/style/*.css -o _site/style/*.css
"
nix-shell -p nodePackages.pnpm --command "
echo 'Building site'
pnpm add fast-glob @11ty/eleventy @11ty/eleventy-img
pnpm eleventy
"
nix-shell -p html-minifier --pure --command "
echo 'Minifying HTML'
html-minifier --input-dir _site --output-dir _site --collapse-whitespace --file-ext html
"
nix-shell -p neocities-cli --command "
echo 'Pushing to Neocities'
set +x
export NEOCITIES_API_KEY=$(cat ~/.neocities/vegan-prestwich)
set -x
neocities push --prune _site
"

15
bin/serve Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
rm -rf _site
mkdir -p _site/style
nix-shell -p sass --pure --command "
echo 'Compiling SCSS'
sass style/style.scss _site/style/style.css
"
nix-shell -p nodePackages.pnpm --command "
echo 'Serving site'
pnpm add fast-glob @11ty/eleventy @11ty/eleventy-img
pnpm eleventy --serve
"

6
bin/upgrade Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
nix-shell -p nodePackages.pnpm --command "
echo 'Upgrading packages'
pnpm upgrade
"

View file

@ -1,13 +0,0 @@
#!/usr/bin/env
rm -rf _site
pnpm add fast-glob @11ty/eleventy
mkdir -p _site/style
sass style/style.scss _site/style/style.css
lightningcss --minify --targets '> 0.25%, not IE 11' _site/style/*.css -o _site/style/*.css
pnpm eleventy
html-minifier --input-dir _site --output-dir _site --collapse-whitespace --file-ext html
set +x
export NEOCITIES_API_KEY=$(cat /home/user/.neocities/vegan-prestwich)
set -x
neocities push --prune _site

BIN
bun.lockb

Binary file not shown.

View file

@ -1,7 +0,0 @@
#!/bin/bash
gem install --no-document neocities
set +x
export NEOCITIES_API_KEY=$(cat ~/.neocities/$1)
set -x
neocities push --prune $2

View file

@ -1,22 +1,7 @@
{
"devDependencies": {
"@11ty/eleventy": "^3.0.0",
"npm-run-all": "^4.1.5"
},
"dependencies": {
"@11ty/eleventy-img": "^5.0.0",
"cross-env": "^7.0.3",
"fast-glob": "^3.3.2"
},
"scripts": {
"watch:sass": "sass --no-source-map --watch style:_site/style",
"watch:eleventy": "eleventy --serve",
"build:rm": "rm -rf _site",
"build:sass": "sass --no-source-map style:_site/style",
"start": "npm-run-all build:rm build:sass --parallel watch:*"
},
"browserslist": [
"> 0.25%",
"not IE 11"
]
"dependencies": {
"@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-img": "^5.0.0",
"fast-glob": "^3.3.2"
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
with (import <nixpkgs> {});
mkShell {
buildInputs = [
html-minifier
lightningcss
neocities-cli
nodejs
nodePackages.pnpm
sass
];
}