Skip to content

Commit

Permalink
Reapply "Merge branch 'main' into dev"
Browse files Browse the repository at this point in the history
This reverts commit cf7d669.
  • Loading branch information
michaelbrusegard committed Oct 24, 2024
1 parent cf7d669 commit 53531d8
Show file tree
Hide file tree
Showing 80 changed files with 2,086 additions and 522 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ jobs:
FEIDE_TOKEN_ENDPOINT: "https://auth.dataporten.no/oauth/token"
FEIDE_USERINFO_ENDPOINT: "https://auth.dataporten.no/openid/userinfo"
NEXT_PUBLIC_SITE_URL: "http://localhost:3000"
LHCI_TOKEN: ${{ secrets.LHCI_BUILD_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 20
- name: Fetch base_ref HEAD
run: git fetch --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
Expand All @@ -54,5 +59,5 @@ jobs:
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
run: |
bun add -g @lhci/cli@0.13.x
bun add -g @lhci/cli@0.14.x
lhci autorun
2 changes: 1 addition & 1 deletion .github/workflows/deploy-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
jobs:
script:
name: Script
runs-on: ubuntu-latest
runs-on: self-hosted
environment: ${{ inputs.environment }}
steps:
- uses: appleboy/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ public/robots.txt

# data
/data

# Ignore husky files, see PR #54
/.husky/*
60 changes: 0 additions & 60 deletions .husky/_/pre-commit

This file was deleted.

60 changes: 0 additions & 60 deletions .husky/_/prepare-commit-msg

This file was deleted.

3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"useSemanticElements": "off"
},
"nursery": {
"useSortedClasses": {
"level": "warn",
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 0 additions & 2 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Use type safe message keys with `next-intl`
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
type Messages = typeof import('./messages/en.json');
// eslint-disable-next-line @typescript-eslint/no-empty-interface
declare interface IntlMessages extends Messages {}
2 changes: 1 addition & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pre-commit:
commands:
check:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
glob: "*.{js,ts,tsx,json}"
stage_fixed: true
run: bunx @biomejs/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
66 changes: 66 additions & 0 deletions lighthouserc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const PAGES_EXCLUDED = ['news', 'storage'];

// Do not convert into an ES6 export.
// lighthouse-ci (as of 0.14.0) uses require() to import, and this is not supported with ES6 modules.
module.exports = {
ci: {
collect: {
url: [
'http://localhost:3000/en/', // Trailing slash required, else the regex for default lighthouse rules won't catch this one
'http://localhost:3000/en/about',
'http://localhost:3000/en/events',
'http://localhost:3000/en/news',
'http://localhost:3000/en/news/1',
'http://localhost:3000/en/storage',
'http://localhost:3000/en/storage/shopping-cart',
],
startServerCommand: 'bun run start',
},
upload: {
target: 'lhci',
serverBaseUrl: 'https://lhci.hackerspace-ntnu.no', // build token is set by the GH Action
},
assert: {
assertMatrix: [
{
matchingUrlPattern: `http://.*/en/(?!${PAGES_EXCLUDED.join('|')}).*`, // match all routes, except for pages with special rules. See https://github.com/GoogleChrome/lighthouse-ci/issues/511 and https://github.com/GoogleChrome/lighthouse-ci/issues/208#issuecomment-784501105
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
},
},
{
matchingUrlPattern: 'http://.*/en/news.*',
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
interactive: 'off',
'uses-responsive-images': 'off', // Should be removed when we obtain images from backend
},
},
{
matchingUrlPattern: 'http://.*/en/storage.*',
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
'unused-javascript': 'off',
'cumulative-layout-shift': 'off', // We don't always know how many items are in the cart, which can lead to layout shifts when loading completes
'max-potential-fid': 'off',
},
},
],
},
},
};
37 changes: 0 additions & 37 deletions lighthouserc.yml

This file was deleted.

54 changes: 51 additions & 3 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
"next": "Next",
"goToNextPage": "Go to next page",
"morePages": "More pages",
"page": "page"
"page": "page",
"category": "category",
"sort": "sort",
"photoOf": "Photo of {name}"
},
"error": {
"notFound": "404 - Page not found",
"notFoundDescription": "Oops! Looks like this page got lost in cyberspace.",
"error": "Oops! Something went wrong",
"errorDescription": "Don't worry, our best hackers are on it!",
"goToHomepage": "Return to homepage",
"tryAgain": "Try again"
},
"layout": {
"hackerspaceHome": "Hackerspace homepage",
Expand Down Expand Up @@ -52,13 +63,15 @@
},
"storage": {
"title": "Storage",
"searchPlaceholder": "Search for product...",
"card": {
"quantityInfo": "{quantity} units",
"addToCart": "Add to cart"
"addToCart": "Add to cart",
"removeFromCart": "Remove from cart"
},
"select": {
"ariaLabel": "Select how to filter the storage items",
"filters": "Filters",
"defaultPlaceholder": "Sort results",
"popularity": "Popularity",
"sortDescending": "Inventory (descending)",
"sortAscending": "Inventory (ascending)",
Expand All @@ -72,8 +85,43 @@
"peripherals": "PC peripherals",
"miniPC": "Mini PC"
},
"searchParams": {
"popularity": "popularity",
"descending": "descending",
"ascending": "ascending",
"name": "name",
"cables": "cables",
"sensors": "sensors",
"peripherals": "peripherals",
"miniPC": "minipc"
},
"tooltips": {
"viewShoppingCart": "View shopping cart"
},
"shoppingCart": {
"title": "Shopping Cart",
"productId": "Product ID",
"productName": "Product Name",
"location": "Location",
"unitsAvailable": "Units available",
"tableDescription": "A list of your shopping cart items.",
"backToStorage": "Back to storage",
"cartEmpty": "Your shopping cart is empty.",
"clearCart": "Empty shopping cart",
"cancel": "Cancel",
"clear": "Clear",
"clearCartDescription": "Are you sure you want to clear your shopping cart? All items will be removed.",
"borrowNow": "Borrow now",
"amountOfItemARIA": "Select number of this item"
},
"loanForm": {
"name": "Name",
"email": "Email",
"phoneNumber": "Phone number",
"phoneNumberDescription": "Phone number for contact. Include country code if the number isn't Norwegian.",
"returnBy": "Return by",
"returnByDescription": "Select how long you would like to borrow the item for.",
"submit": "Submit"
}
}
}
Loading

0 comments on commit 53531d8

Please sign in to comment.