Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: revamp and upgrade #326

Merged
merged 11 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

79 changes: 0 additions & 79 deletions .eslintrc.js

This file was deleted.

26 changes: 16 additions & 10 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,24 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: "${{ env.node_version }}"
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: "Install pnpm & dependencies"
uses: pnpm/action-setup@v4
with:
run_install: |
- recursive: true
- args: [--frozen-lockfile]

- name: Lint check
run: yarn lint
run: pnpm run lint
- name: Format check
run: yarn prettier
run: pnpm run prettier
- name: Unit & Integration tests
run: yarn test
run: pnpm run test
- name: Smoke & Acceptance tests
run: |
yarn build-storybook --quiet
yarn playwright install
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:127.0.0.1:6006 && yarn test-storybook"
pnpm run build-storybook --quiet
pnpm playwright install
pnpm dlx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"pnpm dlx http-server storybook-static --port 6006 --silent" \
"pnpm dlx wait-on tcp:127.0.0.1:6006 && pnpm run test-storybook"
18 changes: 0 additions & 18 deletions .github/workflows/cr.yml

This file was deleted.

17 changes: 12 additions & 5 deletions .github/workflows/nextjs_bundle_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ jobs:
with:
node-version: "20.x"

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: "Install pnpm & dependencies"
uses: pnpm/action-setup@v4
with:
run_install: |
- recursive: true
- args: [--frozen-lockfile]

# - name: Install dependencies
# run: pnpm install --frozen-lockfile

- name: Restore next build
uses: actions/cache@v3
Expand All @@ -46,21 +53,21 @@ jobs:
env:
SKIP_BUILD_PRODUCT_REDIRECTS: 1
# change this if your site requires a custom build command
run: yarn build
run: pnpm build

# Here's the first place where next-bundle-analysis' own script is used
# This step pulls the raw bundle stats for the current bundle
- name: Analyze bundle
run: node report-bundle-size.js

- name: Upload bundle
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: bundle
path: .next/analyze/__bundle_analysis.json

- name: Download base branch bundle stats
uses: dawidd6/action-download-artifact@v2
uses: dawidd6/action-download-artifact@v8
if: success() && github.event.number
with:
workflow: nextjs_bundle_analysis.yml
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: "${{ env.node_version }}"
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: "Install pnpm & dependencies"
uses: pnpm/action-setup@v4
with:
run_install: |
- recursive: true
- args: [--frozen-lockfile]

- name: Install Playwright Browsers
run: yarn playwright install --with-deps
run: pnpm playwright install --with-deps

- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v3
run: pnpm playwright test

- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ yarn-error.log*
.env.development.local
.env.test.local
.env.production.local
storybook-static/
/test-results/
/playwright-report/
/playwright/.cache/
Expand Down
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<img align="right" width="360px" height="410px" src="./.github/assets/project-logo-vertical.png">

# Next.js Enterprise Boilerplate </br> [![GitHub Actions Workflow Status][check-workflow-badge]][check-workflow-badge-link] [![GitHub License][github-license-badge]][github-license-badge-link] [![GitHub contributors][github-contributors-badge]][github-contributors-badge-link] [![Discord][discord-badge]][discord-badge-link] [![Blazity][made-by-blazity-badge]][made-by-blazity-badge-link]
### Next.js Enterprise Boilerplate

</br>

[![GitHub Actions Workflow Status][check-workflow-badge]][check-workflow-badge-link] [![GitHub License][github-license-badge]][github-license-badge-link] [![GitHub contributors][github-contributors-badge]][github-contributors-badge-link] [![Discord][discord-badge]][discord-badge-link] [![Blazity][made-by-blazity-badge]][made-by-blazity-badge-link]

Welcome to the _Next.js Enterprise Boilerplate_, an open-source template for enterprise projects! It's loaded with features that'll help you build a high-performance, maintainable, and enjoyable app. We've done all the heavy lifting for you, so sit back, relax, and get ready to conquer the world with your incredible app! 🌍

Expand All @@ -11,7 +15,7 @@ Welcome to the _Next.js Enterprise Boilerplate_, an open-source template for ent

With this template, you get all the awesomeness you need:

- 🏎️ **[Next.js](https://nextjs.org/)** - Fast by default, with config optimized for performance (with **App Directory**)
- 🏎️ **[Next.js 15](https://nextjs.org/)** - Fast by default, with config optimized for performance (with **App Directory**)
- 💅 **[Tailwind CSS](https://tailwindcss.com/)** - A utility-first CSS framework for rapid UI development
- ✨ **[ESlint](https://eslint.org/)** and **[Prettier](https://prettier.io/)** - For clean, consistent, and error-free code
- 🛠️ **[Extremely strict TypeScript](https://www.typescriptlang.org/)** - With [`ts-reset`](https://github.com/total-typescript/ts-reset) library for ultimate type safety
Expand All @@ -31,7 +35,6 @@ With this template, you get all the awesomeness you need:
- **[Renovate BOT](https://www.whitesourcesoftware.com/free-developer-tools/renovate)** - Auto-updating dependencies, so you can focus on coding
- **[Patch-package](https://www.npmjs.com/package/patch-package)** - Fix external dependencies without losing your mind
- **Components coupling and cohesion graph** - A tool for managing component relationships
- **[Automated ChatGPT Code Reviews](https://openai.com/chatgpt)** - **Stay on the cutting edge with AI-powered code reviews!**
- **[Semantic Release](https://github.com/semantic-release/semantic-release)** - for automatic changelog
- **[T3 Env](https://env.t3.gg/)** - Manage your environment variables with ease

Expand Down Expand Up @@ -69,19 +72,19 @@ To get started with this boilerplate, follow these steps:

```bash
## Don't forget to ⭐ star and fork it first :)
git clone https://github.com/<your_username)/next-enterprise.git
git clone https://github.com/<your_username>/next-enterprise.git
```

2. Install the dependencies:

```bash
yarn install --frozen-lockfile
pnpm install --frozen-lockfile
```

3. Run the development server:

```bash
yarn dev
pnpm run dev
```

4. Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
Expand Down Expand Up @@ -118,15 +121,14 @@ The following scripts are available in the `package.json`:
- `e2e:ui`: Runs end-to-end tests with UI
- `format`: Formats the code with Prettier
- `postinstall`: Applies patches to external dependencies
- `preinstall`: Ensures the project is installed with Yarn
- `coupling-graph`: **Generates a coupling and cohesion graph for the components**

## 🔗 Coupling Graph

The `coupling-graph` script is a useful tool that helps visualize the coupling and connections between your project's internal modules. It's built using the [Madge](https://github.com/pahen/madge) library. To generate the graph, simply run the following command:

```bash
yarn coupling-graph
pnpm run coupling-graph
```

This will create a `graph.svg` file, which contains a graphical representation of the connections between your components. You can open the file with any SVG-compatible viewer.
Expand All @@ -139,9 +141,9 @@ This boilerplate comes with various testing setups to ensure your application's

### Running Tests

- **Unit and integration tests**: Run Jest tests using `yarn test`
- **End-to-end tests (headless mode)**: Run Playwright tests in headless mode with `yarn e2e:headless`
- **End-to-end tests (UI mode)**: Run Playwright tests with UI using `yarn e2e:ui`
- **Unit and integration tests**: Run Jest tests using `pnpm run test`
- **End-to-end tests (headless mode)**: Run Playwright tests in headless mode with `pnpm run e2e:headless`
- **End-to-end tests (UI mode)**: Run Playwright tests with UI using `pnpm run e2e:ui`

<img width="1392" alt="image" src="https://user-images.githubusercontent.com/28964599/233666655-93b7d08b-2fd8-406a-b43c-44d4d96cf387.png">

Expand Down Expand Up @@ -183,7 +185,7 @@ export const FilledForm: Story = {

### Smoke Testing

In this boilerplate, we use Storybook's out-of-the-box support for smoke testing to verify that components render correctly without any errors. Just run `yarn test-storybook` to perform smoke testing. Remember to write stories in JSX or TSX format only. Smoke testing and a lot of other functionalities dont work well with MDX stories.
In this boilerplate, we use Storybook's out-of-the-box support for smoke testing to verify that components render correctly without any errors. Just run `pnpm run test-storybook` to perform smoke testing. Remember to write stories in JSX or TSX format only. Smoke testing and a lot of other functionalities dont work well with MDX stories.

## 🎨 Styling and Design System

Expand Down Expand Up @@ -215,14 +217,6 @@ While this boilerplate doesn't include a specific state management library, we b

Choose the library that best fits your requirements and project structure to ensure an efficient state management solution for your application.

## 🤖 ChatGPT Code Review

We've integrated the innovative [ChatGPT Code Review](https://github.com/anc95/ChatGPT-CodeReview) for AI-powered, automated code reviews. This feature provides real-time feedback on your code, helping improve code quality and catch potential issues.

To use ChatGPT Code Review, add an `OPENAI_API_KEY` environment variable with an appropriate key from the OpenAI platform. For setup details, refer to the [Using GitHub Actions](https://github.com/anc95/ChatGPT-CodeReview#using-github-actions) section in the documentation.

![image](https://user-images.githubusercontent.com/28964599/233685071-e1371edf-6359-41c3-a989-335d6ee09cb7.png)

## 💻 Environment Variables handling

[T3 Env](https://env.t3.gg/) is a library that provides environmental variables checking at build time, type validation and transforming. It ensures that your application is using the correct environment variables and their values are of the expected type. You’ll never again struggle with runtime errors caused by incorrect environment variable usage.
Expand Down
11 changes: 6 additions & 5 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from "next"
import { Button } from "components/Button/Button"

import { LP_GRID_ITEMS } from "lp-items"

export const metadata: Metadata = {
Expand All @@ -23,12 +24,12 @@ export default function Web() {
return (
<>
<section className="bg-white dark:bg-gray-900">
<div className="mx-auto grid max-w-screen-xl px-4 py-8 text-center lg:py-16">
<div className="mx-auto grid max-w-(--breakpoint-xl) px-4 py-8 text-center lg:py-16">
<div className="mx-auto place-self-center">
<h1 className="mb-4 max-w-2xl text-4xl font-extrabold leading-none tracking-tight dark:text-white md:text-5xl xl:text-6xl">
<h1 className="mb-4 max-w-2xl text-4xl leading-none font-extrabold tracking-tight md:text-5xl xl:text-6xl dark:text-white">
Next.js Enterprise Boilerplate
</h1>
<p className="mb-6 max-w-2xl font-light text-gray-500 dark:text-gray-400 md:text-lg lg:mb-8 lg:text-xl">
<p className="mb-6 max-w-2xl font-light text-gray-500 md:text-lg lg:mb-8 lg:text-xl dark:text-gray-400">
Jumpstart your enterprise project with our feature-packed, high-performance Next.js boilerplate!
Experience rapid UI development, AI-powered code reviews, and an extensive suite of tools for a smooth and
enjoyable development process.
Expand All @@ -46,11 +47,11 @@ export default function Web() {
</div>
</section>
<section className="bg-white dark:bg-gray-900">
<div className="mx-auto max-w-screen-xl px-4 py-8 sm:py-16 lg:px-6">
<div className="mx-auto max-w-(--breakpoint-xl) px-4 py-8 sm:py-16 lg:px-6">
<div className="justify-center space-y-8 md:grid md:grid-cols-2 md:gap-12 md:space-y-0 lg:grid-cols-3">
{LP_GRID_ITEMS.map((singleItem) => (
<div key={singleItem.title} className="flex flex-col items-center justify-center text-center">
<div className="mb-4 flex h-10 w-10 items-center justify-center rounded-full bg-primary-100 p-1.5 text-blue-700 dark:bg-primary-900 lg:h-12 lg:w-12">
<div className="bg-primary-100 dark:bg-primary-900 mb-4 flex size-10 items-center justify-center rounded-full p-1.5 text-blue-700 lg:size-12">
{singleItem.icon}
</div>
<h3 className="mb-2 text-xl font-bold dark:text-white">{singleItem.title}</h3>
Expand Down
6 changes: 3 additions & 3 deletions components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"use client"

import * as RadixTooltip from "@radix-ui/react-tooltip"
import { cva, VariantProps } from "class-variance-authority"
import { cva, type VariantProps } from "class-variance-authority"
import React from "react"
import { twMerge } from "tailwind-merge"

const tooltipContent = cva([], {
variants: {
intent: {
primary: ["rounded-0.5md", "bg-zinc-700", "font-open-sans", "text-white"],
primary: ["rounded-md", "bg-zinc-700", "font-sans", "text-white"],
},
size: {
md: ["px-4", "py-2.5", "text-2xs"],
md: ["px-4", "py-2.5", "text-xs"],
},
},
defaultVariants: {
Expand Down
Loading
Loading