Merge pull request #1205 from jonnybarnes/1204-simplify-build-steps
Simplify frontend assests and build steps
This commit is contained in:
commit
a216c194d4
38 changed files with 333 additions and 11358 deletions
11201
package-lock.json
generated
11201
package-lock.json
generated
File diff suppressed because it is too large
Load diff
38
package.json
38
package.json
|
@ -5,41 +5,17 @@
|
|||
"repository": "https://github.com/jonnybarnes/jonnybarnes.uk",
|
||||
"license": "CC0-1.0",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.6",
|
||||
"@babel/preset-env": "^7.23.6",
|
||||
"@csstools/postcss-oklab-function": "^3.0.8",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"babel-loader": "^9.1.3",
|
||||
"browserlist": "^1.0.1",
|
||||
"compression-webpack-plugin": "^10.0.0",
|
||||
"css-loader": "^6.8.1",
|
||||
"cssnano": "^6.0.2",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-webpack-plugin": "^4.0.1",
|
||||
"mini-css-extract-plugin": "^2.7.6",
|
||||
"postcss": "^8.4.32",
|
||||
"postcss-combine-duplicated-selectors": "^10.0.2",
|
||||
"postcss-combine-media-query": "^1.0.1",
|
||||
"postcss-import": "^15.1.0",
|
||||
"postcss-loader": "^7.3.3",
|
||||
"postcss-nesting": "^12.0.2",
|
||||
"style-loader": "^3.3.3",
|
||||
"stylelint": "^15.11.0",
|
||||
"stylelint-config-standard": "^34.0.0",
|
||||
"stylelint-webpack-plugin": "^4.1.1",
|
||||
"webpack": "^5.89.0",
|
||||
"webpack-cli": "^5.1.4"
|
||||
"stylelint": "^16.0.2",
|
||||
"stylelint-config-standard": "^35.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "webpack --mode=development",
|
||||
"prod": "webpack --mode=production"
|
||||
"eslint": "eslint public/assets/js/*.js",
|
||||
"stylelint": "stylelint public/assets/css/*.css",
|
||||
"lint": "npm run eslint && npm run stylelint",
|
||||
"compress": "./scripts/compress.sh",
|
||||
"build": "npm run lint && npm run compress"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 2 versions",
|
||||
"> 1%",
|
||||
"not IE 11",
|
||||
"not IE_Mob 11"
|
||||
],
|
||||
"dependencies": {
|
||||
"@11ty/is-land": "^4.0.0",
|
||||
"@zachleat/snow-fall": "^1.0.2"
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
!function(){"use strict";let e=new class{constructor(){}async register(){const e=await this.getCreateOptions(),t={challenge:this.base64URLStringToBuffer(e.challenge),rp:{id:e.rp.id,name:e.rp.name},user:{id:(new TextEncoder).encode(window.atob(e.user.id)),name:e.user.name,displayName:e.user.displayName},pubKeyCredParams:e.pubKeyCredParams,excludeCredentials:[],authenticatorSelection:e.authenticatorSelection,timeout:6e4},a=await navigator.credentials.create({publicKey:t});if(!a)throw new Error("Error generating a passkey");const n={id:a.id?a.id:null,type:a.type?a.type:null,rawId:a.rawId?this.bufferToBase64URLString(a.rawId):null,response:{attestationObject:a.response.attestationObject?this.bufferToBase64URLString(a.response.attestationObject):null,clientDataJSON:a.response.clientDataJSON?this.bufferToBase64URLString(a.response.clientDataJSON):null}};if(!(await window.fetch("/admin/passkeys/register",{method:"POST",body:JSON.stringify(n),cache:"no-cache",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').getAttribute("content")}})).ok)throw new Error("Error saving the passkey");window.location.reload()}async getCreateOptions(){const e=await fetch("/admin/passkeys/register",{method:"GET"});return await e.json()}async login(){const e=await this.getLoginData(),t=await navigator.credentials.get({publicKey:{challenge:this.base64URLStringToBuffer(e.challenge),userVerification:e.userVerification,timeout:6e4}});if(!t)throw new Error("Authentication failed");const a={id:t.id?t.id:"",type:t.type?t.type:"",rawId:t.rawId?this.bufferToBase64URLString(t.rawId):"",response:{authenticatorData:t.response.authenticatorData?this.bufferToBase64URLString(t.response.authenticatorData):"",clientDataJSON:t.response.clientDataJSON?this.bufferToBase64URLString(t.response.clientDataJSON):"",signature:t.response.signature?this.bufferToBase64URLString(t.response.signature):"",userHandle:t.response.userHandle?this.bufferToBase64URLString(t.response.userHandle):""}};if(!(await window.fetch("/login/passkey",{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').getAttribute("content")}})).ok)throw new Error("Login failed");window.location.assign("/admin")}async getLoginData(){const e=await fetch("/login/passkey",{method:"GET"});return await e.json()}base64URLStringToBuffer(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),a=(4-t.length%4)%4,n=t.padEnd(t.length+a,"="),r=window.atob(n),i=new ArrayBuffer(r.length),s=new Uint8Array(i);for(let e=0;e<r.length;e++)s[e]=r.charCodeAt(e);return i}bufferToBase64URLString(e){const t=new Uint8Array(e);let a="";for(const e of t)a+=String.fromCharCode(e);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}};document.querySelectorAll(".add-passkey").forEach((t=>{t.addEventListener("click",(()=>{e.register()}))})),document.querySelectorAll(".login-passkey").forEach((t=>{t.addEventListener("click",(()=>{e.login()}))}))}();
|
Binary file not shown.
BIN
public/assets/css/app.css.br
Normal file
BIN
public/assets/css/app.css.br
Normal file
Binary file not shown.
BIN
public/assets/css/code.css.br
Normal file
BIN
public/assets/css/code.css.br
Normal file
Binary file not shown.
BIN
public/assets/css/colours.css.br
Normal file
BIN
public/assets/css/colours.css.br
Normal file
Binary file not shown.
BIN
public/assets/css/content.css.br
Normal file
BIN
public/assets/css/content.css.br
Normal file
Binary file not shown.
BIN
public/assets/css/fonts.css.br
Normal file
BIN
public/assets/css/fonts.css.br
Normal file
Binary file not shown.
BIN
public/assets/css/h-card.css.br
Normal file
BIN
public/assets/css/h-card.css.br
Normal file
Binary file not shown.
BIN
public/assets/css/layout.css.br
Normal file
BIN
public/assets/css/layout.css.br
Normal file
Binary file not shown.
BIN
public/assets/css/notes.css.br
Normal file
BIN
public/assets/css/notes.css.br
Normal file
Binary file not shown.
BIN
public/assets/css/variables.css.br
Normal file
BIN
public/assets/css/variables.css.br
Normal file
Binary file not shown.
349
public/assets/frontend/normalize.css
vendored
349
public/assets/frontend/normalize.css
vendored
|
@ -1,349 +0,0 @@
|
|||
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
||||
|
||||
/* Document
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Correct the line height in all browsers.
|
||||
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1.15; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/* Sections
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the margin in all browsers.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the `main` element consistently in IE.
|
||||
*/
|
||||
|
||||
main {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the font size and margin on `h1` elements within `section` and
|
||||
* `article` contexts in Chrome, Firefox, and Safari.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in Firefox.
|
||||
* 2. Show the overflow in Edge and IE.
|
||||
*/
|
||||
|
||||
hr {
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the gray background on active links in IE 10.
|
||||
*/
|
||||
|
||||
a {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Remove the bottom border in Chrome 57-
|
||||
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||
* all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the border on images inside links in IE 10.
|
||||
*/
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Change the font styles in all browsers.
|
||||
* 2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1.15; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the overflow in IE.
|
||||
* 1. Show the overflow in Edge.
|
||||
*/
|
||||
|
||||
button,
|
||||
input { /* 1 */
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||
* 1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
button:-moz-focusring,
|
||||
[type="button"]:-moz-focusring,
|
||||
[type="reset"]:-moz-focusring,
|
||||
[type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the padding in Firefox.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
padding: 0.35em 0.75em 0.625em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the text wrapping in Edge and IE.
|
||||
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||
* 3. Remove the padding so developers are not caught out when they zero out
|
||||
* `fieldset` elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
padding: 0; /* 3 */
|
||||
white-space: normal; /* 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the default vertical scrollbar in IE 10+.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in IE 10.
|
||||
* 2. Remove the padding in IE 10.
|
||||
*/
|
||||
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||
*/
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the odd appearance in Chrome and Safari.
|
||||
* 2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||
* 2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/* Interactive
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Add the correct display in Edge, IE 10+, and Firefox.
|
||||
*/
|
||||
|
||||
details {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the correct display in all browsers.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
/* Misc
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10+.
|
||||
*/
|
||||
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10.
|
||||
*/
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1,3 @@
|
|||
import '../css/app.css';
|
||||
|
||||
import { Auth } from './auth.js';
|
||||
|
||||
let auth = new Auth();
|
BIN
public/assets/js/app.js.br
Normal file
BIN
public/assets/js/app.js.br
Normal file
Binary file not shown.
BIN
public/assets/js/auth.js.br
Normal file
BIN
public/assets/js/auth.js.br
Normal file
Binary file not shown.
|
@ -4,14 +4,11 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>@yield('title'){{ config('app.name') }}</title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
@if (!empty(config('app.font_link')))
|
||||
<link rel="stylesheet" href="{{ config('app.font_link') }}">
|
||||
@endif
|
||||
<link rel="stylesheet" href="/assets/highlight/zenburn.css">
|
||||
@production
|
||||
<link rel="stylesheet" href="/assets/app.css">
|
||||
@endproduction
|
||||
<link rel="stylesheet" href="/assets/css/app.css">
|
||||
<link rel="alternate" type="application/rss+xml" title="Blog RSS Feed" href="/blog/feed.rss">
|
||||
<link rel="alternate" type="application/atom+xml" title="Blog Atom Feed" href="/blog/feed.atom">
|
||||
<link rel="alternate" type="application/json" title="Blog JSON Feed" href="/blog/feed.json">
|
||||
|
@ -81,7 +78,7 @@
|
|||
@section('scripts')
|
||||
<script type="module" src="/assets/frontend/is-land.js"></script>
|
||||
<script type="module" src="/assets/frontend/snow-fall.js"></script>
|
||||
<script src="/assets/app.js"></script>
|
||||
<script type="module" src="/assets/js/app.js"></script>
|
||||
@show
|
||||
</body>
|
||||
</html>
|
||||
|
|
3
scripts/build.sh
Executable file
3
scripts/build.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
echo "Build script"
|
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
echo "compressing app.css"
|
||||
zopfli --i100 ./public/assets/css/app.css
|
||||
brotli --force --quality=11 --output=./public/assets/css/app.css.br -- ./public/assets/css/app.css
|
||||
|
||||
echo "compressing js assets"
|
||||
for file in ./public/assets/js/*.js
|
||||
do
|
||||
zopfli --i100 $file
|
||||
brotli --force --quality=11 --output=$file.br -- $file
|
||||
done
|
||||
|
||||
echo "compressing frontend assets"
|
||||
for file in ./public/assets/frontend/*.css
|
||||
do
|
||||
if [[ -f $file ]]; then
|
||||
zopfli --i100 $file
|
||||
brotli --force --quality=11 --output=$file.br -- $file
|
||||
fi
|
||||
done
|
||||
for file in ./public/assets/frontend/a11y.css/*.css
|
||||
do
|
||||
if [[ -f $file ]]; then
|
||||
zopfli --i100 $file
|
||||
brotli --force --quality=11 --output=$file.br -- $file
|
||||
fi
|
||||
done
|
||||
|
||||
echo "compressing highlight styles"
|
||||
for file in ./public/assets/highlight/*.css
|
||||
do
|
||||
if [[ -f $file ]]; then
|
||||
zopfli --i100 $file
|
||||
brotli --force --quality=11 --output=$file.br -- $file
|
||||
fi
|
||||
done
|
16
scripts/compress.sh
Executable file
16
scripts/compress.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if ! type brotli &> /dev/null; then
|
||||
echo "brotli not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in ./public/assets/css/*.css
|
||||
do
|
||||
brotli --force --quality=11 --output=$file.br -- $file
|
||||
done
|
||||
|
||||
for file in ./public/assets/js/*.js
|
||||
do
|
||||
brotli --force --quality=11 --output=$file.br -- $file
|
||||
done
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Putting the Laravel app in maintenance mode"
|
||||
php artisan down
|
||||
php artisan horizon:terminate
|
||||
|
||||
echo "Pulling the latest changes"
|
||||
git pull
|
||||
|
||||
echo "Updating composer and dependencies"
|
||||
sudo composer self-update
|
||||
composer install --no-dev --optimize-autoloader
|
||||
|
||||
echo "running any migrations"
|
||||
php artisan migrate
|
||||
|
||||
echo "Caching Laravel route and config files"
|
||||
php artisan route:cache
|
||||
php artisan config:cache
|
||||
|
||||
echo "Restarting the supervisord instances"
|
||||
sudo supervisorctl restart all
|
||||
|
||||
echo "Bringing the Laravel app back online"
|
||||
php artisan up
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
for file in ./public/assets/js/*.js
|
||||
do
|
||||
echo "uglifying `basename $file`"
|
||||
uglifyjs --verbose --compress --source-map content=${file:2}.map,url=`basename $file`.map,filename=${file:2}.map,includeSources=true --output $file $file
|
||||
done
|
Loading…
Add table
Reference in a new issue