first commit

This commit is contained in:
Ryan Wang
2022-10-22 21:23:32 +08:00
commit e2db3ba797
18 changed files with 1553 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
+14
View File
@@ -0,0 +1,14 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
env: {
node: true,
},
};
+24
View File
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
+3
View File
@@ -0,0 +1,3 @@
# theme-vite-starter
A development starter theme with Vite Ecosystem for Halo
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
+48
View File
@@ -0,0 +1,48 @@
{
"name": "@halo-dev/theme-vite-starter",
"private": true,
"version": "0.0.0",
"description": "A development starter theme with Vite Ecosystem for Halo",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint ./src --ext .js,.cjs,.mjs,.ts,.cts,.mts --ignore-path .gitignore",
"prettier": "prettier --write './src/**/*.{js,ts,css,json,ml,yaml,html}' './templates/**/*.html'"
},
"keywords": [
"halo",
"halo-theme"
],
"homepage": "https://github.com/halo-sigs/theme-vite-starter#readme",
"bugs": {
"url": "https://github.com/halo-sigs/theme-vite-starter/issues"
},
"author": {
"name": "Halo OSS Organization",
"url": "https://github.com/halo-dev",
"email": "hi@halo.run"
},
"maintainers": [
{
"name": "Ryan Wang",
"url": "https://github.com/ruibaby",
"email": "i@ryanc.cc"
}
],
"license": "GPL-3.0",
"repository": {
"url": "https://github.com/halo-sigs/theme-vite-starter",
"type": "git"
},
"devDependencies": {
"@types/node": "16",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1",
"typescript": "^4.6.4",
"vite": "^3.1.8"
}
}
+1324
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
module.exports = {
printWidth: 120,
tabWidth: 2,
useTabs: false,
endOfLine: "lf",
};
+13
View File
@@ -0,0 +1,13 @@
apiVersion: v1alpha1
kind: Setting
metadata:
name: theme-vite-starter-setting
spec:
forms:
- group: styles
label: 样式
formSchema:
- $formkit: color
name: background_color
label: 背景颜色
value: "#f2f2f2"
+5
View File
@@ -0,0 +1,5 @@
import "./styles/main.css";
export function count(x: number, y: number) {
return x + y;
}
+7
View File
@@ -0,0 +1,7 @@
body {
background: #f2f2f2;
}
ul {
list-style: decimal;
}
+1
View File
@@ -0,0 +1 @@
/// <reference types="vite/client" />
+10
View File
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org" th:replace="modules/layout :: html(content = ~{::content})">
<th:block th:fragment="content">
<ul>
<li th:each="post : ${posts.items}">
<a th:text="${post.spec.title}" th:href="${post.status.permalink}"></a>
</li>
</ul>
</th:block>
</html>
+14
View File
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en" th:fragment="html (content)">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title th:text="${site.title}"></title>
<link rel="stylesheet" th:href="@{/assets/dist/style.css}" href="./assets/dist/style.css" />
<script th:src="@{/assets/dist/main.iife.js}"></script>
</head>
<body th:style="'background-color: '+${theme.config.styles.background_color}">
<th:block th:replace="${content}" />
</body>
</html>
+6
View File
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org" th:replace="modules/layout :: html(content = ~{::content})">
<th:block th:fragment="content">
<article th:utext="${post.content.content}"></article>
</th:block>
</html>
+17
View File
@@ -0,0 +1,17 @@
apiVersion: theme.halo.run/v1alpha1
kind: Theme
metadata:
name: theme-vite-starter
spec:
displayName: Vite Starter
author:
name: Halo OSS Organization
website: https://halo.run
description: A development starter theme with Vite Ecosystem for Halo
logo: https://halo.run/logo
website: https://github.com/halo-sigs/theme-vite-starter
repo: https://github.com/halo-sigs/theme-vite-starter.git
settingName: "theme-vite-starter-setting"
configMapName: "theme-vite-starter-configMap"
version: 1.0.0
require: 2.0.0
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"moduleResolution": "Node",
"strict": true,
"sourceMap": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["src"]
}
+16
View File
@@ -0,0 +1,16 @@
import { defineConfig } from "vite";
import { fileURLToPath } from "url";
import path from "path";
export default defineConfig({
build: {
outDir: fileURLToPath(new URL("./templates/assets/dist", import.meta.url)),
emptyOutDir: true,
lib: {
entry: path.resolve(__dirname, "src/main.ts"),
name: "main",
fileName: "main",
formats: ["iife"],
},
},
});