Skip to content

Commit

Permalink
feat: add in dependabot & lighthouse workflows (#10)
Browse files Browse the repository at this point in the history
* feat: add in dependabot & lighthouse workflows

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: fix types

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: fix build

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: more fixes

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: fix linting issues

Signed-off-by: super-linter <super-linter@super-linter.dev>

* chore: fix lighthouse config

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: fix lighthouse

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: fix linting issues

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: fix linting

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: fix linting issues

Signed-off-by: super-linter <super-linter@super-linter.dev>

* chore: fix lighthouse build directory

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

* chore: fix linting

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>

---------

Signed-off-by: Newton <5769156+iamnewton@users.noreply.github.com>
Signed-off-by: super-linter <super-linter@super-linter.dev>
Co-authored-by: iamnewton <iamnewton@users.noreply.github.com>
  • Loading branch information
iamnewton and iamnewton authored Nov 8, 2024
1 parent 2357fca commit 23f1f6c
Show file tree
Hide file tree
Showing 22 changed files with 589 additions and 409 deletions.
4 changes: 2 additions & 2 deletions .codesandbox/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"command": "npm install",
"name": "Install Dependencies"
"name": "Install Dependencies",
"command": "npm install"
}
],

Expand Down
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NEXT_PUBLIC_ENVIRONMENT="production"
NEXT_PUBLIC_ENVIRONMENT=production
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NEXT_PUBLIC_ENVIRONMENT="development"
NEXT_PUBLIC_ENVIRONMENT=development
34 changes: 30 additions & 4 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ name: Audit
# - [ ] coverage drops

on: # yamllint disable-line rule:truthy
pull_request:
types:
- synchronize
- opened
- push

jobs:
bundle-size:
Expand All @@ -35,3 +32,32 @@ jobs:
with:
build-script: npm run build
bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

performance:
name: Audit the performance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0

- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x

- run: npm ci
name: Install dependencies

- run: npm install -g @lhci/cli@0.14.x
name: Install Lighthouse CLI

- run: npm run build
name: Build project

- run: lhci autorun
name: Run Lighthouse CI
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Dependabot auto-merge
on:
- pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
name: Update the dependencies
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'theholocron/nextjs-template'
steps:
- uses: dependabot/fetch-metadata@4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d
name: Fetch Dependabot metadata
id: metadata
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- run: gh pr merge --auto --merge "$PR_URL"
name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANNOTATE_ONLY: true # Allow annotations in the PR
DISABLE_COMMENTS: false # Enable comments in the PR
IGNORE_GENERATED_FILES: true
IGNORE_GITIGNORED_FILES: true
LINTER_RULES_PATH: /
CSS_FILE_NAME: "stylelint.config.js"
EDITORCONFIG_FILE_NAME: ".editorconfig-checker.json"
FILTER_REGEX_EXCLUDE: "^public/.*"
FIX_CSS_PRETTIER: true
FIX_ENV: true
FIX_GRAPHQL_PRETTIER: true
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ reports
dist
super-linter-output
.next
next-env.d.ts
out
build
.vercel
Expand Down
5 changes: 1 addition & 4 deletions app/msw/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { handlers as authHandlers } from "../../src/auth/handlers";
import { handlers as taskHandlers } from "../../src/tasks/handlers";

export const handlers = [
...taskHandlers,
...authHandlers,
];
export const handlers = [...taskHandlers, ...authHandlers];
14 changes: 14 additions & 0 deletions lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ci": {
"collect": {
"url": ["http://localhost:3000/"],
"startServerCommand": "npx serve@latest out"
},
"assert": {
"preset": "lighthouse:recommended"
},
"upload": {
"target": "temporary-public-storage"
}
}
}
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
16 changes: 13 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/** @type {import('next').NextConfig} */
/**
* @see https://nextjs.org/docs/app/building-your-application/configuring
* @type {import('next').NextConfig}
*/
import bundleAnalyzer from "@next/bundle-analyzer";

const nextConfig = {};
const config = {
output: "export",
};

export default nextConfig;
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});

export default withBundleAnalyzer(config);
Loading

0 comments on commit 23f1f6c

Please sign in to comment.