Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjarling committed Jul 9, 2024
0 parents commit 5733345
Show file tree
Hide file tree
Showing 55 changed files with 2,361 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "prettier"]
}
110 changes: 110 additions & 0 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Deploy Next.js site to Pages

on:
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
strategy:
matrix:
job: ["prettier", "build"]

env:
NEXT_PUBLIC_CONTENTFUL_SPACE_ID: ${{ secrets.NEXT_PUBLIC_CONTENTFUL_SPACE_ID }}
NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN: ${{ secrets.NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }}

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Setup Pages
uses: actions/configure-pages@v5
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Check formatting
run: npx prettier --check .
if: matrix.job == 'prettier'
- name: Build with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next build
if: matrix.job == 'build'
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out
if: matrix.job == 'build'

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
34 changes: 34 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Playwright Tests
on:
push:
branches: [main, playwright]
pull_request:
branches: [main]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm install -g pnpm && pnpm install
- name: Build the app
env:
CONTENTFUL_CMA_TOKEN: ${{ secrets.CONTENTFUL_CMA_TOKEN }}
NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN: ${{ secrets.NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN }}
NEXT_PUBLIC_CONTENTFUL_SPACE_ID: ${{ secrets.NEXT_PUBLIC_CONTENTFUL_SPACE_ID }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }}
run: pnpm build
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm exec playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# vs code
.vscode/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"trailingComma": "all",
"printWidth": 80
}
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Samvera Static Site Template (featuring Hyku)

This repo is a [Next.js](https://nextjs.org/) static site project providing information about the Hyku application and ecosystem. It will be a static site that will be deployed on Github Pages.

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

## Deployment

This site will be deployed on to Github Pages as a static site. To do a local build of the site, run:

```bash
pnpm build
```

## Testing

This site will be tested using [Playwright](https://playwright.dev/docs). Tests are located in the `tests` directory. To run tests, run:

```bash
# Run tests in headless mode
pnpm test

# Run tests in interactive UI mode
pnpm test:ui
```

## Code Quality

To ensure code quality, this site will use ESLint and Prettier. To format project code locally, run:

```bash
pnpm format
```
17 changes: 17 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
assetPrefix: process.env.NEXT_PUBLIC_BASE_PATH,
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
eslint: {
dirs: ["src"],
},
experimental: {
esmExternals: true,
},
images: {
unoptimized: true,
},
output: "export",
};

export default nextConfig;
55 changes: 55 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "avalon-next",
"version": "0.1.0",
"private": true,
"author": [
"Adam J. Arling <aarling@gmail.com>",
"jrgriffiniii <jrgriffiniii.k0idl@simplelogin.co>"
],
"license": "MIT",
"scripts": {
"build": "next build",
"deploy": "gh-pages -d out",
"dev": "next dev",
"export": "next export",
"format": "prettier --write .",
"lint": "next lint",
"start": "next start",
"test": "playwright test",
"test:ui": "playwright test --ui"
},
"dependencies": {
"@contentful/rich-text-react-renderer": "^15.22.1",
"@headlessui/react": "^2.1.1",
"@heroicons/react": "^2.1.4",
"@next/third-parties": "^14.2.4",
"@tailwindcss/forms": "^0.5.7",
"@tanstack/react-query": "^5.49.2",
"contentful": "^10.12.6",
"contentful-management": "^11.27.5",
"install": "^0.13.0",
"next": "14.2.4",
"next-themes": "^0.3.0",
"pnpm": "^9.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-feather": "^2.0.10",
"react-loading-skeleton": "^3.4.0"
},
"devDependencies": {
"@playwright/test": "^1.45.1",
"@tanstack/eslint-plugin-query": "^5.50.0",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"contentful-cli": "^3.3.3",
"eslint": "^9.6.0",
"eslint-config-next": "14.2.4",
"eslint-config-prettier": "^9.1.0",
"gh-pages": "^6.1.1",
"postcss": "^8.4.39",
"prettier": "^3.3.2",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3"
}
}
Loading

0 comments on commit 5733345

Please sign in to comment.