mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
Compare commits
80
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4309f42bf7 | ||
|
|
eef32ad695 | ||
|
|
acd0525513 | ||
|
|
8938c96409 | ||
|
|
6da6231c92 | ||
|
|
19f84d2188 | ||
|
|
20c2964242 | ||
|
|
eac84307bf | ||
|
|
a0dc40d2ca | ||
|
|
cbc831bb70 | ||
|
|
bacaea80a3 | ||
|
|
99a19d8d9e | ||
|
|
7f400470ff | ||
|
|
e26003f430 | ||
|
|
c7e3b12856 | ||
|
|
a123ff9f3f | ||
|
|
d98aa3f745 | ||
|
|
6f45a140ba | ||
|
|
3dab27323a | ||
|
|
3baf011be9 | ||
|
|
c1ba41ea16 | ||
|
|
3c1fc34c2a | ||
|
|
2ca7e8bc14 | ||
|
|
ffc29d8bc5 | ||
|
|
695e8b574e | ||
|
|
04e1d0a508 | ||
|
|
eb7ea991ac | ||
|
|
9f72bb01b7 | ||
|
|
fbc9736831 | ||
|
|
36f686c563 | ||
|
|
dbe84bc9f4 | ||
|
|
91ad20215a | ||
|
|
ee413c5dee | ||
|
|
1917630265 | ||
|
|
67f9cd0b1d | ||
|
|
0864f0b950 | ||
|
|
de27479242 | ||
|
|
d982bf0548 | ||
|
|
371f3cab39 | ||
|
|
74945fe0bb | ||
|
|
ddfe0701af | ||
|
|
9081e9a86d | ||
|
|
ef0f6b335e | ||
|
|
59f23e8672 | ||
|
|
6b75c17b05 | ||
|
|
2fabd8d5c0 | ||
|
|
c62fe7d1ef | ||
|
|
56d673a9ec | ||
|
|
ffb20b64f3 | ||
|
|
bb657545c3 | ||
|
|
3f38a6366b | ||
|
|
a59f6d7ae0 | ||
|
|
99d76f0a8c | ||
|
|
b4007b6c6e | ||
|
|
bfee26609e | ||
|
|
d855df0d6e | ||
|
|
60a4a88246 | ||
|
|
1a2932a194 | ||
|
|
fd8b760b7f | ||
|
|
7d856f25a3 | ||
|
|
a11d859f40 | ||
|
|
fd4bdb4a6f | ||
|
|
7e0b015cbc | ||
|
|
85d474e902 | ||
|
|
ac84a6acb5 | ||
|
|
a4d0b7140a | ||
|
|
4f09648a34 | ||
|
|
131789bf83 | ||
|
|
4e71a1ccf0 | ||
|
|
7e3687c4c9 | ||
|
|
a9ba365bac | ||
|
|
b17e8a19eb | ||
|
|
5d82152932 | ||
|
|
70016f508f | ||
|
|
36825b4950 | ||
|
|
6b311ab255 | ||
|
|
2d42e933c8 | ||
|
|
dce7a28b89 | ||
|
|
1668de832f | ||
|
|
a685537499 |
No files matched your search
@@ -1,2 +1,19 @@
|
||||
BLOG_ENDPOINT=https://raw.githubusercontents.com/lumither/blog-posts/master
|
||||
; use mirror
|
||||
# postgres settings
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
#POSTGRES_PASSWORD=
|
||||
POSTGRES_USER=nocturne
|
||||
POSTGRES_DB=nocturne
|
||||
POSTGRES_HOST=postgres
|
||||
|
||||
# backend settings
|
||||
#GIT_WORK_DIR=../blog_posts_git
|
||||
#LOG_ROOT_DIR=/var/log/nocturne
|
||||
#BLOG_ENDPOINT=https://github.com/Lumither/blog-posts.git
|
||||
BLOG_GIT_URL=https://github.com/Lumither/blog-posts.git
|
||||
WORK_DIR=/nocturne
|
||||
#BACKEND_PORT=3001
|
||||
|
||||
# frontend settings
|
||||
API_LOCAL_URL=http://backend:3001
|
||||
API_REMOTE_URL=https://lumither.com/api
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "next/core-web-vitals"
|
||||
}
|
||||
+8
-40
@@ -1,42 +1,10 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
# confidential
|
||||
.env.*
|
||||
/container/*/.env
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
.yarn/install-state.gz
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
# bun
|
||||
bun.lockb
|
||||
|
||||
# ide related
|
||||
# IDE related
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
# exclude post repo
|
||||
/blog_posts_git
|
||||
@@ -0,0 +1,16 @@
|
||||
ARCH := $(shell uname -m)
|
||||
ifeq ($(ARCH), arm64)
|
||||
ARCH := aarch64
|
||||
endif
|
||||
|
||||
all: release
|
||||
|
||||
release:
|
||||
docker compose -f prod.compose.yaml build --build-arg ARCH=$(ARCH)
|
||||
|
||||
dev:
|
||||
docker-compose -f dev.compose.yaml up --build
|
||||
|
||||
clean:
|
||||
docker-compose -f prod.compose.yaml -f dev.compose.yaml rm -fsv
|
||||
|
||||
@@ -1,83 +1,16 @@
|
||||
# This branch was deprecated.
|
||||
# `Nocturne: Personal Website`
|
||||
|
||||
In the initial plan of the blog, `raw.githubusercontent.com/<usr>/<branch>/<path_to_file>` (or any other git server)
|
||||
was used as the cdn for the blog website, which also come with VCS without effort.
|
||||
This is the code repo of my [personal website](https://lumither.com),
|
||||
and [here](https://github.com/Lumither/blog-posts/) is the link to the
|
||||
content (blog posts etc.) repo.
|
||||
|
||||
The idea is to build a separate repo that will be served as a database in ideal blog system structure, and all the
|
||||
functionality related to CMS will be hosted by cloudflare worker.
|
||||
Powered by Next.js and Rust, built with passion and love
|
||||
|
||||
```bash
|
||||
master > tree
|
||||
.
|
||||
├── idx.json
|
||||
└── posts
|
||||
├── another_article.md
|
||||
├── hello_world.md
|
||||
└── idx.json
|
||||
> [!NOTE]
|
||||
> This system is not production ready, and contains bugs, (security risk potentially).
|
||||
> But have fun on it =)
|
||||
|
||||
2 directories, 3 files
|
||||
```
|
||||
# Todos
|
||||
|
||||
This is an example of [db repo](https://github.com/Lumither/blog-posts.git).
|
||||
|
||||
```bash
|
||||
|
||||
master > cat idx.json
|
||||
{
|
||||
"idx": [
|
||||
{
|
||||
"type": "dir",
|
||||
"name": "posts"
|
||||
}
|
||||
]
|
||||
}
|
||||
master > cat ./posts/idx.json
|
||||
{
|
||||
"idx": [
|
||||
{
|
||||
"type": "md",
|
||||
"name": "another_article.md",
|
||||
"meta": {
|
||||
"title": "another_article!",
|
||||
"desc": "test",
|
||||
"tag": ["blog", "test", "dev"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "md",
|
||||
"name": "hello_world.md",
|
||||
"meta": {
|
||||
"title": "Hello World!",
|
||||
"desc": "test",
|
||||
"tag": ["blog", "test", "dev"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
These are examples of `idx.json`. They were designed to be placed at any layer of the directory, and used
|
||||
to accelerate the client side browsing. The following is an easy [implementation](/app/blog/fetch_posts.ts) of using `idx.json` at `/posts`
|
||||
to get a list of blog posts.
|
||||
|
||||
```ts
|
||||
export default async function fetch_posts(url: string): Promise<Result<JSON[], Error>> {
|
||||
const response = await fetch(`${ url }/posts/idx.json`);
|
||||
if (!response.ok) {
|
||||
return {
|
||||
ok: false,
|
||||
error: new Error(response.statusText)
|
||||
};
|
||||
}
|
||||
const res = await response.json();
|
||||
const posts = res['idx'].filter((posts: { type: string }) => posts.type === 'md');
|
||||
return {
|
||||
ok: true,
|
||||
value: posts
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
The approach work impressively well, thanks for the globe services of GitHub lol, but eventually the plan was changed
|
||||
due to ethical reasons and possibility of breaking GitHub's EULA. Plus, the functionality of the blog site might be constrained due to
|
||||
Cloudflare worker's CPU time limitations, considering the existence of potential resource-intense work such as on-site searching and analytics.
|
||||
- [ ] the todo list lol
|
||||
- [ ] and much more...
|
||||
@@ -1,9 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
function About() {
|
||||
return (
|
||||
<div></div>
|
||||
);
|
||||
}
|
||||
|
||||
export default About;
|
||||
@@ -1,33 +0,0 @@
|
||||
import React from 'react';
|
||||
import Link from 'next/link';
|
||||
import { Card, CardBody, CardHeader } from '@nextui-org/card';
|
||||
import { Divider } from '@nextui-org/react';
|
||||
|
||||
type Props = {
|
||||
post: JSON
|
||||
}
|
||||
|
||||
function BlogPostCard({ post }: Props) {
|
||||
const name = (post as any)['name'];
|
||||
const { title, desc } = (post as any)['meta'] as { title: string, desc: string };
|
||||
return (
|
||||
|
||||
<div>
|
||||
{/*todo: to be update*/ }
|
||||
{/*<Link href={ `/blog/${ name }` }>*/}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<p className={ 'font-bold' }>{ title }</p>
|
||||
</CardHeader>
|
||||
<Divider />
|
||||
<CardBody>
|
||||
{ desc }
|
||||
</CardBody>
|
||||
</Card>
|
||||
{/*</Link>*/}
|
||||
</div>
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
export default BlogPostCard;
|
||||
@@ -1,19 +0,0 @@
|
||||
import { Result } from '@/app/public/type/Result';
|
||||
|
||||
export default async function fetch_posts(url: string): Promise<Result<JSON[], Error>> {
|
||||
const response = await fetch(`${ url }/posts/idx.json`);
|
||||
if (!response.ok) {
|
||||
return {
|
||||
ok: false,
|
||||
error: new Error(response.statusText)
|
||||
};
|
||||
}
|
||||
const res = await response.json();
|
||||
const posts = res['idx'].filter((posts: { type: string }) => posts.type === 'md');
|
||||
return {
|
||||
ok: true,
|
||||
value: posts
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
function Layout({
|
||||
children
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className={ 'flex items-stretch justify-center' }>
|
||||
{ children }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Layout;
|
||||
@@ -1,28 +0,0 @@
|
||||
import React from 'react';
|
||||
import fetch_posts from '@/app/blog/fetch_posts';
|
||||
import BlogPostCard from '@/app/blog/BlogPostCard';
|
||||
|
||||
async function Blog() {
|
||||
|
||||
const res = await fetch_posts(process.env.BLOG_ENDPOINT!);
|
||||
if (!res.ok) {
|
||||
console.log(res.error);
|
||||
return;
|
||||
}
|
||||
const posts = res.value;
|
||||
// console.log(posts);
|
||||
|
||||
return (
|
||||
|
||||
// blog list
|
||||
<ul className={ 'flex flex-col items-center w-full max-w-[1024px]' }>
|
||||
{ posts.map((post, key) => (
|
||||
<li key={ key } className={ 'my-3.5 mx-7 w-[80%]' }>
|
||||
<BlogPostCard post={ post } />
|
||||
</li>)
|
||||
) }
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
export default Blog;
|
||||
@@ -1,3 +0,0 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@@ -1,30 +0,0 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { Inter } from 'next/font/google';
|
||||
import './globals.css';
|
||||
import React from 'react';
|
||||
import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
||||
import Navbar from '@/components/Navbar';
|
||||
|
||||
const inter = Inter({ subsets: [ 'latin' ] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Lumither\'s site',
|
||||
description: 'a small corner on internet'
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<body className={ inter.className }>
|
||||
<NextThemesProvider attribute="class" defaultTheme="dark">
|
||||
<Navbar />
|
||||
{ children }
|
||||
</NextThemesProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
export default function Home() {
|
||||
return (
|
||||
<main>
|
||||
{/*<ThemeSwitcher />*/ }
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { NextUIProvider } from '@nextui-org/react';
|
||||
import React from 'react';
|
||||
|
||||
export function Providers({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<NextUIProvider>
|
||||
{ children }
|
||||
</NextUIProvider>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
export type Result<T, E> = {
|
||||
ok: true;
|
||||
value: T;
|
||||
} | {
|
||||
ok: false;
|
||||
error: E;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
/target
|
||||
|
||||
/Cargo.lock
|
||||
@@ -0,0 +1,18 @@
|
||||
### Rust template
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
debug/
|
||||
target/
|
||||
|
||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||
Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
|
||||
.env.local
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"server",
|
||||
"macros",
|
||||
"markdown",
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "macros"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = "0.3.18"
|
||||
@@ -0,0 +1 @@
|
||||
mod log;
|
||||
@@ -0,0 +1,64 @@
|
||||
/// log the message at specific log level and exit(1)
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust
|
||||
///
|
||||
/// use macros::panic_with_log;
|
||||
/// use tracing::Level;
|
||||
///
|
||||
/// panic_with_log!(Level::ERROR, "test panicked: {}", 42);
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! panic_with_log {
|
||||
($level:expr, $msg:literal $(, $($arg:tt)*)?) => {{
|
||||
use std::process;
|
||||
use tracing::event;
|
||||
event!($level, $msg $(, $($arg)*)?);
|
||||
process::exit(1);
|
||||
}};
|
||||
}
|
||||
|
||||
/// log the message with `Level::ERROR` and exit(1)
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust
|
||||
///
|
||||
/// use macros::error_panic;
|
||||
///
|
||||
/// error_panic!("test panicked: {}", 42);
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! error_panic {
|
||||
($msg:literal $(, $($arg:tt)*)?) => {{
|
||||
use std::process;
|
||||
use tracing::{event, Level};
|
||||
event!(Level::ERROR, $msg $(, $($arg)*)?);
|
||||
process::exit(1);
|
||||
}};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn test_panic_with_log() {
|
||||
use std::io;
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::{fmt, Registry};
|
||||
|
||||
let format = tracing_subscriber::fmt::format()
|
||||
.with_level(true)
|
||||
.with_target(true)
|
||||
.with_source_location(true);
|
||||
|
||||
let subscriber = Registry::default().with(
|
||||
fmt::Layer::default()
|
||||
.with_writer(io::stderr)
|
||||
.event_format(format),
|
||||
);
|
||||
|
||||
tracing::subscriber::set_global_default(subscriber).unwrap();
|
||||
|
||||
panic_with_log!(Level::ERROR, "Test panicked: {}", 42);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "markdown"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
uuid = { version = "1.10.0", features = ["v4", "fast-rng", "serde"] }
|
||||
serde = { version = "1.0.209", features = ["derive"] }
|
||||
serde_json = "1.0.128"
|
||||
regex = "1.10.4"
|
||||
yaml-rust2 = "0.9.0"
|
||||
sha2 = "0.10.8"
|
||||
base64 = "0.22.1"
|
||||
thiserror = "2.0.3"
|
||||
@@ -0,0 +1,16 @@
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("missing front-matter field: id")]
|
||||
MissingID,
|
||||
|
||||
#[error("invalid file id: {}", msg)]
|
||||
InvalidID { msg: String },
|
||||
|
||||
#[error("invalid front-matter: {}", msg)]
|
||||
InvalidFrontMatter { msg: String },
|
||||
|
||||
#[error("fs error: {}", msg)]
|
||||
FSError { msg: String },
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
mod error;
|
||||
mod utils;
|
||||
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::utils::front_matter::{parse_front_matter, split_md_front_matter};
|
||||
|
||||
use base64::{engine::general_purpose, Engine};
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
use sha2::{Digest, Sha256};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Default, Debug, Serialize)]
|
||||
pub struct MdFile {
|
||||
pub file_id: Uuid,
|
||||
pub filename: String,
|
||||
pub meta: Value,
|
||||
pub content: String,
|
||||
pub hash: String,
|
||||
}
|
||||
|
||||
impl MdFile {
|
||||
pub fn from_file(file_path: &Path) -> Result<MdFile, Error> {
|
||||
let raw_file = match fs::read_to_string(file_path) {
|
||||
Ok(file) => file,
|
||||
Err(e) => return Err(Error::FSError { msg: e.to_string() }),
|
||||
};
|
||||
let raw_file_bytes = raw_file.as_bytes().to_vec();
|
||||
let (front_matter_str, content) = split_md_front_matter(raw_file);
|
||||
let front_matter = match parse_front_matter(&front_matter_str) {
|
||||
Ok(front_matter) => front_matter,
|
||||
Err(e) => return Err(Error::InvalidFrontMatter { msg: e.to_string() }),
|
||||
};
|
||||
let hash = calculate_hash_base64(&raw_file_bytes);
|
||||
let file_id = match front_matter["id"].as_str() {
|
||||
Some(id) => match Uuid::from_str(id) {
|
||||
Ok(id) => id,
|
||||
Err(e) => return Err(Error::InvalidID { msg: e.to_string() }),
|
||||
},
|
||||
None => return Err(Error::MissingID),
|
||||
};
|
||||
let file_name = Path::new(file_path)
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
|
||||
Ok(MdFile {
|
||||
file_id,
|
||||
filename: file_name,
|
||||
meta: front_matter,
|
||||
content,
|
||||
hash,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn calculate_hash_base64(bytes: &Vec<u8>) -> String {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(bytes);
|
||||
let hash = hasher.finalize().to_vec();
|
||||
general_purpose::STANDARD.encode(hash)
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
use crate::utils::yaml::yaml_to_serde;
|
||||
use regex::Regex;
|
||||
use serde_json::Value;
|
||||
use std::error::Error;
|
||||
use yaml_rust2::YamlLoader;
|
||||
|
||||
pub fn split_md_front_matter(raw_file: String) -> (String, String) {
|
||||
let re = Regex::new(r"(?s)^(---\n.*?\n---\n)(.*)").unwrap();
|
||||
if let Some(captures) = re.captures(raw_file.as_str()) {
|
||||
let front_matter = captures.get(1).map_or("", |m| m.as_str()).to_string();
|
||||
let main_content = captures.get(2).map_or("", |m| m.as_str()).to_string();
|
||||
(front_matter, main_content)
|
||||
} else {
|
||||
(String::new(), raw_file)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_front_matter(front_matter: &str) -> Result<Value, Box<dyn Error>> {
|
||||
let parsed_f_matter = YamlLoader::load_from_str(front_matter)?;
|
||||
if parsed_f_matter.is_empty() {
|
||||
Ok(Value::String(String::new()))
|
||||
} else {
|
||||
Ok(yaml_to_serde(&parsed_f_matter[0]))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::utils::front_matter::{parse_front_matter, split_md_front_matter};
|
||||
|
||||
#[test]
|
||||
fn front_matter_to_string() {
|
||||
let (front_matter, main_content) = split_md_front_matter(
|
||||
r##"---
|
||||
title: test_title
|
||||
date: 0000-00-00+0000
|
||||
category: test
|
||||
id: bf03afd8-61b4-4e78-a34a-8b3ee39adf16
|
||||
sub_title: sub_title
|
||||
summary: summary
|
||||
tags: [ "test1", "test2" ]
|
||||
---
|
||||
|
||||
test body
|
||||
|
||||
"##
|
||||
.to_string(),
|
||||
);
|
||||
assert_eq!(
|
||||
front_matter,
|
||||
r##"---
|
||||
title: test_title
|
||||
date: 0000-00-00+0000
|
||||
category: test
|
||||
id: bf03afd8-61b4-4e78-a34a-8b3ee39adf16
|
||||
sub_title: sub_title
|
||||
summary: summary
|
||||
tags: [ "test1", "test2" ]
|
||||
---
|
||||
"##
|
||||
);
|
||||
assert_eq!(main_content, "\ntest body\n\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_front_matter_parser() {
|
||||
dbg!(parse_front_matter(
|
||||
r##"---
|
||||
title: test_title
|
||||
date: 0000-00-00+0000
|
||||
category: test
|
||||
id: bf03afd8-61b4-4e78-a34a-8b3ee39adf16
|
||||
sub_title: sub_title
|
||||
summary: summary
|
||||
tags: [ "test1", "test2" ]
|
||||
---
|
||||
"##,
|
||||
))
|
||||
.expect("Failed to parse front matter");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod front_matter;
|
||||
mod yaml;
|
||||
@@ -0,0 +1,29 @@
|
||||
use serde_json::Value;
|
||||
use std::str::FromStr;
|
||||
use yaml_rust2::Yaml;
|
||||
|
||||
pub fn yaml_to_serde(yaml: &Yaml) -> Value {
|
||||
match yaml {
|
||||
Yaml::Null => Value::Null,
|
||||
Yaml::Boolean(b) => Value::Bool(*b),
|
||||
Yaml::Integer(i) => Value::Number(serde_json::Number::from(*i)),
|
||||
Yaml::Real(s) => Value::Number(serde_json::Number::from_str(s).unwrap()),
|
||||
Yaml::String(s) => Value::String(s.clone()),
|
||||
Yaml::Array(arr) => Value::Array(arr.iter().map(yaml_to_serde).collect()),
|
||||
Yaml::Hash(hash) => {
|
||||
let obj: serde_json::map::Map<String, Value> = hash
|
||||
.iter()
|
||||
.map(|(k, v)| {
|
||||
let key = match k {
|
||||
Yaml::String(s) => s.clone(),
|
||||
_ => "INVALID_KEY".to_string(),
|
||||
};
|
||||
(key, yaml_to_serde(v))
|
||||
})
|
||||
.collect();
|
||||
Value::Object(obj)
|
||||
}
|
||||
Yaml::Alias(_) => Value::Null,
|
||||
Yaml::BadValue => Value::Null,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "server"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
macros = { path = "../macros" }
|
||||
|
||||
|
||||
tracing = "0.1.41"
|
||||
git2 = "0.20.0"
|
||||
|
||||
[build-dependencies]
|
||||
git2 = "0.20.0"
|
||||
chrono = "0.4.39"
|
||||
@@ -0,0 +1,15 @@
|
||||
use chrono::Utc;
|
||||
use git2::Repository;
|
||||
|
||||
fn main() {
|
||||
let repo = Repository::open("../..").expect("failed to open repository");
|
||||
let commit = repo
|
||||
.head()
|
||||
.expect("failed to get HEAD")
|
||||
.peel_to_commit()
|
||||
.expect("failed to get HEAD commit");
|
||||
let hash = commit.id().to_string();
|
||||
let utc_date = Utc::now().date_naive().format("%Y%m%d").to_string();
|
||||
let build_id = format!("{}@{}", utc_date, &hash[..8]);
|
||||
println!("cargo:rustc-env=BUILD_ID={}", build_id);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
CREATE TABLE tag
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(20) UNIQUE NOT NULL,
|
||||
description TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE category
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(20) UNIQUE NOT NULL,
|
||||
description TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE post
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
identifier VARCHAR(50) UNIQUE NOT NULL,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
subtitle VARCHAR(255) NOT NULL,
|
||||
published_date DATE NOT NULL,
|
||||
last_update DATE,
|
||||
content TEXT NOT NULL,
|
||||
|
||||
category SERIAL REFERENCES category (id) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE post_tag
|
||||
(
|
||||
post SERIAL REFERENCES post (id),
|
||||
tag SERIAL REFERENCES tag (id)
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
pub const PAGE_SIZE: u32 = 6;
|
||||
@@ -0,0 +1,48 @@
|
||||
// Database related
|
||||
pub mod database {
|
||||
pub mod var_name {
|
||||
pub const URI: &str = "DATABASE_URL";
|
||||
pub const USERNAME: &str = "POSTGRES_USER";
|
||||
pub const PASSWORD: &str = "POSTGRES_PASSWORD";
|
||||
pub const HOST: &str = "POSTGRES_HOST";
|
||||
pub const PORT: &str = "POSTGRES_PORT";
|
||||
pub const DBNAME: &str = "POSTGRES_DB";
|
||||
}
|
||||
|
||||
pub mod default_value {
|
||||
pub const USERNAME: &str = "";
|
||||
pub const PASSWORD: &str = "";
|
||||
pub const HOST: &str = "localhost";
|
||||
pub const PORT: &str = "5432";
|
||||
pub const DBNAME: &str = "nocturne";
|
||||
pub const DATABASE_TYPE: &str = "postgresql";
|
||||
}
|
||||
}
|
||||
|
||||
pub mod server {
|
||||
pub mod var_name {
|
||||
pub const PORT: &str = "BACKEND_PORT";
|
||||
pub const HOST: &str = "BACKEND_HOST";
|
||||
}
|
||||
|
||||
pub mod default_value {
|
||||
pub const PORT: u32 = 3001;
|
||||
pub const HOST: &str = "0.0.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
pub mod general {
|
||||
pub mod var_name {
|
||||
pub const LOG_DIR: &str = "LOG_DIR";
|
||||
pub const WORK_DIR: &str = "WORK_DIR";
|
||||
pub const BLOG_GIT_URL: &str = "BLOG_GIT_URL";
|
||||
pub const BLOG_GIT_REMOTE_BRANCH: &str = "BLOG_GIT_REMOTE_BRANCH";
|
||||
pub const BLOG_GIT_REMOTE_NAME: &str = "BLOG_GIT_REMOTE_NAME";
|
||||
}
|
||||
|
||||
pub mod default_value {
|
||||
pub const WORK_DIR: &str = "~/.nocturne";
|
||||
pub const BLOG_GIT_REMOTE_BRANCH: &str = "master";
|
||||
pub const BLOG_GIT_REMOTE_NAME: &str = "origin";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
pub mod blog;
|
||||
pub mod config;
|
||||
pub mod time;
|
||||
@@ -0,0 +1,2 @@
|
||||
pub const DEFAULT_TIME_FORMAT: &str = "%Y-%m-%dT%H:%M:%S%z";
|
||||
pub const DEFAULT_DATE_FORMAT: &str = "%Y-%m-%d%zT%H%M%S";
|
||||
@@ -0,0 +1,7 @@
|
||||
mod constants;
|
||||
|
||||
const BUILD_ID: &str = env!("BUILD_ID");
|
||||
|
||||
fn main() {
|
||||
println!("{}", BUILD_ID);
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Image,
|
||||
Navbar as NextUINavbar,
|
||||
NavbarBrand,
|
||||
NavbarContent,
|
||||
NavbarItem,
|
||||
NavbarMenu,
|
||||
NavbarMenuItem,
|
||||
NavbarMenuToggle
|
||||
} from '@nextui-org/react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import ThemeSwitcher from '@/components/ThemeSwitcher';
|
||||
|
||||
|
||||
const entries: { display_name: string; href: string; }[] = [
|
||||
{
|
||||
display_name: 'Home',
|
||||
href: '/'
|
||||
},
|
||||
{
|
||||
display_name: 'About',
|
||||
href: '/about'
|
||||
},
|
||||
{
|
||||
display_name: 'Blog',
|
||||
href: '/blog'
|
||||
}
|
||||
];
|
||||
|
||||
function Navbar() {
|
||||
const [ scrolled, setScrolled ] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
const isScrolled = window.scrollY > 0;
|
||||
setScrolled(isScrolled);
|
||||
};
|
||||
window.addEventListener('scroll', handleScroll);
|
||||
return () => {
|
||||
window.removeEventListener('scroll', handleScroll);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextUINavbar isBlurred isBordered>
|
||||
|
||||
<NavbarContent className="sm:hidden" justify="start">
|
||||
<NavbarMenuToggle />
|
||||
</NavbarContent>
|
||||
|
||||
<NavbarContent className="sm:hidden pr-3" justify="center">
|
||||
<Image
|
||||
src={ 'https://avatars.githubusercontent.com/u/46409277?v=4' }
|
||||
alt={ 'avatar' }
|
||||
className={ 'rounded-full h-[3rem]' }
|
||||
></Image>
|
||||
|
||||
<NavbarBrand>
|
||||
<p className="font-bold text-inherit">{ 'Lumither\'s site' }</p>
|
||||
</NavbarBrand>
|
||||
</NavbarContent>
|
||||
|
||||
<NavbarContent className="hidden sm:flex gap-4" justify="center">
|
||||
<Image
|
||||
src={ 'https://avatars.githubusercontent.com/u/46409277?v=4' }
|
||||
alt={ 'avatar' }
|
||||
className={ 'rounded-full h-[3rem]' }
|
||||
></Image>
|
||||
|
||||
<NavbarBrand>
|
||||
<p className="font-bold text-inherit">{ 'Lumither\'s site' }</p>
|
||||
</NavbarBrand>
|
||||
|
||||
{ entries.map((item, index) => (
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
<NavbarItem key={ index } isActive={ usePathname() === item.href }>
|
||||
<Link
|
||||
className="w-full"
|
||||
href={ item.href }
|
||||
>
|
||||
{ item.display_name }
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
)) }
|
||||
</NavbarContent>
|
||||
|
||||
<NavbarContent justify="end">
|
||||
<NavbarItem>
|
||||
<ThemeSwitcher />
|
||||
</NavbarItem>
|
||||
</NavbarContent>
|
||||
|
||||
<NavbarMenu>
|
||||
{ entries.map((item, index) => (
|
||||
<NavbarMenuItem key={ index }>
|
||||
<Link
|
||||
className="w-full"
|
||||
href={ item.href }
|
||||
>
|
||||
{ item.display_name }
|
||||
</Link>
|
||||
</NavbarMenuItem>
|
||||
)) }
|
||||
</NavbarMenu>
|
||||
</NextUINavbar>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Navbar;
|
||||
@@ -1,38 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Switch } from '@nextui-org/react';
|
||||
import { MdOutlineDarkMode, MdOutlineLightMode } from 'react-icons/md';
|
||||
|
||||
function ThemeSwitcher() {
|
||||
const [ mounted, setMounted ] = useState(false);
|
||||
const { setTheme } = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
if (!mounted) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Switch
|
||||
color={ 'default' }
|
||||
startContent={ <MdOutlineLightMode /> }
|
||||
endContent={ <MdOutlineDarkMode /> }
|
||||
onValueChange={ (isSelected) => {
|
||||
if (isSelected) {
|
||||
setTheme('light');
|
||||
} else {
|
||||
setTheme('dark');
|
||||
}
|
||||
} }
|
||||
></Switch>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ThemeSwitcher;
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM rust:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cargo build
|
||||
|
||||
CMD cargo r
|
||||
@@ -0,0 +1,13 @@
|
||||
# docker/dev.Dockerfile
|
||||
FROM node:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
CMD npm run dev
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
FROM rust:latest AS builder
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN ["cargo", "build", "-r"]
|
||||
|
||||
FROM gcr.io/distroless/cc AS production
|
||||
ARG ARCH
|
||||
COPY --from=builder /app/target/release/api_server ./api_server
|
||||
COPY --from=builder /usr/lib/${ARCH}-linux-gnu/libz.so.1 /usr/lib/${ARCH}-linux-gnu/
|
||||
ENTRYPOINT ["./api_server"]
|
||||
@@ -0,0 +1,15 @@
|
||||
FROM node:22 AS builder
|
||||
WORKDIR /app
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM gcr.io/distroless/nodejs22 AS production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=builder /app/next.config.mjs ./
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
CMD ["./server.js"]
|
||||
@@ -0,0 +1,36 @@
|
||||
services:
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: ../container/dev/frontend.containerfile
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- /app/node_modules
|
||||
- /app/.next
|
||||
env_file:
|
||||
- ./container/dev/.env
|
||||
dns:
|
||||
- 1.1.1.1
|
||||
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ../container/dev/backend.containerfile
|
||||
restart: always
|
||||
ports:
|
||||
- "3001:3001"
|
||||
volumes:
|
||||
- ./blog_posts_git:/app/blog_posts_git:ro
|
||||
env_file:
|
||||
- ./container/dev/.env
|
||||
|
||||
postgres:
|
||||
image: postgres:16.3
|
||||
ports:
|
||||
- 5432:5432
|
||||
env_file:
|
||||
- ./container/dev/.env
|
||||
@@ -0,0 +1,38 @@
|
||||
**/*.log
|
||||
**/.DS_Store
|
||||
*.
|
||||
.vscode/settings.json
|
||||
.history
|
||||
.yarn
|
||||
bazel-*
|
||||
bazel-bin
|
||||
bazel-out
|
||||
bazel-qwik
|
||||
bazel-testlogs
|
||||
dist
|
||||
dist-dev
|
||||
lib
|
||||
lib-types
|
||||
etc
|
||||
external
|
||||
node_modules
|
||||
temp
|
||||
tsc-out
|
||||
tsdoc-metadata.json
|
||||
target
|
||||
output
|
||||
rollup.config.js
|
||||
build
|
||||
.cache
|
||||
.vscode
|
||||
.rollup.cache
|
||||
dist
|
||||
tsconfig.tsbuildinfo
|
||||
vite.config.ts
|
||||
*.spec.tsx
|
||||
*.spec.ts
|
||||
.netlify
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
server
|
||||
@@ -0,0 +1,42 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:qwik/recommended",
|
||||
],
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: ["./tsconfig.json"],
|
||||
ecmaVersion: 2021,
|
||||
sourceType: "module",
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
plugins: ["@typescript-eslint"],
|
||||
rules: {
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-inferrable-types": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-empty-interface": "off",
|
||||
"@typescript-eslint/no-namespace": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-this-alias": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"prefer-spread": "off",
|
||||
"no-case-declarations": "off",
|
||||
"no-console": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error"],
|
||||
"@typescript-eslint/consistent-type-imports": "warn",
|
||||
"@typescript-eslint/no-unnecessary-condition": "warn",
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
# Build
|
||||
/dist
|
||||
/lib
|
||||
/lib-types
|
||||
/server
|
||||
|
||||
# Development
|
||||
node_modules
|
||||
.env
|
||||
*.local
|
||||
|
||||
# Cache
|
||||
.cache
|
||||
.mf
|
||||
.rollup.cache
|
||||
tsconfig.tsbuildinfo
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Editor
|
||||
.vscode/*
|
||||
!.vscode/launch.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# Yarn
|
||||
.yarn/*
|
||||
!.yarn/releases
|
||||
@@ -0,0 +1,37 @@
|
||||
**/*.log
|
||||
**/.DS_Store
|
||||
*.
|
||||
.vscode/settings.json
|
||||
.history
|
||||
.yarn
|
||||
bazel-*
|
||||
bazel-bin
|
||||
bazel-out
|
||||
bazel-qwik
|
||||
bazel-testlogs
|
||||
dist
|
||||
dist-dev
|
||||
lib
|
||||
lib-types
|
||||
etc
|
||||
external
|
||||
node_modules
|
||||
temp
|
||||
tsc-out
|
||||
tsdoc-metadata.json
|
||||
target
|
||||
output
|
||||
rollup.config.js
|
||||
build
|
||||
.cache
|
||||
.vscode
|
||||
.rollup.cache
|
||||
tsconfig.tsbuildinfo
|
||||
vite.config.ts
|
||||
*.spec.tsx
|
||||
*.spec.ts
|
||||
.netlify
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
server
|
||||
@@ -0,0 +1,65 @@
|
||||
# Qwik City App ⚡️
|
||||
|
||||
- [Qwik Docs](https://qwik.dev/)
|
||||
- [Discord](https://qwik.dev/chat)
|
||||
- [Qwik GitHub](https://github.com/QwikDev/qwik)
|
||||
- [@QwikDev](https://twitter.com/QwikDev)
|
||||
- [Vite](https://vitejs.dev/)
|
||||
|
||||
---
|
||||
|
||||
## Project Structure
|
||||
|
||||
This project is using Qwik with [QwikCity](https://qwik.dev/qwikcity/overview/). QwikCity is just an extra set of tools on top of Qwik to make it easier to build a full site, including directory-based routing, layouts, and more.
|
||||
|
||||
Inside your project, you'll see the following directory structure:
|
||||
|
||||
```
|
||||
├── public/
|
||||
│ └── ...
|
||||
└── src/
|
||||
├── components/
|
||||
│ └── ...
|
||||
└── routes/
|
||||
└── ...
|
||||
```
|
||||
|
||||
- `src/routes`: Provides the directory-based routing, which can include a hierarchy of `layout.tsx` layout files, and an `index.tsx` file as the page. Additionally, `index.ts` files are endpoints. Please see the [routing docs](https://qwik.dev/qwikcity/routing/overview/) for more info.
|
||||
|
||||
- `src/components`: Recommended directory for components.
|
||||
|
||||
- `public`: Any static assets, like images, can be placed in the public directory. Please see the [Vite public directory](https://vitejs.dev/guide/assets.html#the-public-directory) for more info.
|
||||
|
||||
## Add Integrations and deployment
|
||||
|
||||
Use the `npm run qwik add` command to add additional integrations. Some examples of integrations includes: Cloudflare, Netlify or Express Server, and the [Static Site Generator (SSG)](https://qwik.dev/qwikcity/guides/static-site-generation/).
|
||||
|
||||
```shell
|
||||
npm run qwik add # or `yarn qwik add`
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Development mode uses [Vite's development server](https://vitejs.dev/). The `dev` command will server-side render (SSR) the output during development.
|
||||
|
||||
```shell
|
||||
npm start # or `yarn start`
|
||||
```
|
||||
|
||||
> Note: during dev mode, Vite may request a significant number of `.js` files. This does not represent a Qwik production build.
|
||||
|
||||
## Preview
|
||||
|
||||
The preview command will create a production build of the client modules, a production build of `src/entry.preview.tsx`, and run a local server. The preview server is only for convenience to preview a production build locally and should not be used as a production server.
|
||||
|
||||
```shell
|
||||
npm run preview # or `yarn preview`
|
||||
```
|
||||
|
||||
## Production
|
||||
|
||||
The production build will generate client and server modules by running both client and server build commands. The build command will use Typescript to run a type check on the source code.
|
||||
|
||||
```shell
|
||||
npm run build # or `yarn build`
|
||||
```
|
||||
Generated
+7067
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "my-qwik-empty-starter",
|
||||
"description": "Blank project with routing included",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||
},
|
||||
"engines-annotation": "Mostly required by sharp which needs a Node-API v9 compatible runtime",
|
||||
"private": true,
|
||||
"trustedDependencies": [
|
||||
"sharp"
|
||||
],
|
||||
"trustedDependencies-annotation": "Needed for bun to allow running install scripts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "qwik build",
|
||||
"build.client": "vite build",
|
||||
"build.preview": "vite build --ssr src/entry.preview.tsx",
|
||||
"build.types": "tsc --incremental --noEmit",
|
||||
"deploy": "echo 'Run \"npm run qwik add\" to install a server adapter'",
|
||||
"dev": "vite --mode ssr",
|
||||
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
|
||||
"fmt": "prettier --write .",
|
||||
"fmt.check": "prettier --check .",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
"preview": "qwik build preview && vite preview --open",
|
||||
"start": "vite --open --mode ssr",
|
||||
"qwik": "qwik"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@builder.io/qwik": "^1.12.0",
|
||||
"@builder.io/qwik-city": "^1.12.0",
|
||||
"@types/eslint": "8.56.10",
|
||||
"@types/node": "20.14.11",
|
||||
"@typescript-eslint/eslint-plugin": "7.16.1",
|
||||
"@typescript-eslint/parser": "7.16.1",
|
||||
"eslint": "8.57.0",
|
||||
"eslint-plugin-qwik": "^1.12.0",
|
||||
"prettier": "3.3.3",
|
||||
"typescript": "5.4.5",
|
||||
"undici": "*",
|
||||
"vite": "5.3.5",
|
||||
"vite-tsconfig-paths": "^4.2.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 500 500"><g clip-path="url(#a)"><circle cx="250" cy="250" r="250" fill="#fff"/><path fill="#18B6F6" d="m367.87 418.45-61.17-61.18-.94.13v-.67L175.7 227.53l32.05-31.13L188.9 87.73 99.56 199.09c-15.22 15.42-18.03 40.51-7.08 59.03l55.83 93.11a46.82 46.82 0 0 0 40.73 22.81l27.65-.27 151.18 44.68Z"/><path fill="#AC7EF4" d="m401.25 196.94-12.29-22.81-6.41-11.67-2.54-4.56-.26.26-33.66-58.63a47.07 47.07 0 0 0-41.27-23.75l-29.51.8-88.01.28a47.07 47.07 0 0 0-40.33 23.34L93.4 207l95.76-119.54L314.7 226.19l-22.3 22.67 13.35 108.54.13-.26v.26h-.26l.26.27 10.42 10.2 50.62 49.78c2.13 2 5.6-.4 4.13-2.96l-31.25-61.85 54.5-101.3 1.73-2c.67-.81 1.33-1.62 1.87-2.42a46.8 46.8 0 0 0 3.34-50.18Z"/><path fill="#fff" d="M315.1 225.65 189.18 87.6l17.9 108.14L175 227l130.5 130.27-11.75-108.14 21.37-23.48Z"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h500v500H0z"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 947 B |
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/web-manifest-combined.json",
|
||||
"name": "qwik-project-name",
|
||||
"short_name": "Welcome to Qwik",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#fff",
|
||||
"description": "A Qwik project app."
|
||||
}
|
||||
Whitespace-only changes.
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
// This file can be used to add references for global types like `vite/client`.
|
||||
|
||||
// Add global `vite/client` types. For more info, see: https://vitejs.dev/guide/features#client-types
|
||||
/// <reference types="vite/client" />
|
||||
@@ -0,0 +1,48 @@
|
||||
import { component$ } from "@builder.io/qwik";
|
||||
import { useDocumentHead, useLocation } from "@builder.io/qwik-city";
|
||||
|
||||
/**
|
||||
* The RouterHead component is placed inside of the document `<head>` element.
|
||||
*/
|
||||
export const RouterHead = component$(() => {
|
||||
const head = useDocumentHead();
|
||||
const loc = useLocation();
|
||||
|
||||
return (
|
||||
<>
|
||||
<title>{head.title}</title>
|
||||
|
||||
<link rel="canonical" href={loc.url.href} />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
|
||||
{head.meta.map((m) => (
|
||||
<meta key={m.key} {...m} />
|
||||
))}
|
||||
|
||||
{head.links.map((l) => (
|
||||
<link key={l.key} {...l} />
|
||||
))}
|
||||
|
||||
{head.styles.map((s) => (
|
||||
<style
|
||||
key={s.key}
|
||||
{...s.props}
|
||||
{...(s.props?.dangerouslySetInnerHTML
|
||||
? {}
|
||||
: { dangerouslySetInnerHTML: s.style })}
|
||||
/>
|
||||
))}
|
||||
|
||||
{head.scripts.map((s) => (
|
||||
<script
|
||||
key={s.key}
|
||||
{...s.props}
|
||||
{...(s.props?.dangerouslySetInnerHTML
|
||||
? {}
|
||||
: { dangerouslySetInnerHTML: s.script })}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* WHAT IS THIS FILE?
|
||||
*
|
||||
* Development entry point using only client-side modules:
|
||||
* - Do not use this mode in production!
|
||||
* - No SSR
|
||||
* - No portion of the application is pre-rendered on the server.
|
||||
* - All of the application is running eagerly in the browser.
|
||||
* - More code is transferred to the browser than in SSR mode.
|
||||
* - Optimizer/Serialization/Deserialization code is not exercised!
|
||||
*/
|
||||
import { render, type RenderOptions } from "@builder.io/qwik";
|
||||
import Root from "./root";
|
||||
|
||||
export default function (opts: RenderOptions) {
|
||||
return render(document, <Root />, opts);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* WHAT IS THIS FILE?
|
||||
*
|
||||
* It's the bundle entry point for `npm run preview`.
|
||||
* That is, serving your app built in production mode.
|
||||
*
|
||||
* Feel free to modify this file, but don't remove it!
|
||||
*
|
||||
* Learn more about Vite's preview command:
|
||||
* - https://vitejs.dev/config/preview-options.html#preview-options
|
||||
*
|
||||
*/
|
||||
import { createQwikCity } from "@builder.io/qwik-city/middleware/node";
|
||||
import qwikCityPlan from "@qwik-city-plan";
|
||||
// make sure qwikCityPlan is imported before entry
|
||||
import render from "./entry.ssr";
|
||||
|
||||
/**
|
||||
* The default export is the QwikCity adapter used by Vite preview.
|
||||
*/
|
||||
export default createQwikCity({ render, qwikCityPlan });
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* WHAT IS THIS FILE?
|
||||
*
|
||||
* SSR entry point, in all cases the application is rendered outside the browser, this
|
||||
* entry point will be the common one.
|
||||
*
|
||||
* - Server (express, cloudflare...)
|
||||
* - npm run start
|
||||
* - npm run preview
|
||||
* - npm run build
|
||||
*
|
||||
*/
|
||||
import {
|
||||
renderToStream,
|
||||
type RenderToStreamOptions,
|
||||
} from "@builder.io/qwik/server";
|
||||
import { manifest } from "@qwik-client-manifest";
|
||||
import Root from "./root";
|
||||
|
||||
export default function (opts: RenderToStreamOptions) {
|
||||
return renderToStream(<Root />, {
|
||||
manifest,
|
||||
...opts,
|
||||
// Use container attributes to set attributes on the html tag.
|
||||
containerAttributes: {
|
||||
lang: "en-us",
|
||||
...opts.containerAttributes,
|
||||
},
|
||||
serverData: {
|
||||
...opts.serverData,
|
||||
},
|
||||
});
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,38 @@
|
||||
import { component$ } from "@builder.io/qwik";
|
||||
import {
|
||||
QwikCityProvider,
|
||||
RouterOutlet,
|
||||
ServiceWorkerRegister,
|
||||
} from "@builder.io/qwik-city";
|
||||
import { RouterHead } from "./components/router-head/router-head";
|
||||
import { isDev } from "@builder.io/qwik";
|
||||
|
||||
import "./global.css";
|
||||
|
||||
export default component$(() => {
|
||||
/**
|
||||
* The root of a QwikCity site always start with the <QwikCityProvider> component,
|
||||
* immediately followed by the document's <head> and <body>.
|
||||
*
|
||||
* Don't remove the `<head>` and `<body>` elements.
|
||||
*/
|
||||
|
||||
return (
|
||||
<QwikCityProvider>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
{!isDev && (
|
||||
<link
|
||||
rel="manifest"
|
||||
href={`${import.meta.env.BASE_URL}manifest.json`}
|
||||
/>
|
||||
)}
|
||||
<RouterHead />
|
||||
</head>
|
||||
<body lang="en">
|
||||
<RouterOutlet />
|
||||
{!isDev && <ServiceWorkerRegister />}
|
||||
</body>
|
||||
</QwikCityProvider>
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { component$ } from "@builder.io/qwik";
|
||||
import type { DocumentHead } from "@builder.io/qwik-city";
|
||||
|
||||
export default component$(() => {
|
||||
return (
|
||||
<>
|
||||
<h1>Hi 👋</h1>
|
||||
<div>
|
||||
Can't wait to see what you build with qwik!
|
||||
<br />
|
||||
Happy coding.
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
export const head: DocumentHead = {
|
||||
title: "Welcome to Qwik",
|
||||
meta: [
|
||||
{
|
||||
name: "description",
|
||||
content: "Qwik site description",
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import { component$, Slot } from "@builder.io/qwik";
|
||||
import type { RequestHandler } from "@builder.io/qwik-city";
|
||||
|
||||
export const onGet: RequestHandler = async ({ cacheControl }) => {
|
||||
// Control caching for this request for best performance and to reduce hosting costs:
|
||||
// https://qwik.dev/docs/caching/
|
||||
cacheControl({
|
||||
// Always serve a cached response by default, up to a week stale
|
||||
staleWhileRevalidate: 60 * 60 * 24 * 7,
|
||||
// Max once every 5 seconds, revalidate on the server to get a fresh version of this page
|
||||
maxAge: 5,
|
||||
});
|
||||
};
|
||||
|
||||
export default component$(() => {
|
||||
return <Slot />;
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* WHAT IS THIS FILE?
|
||||
*
|
||||
* The service-worker.ts file is used to have state of the art prefetching.
|
||||
* https://qwik.dev/qwikcity/prefetching/overview/
|
||||
*
|
||||
* Qwik uses a service worker to speed up your site and reduce latency, ie, not used in the traditional way of offline.
|
||||
* You can also use this file to add more functionality that runs in the service worker.
|
||||
*/
|
||||
import { setupServiceWorker } from "@builder.io/qwik-city/service-worker";
|
||||
|
||||
setupServiceWorker();
|
||||
|
||||
addEventListener("install", () => self.skipWaiting());
|
||||
|
||||
addEventListener("activate", () => self.clients.claim());
|
||||
|
||||
declare const self: ServiceWorkerGlobalScope;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"target": "ES2017",
|
||||
"module": "ES2022",
|
||||
"lib": ["es2022", "DOM", "WebWorker", "DOM.Iterable"],
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "@builder.io/qwik",
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "Bundler",
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"incremental": true,
|
||||
"isolatedModules": true,
|
||||
"outDir": "tmp",
|
||||
"noEmit": true,
|
||||
"paths": {
|
||||
"~/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"files": ["./.eslintrc.cjs"],
|
||||
"include": ["src", "./*.d.ts", "./*.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* This is the base config for vite.
|
||||
* When building, the adapter config is used which loads this file and extends it.
|
||||
*/
|
||||
import { defineConfig, type UserConfig } from "vite";
|
||||
import { qwikVite } from "@builder.io/qwik/optimizer";
|
||||
import { qwikCity } from "@builder.io/qwik-city/vite";
|
||||
import tsconfigPaths from "vite-tsconfig-paths";
|
||||
import pkg from "./package.json";
|
||||
|
||||
type PkgDep = Record<string, string>;
|
||||
const { dependencies = {}, devDependencies = {} } = pkg as any as {
|
||||
dependencies: PkgDep;
|
||||
devDependencies: PkgDep;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
errorOnDuplicatesPkgDeps(devDependencies, dependencies);
|
||||
|
||||
/**
|
||||
* Note that Vite normally starts from `index.html` but the qwikCity plugin makes start at `src/entry.ssr.tsx` instead.
|
||||
*/
|
||||
export default defineConfig(({ command, mode }): UserConfig => {
|
||||
return {
|
||||
plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
|
||||
// This tells Vite which dependencies to pre-build in dev mode.
|
||||
optimizeDeps: {
|
||||
// Put problematic deps that break bundling here, mostly those with binaries.
|
||||
// For example ['better-sqlite3'] if you use that in server functions.
|
||||
exclude: [],
|
||||
},
|
||||
|
||||
/**
|
||||
* This is an advanced setting. It improves the bundling of your server code. To use it, make sure you understand when your consumed packages are dependencies or dev dependencies. (otherwise things will break in production)
|
||||
*/
|
||||
// ssr:
|
||||
// command === "build" && mode === "production"
|
||||
// ? {
|
||||
// // All dev dependencies should be bundled in the server build
|
||||
// noExternal: Object.keys(devDependencies),
|
||||
// // Anything marked as a dependency will not be bundled
|
||||
// // These should only be production binary deps (including deps of deps), CLI deps, and their module graph
|
||||
// // If a dep-of-dep needs to be external, add it here
|
||||
// // For example, if something uses `bcrypt` but you don't have it as a dep, you can write
|
||||
// // external: [...Object.keys(dependencies), 'bcrypt']
|
||||
// external: Object.keys(dependencies),
|
||||
// }
|
||||
// : undefined,
|
||||
|
||||
server: {
|
||||
headers: {
|
||||
// Don't cache the server response in dev mode
|
||||
"Cache-Control": "public, max-age=0",
|
||||
},
|
||||
},
|
||||
preview: {
|
||||
headers: {
|
||||
// Do cache the server response in preview (non-adapter production build)
|
||||
"Cache-Control": "public, max-age=600",
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// *** utils ***
|
||||
|
||||
/**
|
||||
* Function to identify duplicate dependencies and throw an error
|
||||
* @param {Object} devDependencies - List of development dependencies
|
||||
* @param {Object} dependencies - List of production dependencies
|
||||
*/
|
||||
function errorOnDuplicatesPkgDeps(
|
||||
devDependencies: PkgDep,
|
||||
dependencies: PkgDep,
|
||||
) {
|
||||
let msg = "";
|
||||
// Create an array 'duplicateDeps' by filtering devDependencies.
|
||||
// If a dependency also exists in dependencies, it is considered a duplicate.
|
||||
const duplicateDeps = Object.keys(devDependencies).filter(
|
||||
(dep) => dependencies[dep],
|
||||
);
|
||||
|
||||
// include any known qwik packages
|
||||
const qwikPkg = Object.keys(dependencies).filter((value) =>
|
||||
/qwik/i.test(value),
|
||||
);
|
||||
|
||||
// any errors for missing "qwik-city-plan"
|
||||
// [PLUGIN_ERROR]: Invalid module "@qwik-city-plan" is not a valid package
|
||||
msg = `Move qwik packages ${qwikPkg.join(", ")} to devDependencies`;
|
||||
|
||||
if (qwikPkg.length > 0) {
|
||||
throw new Error(msg);
|
||||
}
|
||||
|
||||
// Format the error message with the duplicates list.
|
||||
// The `join` function is used to represent the elements of the 'duplicateDeps' array as a comma-separated string.
|
||||
msg = `
|
||||
Warning: The dependency "${duplicateDeps.join(", ")}" is listed in both "devDependencies" and "dependencies".
|
||||
Please move the duplicated dependencies to "devDependencies" only and remove it from "dependencies"
|
||||
`;
|
||||
|
||||
// Throw an error with the constructed message.
|
||||
if (duplicateDeps.length > 0) {
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
target/
|
||||
|
||||
Cargo.lock
|
||||
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "loadbalancer"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/var/log/nocturne/*.log {
|
||||
size 20K
|
||||
compress
|
||||
rotate 10
|
||||
missingok
|
||||
copytruncate
|
||||
delaycompress
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {};
|
||||
|
||||
export default nextConfig;
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen 443 ssl;
|
||||
server_name lumither.com;
|
||||
|
||||
# ssl_certificate certs/cert.pem;
|
||||
# ssl_certificate_key certs/key.pem;
|
||||
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_session_timeout 5m;
|
||||
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
location / {
|
||||
default_type text/html;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
rewrite ^/api(/.*)$ $1 break;
|
||||
proxy_pass http://127.0.0.1:3001;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"name": "blog",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nextui-org/react": "^2.3.5",
|
||||
"framer-motion": "^11.1.7",
|
||||
"next": "14.2.2",
|
||||
"next-themes": "^0.3.0",
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
"react-icons": "^5.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.2.2"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
/** @type {import('postcss-load-config').Config} */
|
||||
const config = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -0,0 +1,38 @@
|
||||
services:
|
||||
frontend:
|
||||
depends_on:
|
||||
- backend
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: ../container/release/frontend.containerfile
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:3000"
|
||||
env_file:
|
||||
- ./.env
|
||||
|
||||
|
||||
backend:
|
||||
depends_on:
|
||||
- postgres
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ../container/release/backend.containerfile
|
||||
args:
|
||||
ARCH: ${ARCH}
|
||||
restart: always
|
||||
ports:
|
||||
- "3001:3001"
|
||||
env_file:
|
||||
- ./.env
|
||||
- ./.env.local
|
||||
dns:
|
||||
- 1.1.1.1
|
||||
|
||||
postgres:
|
||||
image: postgres:16.3
|
||||
ports:
|
||||
- "5432:5432"
|
||||
env_file:
|
||||
- ./.env
|
||||
- ./.env.local
|
||||
@@ -1,33 +0,0 @@
|
||||
import { nextui } from '@nextui-org/react';
|
||||
|
||||
import type { Config } from 'tailwindcss';
|
||||
|
||||
const config: Config = {
|
||||
content: [
|
||||
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./components/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./app/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}'
|
||||
],
|
||||
// theme: {
|
||||
// extend: {}
|
||||
// },
|
||||
darkMode: 'class',
|
||||
plugins: [ nextui(
|
||||
{
|
||||
// defaultTheme: 'dark',
|
||||
defaultExtendTheme: 'light',
|
||||
themes: {
|
||||
'light': {
|
||||
layout: {},
|
||||
colors: {}
|
||||
},
|
||||
'dark': {
|
||||
layout: {},
|
||||
colors: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
) ]
|
||||
};
|
||||
export default config;
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"target": "ESNext",
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"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"]
|
||||
}
|
||||
Reference in new issue
Block a user