initial commit uwu

This commit is contained in:
anna 2022-12-01 01:07:28 +01:00
commit df23eb263c
Signed by: fef
GPG key ID: EC22E476DC2D3D84
15 changed files with 7147 additions and 0 deletions

10
.editorconfig Normal file
View file

@ -0,0 +1,10 @@
root = true
[*]
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

6
.eslintrc.cjs Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommented"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
root: true,
};

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/node_modules
/public/js
/target

1143
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

7
Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "nyanoblog"
version = "0.1.0"
edition = "2021"
[dependencies]
actix-web = "4"

5840
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

32
package.json Normal file
View file

@ -0,0 +1,32 @@
{
"name": "nyanoblog",
"version": "0.1.0",
"description": "A hackable next generation microblogging server",
"type": "module",
"private": true,
"main": "index.js",
"scripts": {
"start": "scripts/dev-server.js",
"start:tsc": "tsc --watch",
"start:server": "web-dev-server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.bsd.gay/nyanoblog/nyanoblog.git"
},
"author": "anna <owo@fef.moe>",
"license": "AGPL-3.0",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@web/dev-server": "^0.1.35",
"eslint": "^8.28.0",
"rollup": "^3.5.0",
"typescript": "^4.9.3"
},
"dependencies": {
"lit": "^2.4.1",
"redux": "^4.2.0"
}
}

14
public/index.html Normal file
View file

@ -0,0 +1,14 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<base href="/">
<title>nyanoblog</title>
</head>
<body>
<nyano-blog unresolved></nyano-blog>
<script type="module" src="js/app.js"></script>
</body>
</html>

1
public/src Symbolic link
View file

@ -0,0 +1 @@
../src

7
rollup.config.js Normal file
View file

@ -0,0 +1,7 @@
export default {
input: "public/js/app.js",
output: {
file: "public/js/app.bundle.js",
format: "esm",
},
};

26
scripts/dev-server.js Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env node
const { spawn } = require("node:child_process");
console.log("Starting development server");
const tsc = spawn("npm", ["run", "start:tsc"]);
tsc.on("exit", code => {
console.log(`tsc exited with code ${code}`);
server.kill("SIGINT");
});
tsc.stdout.on("data", console.log);
tsc.stderr.on("data", console.error);
const server = spawn("npm", ["run", "start:server"]);
server.on("exit", code => {
console.log(`web-dev-server exited with code ${code}`);
tsc.kill("SIGINT");
});
server.stderr.on("data", console.error);
process.on("SIGINT", () => {
console.log("SIGINT caught, shutting down");
server.kill("SIGINT");
tsc.kill("SIGINT");
});

17
src/main.rs Normal file
View file

@ -0,0 +1,17 @@
use actix_web::{get, App, HttpResponse, HttpServer, Responder};
#[get("/")]
async fn hello() -> impl Responder {
HttpResponse::Ok().body("hello, world")
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.service(hello)
})
.bind(("::1", 8001))?
.run()
.await
}

14
src/web/app.ts Normal file
View file

@ -0,0 +1,14 @@
import {
LitElement,
html,
} from "lit";
import {customElement} from "lit/decorators.js";
@customElement("nyano-blog")
export default class NyanoBlog extends LitElement {
public render() {
return html`
<h1>hello, world</h1>
`;
}
}

18
tsconfig.json Normal file
View file

@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "Node",
"lib": ["ES2020", "DOM"],
"outDir": "public/js",
"sourceMap": true,
"baseUrl": "src/web",
"experimentalDecorators": true,
},
"include": [
"src/web/**/*",
],
"exclude": [
"node_modules",
],
}

9
web-dev-server.config.js Normal file
View file

@ -0,0 +1,9 @@
export default {
open: true,
watch: true,
appIndex: "public/index.html",
rootDir: "public",
nodeResolve: {
exportConditions: ["development"],
},
};