Add project files

main
Egor Ternovoy 2 weeks ago
parent e2e5ebe966
commit 0b672d2f3c
Signed by: cofob
GPG Key ID: ACAD4265E193794D
  1. 9
      .editorconfig
  2. 3
      .env
  3. 2
      .envrc
  4. 13
      .eslintignore
  5. 19
      .eslintrc.cjs
  6. 3
      .gitattributes
  7. 9
      .gitignore
  8. 1
      .npmrc
  9. 13
      .prettierignore
  10. 7
      .prettierrc
  11. 2
      README.md
  12. 43
      flake.lock
  13. 24
      flake.nix
  14. 10
      jsconfig.json
  15. 52
      package.json
  16. 13
      postcss.config.cjs
  17. 15
      src/app.d.ts
  18. 11
      src/app.html
  19. 19
      src/lib/app.css
  20. 1
      src/lib/components/Footer.svelte
  21. 40
      src/lib/components/Meta.svelte
  22. 1
      src/lib/components/Navbar.svelte
  23. 3
      src/lib/components/index.ts
  24. 3
      src/lib/utils.ts
  25. 17
      src/routes/+error.svelte
  26. 37
      src/routes/+layout.svelte
  27. 7
      src/routes/+page.svelte
  28. 7
      src/routes/+page.ts
  29. 23
      src/routes/sitemap.xml/+server.ts
  30. BIN
      static/fonts/Manrope.ttf
  31. BIN
      static/fonts/Manrope.woff2
  32. 3
      static/robots.txt
  33. 41
      svelte.config.js
  34. 9
      tailwind.config.cjs
  35. 8
      tsconfig.json
  36. 23
      vite.config.js
  37. 2245
      yarn.lock

@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

@ -0,0 +1,3 @@
VITE_DOMAIN=cofob.ru
VITE_IPFS_ENDPOINT=https://static.ipfsqr.ru/
VITE_ANALYTICS=<script>var _paq=window._paq=window._paq||[];_paq.push(["trackPageView"]),_paq.push(["enableLinkTracking"]),function(){var a="//trac.firesquare.ru/";_paq.push(["setTrackerUrl",a+"matomo.php"]),_paq.push(["setSiteId","3"]);var e=document,r=e.createElement("script"),p=e.getElementsByTagName("script")[0];r.async=!0,r.src=a+"matomo.js",p.parentNode.insertBefore(r,p)}();</script><noscript><p><img src="//trac.firesquare.ru/matomo.php?idsite=3&amp;rec=1" style="border:0;" alt="" /></p></noscript>

@ -0,0 +1,2 @@
use flake
layout node

@ -0,0 +1,13 @@
/node_modules
/build
/.svelte-kit
/package
/.env
/.env.*
/!.env.example
/.cloudflare/
/.direnv
# Ignore files for PNPM, NPM and YARN
/pnpm-lock.yaml
/yarn.lock

@ -0,0 +1,19 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
plugins: ["svelte3"],
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
settings: {
"svelte3/typescript": () => require("typescript"),
},
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
},
env: {
browser: true,
es2017: true,
node: true,
},
};

3
.gitattributes vendored

@ -0,0 +1,3 @@
*.ico filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.woff2 filter=lfs diff=lfs merge=lfs -text

9
.gitignore vendored

@ -0,0 +1,9 @@
/node_modules
/build
/.svelte-kit
/package
/.env.*
/!.env.example
/.output
/.cloudflare
/.direnv

@ -0,0 +1 @@
engine-strict=true

@ -0,0 +1,13 @@
/node_modules
/build
/.svelte-kit
/package
/.env
/.env.*
/!.env.example
/.cloudflare/
/.direnv
# Ignore files for PNPM, NPM and YARN
/pnpm-lock.yaml
/yarn.lock

@ -0,0 +1,7 @@
{
"useTabs": true,
"singleQuote": false,
"trailingComma": "all",
"printWidth": 120,
"tabWidth": 2
}

@ -1,3 +1,3 @@
# cofob.ru
My personal website
My personal website

@ -0,0 +1,43 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1658826464,
"narHash": "sha256-94ZTF0uIX/iZdiD4RJ5f933ak/OM4XLl7hF+gCa4Iuk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ce49cb7792a7ffd65ef352dda1110a4e4a204eac",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

@ -0,0 +1,24 @@
{
description = "Svelte-powered site";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
yarn18 = pkgs.yarn.overrideAttrs (old: { buildInputs = [ pkgs.nodejs-18_x ]; });
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs-18_x
yarn18
];
};
}
);
}

@ -0,0 +1,10 @@
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node",
"target": "ES2020",
"strictNullChecks": true,
"strictFunctionTypes": true
},
"exclude": ["node_modules", "**/node_modules/*"]
}

@ -0,0 +1,52 @@
{
"name": "cofob-ru",
"type": "module",
"version": "0.0.1",
"license": "MIT",
"description": "svelte-powered website",
"homepage": "https://cofob.ru/",
"scripts": {
"dev": "vite dev",
"build": "DEPLOY_TARGET=node vite build",
"build:static": "DEPLOY_TARGET=static vite build && cp ./build/200.html ./build/ipfs-404.html",
"build:cloudflare": "DEPLOY_TARGET=cloudflare vite build",
"package": "svelte-kit package",
"preview": "vite preview",
"postinstall": "svelte-kit sync",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check --plugin-search-dir=. . && eslint .",
"format": "prettier --write --plugin-search-dir=. .",
"start": "yarn build && yarn preview"
},
"devDependencies": {
"@sveltejs/adapter-cloudflare": "latest",
"@sveltejs/adapter-node": "latest",
"@sveltejs/adapter-static": "latest",
"@sveltejs/kit": "latest",
"@types/nprogress": "latest",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"autoprefixer": "latest",
"cssnano": "latest",
"cssnano-preset-advanced": "latest",
"eslint": "latest",
"eslint-config-prettier": "latest",
"eslint-plugin-svelte3": "latest",
"postcss": "latest",
"postcss-discard-comments": "latest",
"postcss-import": "latest",
"prettier": "latest",
"prettier-plugin-svelte": "latest",
"svelte": "latest",
"svelte-check": "latest",
"svelte-heros": "latest",
"svelte-preprocess": "latest",
"tailwindcss": "latest",
"typescript": "latest",
"vite": "latest"
},
"dependencies": {
"nprogress": "latest"
}
}

@ -0,0 +1,13 @@
module.exports = {
plugins: {
"postcss-import": {},
"postcss-discard-comments": {
removeAll: true,
},
tailwindcss: {},
autoprefixer: {},
cssnano: {
preset: "advanced",
},
},
};

15
src/app.d.ts vendored

@ -0,0 +1,15 @@
/// <reference types="@sveltejs/kit" />
// See https://kit.svelte.dev/docs/typescript
// for information about these interfaces
declare namespace App {
interface ImportMetaEnv {
VITE_DOMAIN: string;
VITE_IPFS_ENDPOINT: string;
VITE_ANALYTICS: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
}

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body class="bg-white text-gray-800">
%sveltekit.body%
</body>
</html>

@ -0,0 +1,19 @@
@import "nprogress/nprogress.css";
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
@font-face {
font-family: "Manrope";
src: url("/fonts/Manrope.woff2") format("woff2"), url("/fonts/Manrope.ttf") format("truetype");
font-weight: 100 1000;
font-stretch: 25% 151%;
}
html {
@apply motion-safe:scroll-smooth antialiased break-words;
font-family: Manrope, sans-serif;
}
}

@ -0,0 +1,40 @@
<script lang="ts">
import { getIPFSLink } from "$lib/utils";
export let title: string;
export let description: string;
export let cover: string = getIPFSLink("QmSnwhp78vrJo57jPshuwPQqc2s6U8CUqq51AazvSECWdF/default_cover.webp");
export let noindex = false;
title = title + " — cofob.ru";
</script>
<svelte:head>
<title>{title}</title>
<!-- Meta - запрещённая в России организация -->
<meta content="#ea590b" name="theme-color" />
<meta content="Russian" name="language" />
<meta content="ru_RU" name="og:locale" />
<meta content="cofob.ru" property="og:site_name" />
<meta
content="cofob,cofob.ru,персональный сайт,personal website,кофоб,егор терновой,portfolio,портфолио"
name="keywords"
/>
<meta content="index, follow" name="robots" />
<meta content={title} name="title" />
<meta content={title} property="og:title" />
<meta content={title} property="twitter:title" />
<meta content={description} name="description" />
<meta content={description} property="og:description" />
<meta content={description} property="twitter:description" />
<meta content={cover} property="og:image" />
<meta content={cover} property="twitter:image" />
<meta content="website" property="og:type" />
<meta content="summary_large_image" property="twitter:card" />
{#if noindex}
<meta name="robots" content="noindex" />
{/if}
<!-- Ебать сколько тэгов. -->
</svelte:head>

@ -0,0 +1 @@
<p>навбар</p>

@ -0,0 +1,3 @@
export { default as Meta } from "./Meta.svelte";
export { default as Footer } from "./Footer.svelte";
export { default as Navbar } from "./Navbar.svelte";

@ -0,0 +1,3 @@
export function getIPFSLink(cid: string): string {
return import.meta.env.VITE_IPFS_ENDPOINT + "ipfs/" + cid;
}

@ -0,0 +1,17 @@
<script lang="ts">
import { Meta } from "$lib/components";
import { page } from "$app/stores";
export let message: string;
export let status: string;
</script>
<Meta title="Ошибка" description="Ошибка {status}" noindex />
<div>
{#if $page.status == 404}
<p>404</p>
{/if}
{$page.error?.message}
<a href="/">на главную -></a>
</div>

@ -0,0 +1,37 @@
<script lang="ts">
import "$lib/app.css";
import NProgress from "nprogress";
import { navigating } from "$app/stores";
import { Footer, Navbar } from "$lib/components";
NProgress.configure({
showSpinner: false,
});
$: {
if ($navigating) {
setTimeout(() => {
if ($navigating) {
NProgress.start();
}
}, 100);
}
if (!$navigating) {
NProgress.done();
}
}
</script>
<svelte:head>
<link rel="preconnect" href={import.meta.env.VITE_IPFS_ENDPOINT} />
</svelte:head>
<Navbar />
<main>
<slot />
</main>
<Footer />
{@html import.meta.env.VITE_ANALYTICS}

@ -0,0 +1,7 @@
<script lang="ts">
import { Meta } from "$lib/components";
</script>
<Meta title="Главная" description="Персональный сайт кофоба" />
<p>главная</p>

@ -0,0 +1,7 @@
import type { PageLoad } from "./$types";
export const load: PageLoad = async ({ setHeaders }) => {
setHeaders({
"cache-control": "public, max-age=300",
});
};

@ -0,0 +1,23 @@
export async function GET() {
const headers = {
"Cache-Control": "max-age=0, s-maxage=3600",
"Content-Type": "application/xml",
};
return new Response(`<?xml version="1.0" encoding="UTF-8" ?>
<urlset
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="https://www.google.com/schemas/sitemap-news/0.9"
xmlns:xhtml="https://www.w3.org/1999/xhtml"
xmlns:mobile="https://www.google.com/schemas/sitemap-mobile/1.0"
xmlns:image="https://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="https://www.google.com/schemas/sitemap-video/1.1"
>
<url>
<loc>/</loc>
<changefreq>weekly</changefreq>
<priority>1</priority>
<lastmod>2022-09-14</lastmod>
</url>
</urlset>`, { headers: headers });
}

BIN
static/fonts/Manrope.ttf (Stored with Git LFS)

Binary file not shown.

BIN
static/fonts/Manrope.woff2 (Stored with Git LFS)

Binary file not shown.

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

@ -0,0 +1,41 @@
import preprocess from "svelte-preprocess";
import cf_adapter from "@sveltejs/adapter-cloudflare";
import static_adapter from "@sveltejs/adapter-static";
import node_adapter from "@sveltejs/adapter-node";
let adapter;
switch (process.env.DEPLOY_TARGET) {
case "cloudflare":
adapter = cf_adapter();
break;
case "static":
adapter = static_adapter({ fallback: "200.html" });
break;
case "node":
adapter = node_adapter({ precompress: true });
break;
default:
adapter = static_adapter({ fallback: "200.html" });
}
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [
preprocess({
postcss: true,
}),
],
kit: {
adapter,
alias: {
$src: "src",
$components: "src/lib/components",
},
trailingSlash: "always",
},
};
export default config;

@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: "jit",
content: ["./src/**/*.{html,js,svelte,ts}"],
theme: {
extend: {},
},
darkMode: "class",
};

@ -0,0 +1,8 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"checkJs": false,
"allowSyntheticDefaultImports": true,
"strict": true
}
}

@ -0,0 +1,23 @@
import child_process from "child_process";
import { sveltekit } from "@sveltejs/kit/vite";
const get_css_hash = ({ css, hash }) => {
return `${hash(css)}`;
};
/**
* @type {import('vite').UserConfig}
*/
const config = {
compilerOptions: {
cssHash: get_css_hash,
},
define: {
"import.meta.env.VITE_VERSION": JSON.stringify(
child_process.execSync("git describe --tags --abbrev=0 --always").toString().trim(),
),
},
plugins: [sveltekit()],
};
export default config;

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save