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:
Cell
2025-08-31 15:07:00 +08:00
committed by GitHub
parent c923116b9b
commit d8624386c7
43 changed files with 3721 additions and 304 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: Bug Report
description: Create a report to help us improve
title: "[Bug report] "
title: '[Bug report] '
body:
- type: markdown
attributes:
+1 -1
View File
@@ -1,6 +1,6 @@
name: Feature Request
description: Suggest an idea for this project
title: "[Feature request] "
title: '[Feature request] '
body:
- type: markdown
attributes:
+1 -1
View File
@@ -1,4 +1,4 @@
name: "CodeQL config"
name: CodeQL config
paths-ignore:
- assets/lib/**
+20 -21
View File
@@ -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 # 预览构建后的站点(需先构建)
```
### 代码质量
+29 -15
View File
@@ -5,30 +5,44 @@
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: npm # See documentation for possible values
directory: / # Location of package manifests
schedule:
interval: "monthly"
interval: monthly
open-pull-requests-limit: 1000
assignees:
- "Lruihao"
- Lruihao
labels:
- "dependencies"
- package-ecosystem: "github-actions"
directory: "/"
- dependencies
ignore:
- dependency-name: '@types/node'
update-types:
- 'version-update:semver-major'
groups:
npm-development:
dependency-type: development
update-types:
- minor
- patch
npm-production:
dependency-type: production
update-types:
- patch
- package-ecosystem: github-actions
directory: /
schedule:
interval: "monthly"
interval: monthly
open-pull-requests-limit: 1000
assignees:
- "Lruihao"
- Lruihao
labels:
- "dependencies"
- package-ecosystem: "gitsubmodule"
directory: "/"
- dependencies
- package-ecosystem: gitsubmodule
directory: /
schedule:
interval: "weekly"
interval: weekly
open-pull-requests-limit: 1000
assignees:
- "Lruihao"
- Lruihao
labels:
- "dependencies"
- dependencies
+1 -1
View File
@@ -16,4 +16,4 @@ changelog:
- bug
- title: Other Changes
labels:
- "*"
- '*'
+28 -28
View File
@@ -9,7 +9,7 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: CodeQL
on:
push:
@@ -19,7 +19,7 @@ on:
branches:
- main
schedule:
- cron: "30 18 * * 5"
- cron: '30 18 * * 5'
jobs:
analyze:
@@ -29,44 +29,44 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ "javascript" ]
language: [javascript]
# CodeQL supports [ "cpp", "csharp", "go", "java", "javascript", "python" ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/configs/codeql.yml
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/configs/codeql.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
# - run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
+2 -2
View File
@@ -31,9 +31,9 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: 'Update hugo-fixit component list'
title: Update hugo-fixit component list
commit-message: 'docs(readme): update hugo-fixit component list'
body: 'This PR updates the hugo-fixit component list in the README.'
body: This PR updates the hugo-fixit component list in the README.
base: main
branch: update-component-list
labels: documentation
+5 -6
View File
@@ -25,17 +25,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for generating release notes
fetch-depth: 0 # Fetch all history for generating release notes
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies and generate release notes
node-version-file: .nvmrc
- name: Generate release notes
run: |
npm install
npm run release -- --starting-version ${{ github.ref_name }}
npx fixit-releaser changelog --starting-version ${{ github.ref_name }}
sed -i '1,4d' CHANGELOG.md
- name: GitHub Release