Skip to content

Commit

Permalink
Merge pull request #1 from clydedsouza/nextjs
Browse files Browse the repository at this point in the history
Migrate to Next JS
  • Loading branch information
clydedsouza authored Jul 29, 2024
2 parents 81f306a + 5e5dbe1 commit 0159d16
Show file tree
Hide file tree
Showing 188 changed files with 10,443 additions and 19,551 deletions.
48 changes: 34 additions & 14 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ on:
- "api/**"
- "images/**"

workflow_dispatch:

permissions:
contents: read

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build_website:
name: Build website
Expand All @@ -25,35 +34,46 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x

- name: Install NPM packages
- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: npm ci

- name: Run unit tests
run: npm run test

- name: Run lint
run: npm run lint

- name: Run prettier
run: npm run pretty

- name: Run unit tests
run: npm run test
- name: Build with Next.js
run: npx --no-install next build

- name: Build website
run: npm run build
- name: Generate sitemap file
run: npm run sitemap

- name: Upload website files
uses: actions/upload-artifact@v3
with:
path: ./website/build
path: ./website/out

deploy_website:
name: Deploy website
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build_website
if: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
website/.env.production
2 changes: 2 additions & 0 deletions website/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_MIXPANEL_TOKEN=6c905af7861c30571d76bbc6d67696ef
NEXT_PUBLIC_TAWKTO_CHATBOT_PROPERTY_ID=5f8abef7f91e4b431ec53ec7
5 changes: 0 additions & 5 deletions website/.eslintignore

This file was deleted.

47 changes: 0 additions & 47 deletions website/.eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions website/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
21 changes: 17 additions & 4 deletions website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,33 @@
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
*.pem

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

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
7 changes: 0 additions & 7 deletions website/.prettierignore

This file was deleted.

6 changes: 0 additions & 6 deletions website/.prettierrc.json

This file was deleted.

12 changes: 0 additions & 12 deletions website/TestHelpers/testHelper.ts

This file was deleted.

33 changes: 33 additions & 0 deletions website/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/

import type { Config } from "jest";
import nextJest from "next/jest.js";

const config: Config = {
clearMocks: true,
coverageProvider: "v8",
testEnvironment: "jsdom",
setupFilesAfterEnv: ["<rootDir>/src/test-util/setupTests.ts"],

// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "\\\\node_modules\\\\"
// ],
};

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
});

// export default config;
export default createJestConfig(config);
7 changes: 7 additions & 0 deletions website/next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: "https://clydedsouza.net",
generateRobotsTxt: true,
generateIndexSitemap: false,
outDir: "out",
};
13 changes: 13 additions & 0 deletions website/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-check
const path = require("path");

/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
reactStrictMode: true,
sassOptions: {
includePaths: [path.join(__dirname, "styles")],
},
};

module.exports = nextConfig;
Loading

0 comments on commit 0159d16

Please sign in to comment.