feat: универсальный шаблон проектов контура Raisa
- base_templates/: шаблоны платформы fastapi, streamlit, airflow без изменений - contour/: платформа, подтверждённые версии, грабли, профили 4 типов приложений - project-kit/: SDD (S/M/L, delta/spec/plan, constitution, DoR/DoD) + grill, критик тестов, UX gate, handoff; один канон AGENTS.md для Cursor и Claude Code - scripts/init_project.sh: сборка нового проекта или подключение kit к существующему - docs/decisions/0001: что перенесено из elite_vibecoding и dmukp и почему Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139EkK4ShEj52pM9Z5UCwM1
This commit is contained in:
1
base_templates/fastapi/web/.env
Normal file
1
base_templates/fastapi/web/.env
Normal file
@@ -0,0 +1 @@
|
||||
REACT_APP_API_URL=http://localhost:8000
|
||||
91
base_templates/fastapi/web/biome.json
Normal file
91
base_templates/fastapi/web/biome.json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||
"vcs": {
|
||||
"enabled": true,
|
||||
"clientKind": "git",
|
||||
"useIgnoreFile": true
|
||||
},
|
||||
"files": {
|
||||
"ignoreUnknown": true,
|
||||
"ignore": ["node_modules"]
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"lineWidth": 140,
|
||||
"formatWithErrors": true
|
||||
},
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"ignore": ["*.json"],
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"a11y": {
|
||||
"useButtonType": "off",
|
||||
"noSvgWithoutTitle": "off"
|
||||
},
|
||||
"complexity": {
|
||||
"noForEach": "off",
|
||||
"noUselessTypeConstraint": "warn"
|
||||
},
|
||||
"correctness": {
|
||||
"noUnusedVariables": "error",
|
||||
"noUnusedImports": "error",
|
||||
"useExhaustiveDependencies": "info"
|
||||
},
|
||||
"nursery": {
|
||||
"noCommonJs": "error",
|
||||
"noDuplicateElseIf": "error",
|
||||
"noDuplicateProperties": "error",
|
||||
"noNestedTernary": "error",
|
||||
"useAtIndex": "error",
|
||||
"useCollapsedIf": "error",
|
||||
"useConsistentCurlyBraces": "error"
|
||||
},
|
||||
"performance": {
|
||||
"noDelete": "off",
|
||||
"noAccumulatingSpread": "off"
|
||||
},
|
||||
"style": {
|
||||
"useDefaultSwitchClause": "error",
|
||||
"useForOf": "error",
|
||||
"useFragmentSyntax": "error",
|
||||
"useConsistentArrayType": "error",
|
||||
"useShorthandAssign": "error"
|
||||
},
|
||||
"suspicious": {
|
||||
"noConsole": "warn",
|
||||
"noEmptyBlockStatements": "error",
|
||||
"noEvolvingTypes": "error",
|
||||
"noExplicitAny": "warn",
|
||||
"noSkippedTests": "warn",
|
||||
"useAwait": "error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "single",
|
||||
"jsxQuoteStyle": "single",
|
||||
"bracketSameLine": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"json": {
|
||||
"parser": {
|
||||
"allowComments": true
|
||||
}
|
||||
},
|
||||
"css": {
|
||||
"formatter": {
|
||||
"enabled": true
|
||||
},
|
||||
"parser": {
|
||||
"cssModules": true
|
||||
}
|
||||
}
|
||||
}
|
||||
27
base_templates/fastapi/web/package.json
Normal file
27
base_templates/fastapi/web/package.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "rsbuild build",
|
||||
"start": "rsbuild dev --open",
|
||||
"preview": "rsbuild preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"raisa-ui": "^1.0.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-daisyui": "^5.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@rsbuild/core": "^1.2.4",
|
||||
"@rsbuild/plugin-react": "^1.1.0",
|
||||
"@types/react": "^18.3.1",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"typescript": "^5.7.3",
|
||||
"daisyui": "^4.12.10",
|
||||
"tailwindcss": "^3.4.13"
|
||||
}
|
||||
}
|
||||
5
base_templates/fastapi/web/postcss.config.cjs
Normal file
5
base_templates/fastapi/web/postcss.config.cjs
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
}
|
||||
}
|
||||
0
base_templates/fastapi/web/public/.gitkeep
Normal file
0
base_templates/fastapi/web/public/.gitkeep
Normal file
13
base_templates/fastapi/web/public/index.html
Normal file
13
base_templates/fastapi/web/public/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru-RU">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<title>Пример React-приложения</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
28
base_templates/fastapi/web/rsbuild.config.ts
Normal file
28
base_templates/fastapi/web/rsbuild.config.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { defineConfig, loadEnv } from '@rsbuild/core';
|
||||
import { pluginReact } from '@rsbuild/plugin-react';
|
||||
|
||||
const { publicVars, rawPublicVars } = loadEnv({prefixes: ['REACT_APP_']});
|
||||
|
||||
export default defineConfig({
|
||||
server: {
|
||||
base: (rawPublicVars['REACT_APP_ROOT_PATH'] !== undefined) ? rawPublicVars['REACT_APP_ROOT_PATH'] : '/'
|
||||
},
|
||||
output: {
|
||||
filename: {
|
||||
js: '[name]_script.[contenthash:8].js',
|
||||
css: '[name]_style.[contenthash:8].css',
|
||||
},
|
||||
assetPrefix: (rawPublicVars['REACT_APP_ROOT_PATH'] !== undefined) ? rawPublicVars['REACT_APP_ROOT_PATH'] : './'
|
||||
},
|
||||
html: {
|
||||
template: './public/index.html',
|
||||
},
|
||||
source: {
|
||||
include: [{ not: /[\\/]core-js[\\/]/ }],
|
||||
define: {
|
||||
...publicVars,
|
||||
'process.env': JSON.stringify(rawPublicVars),
|
||||
}
|
||||
},
|
||||
plugins: [pluginReact()],
|
||||
});
|
||||
40
base_templates/fastapi/web/src/App.tsx
Normal file
40
base_templates/fastapi/web/src/App.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Config } from './conf/config';
|
||||
import { Card } from 'react-daisyui';
|
||||
|
||||
const App = () => {
|
||||
const [apiResponse, setApiResponse] = useState<{
|
||||
date_with_time: string,
|
||||
text: string
|
||||
}|null>(null);
|
||||
|
||||
// Загрузка данных с сервера
|
||||
useEffect(() => {
|
||||
|
||||
fetch(`${Config.API_URL}/api`, {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
method: 'GET'
|
||||
})
|
||||
.then(async (response) => {
|
||||
setApiResponse(await response.json())
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Ошибка при получении данных с api:', error);
|
||||
alert("Ошибка при получении данных с api");
|
||||
})
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className='flex items-center justify-center absolute inset-0'>
|
||||
<Card className="flex flex-col gap-2 border-[2px] items-center justify-center border-primary rounded-md p-6" style={{ width: '50vw', height: '200px' }}>
|
||||
<h1>Шаблон приложения Fast API</h1>
|
||||
<p>Время: {(apiResponse?.date_with_time) ? new Date(apiResponse?.date_with_time).toISOString() : "Нет данных по времени"}, Текст: {apiResponse?.text}</p>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
6
base_templates/fastapi/web/src/conf/config.ts
Normal file
6
base_templates/fastapi/web/src/conf/config.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
//@ts-ignore
|
||||
const environment = process.env;
|
||||
|
||||
export class Config {
|
||||
static API_URL: string = environment.REACT_APP_API_URL ?? environment.REACT_APP_ROOT_PATH ?? '';
|
||||
}
|
||||
1
base_templates/fastapi/web/src/env.d.ts
vendored
Normal file
1
base_templates/fastapi/web/src/env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="@rsbuild/core/types" />
|
||||
17
base_templates/fastapi/web/src/index.css
Normal file
17
base_templates/fastapi/web/src/index.css
Normal file
@@ -0,0 +1,17 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
||||
14
base_templates/fastapi/web/src/index.tsx
Normal file
14
base_templates/fastapi/web/src/index.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
|
||||
const rootEl = document.getElementById('root');
|
||||
if (rootEl) {
|
||||
const root = ReactDOM.createRoot(rootEl);
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
);
|
||||
}
|
||||
43
base_templates/fastapi/web/tailwind.config.js
Normal file
43
base_templates/fastapi/web/tailwind.config.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
"./src/**/*.{html,js,jsx,ts,tsx}",
|
||||
"node_modules/daisyui/dist/**/*.js",
|
||||
"node_modules/react-daisyui/dist/**/*.js",
|
||||
"node_modules/raisa-ui/dist/**/*.js"
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [require('daisyui')],
|
||||
daisyui: {
|
||||
themes: [
|
||||
{
|
||||
rshb: {
|
||||
...require('daisyui/src/theming/themes')['light'],
|
||||
|
||||
"primary": "#171A1C",
|
||||
"primary-content": "#fcfcfd",
|
||||
"secondary": "#ECEDEF",
|
||||
"secondary-content": "#687178",
|
||||
"accent": "#8ecaff",
|
||||
"accent-content": "#fcfcfd",
|
||||
"neutral": "#ecedef",
|
||||
"neutral-content": "#171A1C",
|
||||
"base-100": "#FCFCFD",
|
||||
"base-200": "#F6F7F8",
|
||||
"base-300": "#ECEDEF",
|
||||
"base-content": "#171A1C",
|
||||
"info": "#0894FF",
|
||||
"info-content": "#E3E5E8",
|
||||
"success": "#39B33D",
|
||||
"success-content": "#E3E5E8",
|
||||
"warning": "#E6B200",
|
||||
"warning-content": "#fcfcfd",
|
||||
"error": "#FF371A",
|
||||
"error-content": "#fcfcfd",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
23
base_templates/fastapi/web/tsconfig.json
Normal file
23
base_templates/fastapi/web/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["DOM", "ES2020"],
|
||||
"jsx": "react-jsx",
|
||||
"target": "ES2020",
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true,
|
||||
"useDefineForClassFields": true,
|
||||
|
||||
/* modules */
|
||||
"module": "ESNext",
|
||||
"isolatedModules": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "Bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
|
||||
/* type checking */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user