mirror of
https://gitee.com/mirrors/AllinSSL.git
synced 2026-03-08 07:41:10 +08:00
【新增】私有证书
This commit is contained in:
269
frontend/.kiro/specs/vite-html-to-php-plugin/design.md
Normal file
269
frontend/.kiro/specs/vite-html-to-php-plugin/design.md
Normal file
@@ -0,0 +1,269 @@
|
||||
# Design Document
|
||||
|
||||
## Overview
|
||||
|
||||
The Vite HTML to PHP Template plugin is a post-build transformation tool that converts standard HTML files into PHP template format. The plugin integrates with Vite's build lifecycle, executing after the build process completes to perform secondary transformations on generated HTML files. It uses HTML parsing to extract specific content sections and reorganizes them into a structured PHP template format compatible with template engines like ThinkPHP.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Plugin Architecture
|
||||
|
||||
The plugin follows Vite's plugin architecture pattern and implements the following hooks:
|
||||
|
||||
- **closeBundle**: Executes after the build is complete and all files are written
|
||||
- **buildEnd**: Fallback hook for error handling and cleanup
|
||||
|
||||
### Core Components
|
||||
|
||||
```
|
||||
vite-plugin-html-to-php-template/
|
||||
├── src/
|
||||
│ ├── index.ts # Main plugin entry point
|
||||
│ ├── parser.ts # HTML parsing and content extraction
|
||||
│ ├── template-generator.ts # PHP template generation
|
||||
│ ├── file-processor.ts # File system operations
|
||||
│ └── types.ts # TypeScript type definitions
|
||||
├── package.json
|
||||
├── tsconfig.json
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## Components and Interfaces
|
||||
|
||||
### Plugin Interface
|
||||
|
||||
```typescript
|
||||
interface PluginOptions {
|
||||
// Input directory containing HTML files (default: 'dist')
|
||||
inputDir?: string;
|
||||
|
||||
// Output directory for PHP templates (default: same as inputDir)
|
||||
outputDir?: string;
|
||||
|
||||
// Glob pattern for HTML files to process (default: '**/*.html')
|
||||
include?: string | string[];
|
||||
|
||||
// Glob pattern for files to exclude (default: [])
|
||||
exclude?: string | string[];
|
||||
|
||||
// Template configuration
|
||||
template?: {
|
||||
extend?: string; // Default: 'main/newMain'
|
||||
blocks?: BlockConfig; // Block name mappings
|
||||
footer?: string; // Default: 'footer2'
|
||||
};
|
||||
|
||||
// Processing options
|
||||
preserveOriginal?: boolean; // Keep original HTML files (default: false)
|
||||
encoding?: string; // File encoding (default: 'utf-8')
|
||||
}
|
||||
|
||||
interface BlockConfig {
|
||||
title?: string; // Default: 'title'
|
||||
keywords?: string; // Default: 'keywords'
|
||||
description?: string; // Default: 'description'
|
||||
csslink?: string; // Default: 'csslink'
|
||||
main?: string; // Default: 'main'
|
||||
script?: string; // Default: 'script'
|
||||
}
|
||||
```
|
||||
|
||||
### HTML Parser Interface
|
||||
|
||||
```typescript
|
||||
interface ParsedContent {
|
||||
title: string;
|
||||
keywords: string;
|
||||
description: string;
|
||||
stylesheets: string[];
|
||||
scripts: string[];
|
||||
bodyContent: string;
|
||||
}
|
||||
|
||||
interface ParserOptions {
|
||||
preserveComments?: boolean;
|
||||
minifyContent?: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
### Template Generator Interface
|
||||
|
||||
```typescript
|
||||
interface TemplateConfig {
|
||||
extend: string;
|
||||
blocks: BlockConfig;
|
||||
footer: string;
|
||||
}
|
||||
|
||||
interface GeneratedTemplate {
|
||||
content: string;
|
||||
blocks: {
|
||||
[key: string]: string;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Data Models
|
||||
|
||||
### HTML Content Extraction Model
|
||||
|
||||
The parser extracts content using the following mapping:
|
||||
|
||||
1. **Title**: `<title>` element text content
|
||||
2. **Keywords**: `<meta name="keywords" content="...">` attribute value
|
||||
3. **Description**: `<meta name="description" content="...">` attribute value
|
||||
4. **Stylesheets**: All `<link rel="stylesheet" ...>` elements (complete tags)
|
||||
5. **Scripts**: All `<script>` elements with `type="text/javascript"` or `type="module"` (complete tags)
|
||||
6. **Body Content**: Complete innerHTML of `<body>` element
|
||||
|
||||
### PHP Template Structure Model
|
||||
|
||||
```php
|
||||
<!-- 引入公共 -->
|
||||
{extend name="main/newMain"/}
|
||||
<!-- 标题 -->
|
||||
{block name="title"}[TITLE_CONTENT]{/block}
|
||||
<!-- 关键字 -->
|
||||
{block name="keywords"}[KEYWORDS_CONTENT]{/block}
|
||||
<!-- 描述 -->
|
||||
{block name="description"}[DESCRIPTION_CONTENT]{/block}
|
||||
<!-- 自定义css -->
|
||||
{block name="csslink"}
|
||||
[STYLESHEET_LINKS]
|
||||
{/block}
|
||||
<!-- 主体内容 -->
|
||||
{block name="main"}
|
||||
[BODY_CONTENT]
|
||||
{/block}
|
||||
<!-- 自定义js -->
|
||||
{block name="script"}
|
||||
[SCRIPT_TAGS]
|
||||
{/block}
|
||||
|
||||
<!-- 底部 -->
|
||||
{block name="footer2"}{/block}
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Error Categories
|
||||
|
||||
1. **File System Errors**
|
||||
- File not found
|
||||
- Permission denied
|
||||
- Disk space issues
|
||||
|
||||
2. **HTML Parsing Errors**
|
||||
- Malformed HTML
|
||||
- Missing required elements
|
||||
- Encoding issues
|
||||
|
||||
3. **Template Generation Errors**
|
||||
- Invalid template configuration
|
||||
- Content encoding issues
|
||||
|
||||
### Error Handling Strategy
|
||||
|
||||
```typescript
|
||||
class PluginError extends Error {
|
||||
constructor(
|
||||
message: string,
|
||||
public code: string,
|
||||
public file?: string,
|
||||
public cause?: Error
|
||||
) {
|
||||
super(message);
|
||||
this.name = 'ViteHtmlToPhpPluginError';
|
||||
}
|
||||
}
|
||||
|
||||
// Error codes
|
||||
enum ErrorCodes {
|
||||
FILE_NOT_FOUND = 'FILE_NOT_FOUND',
|
||||
PARSE_ERROR = 'PARSE_ERROR',
|
||||
TEMPLATE_ERROR = 'TEMPLATE_ERROR',
|
||||
CONFIG_ERROR = 'CONFIG_ERROR'
|
||||
}
|
||||
```
|
||||
|
||||
### Recovery Mechanisms
|
||||
|
||||
- **Graceful Degradation**: Continue processing other files when one fails
|
||||
- **Detailed Logging**: Provide file paths and line numbers in error messages
|
||||
- **Validation**: Validate configuration and input files before processing
|
||||
- **Rollback**: Option to preserve original files during processing
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Unit Tests
|
||||
|
||||
1. **HTML Parser Tests**
|
||||
- Test extraction of each content type
|
||||
- Test handling of missing elements
|
||||
- Test malformed HTML scenarios
|
||||
- Test different HTML structures
|
||||
|
||||
2. **Template Generator Tests**
|
||||
- Test PHP template generation
|
||||
- Test custom block configurations
|
||||
- Test content escaping and encoding
|
||||
- Test template structure validation
|
||||
|
||||
3. **File Processor Tests**
|
||||
- Test file reading/writing operations
|
||||
- Test glob pattern matching
|
||||
- Test directory creation
|
||||
- Test error handling
|
||||
|
||||
### Integration Tests
|
||||
|
||||
1. **Plugin Integration**
|
||||
- Test with Vite build process
|
||||
- Test with different Vite configurations
|
||||
- Test with various HTML structures
|
||||
- Test error scenarios in build context
|
||||
|
||||
2. **End-to-End Tests**
|
||||
- Test complete HTML to PHP conversion
|
||||
- Test with real-world HTML files
|
||||
- Test configuration variations
|
||||
- Test performance with large files
|
||||
|
||||
### Test Data
|
||||
|
||||
Create test fixtures with:
|
||||
- Simple HTML files
|
||||
- Complex HTML with multiple scripts/styles
|
||||
- Malformed HTML files
|
||||
- HTML files with missing elements
|
||||
- HTML files with special characters
|
||||
- Large HTML files for performance testing
|
||||
|
||||
## Implementation Considerations
|
||||
|
||||
### Performance
|
||||
|
||||
- **Streaming**: Use streaming for large files
|
||||
- **Parallel Processing**: Process multiple files concurrently
|
||||
- **Memory Management**: Avoid loading entire files into memory when possible
|
||||
- **Caching**: Cache parsed templates for repeated builds
|
||||
|
||||
### Security
|
||||
|
||||
- **Path Traversal**: Validate file paths to prevent directory traversal
|
||||
- **Content Sanitization**: Ensure extracted content doesn't contain malicious code
|
||||
- **File Permissions**: Respect file system permissions
|
||||
|
||||
### Compatibility
|
||||
|
||||
- **Node.js Versions**: Support Node.js 16+
|
||||
- **Vite Versions**: Support Vite 4+ and 5+
|
||||
- **HTML Standards**: Support HTML5 and XHTML
|
||||
- **Encoding**: Support UTF-8 and other common encodings
|
||||
|
||||
### Extensibility
|
||||
|
||||
- **Plugin Hooks**: Allow custom processing hooks
|
||||
- **Template Customization**: Support custom template formats
|
||||
- **Content Processors**: Allow custom content transformation functions
|
||||
- **Output Formats**: Support different template engine formats
|
||||
75
frontend/.kiro/specs/vite-html-to-php-plugin/requirements.md
Normal file
75
frontend/.kiro/specs/vite-html-to-php-plugin/requirements.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Requirements Document
|
||||
|
||||
## Introduction
|
||||
|
||||
This feature involves creating a Vite plugin that converts standard HTML files into PHP template format. The plugin should execute after the build process is complete to perform secondary transformations on the generated HTML files. The target PHP template format follows a specific structure with blocks for different content sections (title, keywords, description, CSS links, main content, and scripts).
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement 1
|
||||
|
||||
**User Story:** As a developer, I want to automatically convert HTML files to PHP template format during the build process, so that I can integrate static HTML builds with PHP-based template systems.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN the Vite build process completes THEN the plugin SHALL automatically process HTML files in the output directory
|
||||
2. WHEN processing HTML files THEN the plugin SHALL extract content from specific HTML elements and place them in corresponding PHP template blocks
|
||||
3. WHEN the plugin runs THEN it SHALL execute as a post-build hook to ensure all HTML files are fully generated before processing
|
||||
|
||||
### Requirement 2
|
||||
|
||||
**User Story:** As a developer, I want the plugin to extract and organize different types of content from HTML files, so that the resulting PHP template has properly structured blocks.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN processing an HTML file THEN the plugin SHALL extract the title element content and place it in a `{block name="title"}` block
|
||||
2. WHEN processing meta tags THEN the plugin SHALL extract keywords meta content and place it in a `{block name="keywords"}` block
|
||||
3. WHEN processing meta tags THEN the plugin SHALL extract description meta content and place it in a `{block name="description"}` block
|
||||
4. WHEN processing link elements THEN the plugin SHALL extract stylesheet links and place them in a `{block name="csslink"}` block
|
||||
5. WHEN processing script elements THEN the plugin SHALL extract JavaScript content (both inline and external) and place it in a `{block name="script"}` block
|
||||
6. WHEN processing the body element THEN the plugin SHALL extract all body content and place it in a `{block name="main"}` block
|
||||
|
||||
### Requirement 3
|
||||
|
||||
**User Story:** As a developer, I want the plugin to handle different types of script and link elements correctly, so that all assets are properly extracted and organized.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN encountering script elements with `type="text/javascript"` THEN the plugin SHALL extract and include them in the script block
|
||||
2. WHEN encountering script elements with `type="module"` THEN the plugin SHALL extract and include them in the script block
|
||||
3. WHEN encountering link elements with `rel="stylesheet"` THEN the plugin SHALL extract and include them in the csslink block
|
||||
4. WHEN processing script or link elements THEN the plugin SHALL preserve all attributes and content exactly as they appear in the original HTML
|
||||
|
||||
### Requirement 4
|
||||
|
||||
**User Story:** As a developer, I want the generated PHP template to follow a consistent structure, so that it integrates seamlessly with existing PHP template systems.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN generating the PHP template THEN the plugin SHALL start with the extend directive `{extend name="main/newMain"/}`
|
||||
2. WHEN generating blocks THEN the plugin SHALL use the exact block syntax `{block name="blockname"}content{/block}`
|
||||
3. WHEN generating the template THEN the plugin SHALL include HTML comments to identify each section
|
||||
4. WHEN generating the template THEN the plugin SHALL end with the footer block `{block name="footer2"}{/block}`
|
||||
5. WHEN no content exists for a specific block THEN the plugin SHALL still create the block structure but leave it empty
|
||||
|
||||
### Requirement 5
|
||||
|
||||
**User Story:** As a developer, I want the plugin to be configurable, so that I can customize its behavior for different projects.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN initializing the plugin THEN it SHALL accept configuration options for input/output directories
|
||||
2. WHEN configured THEN the plugin SHALL allow specifying which HTML files to process (via glob patterns)
|
||||
3. WHEN configured THEN the plugin SHALL allow customizing the PHP template structure and block names
|
||||
4. WHEN no configuration is provided THEN the plugin SHALL use sensible defaults for all options
|
||||
|
||||
### Requirement 6
|
||||
|
||||
**User Story:** As a developer, I want the plugin to handle errors gracefully, so that build failures are informative and recoverable.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN encountering malformed HTML THEN the plugin SHALL log a warning and continue processing other files
|
||||
2. WHEN file system operations fail THEN the plugin SHALL throw descriptive errors with file paths and operation details
|
||||
3. WHEN HTML parsing fails THEN the plugin SHALL provide clear error messages indicating the problematic file and location
|
||||
4. WHEN the plugin encounters unexpected content THEN it SHALL handle it gracefully without breaking the build process
|
||||
114
frontend/.kiro/specs/vite-html-to-php-plugin/tasks.md
Normal file
114
frontend/.kiro/specs/vite-html-to-php-plugin/tasks.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# Implementation Plan
|
||||
|
||||
- [x] 1. Set up project structure and core interfaces
|
||||
- Create directory structure for the plugin with src/, tests/, and configuration files
|
||||
- Define TypeScript interfaces for plugin options, parsed content, and template configuration
|
||||
- Set up package.json with dependencies (jsdom, glob, vite) and build scripts
|
||||
- Configure tsconfig.json for TypeScript compilation
|
||||
- _Requirements: 1.1, 5.1, 5.4_
|
||||
|
||||
- [x] 2. Implement HTML content parser
|
||||
- [x] 2.1 Create HTML parsing utilities
|
||||
- Write functions to parse HTML using jsdom and extract title, meta tags, and body content
|
||||
- Implement content extraction for title element, keywords meta, and description meta
|
||||
- Create unit tests for HTML parsing with various HTML structures
|
||||
- _Requirements: 2.1, 2.2, 2.3_
|
||||
|
||||
- [x] 2.2 Implement asset extraction functionality
|
||||
- Write functions to extract stylesheet link elements with proper attribute preservation
|
||||
- Implement script element extraction for both type="text/javascript" and type="module"
|
||||
- Create tests for asset extraction with different script and link configurations
|
||||
- _Requirements: 2.4, 2.5, 3.1, 3.2, 3.3, 3.4_
|
||||
|
||||
- [x] 2.3 Add error handling for HTML parsing
|
||||
- Implement graceful handling of malformed HTML with warning logs
|
||||
- Add validation for required HTML elements and provide fallbacks
|
||||
- Create tests for error scenarios including missing elements and invalid HTML
|
||||
- _Requirements: 6.1, 6.3_
|
||||
|
||||
- [x] 3. Create PHP template generator
|
||||
- [x] 3.1 Implement template structure generation
|
||||
- Write functions to generate PHP template with extend directive and block structure
|
||||
- Implement block content insertion for title, keywords, description, csslink, main, and script blocks
|
||||
- Create tests for template generation with various content combinations
|
||||
- _Requirements: 4.1, 4.2, 4.3, 4.4, 4.5_
|
||||
|
||||
- [x] 3.2 Add template customization support
|
||||
- Implement configuration options for custom block names and template structure
|
||||
- Add support for custom extend directive and footer block configuration
|
||||
- Create tests for template customization with different configuration options
|
||||
- _Requirements: 5.3_
|
||||
|
||||
- [x] 4. Implement file processing operations
|
||||
- [x] 4.1 Create file system utilities
|
||||
- Write functions for reading HTML files with proper encoding support
|
||||
- Implement file writing operations for generated PHP templates
|
||||
- Add directory creation and file path validation utilities
|
||||
- Create tests for file operations including error scenarios
|
||||
- _Requirements: 6.2_
|
||||
|
||||
- [x] 4.2 Implement glob pattern matching
|
||||
- Add support for include/exclude glob patterns to filter HTML files
|
||||
- Implement file discovery functionality using glob patterns
|
||||
- Create tests for pattern matching with various file structures
|
||||
- _Requirements: 5.2_
|
||||
|
||||
- [x] 5. Create main plugin implementation
|
||||
- [x] 5.1 Implement Vite plugin interface
|
||||
- Create main plugin function that returns Vite plugin object
|
||||
- Implement closeBundle hook to execute after build completion
|
||||
- Add buildEnd hook for error handling and cleanup
|
||||
- Create integration tests with Vite build process
|
||||
- _Requirements: 1.1, 1.3_
|
||||
|
||||
- [x] 5.2 Integrate all components
|
||||
- Wire together HTML parser, template generator, and file processor
|
||||
- Implement main processing workflow that handles multiple HTML files
|
||||
- Add configuration validation and default option handling
|
||||
- Create end-to-end tests with complete HTML to PHP conversion
|
||||
- _Requirements: 1.2, 5.4_
|
||||
|
||||
- [ ] 6. Add comprehensive error handling
|
||||
- [x] 6.1 Implement error classes and codes
|
||||
- Create custom error classes with specific error codes for different failure types
|
||||
- Add detailed error messages with file paths and operation context
|
||||
- Implement error recovery mechanisms for continuing processing after failures
|
||||
- Create tests for all error scenarios and recovery mechanisms
|
||||
- _Requirements: 6.1, 6.2, 6.3, 6.4_
|
||||
|
||||
- [x] 6.2 Add logging and debugging support
|
||||
- Implement structured logging for processing steps and errors
|
||||
- Add debug mode with verbose output for troubleshooting
|
||||
- Create performance monitoring for processing large files
|
||||
- Add tests for logging functionality
|
||||
- _Requirements: 6.1, 6.3_
|
||||
|
||||
- [ ] 7. Create comprehensive test suite
|
||||
- [-] 7.1 Write unit tests for all components
|
||||
- Create test fixtures with various HTML file structures and edge cases
|
||||
- Write comprehensive tests for HTML parser with malformed and complex HTML
|
||||
- Add tests for template generator with different configurations
|
||||
- Test file processor with various file system scenarios
|
||||
- _Requirements: All requirements validation_
|
||||
|
||||
- [ ] 7.2 Implement integration and performance tests
|
||||
- Create integration tests with real Vite projects and build processes
|
||||
- Add performance tests with large HTML files and multiple file processing
|
||||
- Test plugin with different Vite configurations and environments
|
||||
- Create tests for concurrent file processing
|
||||
- _Requirements: All requirements validation_
|
||||
|
||||
- [ ] 8. Add documentation and examples
|
||||
- [ ] 8.1 Create comprehensive README
|
||||
- Write installation and usage instructions with code examples
|
||||
- Document all configuration options with detailed explanations
|
||||
- Add troubleshooting guide for common issues
|
||||
- Include examples of input HTML and output PHP templates
|
||||
- _Requirements: 5.1, 5.2, 5.3_
|
||||
|
||||
- [ ] 8.2 Create example projects
|
||||
- Build example Vite project demonstrating plugin usage
|
||||
- Create examples with different HTML structures and configurations
|
||||
- Add example showing integration with PHP template systems
|
||||
- Document best practices for using the plugin
|
||||
- _Requirements: All requirements demonstration_
|
||||
23
frontend/.kiro/steering/product.md
Normal file
23
frontend/.kiro/steering/product.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Product Overview
|
||||
|
||||
This is a Baota (宝塔) Turborepo monorepo containing multiple web applications and shared packages for domain management, SSL certificate management, and cloud control systems.
|
||||
|
||||
## Key Applications
|
||||
|
||||
- **allin-ssl**: SSL certificate management application
|
||||
- **cloud-control**: Cloud infrastructure control panel
|
||||
- **domain-management-backend**: Domain management backend interface
|
||||
- **domain-official**: Official domain registration website
|
||||
- **naive-template**: Reusable template based on Naive UI
|
||||
|
||||
## Target Users
|
||||
|
||||
System administrators and developers managing web infrastructure, SSL certificates, and domain registrations through web-based control panels.
|
||||
|
||||
## Core Features
|
||||
|
||||
- SSL certificate lifecycle management
|
||||
- Domain registration and management
|
||||
- Cloud infrastructure monitoring and control
|
||||
- Multi-language support (i18n)
|
||||
- Real-time monitoring and analytics
|
||||
84
frontend/.kiro/steering/structure.md
Normal file
84
frontend/.kiro/steering/structure.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Project Structure
|
||||
|
||||
## Monorepo Organization
|
||||
|
||||
```
|
||||
├── apps/ # Applications
|
||||
├── packages/ # Shared packages
|
||||
├── plugin/ # Custom Vite plugins
|
||||
├── scripts/ # Build and utility scripts
|
||||
├── types/ # Global type definitions
|
||||
└── environment/ # Environment configurations
|
||||
```
|
||||
|
||||
## Application Structure (`apps/`)
|
||||
|
||||
Each app follows a consistent structure:
|
||||
|
||||
```
|
||||
apps/app-name/
|
||||
├── src/
|
||||
│ ├── api/ # API layer and HTTP clients
|
||||
│ ├── assets/ # Static assets (images, icons, fonts)
|
||||
│ ├── components/ # Reusable Vue components
|
||||
│ ├── config/ # App configuration
|
||||
│ ├── lib/ # App-specific utilities
|
||||
│ ├── locales/ # i18n translation files
|
||||
│ ├── router/ # Vue Router configuration
|
||||
│ ├── styles/ # Global styles and themes
|
||||
│ ├── types/ # TypeScript type definitions
|
||||
│ ├── views/ # Page components
|
||||
│ ├── App.tsx # Root component
|
||||
│ └── main.ts # Application entry point
|
||||
├── public/ # Public static files
|
||||
├── types/ # Generated type definitions
|
||||
├── mock/ # Mock data for development
|
||||
├── package.json
|
||||
├── vite.config.ts
|
||||
└── tsconfig.json
|
||||
```
|
||||
|
||||
## Shared Packages (`packages/`)
|
||||
|
||||
- **@baota/utils**: Common utilities (browser, data, string, crypto, etc.)
|
||||
- **@baota/vue/**: Vue-specific packages
|
||||
- `hooks/`: Composable functions
|
||||
- `i18n/`: Internationalization utilities
|
||||
- `naive-ui/`: Naive UI components and themes
|
||||
- `pinia/`: State management utilities
|
||||
- `router/`: Router utilities
|
||||
- `vite/`: Vite configuration helpers
|
||||
|
||||
## Custom Plugins (`plugin/`)
|
||||
|
||||
- **vite-plugin-i18n**: Translation file generation
|
||||
- **vite-plugin-ftp-sync**: FTP deployment automation
|
||||
- **vite-plugin-turborepo-deploy**: Git synchronization
|
||||
- **vite-plugin-html-to-php-template**: HTML to PHP conversion
|
||||
- **vite-plugin-timestamp-cache**: Cache busting utilities
|
||||
|
||||
## Naming Conventions
|
||||
|
||||
- **Files**: kebab-case for directories, camelCase for TypeScript files
|
||||
- **Components**: PascalCase for Vue components (`.tsx` preferred)
|
||||
- **Views**: Organized by feature in `src/views/`
|
||||
- **API**: Grouped by domain in `src/api/`
|
||||
- **Types**: Descriptive names ending in `.d.ts`
|
||||
|
||||
## Path Aliases
|
||||
|
||||
Standard aliases used across apps:
|
||||
- `@/`: `src/` directory
|
||||
- `@api/`: `src/api/`
|
||||
- `@components/`: `src/components/`
|
||||
- `@views/`: `src/views/`
|
||||
- `@assets/`: `src/assets/`
|
||||
- `@types/`: `src/types/`
|
||||
- Feature-specific aliases (e.g., `@login/`, `@certManage/`)
|
||||
|
||||
## Architecture Patterns
|
||||
|
||||
- **MVC Separation**: Separate state (stores), controllers (composables), and views
|
||||
- **Composition API**: Use `<script setup>` syntax
|
||||
- **TSX Components**: Prefer `.tsx` over `.vue` for complex components
|
||||
- **Feature-based Organization**: Group related files by feature/domain
|
||||
60
frontend/.kiro/steering/tech.md
Normal file
60
frontend/.kiro/steering/tech.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# Technology Stack
|
||||
|
||||
## Build System & Package Management
|
||||
- **Monorepo**: Turborepo for build orchestration and caching
|
||||
- **Package Manager**: pnpm (v10.14.0+)
|
||||
- **Node.js**: >= 18
|
||||
- **Build Tool**: Vite for fast development and optimized builds
|
||||
|
||||
## Frontend Stack
|
||||
- **Framework**: Vue 3 with Composition API and `<script setup>` syntax
|
||||
- **Language**: TypeScript (ES2022 target)
|
||||
- **Syntax**: TSX for Vue components (`.tsx` files preferred)
|
||||
- **UI Library**: Naive UI
|
||||
- **Styling**: Tailwind CSS + CSS Modules
|
||||
- **State Management**: Pinia with persistence plugin
|
||||
- **Routing**: Vue Router
|
||||
- **Utilities**: VueUse, Axios for HTTP requests
|
||||
|
||||
## Development Tools
|
||||
- **Linting**: ESLint with Vue and TypeScript support
|
||||
- **Formatting**: Prettier
|
||||
- **Testing**: Vitest
|
||||
- **Type Checking**: vue-tsc
|
||||
- **Auto-imports**: unplugin-auto-import for Vue APIs
|
||||
- **Component Auto-import**: unplugin-vue-components with Naive UI resolver
|
||||
|
||||
## Custom Plugins
|
||||
- **@baota/vite-plugin-i18n**: Internationalization generator
|
||||
- **@baota/vite-plugin-ftp-sync**: FTP deployment synchronization
|
||||
- **@baota/vite-plugin-turborepo-deploy**: Git project synchronization
|
||||
|
||||
## Common Commands
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
# Development
|
||||
pnpm dev # Start all apps
|
||||
pnpm dev --filter app-name # Start specific app
|
||||
|
||||
# Building
|
||||
pnpm build # Build all apps
|
||||
pnpm build --filter app-name # Build specific app
|
||||
|
||||
# Testing & Quality
|
||||
pnpm test # Run tests
|
||||
pnpm lint # Lint all code
|
||||
pnpm check-types # Type checking
|
||||
pnpm format # Format code
|
||||
|
||||
# Utilities
|
||||
pnpm clear # Clean temp files
|
||||
pnpm sync # Sync project files
|
||||
```
|
||||
|
||||
## Workspace Structure
|
||||
- Apps use `workspace:*` dependencies for internal packages
|
||||
- Shared packages under `@baota/` namespace
|
||||
- All packages support both ESM and CJS exports
|
||||
Reference in New Issue
Block a user