Skip to content

Commit

Permalink
refactor: move all packages to crates subdir (#356)
Browse files Browse the repository at this point in the history
In future development, we'll have more crates. So place them in the
"crates" sub-directory to prevent too many files in the project root.
  • Loading branch information
wangl-cc authored Dec 27, 2024
1 parent 1f80ec5 commit 18787c7
Show file tree
Hide file tree
Showing 93 changed files with 37 additions and 36 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches: ["main"]
paths:
- "*/src/**"
- "*/Cargo.toml"
- "*/build.rs"
- "crates/*/src/**"
- "crates/*/Cargo.toml"
- "crates/*/build.rs"
- "Cargo.lock"
- "codecov.yml"
- ".github/workflows/ci.yml"
Expand All @@ -15,9 +15,9 @@ on:
pull_request:
branches: ["main"]
paths:
- "*/src/**"
- "*/Cargo.toml"
- "*/build.rs"
- "crates/*/src/**"
- "crates/*/Cargo.toml"
- "crates/*/build.rs"
- "Cargo.lock"
- "codecov.yml"
- ".github/workflows/ci.yml"
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
env:
MAA_CONFIG_DIR: ${{ github.workspace }}/maa-cli/config_examples
run: |
cargo run -- install beta
cargo run --package maa-cli -- install beta
core_dir=$(cargo run -- dir library)
resource_dir=$(cargo run -- dir resource)
cache_dir=$(cargo run -- dir cache)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: DavidAnson/markdownlint-cli2-action@v18
with:
globs: "**/*.md"
config: "maa-cli/docs/.markdownlint.yaml"
config: "crates/maa-cli/docs/.markdownlint.yaml"

check-links:
name: Check Dead Links
Expand Down
33 changes: 17 additions & 16 deletions .github/workflows/sync.yml → .github/workflows/publish-sync.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Sync to MAA Main Repository

on:
# Dry run on pull request
pull_request:
branches: ["main"]
paths:
- "crates/maa-cli/docs/**"
workflow_call:
inputs:
version:
Expand All @@ -15,17 +20,6 @@ on:
MAA_HOMEBREW_BUMP_PR:
description: GitHub PAT for creating PR
required: true
workflow_dispatch:
inputs:
version:
description: Package version
required: true
type: string
dryrun:
description: Do not create PR
default: true
required: true
type: boolean

defaults:
run:
Expand All @@ -42,26 +36,33 @@ jobs:
token: ${{ secrets.MAA_HOMEBREW_BUMP_PR }}
repository: MaaAssistantArknights/MaaAssistantArknights
ref: dev
- name: Update Submodules to Current Commit
- name: Update Submodule (Workflow Call)
if: github.event_name == 'workflow_call'
working-directory: src/maa-cli
run: |
git submodule init .
git submodule update .
git checkout '${{ github.ref }}'
- name: Checkout Submodule (Pull Request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
path: src/maa-cli
- name: Sync Documentations
working-directory: docs
run: |
../src/maa-cli/maa-cli/docs/gen_docs.sh
../src/maa-cli/crates/maa-cli/docs/gen_docs.sh
- name: Show Changes
if: ${{ inputs.dryrun }}
# Show changes in diff format if it's a pull request or dry run
if: github.event_name == 'pull_request' || inputs.dryrun
run: |
{
echo '```diff'
git diff --submodule
git diff
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Create Pull Request
if: ${{ !inputs.dryrun }}
if: github.event_name != 'pull_request' && !inputs.dryrun
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.MAA_HOMEBREW_BUMP_PR }}
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[workspace]
resolver = "2"
members = ["maa-*"]
members = ["crates/*"]

[workspace.package]
license = "AGPL-3.0-only"
homepage = "https://github.com/MaaAssistantArknights/maa-cli"
repository = "https://github.com/MaaAssistantArknights/maa-cli"

[workspace.dependencies]
maa-dirs = { path = "maa-dirs", version = "0.1.1" }
maa-sys = { path = "maa-sys", version = "0.5.0" }
maa-types = { path = "maa-types", version = "0.1" }
maa-dirs = { path = "crates/maa-dirs", version = "0.1.1" }
maa-sys = { path = "crates/maa-sys", version = "0.5.0" }
maa-types = { path = "crates/maa-types", version = "0.1" }

anyhow = "1"
async-trait = "0.1.81"
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
![Beta Release Version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2FMaaAssistantArknights%2Fmaa-cli%2Fraw%2Fversion%2Fbeta.json&query=%24.version&prefix=v&label=beta)
![Nightly Release Version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2FMaaAssistantArknights%2Fmaa-cli%2Fraw%2Fversion%2Falpha.json&query=%24.version&prefix=v&label=nightly)

[简体中文](maa-cli/docs/zh-CN/intro.md)
| [English](maa-cli/docs/en-US/intro.md)
| [한국어](maa-cli/docs/ko-KR/intro.md)
[简体中文](crates/maa-cli/docs/zh-CN/intro.md)
| [English](crates/maa-cli/docs/en-US/intro.md)
| [한국어](crates/maa-cli/docs/ko-KR/intro.md)

一个使用 Rust 编写的 [MAA][maa-home] 命令行工具。

Expand All @@ -31,10 +31,10 @@

## 文档

- [安装及编译](maa-cli/docs/zh-CN/install.md)
- [使用](maa-cli/docs/zh-CN/usage.md)
- [配置](maa-cli/docs/zh-CN/config.md)
- [常见问题](maa-cli/docs/zh-CN/faq.md)
- [安装及编译](crates/maa-cli/docs/zh-CN/install.md)
- [使用](crates/maa-cli/docs/zh-CN/usage.md)
- [配置](crates/maa-cli/docs/zh-CN/config.md)
- [常见问题](crates/maa-cli/docs/zh-CN/faq.md)

[maa-home]: https://github.com/MaaAssistantArknights/MaaAssistantArknights/

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sedi() {
for lang in en-US zh-CN zh-TW ja-JP ko-KR; do
lang_lower=$(echo "$lang" | tr '[:upper:]' '[:lower:]')
# output to the specified directory, default is the same as the language
output_dir=$(resolve_dir "${2:-"$lang_lower/manual/cli"}")
output_dir=$(resolve_dir "$lang_lower/manual/cli")
# the original directory of docs is at the same directory as this script
original_dir=$(resolve_dir "$(dirname "${BASH_SOURCE[0]}")")

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 18787c7

Please sign in to comment.