Add a working WIP example

This commit is contained in:
Manav Rathi 2024-02-15 20:18:33 +05:30
parent 41351e71d2
commit 632af065fe
12 changed files with 135 additions and 0 deletions

View file

@ -11,6 +11,7 @@
},
"dependencies": {
"@date-io/date-fns": "^2.14.0",
"@repo/ui": "*",
"@ente-io/utils": "*",
"@mui/x-date-pickers": "^5.0.0-alpha.6",
"@sentry/nextjs": "^7.77.0",

12
apps/web/app/page.tsx Normal file
View file

@ -0,0 +1,12 @@
import { Card } from "@repo/ui/card";
import { sayHello } from "@repo/ui/hello";
export default function Page(): JSX.Element {
sayHello();
return (
<main>
<Card href={"http://example.org"}>Card</Card>
</main>
);
}

5
apps/web/next-env.d.ts vendored Normal file
View file

@ -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
apps/web/next.config.js Normal file
View file

@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = {
transpilePackages: ["@repo/ui"],
};

22
apps/web/package.json Normal file
View file

@ -0,0 +1,22 @@
{
"name": "web",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@repo/ui": "*",
"next": "^14.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^20.10.6",
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
"typescript": "^5.3.3"
}
}

35
apps/web/tsconfig.json Normal file
View file

@ -0,0 +1,35 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
// "module": "NodeNext",
"moduleDetection": "force",
// "moduleResolution": "NodeNext",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022",
"plugins": [{ "name": "next" }],
"module": "ESNext",
"moduleResolution": "Bundler",
"allowJs": true,
"jsx": "preserve",
"noEmit": true
},
"include": [
"next-env.d.ts",
"next.config.js",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}

View file

@ -14,6 +14,7 @@
"dev:auth": "turbo run dev --filter=auth",
"dev:photos": "turbo run dev --filter=photos",
"dev:accounts": "turbo run dev --filter=accounts",
"dev:web": "turbo run dev --filter=web",
"dev:cast": "turbo run dev --filter=cast",
"export:photos": "turbo run export --filter=photos",
"export:auth": "turbo run export --filter=auth",

View file

@ -36,6 +36,7 @@ const nextConfig = {
},
},
transpilePackages: [
"@repo/ui",
'@ente-io/utils',
'@mui/material',
'@mui/system',

15
packages/ui/package.json Normal file
View file

@ -0,0 +1,15 @@
{
"name": "@repo/ui",
"version": "0.0.0",
"private": true,
"exports": {
"./hello": "./src/hello.ts",
"./card": "./src/card.tsx"
},
"devDependencies": {
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
"react": "^18.2.0",
"typescript": "^5.3.3"
}
}

14
packages/ui/src/card.tsx Normal file
View file

@ -0,0 +1,14 @@
/** Test comment */
export function Card({
href,
children,
}: {
href: string;
children: React.ReactNode;
}): JSX.Element {
return (
<a href={href} rel="noopener noreferrer" target="_blank">
<p>{children}</p>
</a>
);
}

2
packages/ui/src/hello.ts Normal file
View file

@ -0,0 +1,2 @@
/** Howdy! */
export const sayHello = () => console.log("Hello, world");

23
packages/ui/tsconfig.json Normal file
View file

@ -0,0 +1,23 @@
{
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"moduleDetection": "force",
"moduleResolution": "NodeNext",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022",
"jsx": "preserve",
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}