add sub git and git-tools
This commit is contained in:
commit
9a0c882fe4
41
.gitignore
vendored
Executable file
41
.gitignore
vendored
Executable file
@ -0,0 +1,41 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# local env files
|
||||
.env*
|
||||
!.env*.example
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
|
||||
# tailwind
|
||||
.turbo
|
||||
.vscode
|
||||
styles/dist.css
|
38
README.md
Normal file
38
README.md
Normal file
@ -0,0 +1,38 @@
|
||||
# Next.js + Turbopack App Directory Playground
|
||||
|
||||
[Turbopack](https://turbo.build/pack) is a new incremental bundler optimized for JavaScript and TypeScript, written in Rust by the creators of Webpack and Next.js at [Vercel](https://vercel.com). On large applications Turbopack updates 10x faster than Vite and 700x faster than Webpack ([benchmark](https://turbo.build/pack/docs/benchmarks)). For the biggest applications the difference grows even more stark with updates up to 20x faster than Vite.
|
||||
|
||||
This playground is a mirror of the [Next.js v13 App Directory Playground](https://github.com/vercel/app-playground), but uses Turbopack as the Next.js development server (`next dev --turbo`).
|
||||
|
||||
**As a reminder, Turbopack is currently in alpha and not yet ready for production. We appreciate your ongoing support as we work to make it ready for everyone.**
|
||||
|
||||
## Running Locally
|
||||
|
||||
1. Install dependencies: `yarn`
|
||||
1. Start the dev server: `yarn dev`
|
||||
|
||||
**Note:** The playground uses [Tailwind CSS](https://tailwindcss.com). However, Turbopack does not yet support fully [PostCSS](https://turbo.build/pack/docs/features/css#postcss), but it does support CSS and CSS Modules. [As a workaround](https://turbo.build/pack/docs/features/css#tailwind-css), we run Tailwind through it's CLI upon `postinstall`. For live reload of CSS, you can run Tailwind in another process with the `--watch` flag or install `concurrently` and modify your `dev` script:
|
||||
|
||||
```bash
|
||||
yarn add concurrently --dev
|
||||
```
|
||||
|
||||
Then modify your `dev` script in `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"dev": "concurrently \"next dev --turbo\" \"npm run tailwind --watch\""
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more information, see: https://turbo.build/pack/docs/features/css#tailwind-css
|
||||
|
||||
## Documentation
|
||||
|
||||
https://nextjs.link/with-turbopack
|
||||
|
||||
## Providing Feedback
|
||||
|
||||
https://nextjs.link/turbopack-feedback
|
21
app/layout.tsx
Normal file
21
app/layout.tsx
Normal file
@ -0,0 +1,21 @@
|
||||
import '@/styles/dist.css';
|
||||
import React from 'react';
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<html>
|
||||
<head>
|
||||
<title>kjuulh microblog</title>
|
||||
</head>
|
||||
<body className="box-border overflow-y-scroll bg-zinc-900">
|
||||
<div className="grid grid-cols-[1fr,min(800px,100%),1fr] px-6">
|
||||
<div className="col-start-2 space-y-6">{children}</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
14
app/page.tsx
Normal file
14
app/page.tsx
Normal file
@ -0,0 +1,14 @@
|
||||
import { getPosts } from '@/lib/getPosts';
|
||||
import Posts from './posts';
|
||||
|
||||
export const revalidate = 10;
|
||||
|
||||
export default async function Page() {
|
||||
const posts = await getPosts();
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<Posts posts={posts} />
|
||||
</div>
|
||||
);
|
||||
}
|
5
app/postCard.tsx
Normal file
5
app/postCard.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
const PostCard = () => {
|
||||
return <div></div>;
|
||||
};
|
||||
|
||||
export default PostCard;
|
24
app/posts.tsx
Normal file
24
app/posts.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
import { getPosts, Post } from '@/lib/getPosts';
|
||||
import { FC, use } from 'react';
|
||||
|
||||
interface PostProps {
|
||||
posts: Post[];
|
||||
}
|
||||
const Posts: FC<PostProps> = ({ posts }) => {
|
||||
return (
|
||||
<>
|
||||
{posts.map((p) => (
|
||||
<div className="space-y-2 text-white">
|
||||
<p className="font-bold">{p.author.name}</p>
|
||||
<p>{p.title}</p>
|
||||
{p.message &&
|
||||
p.message
|
||||
.split('\n')
|
||||
.map((para, i) => para && <p key={i}>{para}</p>)}
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Posts;
|
41
lib/getPosts.tsx
Normal file
41
lib/getPosts.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
import { exec } from 'child_process';
|
||||
|
||||
export type Post = {
|
||||
title: string;
|
||||
message?: string;
|
||||
author: {
|
||||
email: string;
|
||||
name: string;
|
||||
};
|
||||
time: number;
|
||||
};
|
||||
|
||||
const posts: Post[] = [
|
||||
{
|
||||
author: 'kjuulh',
|
||||
post: 'some post\n',
|
||||
},
|
||||
{
|
||||
author: 'kjuulh',
|
||||
post: `some other post with
|
||||
some more text`,
|
||||
},
|
||||
];
|
||||
|
||||
export const getPosts = async (): Promise<Post[]> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(`git-log --path ${process.env.POSTS_DIR}`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.warn(error);
|
||||
reject('could not load posts stderr: ' + stderr + 'stdout: ' + stdout);
|
||||
return;
|
||||
}
|
||||
|
||||
const posts: Post[] = JSON.parse(stdout);
|
||||
|
||||
resolve(posts);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const revalidate = 5;
|
5
next-env.d.ts
vendored
Normal file
5
next-env.d.ts
vendored
Normal 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.
|
11
next.config.js
Executable file
11
next.config.js
Executable file
@ -0,0 +1,11 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true, // Recommended for the `pages` directory, default in `app`.
|
||||
swcMinify: true,
|
||||
experimental: {
|
||||
// Required:
|
||||
appDir: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
42
package.json
Normal file
42
package.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbo",
|
||||
"dev:tailwind": "concurrently 'next dev --turbo' 'yarn run tailwind --watch'",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"tailwind": "tailwindcss -i styles/globals.css -o styles/dist.css",
|
||||
"format": "prettier --write \"**/*.{js,ts,tsx,md}\"",
|
||||
"postinstall": "npm run tailwind"
|
||||
},
|
||||
"prettier": {
|
||||
"arrowParens": "always",
|
||||
"semi": true,
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true
|
||||
},
|
||||
"dependencies": {
|
||||
"clsx": "1.2.1",
|
||||
"concurrently": "7.5.0",
|
||||
"next": "latest",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"styled-components": "6.0.0-beta.2",
|
||||
"styled-jsx": "5.1.0",
|
||||
"use-count-up": "3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "18.0.3",
|
||||
"@types/react": "18.0.15",
|
||||
"@types/react-dom": "18.0.6",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"eslint": "8.19.0",
|
||||
"eslint-config-next": "latest",
|
||||
"postcss": "^8.4.14",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-plugin-tailwindcss": "^0.1.12",
|
||||
"tailwindcss": "^3.1.6",
|
||||
"typescript": "4.7.4"
|
||||
}
|
||||
}
|
1
posts
Submodule
1
posts
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a8dde26a9516c3d8b64bc9afee8936c2ba5f3976
|
BIN
public/favicon.ico
Executable file
BIN
public/favicon.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
public/q-zip.png
Normal file
BIN
public/q-zip.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
3
styles/globals.css
Executable file
3
styles/globals.css
Executable file
@ -0,0 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
63
tailwind.config.js
Normal file
63
tailwind.config.js
Normal file
@ -0,0 +1,63 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
'./app/**/*.{js,ts,jsx,tsx}',
|
||||
'./page/**/*.{js,ts,jsx,tsx}',
|
||||
'./ui/**/*.{js,ts,jsx,tsx}',
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
// https://vercel.com/design/color
|
||||
colors: {
|
||||
vercel: {
|
||||
pink: '#FF0080',
|
||||
blue: '#0070F3',
|
||||
cyan: '#50E3C2',
|
||||
orange: '#F5A623',
|
||||
violet: '#7928CA',
|
||||
},
|
||||
},
|
||||
keyframes: ({ theme }) => ({
|
||||
rerender: {
|
||||
'0%': {
|
||||
'border-color': theme('colors.vercel.pink'),
|
||||
},
|
||||
'40%': {
|
||||
'border-color': theme('colors.vercel.pink'),
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
'0%': {
|
||||
background: theme('colors.vercel.pink'),
|
||||
color: theme('colors.white'),
|
||||
},
|
||||
'40%': {
|
||||
background: theme('colors.vercel.pink'),
|
||||
color: theme('colors.white'),
|
||||
},
|
||||
},
|
||||
shimmer: {
|
||||
'100%': {
|
||||
transform: 'translateX(100%)',
|
||||
},
|
||||
},
|
||||
translateXReset: {
|
||||
'100%': {
|
||||
transform: 'translateX(0)',
|
||||
},
|
||||
},
|
||||
fadeToTransparent: {
|
||||
'0%': {
|
||||
opacity: 1,
|
||||
},
|
||||
'40%': {
|
||||
opacity: 1,
|
||||
},
|
||||
'100%': {
|
||||
opacity: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
};
|
31
tsconfig.json
Executable file
31
tsconfig.json
Executable file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/ui/*": ["ui/*"],
|
||||
"@/lib/*": ["lib/*"],
|
||||
"@/styles/*": ["styles/*"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user