Skip to content

Commit

Permalink
Merge pull request #1 from lucasheartcliff/next
Browse files Browse the repository at this point in the history
Switching to Next JS and adding the base implementation
  • Loading branch information
lucasheartcliff authored Jan 29, 2024
2 parents 10d3111 + 2ae9653 commit 4cf192a
Show file tree
Hide file tree
Showing 137 changed files with 57,724 additions and 12,318 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
out
!.storybook
100 changes: 100 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
// Configuration for JavaScript files
"extends": [
"airbnb-base",
"next/core-web-vitals", // Needed to avoid warning in next.js build: 'The Next.js plugin was not detected in your ESLint configuration'
"plugin:prettier/recommended"
],
"rules": {
"prettier/prettier": [
"warn",
{
"singleQuote": true,
"endOfLine": "auto"
}
]
},
"overrides": [
// Configuration for TypeScript files
{
"files": ["**/*.ts", "**/*.tsx"],
"plugins": [
"@typescript-eslint",
"unused-imports",
"tailwindcss",
"simple-import-sort"
],
"extends": [
"plugin:tailwindcss/recommended",
"airbnb-typescript",
"next/core-web-vitals",
"plugin:prettier/recommended"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"prettier/prettier": [
"warn",
{
"singleQuote": true,
"endOfLine": "auto"
}
],
"no-continue": "off",
"react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
"react/require-default-props": "off", // Allow non-defined react props as undefined
"react/jsx-props-no-spreading": "off", // _app.tsx uses spread operator and also, react-hook-form
"react-hooks/exhaustive-deps": "off", // Incorrectly report needed dependency with Next.js router
"@next/next/no-img-element": "off", // We currently not using next/image because it isn't supported with SSG mode
"@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier
"@typescript-eslint/consistent-type-imports": "error", // Ensure `import type` is used when it's necessary
"no-restricted-syntax": [
"warn",
"ForInStatement",
"LabeledStatement",
"WithStatement"
], // Overrides Airbnb configuration and enable no-restricted-syntax
"import/prefer-default-export": "off", // Named export is easier to refactor automatically
"simple-import-sort/imports": "error", // Import configuration for `eslint-plugin-simple-import-sort`
"simple-import-sort/exports": "error", // Export configuration for `eslint-plugin-simple-import-sort`
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }]
}
},
// Configuration for testing
{
"files": ["**/*.test.ts", "**/*.test.tsx"],
"plugins": ["jest", "jest-formatting", "testing-library", "jest-dom"],
"extends": [
"plugin:jest/recommended",
"plugin:jest-formatting/recommended",
"plugin:testing-library/react",
"plugin:jest-dom/recommended"
]
},
// Configuration for e2e testing (Cypress)
{
"files": ["cypress/**/*.ts"],
"plugins": ["cypress"],
"extends": ["plugin:cypress/recommended"],
"parserOptions": {
"project": "./cypress/tsconfig.json"
}
},
// Configuration for Storybook
{
"files": ["*.stories.*"],
"extends": ["plugin:storybook/recommended"],
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
]
}
}
]
}
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
custom:
["https://donate.stripe.com/7sI5m5146ehfddm7tj", "https://nextlessjs.com"]
67 changes: 67 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

name: Build with ${{ matrix.node-version }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build-prod

test:
strategy:
matrix:
node-version: [16.x]

name: Run all tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Retrieve Git history, needed to verify commits
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci

- if: github.event_name == 'pull_request'
name: Validate all commits from PR
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

- name: Linter
run: npm run lint

- name: Type checking
run: npm run check-types

- name: Run unit tests
run: npm run test

- name: Run storybook tests
run: npm run test-storybook:ci

- name: Run e2e tests
run: npx percy exec -- npm run e2e:headless
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
workflow_run:
workflows: ["CI"]
types:
- completed
branches:
- main

jobs:
release:
strategy:
matrix:
node-version: [16.x]

name: Create a new release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: HUSKY=0 npm ci

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
33 changes: 33 additions & 0 deletions .github/workflows/update-deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update dependencies

on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *"

jobs:
update:
strategy:
matrix:
node-version: [16.x]

name: Update all dependencies
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci

- run: npx npm-check-updates -u # Update dependencies
- run: rm -Rf node_modules package-lock.json
- run: npm install
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "build: update dependencies to the latest version"
title: Update dependencies to the latest version
129 changes: 38 additions & 91 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,51 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# dependencies
/node_modules
/.pnp
.pnp.js

# Dependency directories
node_modules/
jspm_packages/
# testing
/coverage

# TypeScript v1 declaration files
typings/
# storybook
storybook-static

# TypeScript cache
*.tsbuildinfo
# cypress
cypress/screenshots
cypress/videos

# Optional npm cache directory
.npm
# next.js
/.next
/out

# Optional eslint cache
.eslintcache
# next-sitemap
public/robots.txt
public/sitemap.xml
public/sitemap-*.xml

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# cache
.swc/

# Optional REPL history
.node_repl_history
# production
/build

# Output of 'npm pack'
*.tgz
# misc
.DS_Store
*.pem
Thumbs.db

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/
# debug
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*

# FuseBox cache
.fusebox/
# local env files
.env*.local

# DynamoDB Local files
.dynamodb/
# local folder
local

# TernJS port file
.tern-port
# vercel
.vercel
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# npx --no -- commitlint --edit $1
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# Disable concurent to run `check-types` after ESLint in lint-staged
# npx lint-staged --concurrent false
Loading

0 comments on commit 4cf192a

Please sign in to comment.