Skip to content

Commit

Permalink
feat: add next-example
Browse files Browse the repository at this point in the history
  • Loading branch information
tclxshunquan-wang committed Aug 20, 2024
1 parent b7f24a9 commit 4bbcc2f
Show file tree
Hide file tree
Showing 18 changed files with 1,269 additions and 28 deletions.
36 changes: 36 additions & 0 deletions examples/next-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun run dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Binary file added examples/next-example/app/favicon.ico
Binary file not shown.
27 changes: 27 additions & 0 deletions examples/next-example/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}

@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
22 changes: 22 additions & 0 deletions examples/next-example/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import './globals.css';
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';

const inter = Inter({ subsets: ['latin'] });

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
);
}
10 changes: 10 additions & 0 deletions examples/next-example/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div>
Hello @hyperse/track
</div>
</main>
);
}
10 changes: 10 additions & 0 deletions examples/next-example/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { base, defineConfig } from '@hyperse/eslint-config-hyperse';

export default defineConfig([
...base,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
]);
28 changes: 28 additions & 0 deletions examples/next-example/lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
/**
* This is the base lint-staged rules config and just includes prettier by default.
* A good practice is to override this base configuration in each package and/or application
* where we are able to add customization depending on the nature of the project (eslint...).
*/
import { getEslintFixCmd } from '../lint-staged.common.mjs';

/**
* @type {Record<string, (filenames: string[]) => string | string[] | Promise<string | string[]>>}
*/
const rules = {
'**/*.{js,jsx,ts,tsx,mjs,cjs}': (filenames) => {
return getEslintFixCmd({
cwd: dirname(fileURLToPath(import.meta.url)),
fix: true,
cache: true,
// when autofixing staged-files a good tip is to disable react-hooks/exhaustive-deps, cause
// a change here can potentially break things without proper visibility.
rules: [],
maxWarnings: 25,
files: filenames,
});
},
};

export default rules;
5 changes: 5 additions & 0 deletions examples/next-example/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/basic-features/typescript for more information.
4 changes: 4 additions & 0 deletions examples/next-example/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig
38 changes: 38 additions & 0 deletions examples/next-example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "next-example",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev -p 3001",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"repository": {
"type": "git",
"url": "[email protected]:hyperse-io/track.git"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"dependencies": {
"@types/node": "20.6.2",
"@types/react": "18.2.22",
"@types/react-dom": "18.2.7",
"autoprefixer": "10.4.15",
"eslint": "8.49.0",
"eslint-config-next": "13.5.1",
"next": "14.2.5",
"postcss": "8.4.30",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.3",
"typescript": "5.2.2"
},
"devDependencies": {
"@hyperse/eslint-config-hyperse": "1.1.3"
}
}
6 changes: 6 additions & 0 deletions examples/next-example/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
1 change: 1 addition & 0 deletions examples/next-example/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/next-example/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions examples/next-example/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: ['class', '[data-theme="dark"]'],
corePlugins: {
// Avoid conflicts with antd
preflight: false,
},
content: [
'./app/**/*.{js,tsx,md,mdx}',
],
theme: {
extend: {},
},
};
28 changes: 28 additions & 0 deletions examples/next-example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
8 changes: 5 additions & 3 deletions hyperse-track.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"name": "website",
"path": "website",
},
{
"name": "next-example",
"path": "examples/next-example",
},
],
"extensions": {
"recommendations": [
Expand Down Expand Up @@ -45,6 +49,7 @@
"eslint.workingDirectories": [
"./",
"./website",
"./examples/next-example",
],
"typescript.tsdk": "root/node_modules/typescript/lib",
"[jsonc]": {
Expand All @@ -56,8 +61,5 @@
"i18n-ally.localesPaths": [
"i18n"
],
"[markdown]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
},
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
],
"workspaces": [
"website",
"examples/next-example",
"./"
],
"scripts": {
Expand Down
Loading

0 comments on commit 4bbcc2f

Please sign in to comment.