Skip to content

Commit

Permalink
Merge pull request #232 from Scc33/nextMigration
Browse files Browse the repository at this point in the history
Next migration
  • Loading branch information
Scc33 authored Jul 11, 2024
2 parents 777c931 + 8a272bf commit 00817ad
Show file tree
Hide file tree
Showing 164 changed files with 1,953 additions and 1,585 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["next/core-web-vitals", "prettier"],
"plugins": ["prettier"]
}
18 changes: 0 additions & 18 deletions .github/workflows/cd.yml

This file was deleted.

88 changes: 1 addition & 87 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,96 +31,10 @@ jobs:
# Now we run our tests
- name: Run tests
run: bun run test
# Now we run our lints
- name: Run lints
run: bun run lint
# Now we run our pretty checks for code formatting
- name: Run pretty checks
run: bun run pretty-check
# Finally we run svelte-check for some last minute svelte sanity
- name: Run svelte-check
run: bun run svelte-check
# This comments the current Jest Coverage Report containing JUnit XML reports and a Code Coverage Summary
- name: Jest Coverage Comment
# This comments the current Jest Coverage Report containing JUnit XML reports
# and a Code Coverage Summary
uses: MishaKav/jest-coverage-comment@434e6d2d37116d23d812809b61d499639842fa3b # v1.0.26
with:
title: "Unit Test Coverage Report"
junitxml-path: ./test-results.xml
junitxml-title: Unit Test Report

test:
# Runs on execution of build
needs: build
name: playwright-test
# Running on ubuntu-latest, nothing special
runs-on: ubuntu-latest
steps:
# As usual, we simply checkout the project
- name: Checkout
uses: actions/checkout@v4
# Setup the latest version of Bun
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
# Install project dependencies
- name: Install dependencies
run: bun install --frozen-lockfile
# Install Playwright browsers
- name: Install Playwright Browsers
run: bunx playwright install --with-deps
# Run Playwright tests
- name: Run tests
run: bun run test:playwright

analyze:
# Runs on successful playwright
needs: [build, test]
name: lighthouse-test
# Running on ubuntu-latest, nothing special
runs-on: ubuntu-latest
steps:
# As usual, we simply checkout the project
- name: Checkout
uses: actions/checkout@v4
# Setup the latest version of Bun
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
# Install project dependencies
- name: Install dependencies
run: bun install --frozen-lockfile
# Install Playwright browsers
- name: Install Playwright Browsers
run: bunx playwright install --with-deps
# Run Lighthouse Playwright tests
- name: Run Playwright tests
run: bun run test:lighthouse
- name: Read JSON and set output
id: json-reader
run: |
categories=$(jq -c '.categories' ./lighthouse-reports/lighthouse.json)
echo "::set-output name=json::$categories"
- name: Format Lighthouse Score
# Transform the audit results into a single, friendlier output
id: format-lighthouse-score
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
env:
# using env as input to our script
# see https://github.com/actions/github-script#use-env-as-input
LIGHTHOUSE_RESULT: ${{ steps.json-reader.outputs.json }}
with:
# Run as a separate file so we do not have to inline all of our formatting logic.
# See https://github.com/actions/github-script#run-a-separate-file for more info.
script: |
const { formatLighthouseResults } = await import('${{github.workspace}}/scripts/lighthouse/index.js')
await formatLighthouseResults({core})
- name: Add Comment to PR
if: ${{ github.event_name == 'pull_request' && github.base_ref != 'master' }}
# Replace the previous message with our formatted lighthouse results
uses: thollander/actions-comment-pull-request@d61db783da9abefc3437960d0cce08552c7c004f # v2.4.2
with:
# Reference the previously created comment
comment_tag: "lighthouse-audit"
message: |
${{ steps.format-lighthouse-score.outputs.comment }}
33 changes: 0 additions & 33 deletions .github/workflows/deploy.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/smoke.yml

This file was deleted.

59 changes: 43 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
.DS_Store
node_modules
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
coverage
playwright-report/index.html
yarn-error.log

# 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

# old
.svelte-kit
.vscode
lighthouse-reports
playwright-report
test-results
lighthouse-report
.vscode/settings.json
/test-results
test-results.xml
/lighthouse-reports
test-report.xml
test-results.xml
8 changes: 1 addition & 7 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,4 @@ echo "Running tests..."
bun run test

echo "Running eslint with lint-staged..."
bun run lint-staged

echo "Running prettier..."
bun run pretty-check

echo "Running svelte-checks..."
bun run svelte-check
bun run lint-staged
11 changes: 1 addition & 10 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,4 @@ echo "Running tests..."
bun run test

echo "Running eslint..."
bun run eslint

echo "Running prettier..."
bun run pretty-check

echo "Running svelte-checks..."
bun run svelte-check

echo "Running Playwright tests..."
bun run test:playwright
bun run eslint
1 change: 0 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"plugins": ["prettier-plugin-svelte"],
"trailingComma": "none",
"tabWidth": 2,
"semi": true,
Expand Down
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

36 changes: 36 additions & 0 deletions __tests__/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Home from "@/app/page";
import ActiveSectionContextProvider from "@/context/active-section-context";
import ThemeContextProvider from "@/context/theme-context";
import { render } from "@testing-library/react";
import { it, expect, vi } from "vitest";

const mockIntersectionObserver = vi.fn();
mockIntersectionObserver.mockReturnValue({
observe: () => null,
unobserve: () => null,
disconnect: () => null
});
window.IntersectionObserver = mockIntersectionObserver;
window.matchMedia = vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(), // Deprecated
removeListener: vi.fn(), // Deprecated
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn()
}));

it("Renders page correctly", async () => {
const { asFragment } = render(
<ThemeContextProvider>
<ActiveSectionContextProvider>
<Home />
</ActiveSectionContextProvider>
</ThemeContextProvider>
);
await expect(asFragment()).toMatchFileSnapshot(
"./__snapshots__/Page.snap.html"
);
});
Loading

0 comments on commit 00817ad

Please sign in to comment.