Skip to content

Commit aa18dce

Browse files
Merge pull request #17 from mProjectsCode/rewrite
Rewrite
2 parents f0f4342 + 12b68b8 commit aa18dce

File tree

3,013 files changed

+51742
-60628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,013 files changed

+51742
-60628
lines changed

.github/workflows/deploy.yml

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,53 @@
11
name: Deploy to GitHub Pages
22

33
on:
4-
# Allows you to run this workflow manually from the Actions tab on GitHub.
5-
workflow_dispatch:
6-
# Trigger workflow when one of the data files was changed (check if separate jobs of gather-data each trigger this workflow separately)
7-
# push:
8-
# paths:
9-
# - '**/*.json'
4+
# Allows you to run this workflow manually from the Actions tab on GitHub.
5+
workflow_dispatch:
106

117
# Allow this job to clone the repo and create a page deployment
128
permissions:
13-
contents: read
14-
pages: write
15-
id-token: write
9+
contents: read
10+
pages: write
11+
id-token: write
1612

1713
jobs:
18-
build:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- name: Checkout your repository using git
22-
uses: actions/checkout@v4
23-
- name: Setup Bun
24-
uses: oven-sh/setup-bun@v2
25-
- name: Install dependencies
26-
run: bun install --frozen-lockfile
27-
- name: Install, build, and upload your site
28-
uses: withastro/action@v3
29-
with:
30-
path: website # The root location of your Astro project inside the repository. (optional)
31-
# node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 18. (optional)
32-
package-manager: bun@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
33-
34-
deploy:
35-
needs: build
36-
runs-on: ubuntu-latest
37-
environment:
38-
name: github-pages
39-
url: ${{ steps.deployment.outputs.page_url }}
40-
steps:
41-
- name: Deploy to GitHub Pages
42-
id: deployment
43-
uses: actions/deploy-pages@v4
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout your repository using git
18+
uses: actions/checkout@v4
19+
20+
- name: Install Bun
21+
uses: oven-sh/setup-bun@v1
22+
with:
23+
bun-version: latest
24+
25+
- name: Install Rust
26+
uses: actions-rust-lang/setup-rust-toolchain@v1
27+
with:
28+
toolchain: nightly
29+
target: wasm32-unknown-unknown
30+
31+
- name: Install wasm-pack
32+
run: bun install -g wasm-pack
33+
34+
- name: Build data-wasm
35+
run: make wasm
36+
37+
- name: Install, build, and upload your site
38+
uses: withastro/action@v3
39+
with:
40+
path: website # The root location of your Astro project inside the repository. (optional)
41+
# node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 18. (optional)
42+
package-manager: bun@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
43+
44+
deploy:
45+
needs: build
46+
runs-on: ubuntu-latest
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.github/workflows/gather-data.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ web_modules/
113113
# Next.js build output
114114

115115
.next
116-
out
117116

118117
# Nuxt.js build / generate output
119118

.prettierignore

Lines changed: 0 additions & 18 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"files.exclude": {
33
"obsidian-releases": true,
44
"choosealicense.com": false,
5-
"pluginRepos": true
6-
}
5+
"pluginRepos": true,
6+
"data/out/plugin-repos/**": true
7+
},
8+
"rust-analyzer.files.exclude": [
9+
"data/out/**"
10+
]
711
}

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
wasm:
2+
cd data-wasm && make
3+
4+
data:
5+
cd data && make
6+
7+
format:
8+
cd data && make format
9+
cd data-lib && make format
10+
cd data-wasm && make format
11+
cd website && bun run format
12+
13+
lint:
14+
cd data && make lint
15+
cd data-lib && make lint
16+
cd data-wasm && make lint
17+
18+
submodule-update:
19+
git submodule update --init --remote

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,65 @@ A stats website for the Obsidian Eco-System.
44

55
https://www.moritzjung.dev/obsidian-stats/
66

7+
## Project Structure
8+
9+
The project is split into 4 parts.
10+
11+
1. The website located in `website`
12+
2. A shared Rust library in `data-lib`
13+
3. The data collection code in `data`
14+
4. The data analysis code used for the website in `data-wasm`
15+
16+
All collected data is persisted in the `data/out` folder and tracked in Git, except for cloned plugin repos.
17+
18+
The project uses Makefiles that sometimes think targets are up to date. In that case you can add the `-B` flag to the make command.
19+
20+
### How to Build
21+
22+
Requirements:
23+
24+
1. [Bun](https://bun.com/)
25+
2. [Latest Rust Compiler](https://rustup.rs/)
26+
3. [wasm-pack](https://github.com/drager/wasm-pack)
27+
4. Probably be on Linux, idk
28+
29+
To test and build the website locally you first need to build the `data-wasm` folder.
30+
For this you can run `make wasm` in the repo root.
31+
32+
After this you can navigate to the `website` folder and install dependencies with `bun i`.
33+
Then you can run either the dev server with `bun run dev` or build the website via `bun run build`.
34+
35+
### How to Run Data Collection
36+
37+
Requirements:
38+
39+
1. [Latest Rust Compiler](https://rustup.rs/)
40+
2. Probably Linux, idk
41+
3. 10+ minutes of time
42+
43+
Depending on your goal, the first thing you might want to run is `make submodule-update`.
44+
45+
After that you can run the data collection via `make data`.
46+
47+
The data collection consists of multiple phases:
48+
49+
1. Theme Data
50+
1. Read theme data from the `obsidian-releases` repo
51+
2. Build and save theme data to `data/out/theme-data`
52+
2. Plugin Data
53+
1. Read plugin data from the `obsidian-releases` repo, including download data
54+
2. Build plugin, download, and version data
55+
3. Save that data to `data/out/plugin-data`
56+
3. Clone Plugin Repos to `data/out/plugin-repos`
57+
4. Extract extra data from plugin repos to `data/out/plugin-repo-data`
58+
5. Process licenses from `choosealicense.com` to `data/out/licenses.json`
59+
6. Obsidian Releases Data
60+
1. Get release data from GitHub releases, process, and save to `data/out/releases-github-raw`. This data is incremental.
61+
2. Interpolate download data and save to `data/out/releases-github-interpolated`
62+
3. Get the Obsidian changelog, process and save to `data/out/releases-changelog`
63+
64+
Currently you select which steps to run by commenting out the steps that you don't want in `data/src/main.rs`.
65+
766
## Credits
867

968
I want to thank the following people:

arquero.d.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

bun.lockb

-21.7 KB
Binary file not shown.

data-lib/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)