mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
chore: structure refactor, linting, and monorepo setup (#629)
* chore: use monorepo to manage demo, test and other applications and internal packages * style: add eslint support and lint code * chore: refactor project structure and add versioning package replace of fixit-releaser * chore(deps-dev): replace husky with simple-git-hooks * Potential fix for code scanning alert no. 13: Shell command built from environment values * chore(deps-dev): update the final fixit-releaser version * docs: update contributing guidelines for new structure and commands --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
@@ -17,21 +17,24 @@ FixIt 是一个面向 Hugo 静态网站生成器的现代化、响应式主题
|
||||
|
||||
```
|
||||
FixIt/
|
||||
├── apps/ # 最小化站点
|
||||
│ ├── demo/ # 演示站点
|
||||
│ └── test/ # 测试站点
|
||||
├── archetypes/ # 内容模板
|
||||
├── assets/ # 主题资源文件
|
||||
│ ├── css/ # SCSS 样式文件
|
||||
│ ├── js/ # JavaScript 文件
|
||||
│ ├── images/ # 图像资源
|
||||
│ └── lib/ # 第三方库
|
||||
├── demo/ # 演示站点
|
||||
├── i18n/ # 国际化翻译文件
|
||||
├── layouts/ # Hugo 模板文件
|
||||
│ ├── _markup/ # Hugo 渲染钩子
|
||||
│ ├── _partials/ # 可复用模板组件
|
||||
│ └── _shortcodes/ # 自定义短代码
|
||||
├── packages/ # 主题相关包
|
||||
├── static/ # 静态文件
|
||||
├── test/ # 测试站点内容
|
||||
└── hugo.toml # 主题默认配置
|
||||
├── hugo.toml # 主题默认配置
|
||||
└── package.json # npm 脚本和依赖
|
||||
```
|
||||
|
||||
## SCSS/CSS 编码规范
|
||||
@@ -81,7 +84,7 @@ FixIt/
|
||||
```scss
|
||||
.element {
|
||||
color: $global-font-color;
|
||||
|
||||
|
||||
[data-theme='dark'] & {
|
||||
color: $global-font-color-dark;
|
||||
}
|
||||
@@ -121,29 +124,21 @@ FixIt/
|
||||
```javascript
|
||||
// 使用 ES6 类
|
||||
export default class Util {
|
||||
/**
|
||||
* 工具函数示例
|
||||
* @param {String} text 要复制的文本
|
||||
* @returns {Promise} 返回 Promise
|
||||
*/
|
||||
copyText(text) {
|
||||
if (navigator.clipboard) {
|
||||
return navigator.clipboard.writeText(text);
|
||||
}
|
||||
// 降级方案...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
// 主题类组织
|
||||
class FixIt {
|
||||
constructor() {
|
||||
this.config = window.config;
|
||||
this.util = new Util();
|
||||
this.config = window.config
|
||||
this.util = new Util()
|
||||
}
|
||||
|
||||
|
||||
init() {
|
||||
this.initTheme();
|
||||
this.initComponents();
|
||||
this.initTheme()
|
||||
this.initComponents()
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -226,9 +221,13 @@ class FixIt {
|
||||
2. **开发命令**:
|
||||
|
||||
```bash
|
||||
pnpm dev # 启动开发服务器
|
||||
pnpm test # 运行测试环境
|
||||
pnpm build # 构建 Demo
|
||||
pnpm dev:demo # 启动 demo 站点开发服务器
|
||||
pnpm dev:test # 启动 test 站点开发服务器
|
||||
pnpm dev:docs # 启动文档开发服务器(需有 fixit-docs 作为同级目录)
|
||||
pnpm build:demo # 构建 demo 站点
|
||||
pnpm build:test # 构建 test 站点
|
||||
pnpm build # 一键构建所有站点
|
||||
pnpm preview # 预览构建后的站点(需先构建)
|
||||
```
|
||||
|
||||
### 代码质量
|
||||
|
||||
Reference in New Issue
Block a user