init astro template

This commit is contained in:
熊潇 2025-04-28 22:43:09 +08:00
commit 96b752b0c5
15 changed files with 4924 additions and 0 deletions

13
.cnb.yml Normal file
View File

@ -0,0 +1,13 @@
# .cnb.yml
$:
vscode:
- docker:
image: docker.cnb.cool/kevisual/dev-env:latest
services:
- vscode
- docker
imports: https://cnb.cool/kevisual/env/-/blob/main/env.yml
# 开发环境启动后会执行的任务
stages:
- name: pnpm install
script: pnpm install

22
.github/wrokflows/git-sync.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Sync to CNB
on: [push]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sync to CNB Repository
run: |
docker run --rm \
-v ${{ github.workspace }}:${{ github.workspace }} \
-w ${{ github.workspace }} \
-e PLUGIN_TARGET_URL="https://cnb.cool/kevisual/astro-template.git" \
-e PLUGIN_AUTH_TYPE="https" \
-e PLUGIN_USERNAME="cnb" \
-e PLUGIN_PASSWORD=${{ secrets.GIT_PASSWORD }} \
-e PLUGIN_SYNC_MODE="rebase" \
tencentcom/git-sync

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
node_modules
.DS_Store
.astro
dist

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "packages/components"]
path = packages/components
url = https://git.xiongxiao.me/kevisual/components.git

3
.npmrc Normal file
View File

@ -0,0 +1,3 @@
//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN}
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
ignore-workspace-root-check=true

1
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1 @@
{}

14
astro.config.mjs Normal file
View File

@ -0,0 +1,14 @@
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import react from '@astrojs/react';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
// ...
integrations: [mdx(), react()],
vite: {
plugins: [tailwindcss()],
},
});

47
package.json Normal file
View File

@ -0,0 +1,47 @@
{
"name": "@kevisual/astro-template",
"version": "0.0.1",
"description": "",
"main": "index.js",
"basename": "/",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"pub": "envision deploy ./dist -k vite-react -v 0.0.1",
"git:submodule": "git submodule update --init --recursive"
},
"keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
"license": "MIT",
"type": "module",
"dependencies": {
"@astrojs/mdx": "^4.2.5",
"@astrojs/react": "^4.2.5",
"@kevisual/query": "^0.0.17",
"@tailwindcss/vite": "^4.1.4",
"astro": "^5.7.7",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"lodash-es": "^4.17.21",
"lucide-react": "^0.503.0",
"nanoid": "^5.1.5",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-toastify": "^11.0.5",
"zustand": "^5.0.3"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"tailwindcss": "^4.1.4",
"commander": "^13.1.0",
"dotenv": "^16.5.0",
"inquire": "^0.4.8",
"@kevisual/types": "^0.0.7",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2"
},
"packageManager": "pnpm@10.10.0"
}

4741
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

4
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,4 @@
packages:
- packages/*
- apps/*
- submodules/*

3
src/components/Test.tsx Normal file
View File

@ -0,0 +1,3 @@
export const Test = () => {
return <div>Test</div>;
};

3
src/modules/query.ts Normal file
View File

@ -0,0 +1,3 @@
import { Query } from '@kevisual/query';
export const query = new Query();

49
src/pages/index.astro Normal file
View File

@ -0,0 +1,49 @@
---
// import { query } from '@/modules/query.ts';
console.log('Hello from index.astro');
import { Test } from '@/components/Test.tsx';
import '../styles/global.css';
---
<html lang='en'>
<head>
<title>My Homepage</title>
</head>
<body>
<h1>Welcome to my website!</h1>
<div class='bg-amber-50 w-20 h-20 rounded-full'></div>
<div id='root'></div>
<Test client:only />
<script type='importmap' data-vite-ignore is:inline>
{
"imports": {
"react": "https://esm.sh/react@19.1.0",
"react-dom": "https://esm.sh/react-dom@19.1.0/client.js",
"react-toastify": "https://esm.sh/react-toastify@11.0.5"
}
}
</script>
<script type='module' data-vite-ignore is:inline>
import { Button, message } from 'https://esm.sh/antd?standalone';
import React from 'react';
import { ToastContainer, toast } from 'react-toastify';
import { createRoot } from 'react-dom';
setTimeout(() => {
toast.loading('Hello from index.astro');
window.toast = toast;
console.log('message', toast);
}, 1000);
console.log('Hello from index.astro', Button);
const root = document.getElementById('root');
const render = createRoot(root);
const App = () => {
const button = React.createElement(Button, null, 'Hello');
const messageEl = React.createElement(ToastContainer, null, 'Hello');
const wrapperMessage = React.createElement('div', null, [button, messageEl]);
return wrapperMessage;
};
// render.render(React.createElement(Button, null, 'Hello'), root);
render.render(App(), root);
</script>
</body>
</html>

1
src/styles/global.css Normal file
View File

@ -0,0 +1 @@
@import 'tailwindcss';

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"extends": "@kevisual/types/json/frontend.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
},
},
"include": [
"src/**/*",
],
}