blog-minerva-juppiter

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 529bcc0b4490167ee4c4984f061adb26c795fea5
parent 9a699ad061084bd403af48ea425adf5d36112454
Author: minerva-jupiter <ryouturn@gmail.com>
Date:   Wed,  9 Apr 2025 13:04:48 +0900

change to pure html

Diffstat:
D.npmrc | 1-
D.prettierignore | 6------
D.prettierrc | 15---------------
DREADME.md | 44--------------------------------------------
Aarticles/1.html | 14++++++++++++++
De2e/demo.test.ts | 6------
Deslint.config.js | 37-------------------------------------
Aindex.html | 39+++++++++++++++++++++++++++++++++++++++
Rstatic/minerva-juppiter.svg -> minerva-juppiter.svg | 0
Dpackage.json | 36------------------------------------
Dplaywright.config.ts | 9---------
Arobots.txt | 6++++++
Dsrc/app.d.ts | 23-----------------------
Dsrc/app.html | 12------------
Dsrc/demo.spec.ts | 7-------
Dsrc/lib/assets/articles.json | 13-------------
Dsrc/lib/index.ts | 1-
Dsrc/routes/+layout.svelte | 46----------------------------------------------
Dsrc/routes/+page.svelte | 32--------------------------------
Dsrc/routes/about/+page.svelte | 17-----------------
Dsrc/routes/article/[ArticleNumber]/+page.server.ts | 40----------------------------------------
Dsrc/routes/article/[ArticleNumber]/+page.svelte | 28----------------------------
Dsrc/routes/page.svelte.test.ts | 11-----------
Astyle.css | 32++++++++++++++++++++++++++++++++
Dsvelte.config.js | 9---------
Dtsconfig.json | 19-------------------
Dvite.config.ts | 32--------------------------------
Dvitest-setup-client.ts | 18------------------
28 files changed, 91 insertions(+), 462 deletions(-)

diff --git a/.npmrc b/.npmrc @@ -1 +0,0 @@ -engine-strict=true diff --git a/.prettierignore b/.prettierignore @@ -1,6 +0,0 @@ -# Package Managers -package-lock.json -pnpm-lock.yaml -yarn.lock -bun.lock -bun.lockb diff --git a/.prettierrc b/.prettierrc @@ -1,15 +0,0 @@ -{ - "useTabs": true, - "singleQuote": true, - "trailingComma": "none", - "printWidth": 100, - "plugins": ["prettier-plugin-svelte"], - "overrides": [ - { - "files": "*.svelte", - "options": { - "parser": "svelte" - } - } - ] -} diff --git a/README.md b/README.md @@ -1,44 +0,0 @@ -# blog-minerva-juppiter - -this app is used for my blog. -this has not license and MUST not copy or fork before deploying data base of articles. - - -# sv - -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). - -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```bash -# create a new project in the current directory -npx sv create - -# create a new project in my-app -npx sv create my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. diff --git a/articles/1.html b/articles/1.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="UTF-8"> + <title>Svelteでブログを構築した。</title> + </head> + <body> + <h1>Svelteでブログを構築した。</h1> + <h4>2025/03/29</h4> + <p>Svelteに挑戦と同時に、ブログを作りましたとさ。</p> + <ins datetime="2025-04-09">純粋なHTMLのサイトに更新作業中。</ins> + </body> +</html>+ \ No newline at end of file diff --git a/e2e/demo.test.ts b/e2e/demo.test.ts @@ -1,6 +0,0 @@ -import { expect, test } from '@playwright/test'; - -test('home page has expected h1', async ({ page }) => { - await page.goto('/'); - await expect(page.locator('h1')).toBeVisible(); -}); diff --git a/eslint.config.js b/eslint.config.js @@ -1,37 +0,0 @@ -import prettier from 'eslint-config-prettier'; -import js from '@eslint/js'; -import { includeIgnoreFile } from '@eslint/compat'; -import svelte from 'eslint-plugin-svelte'; -import globals from 'globals'; -import { fileURLToPath } from 'node:url'; -import ts from 'typescript-eslint'; -import svelteConfig from './svelte.config.js'; - -const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url)); - -export default ts.config( - includeIgnoreFile(gitignorePath), - js.configs.recommended, - ...ts.configs.recommended, - ...svelte.configs.recommended, - prettier, - ...svelte.configs.prettier, - { - languageOptions: { - globals: { ...globals.browser, ...globals.node } - }, - rules: { 'no-undef': 'off' } - }, - { - files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'], - ignores: ['eslint.config.js', 'svelte.config.js'], - languageOptions: { - parserOptions: { - projectService: true, - extraFileExtensions: ['.svelte'], - parser: ts.parser, - svelteConfig - } - } - } -); diff --git a/index.html b/index.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html lang="jp"> + <head> + <meta charset="UTF-8"> + <meta name="author" content="Minerva_Juppiter"> + <meta name="description" content="Minerva_Juppiterのblog"> + <meta name="keywords" content="blog, Minerva_Juppiter, HTML, CSS, Art, Literature, Physics, Philosophy, Music"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="stylesheet" href="style.css"> + <title>Blog by Minerva_Juppiter</title> + </head> + <body> + <header> + <h1>Blog</h1> + <h2>by Minerva_Juppiter</h2> + <nav> + <a href="/">Home</a> + / + <a href="/about">About</a> + </nav> + </header> + <br> + <main> + <h1>Articles</h1> + <ul> + <li> + <a href="articles/1.html">Svelteでブログを構築した。</a> + </li> + </ul> + </main> + <br> + <footer> + <p> + @all right reserved by Minerva_Juppiter + </p> + </footer> + </body> +</html>+ \ No newline at end of file diff --git a/static/minerva-juppiter.svg b/minerva-juppiter.svg diff --git a/package.json b/package.json @@ -1,36 +0,0 @@ -{ - "name": "blog-minerva-juppiter", - "version": "0.0.1", - "devDependencies": { - "@cloudflare/workers-types": "^4.20250402.0", - "@playwright/test": "1.51.1", - "@sveltejs/adapter-cloudflare": "6.0.1", - "@sveltejs/kit": "2.20.2", - "@sveltejs/vite-plugin-svelte": "5.0.3", - "@testing-library/jest-dom": "6.6.3", - "@testing-library/svelte": "5.2.7", - "globals": "16.0.0", - "jsdom": "26.0.0", - "prettier": "3.5.3", - "prettier-plugin-svelte": "3.3.3", - "svelte": "5.25.3", - "svelte-check": "4.1.5", - "typescript": "5.8.2", - "vite": "6.2.3", - "vitest": "3.0.9" - }, - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "prepare": "svelte-kit sync || echo ''", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "format": "prettier --write .", - "test:unit": "vitest", - "test": "npm run test:unit -- --run && npm run test:e2e", - "test:e2e": "playwright test" - }, - "type": "module" -} diff --git a/playwright.config.ts b/playwright.config.ts @@ -1,9 +0,0 @@ -import { defineConfig } from '@playwright/test'; - -export default defineConfig({ - webServer: { - command: 'npm run build && npm run preview', - port: 4173 - }, - testDir: 'e2e' -}); diff --git a/robots.txt b/robots.txt @@ -0,0 +1,5 @@ +User-agent: Googlebot +Disallow: /nogooglebot/ + +User-agent: * +Allow: /+ \ No newline at end of file diff --git a/src/app.d.ts b/src/app.d.ts @@ -1,23 +0,0 @@ -// See https://svelte.dev/docs/kit/types#app.d.ts -// for information about these interfaces -import type { D1Database } from '@cloudflare/workers-types'; -declare global { - namespace App { - // interface Error {} - // interface Locals {} - // interface PageData {} - // interface PageState {} - // interface Platform {} - interface Platform { - env: { - DB: D1Database; - }; - context: { - waitUntil(promise: Promise<any>): void; - }; - caches: CacheStorage & { default: Cache } - } - } -} - -export {}; diff --git a/src/app.html b/src/app.html @@ -1,12 +0,0 @@ -<!doctype html> -<html lang="jp"> - <head> - <meta charset="utf-8" /> - <link rel="icon" href="%sveltekit.assets%/minerva-juppiter.svg" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - %sveltekit.head% - </head> - <body data-sveltekit-preload-data="hover"> - <div style="display: contents">%sveltekit.body%</div> - </body> -</html> diff --git a/src/demo.spec.ts b/src/demo.spec.ts @@ -1,7 +0,0 @@ -import { describe, it, expect } from 'vitest'; - -describe('sum test', () => { - it('adds 1 + 2 to equal 3', () => { - expect(1 + 2).toBe(3); - }); -}); diff --git a/src/lib/assets/articles.json b/src/lib/assets/articles.json @@ -1,12 +0,0 @@ -[ - { - "ArticleName":"光回線のアップグレードが完了しました。", - "ArticleBody":"我が家に入っている光回線は大家さんが契約した30Mbpsプランだったのだけど、4/1付けでアップグレードができた。", - "Date":"2025/04/01" - }, - { - "ArticleName":"Svelteでブログを構築した。", - "ArticleBody":"Svelteに挑戦と同時に、ブログを作りましたとさ。", - "Date":"2025/03/29" - } -]- \ No newline at end of file diff --git a/src/lib/index.ts b/src/lib/index.ts @@ -1 +0,0 @@ -// place files you want to import through the `$lib` alias in this folder. diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte @@ -1,45 +0,0 @@ -<header> - <h1>Blog</h1> - <h2>by Minerva_Juppiter</h2> - <nav> - <a href="/">Home</a> - / - <a href="/about">About</a> - </nav> -</header> -<br/> -<slot /> -<br/> -<footer> - <p> - @all right reserved by Minerva_Juppiter - </p> -</footer> - -<style> - :global(body) { - background-color: black; - color: #d9d9d9; - font-family: "Tw Cen MT","Century Gothic","Noto Sans JP"; - margin: 0%; - } - header { - background-color: #d9d9d9; - color: #0f0a05; - padding-left: 4rem; - padding-right: 4rem; - padding-top: 3rem; - padding-bottom: 3rem; - } - nav a { - text-decoration: none; - color: black; - font-size: large; - } - footer { - background-color: #0f0a05; - text-align: center; - color: gray; - padding: 1rem; - } -</style>- \ No newline at end of file diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte @@ -1,31 +0,0 @@ -<h1>Articles</h1> -<ul> - {#each articles as article,index} - <a href="./article/{index}"> - <li>{article.ArticleName}</li> - </a> - {/each} -</ul> - -<script lang="ts"> - import articles from "$lib/assets/articles.json"; -</script> - -<style> - h1 { - padding-left: 4rem; - } - ul { - padding-left: 4rem; - font-size: large; - } - a { - text-decoration: none; - padding: 4rem; - color: #d9d9d9; - } -</style> - -<svelte:head> - <title>Blog Minerva_Juppiter</title> -</svelte:head>- \ No newline at end of file diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte @@ -1,16 +0,0 @@ -<div> - <h1>About</h1> - <br/> - <h3>About this page</h3> - <p>This page is deployed by cloudflare pages & github</p> - <br/> - <h3>Repository</h3> - <p><a href="https://github.com/minerva-jupiter/blog-minerva-juppiter">https://github.com/minerva-jupiter/blog-minerva-juppiter</a></p> -</div> - -<style> - div { - padding-left: 4rem; - padding-right: 4rem; - } -</style>- \ No newline at end of file diff --git a/src/routes/article/[ArticleNumber]/+page.server.ts b/src/routes/article/[ArticleNumber]/+page.server.ts @@ -1,39 +0,0 @@ -import { error } from '@sveltejs/kit'; -import type { PageServerLoad } from './$types'; - -// Function to get the D1 database instance -const getDatabase = (platform: { env: { DB: any } }) => { - if (!platform?.env?.DB) { - throw new Error('D1 database is not configured.'); - } - return platform.env.DB; -}; - -export const load: PageServerLoad = async ({ params, platform }) => { - if (!platform) { - throw error(500, 'Platform is not defined.'); - } - const post = await getPostFromDatabase(platform, params.ArticleNumber); - - if (post) { - return post; - } - - throw error(404, 'Not found'); -}; - -const getPostFromDatabase = async ( - platform: { env: { DB: any } }, - slug: string -): Promise<{ title: string; content: string } | null> => { - const db = getDatabase(platform); - - const query = 'SELECT title, content FROM posts WHERE slug = ?'; - const result = await db.prepare(query).bind(slug).first(); - - if (result) { - return { title: result.title, content: result.content }; - } - - return null; -};- \ No newline at end of file diff --git a/src/routes/article/[ArticleNumber]/+page.svelte b/src/routes/article/[ArticleNumber]/+page.svelte @@ -1,27 +0,0 @@ -<script lang="ts"> - import type { PageProps } from './$types'; - import articles from '$lib/assets/articles.json'; - - let { data }: PageProps = $props(); -</script> - -<div> - <h1>{articles[data.content].ArticleName}</h1> - - <h4>{articles[data.content].Date}</h4> - - <p>{articles[data.content].ArticleBody}</p> -</div> - -<style> - div { - padding-left: 4rem; - padding-right: 4rem; - } -</style> - -<svelte:head> - <title> - {articles[data.content].ArticleName} - </title> -</svelte:head>- \ No newline at end of file diff --git a/src/routes/page.svelte.test.ts b/src/routes/page.svelte.test.ts @@ -1,11 +0,0 @@ -import { describe, test, expect } from 'vitest'; -import '@testing-library/jest-dom/vitest'; -import { render, screen } from '@testing-library/svelte'; -import Page from './+page.svelte'; - -describe('/+page.svelte', () => { - test('should render h1', () => { - render(Page); - expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument(); - }); -}); diff --git a/style.css b/style.css @@ -0,0 +1,31 @@ + body { + background-color: black; + color: #d9d9d9; + font-family: "Tw Cen MT","Century Gothic","Noto Sans JP"; + margin: 0%; + } + header { + background-color: #d9d9d9; + color: #0f0a05; + padding-left: 4rem; + padding-right: 4rem; + padding-top: 3rem; + padding-bottom: 3rem; + } + nav a { + text-decoration: none; + color: black; + font-size: large; + } + main { + padding-left: 4rem; + padding-right: 4rem; + padding-top: 3rem; + padding-bottom: 3rem; + } + footer { + background-color: #0f0a05; + text-align: center; + color: gray; + padding: 1rem; + }+ \ No newline at end of file diff --git a/svelte.config.js b/svelte.config.js @@ -1,9 +0,0 @@ -import adapter from '@sveltejs/adapter-cloudflare'; -import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; - -const config = { - preprocess: vitePreprocess(), - kit: { adapter: adapter() } -}; - -export default config; diff --git a/tsconfig.json b/tsconfig.json @@ -1,19 +0,0 @@ -{ - "extends": "./.svelte-kit/tsconfig.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "moduleResolution": "bundler" - } - // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias - // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files - // - // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes - // from the referenced tsconfig.json - TypeScript does not merge them in -} diff --git a/vite.config.ts b/vite.config.ts @@ -1,32 +0,0 @@ -import { svelteTesting } from '@testing-library/svelte/vite'; -import { sveltekit } from '@sveltejs/kit/vite'; -import { defineConfig } from 'vite'; - -export default defineConfig({ - plugins: [sveltekit()], - test: { - workspace: [ - { - extends: './vite.config.ts', - plugins: [svelteTesting()], - test: { - name: 'client', - environment: 'jsdom', - clearMocks: true, - include: ['src/**/*.svelte.{test,spec}.{js,ts}'], - exclude: ['src/lib/server/**'], - setupFiles: ['./vitest-setup-client.ts'] - } - }, - { - extends: './vite.config.ts', - test: { - name: 'server', - environment: 'node', - include: ['src/**/*.{test,spec}.{js,ts}'], - exclude: ['src/**/*.svelte.{test,spec}.{js,ts}'] - } - } - ] - } -}); diff --git a/vitest-setup-client.ts b/vitest-setup-client.ts @@ -1,18 +0,0 @@ -import '@testing-library/jest-dom/vitest'; -import { vi } from 'vitest'; - -// required for svelte5 + jsdom as jsdom does not support matchMedia -Object.defineProperty(window, 'matchMedia', { - writable: true, - enumerable: true, - value: vi.fn().mockImplementation((query) => ({ - matches: false, - media: query, - onchange: null, - addEventListener: vi.fn(), - removeEventListener: vi.fn(), - dispatchEvent: vi.fn() - })) -}); - -// add more mocks here if you need them