From 894d8e603e6d46937e243a5bd433df2f66006376 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Sun, 7 Sep 2025 01:05:14 -0700
Subject: [PATCH 1/3] Add Contributors.vue
---
.gitignore | 1 +
.vitepress/get-contributors.js | 49 +++++++++++++++++
.vitepress/theme/components/Contributors.vue | 57 ++++++++++++++++++++
.vitepress/theme/index.js | 2 +
docs/index.md | 4 ++
package-lock.json | 1 +
package.json | 4 +-
7 files changed, 117 insertions(+), 1 deletion(-)
create mode 100644 .vitepress/get-contributors.js
create mode 100644 .vitepress/theme/components/Contributors.vue
diff --git a/.gitignore b/.gitignore
index 7c37c91..e1caf77 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
build/
node_modules/
.vitepress/cache
+.vitepress/contributors.json
diff --git a/.vitepress/get-contributors.js b/.vitepress/get-contributors.js
new file mode 100644
index 0000000..67fe22d
--- /dev/null
+++ b/.vitepress/get-contributors.js
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+const fs = require('fs')
+
+async function getAllContributors(repo) {
+ let results = []
+ let page = 1
+
+ while (true) {
+ const url = `https://api.github.com/repos/${repo}/contributors?per_page=100&page=${page}`
+ const data = { headers: { Accept: 'application/vnd.github+json' } }
+
+ const response = await fetch(url, data)
+ if (!response.ok) break
+
+ const contributors = await response.json()
+ // console.log('contributors:', contributors)
+ if (!contributors.length) break
+
+ const filtered = contributors
+ .filter((c) => c.type === 'User')
+ .map((c) => ({
+ login: c.login,
+ avatar_url: c.avatar_url,
+ contributions: c.contributions,
+ }))
+ // console.log('filtered:', filtered)
+
+ results.push(...filtered)
+ page++
+ await new Promise((resolve) => setTimeout(resolve, 250))
+ }
+
+ return results
+}
+
+const repo = process.argv[2]
+const file = process.argv[3] ?? '.vitepress/contributors.json'
+console.log(`get-contributors - repo: ${repo} - file: ${file}`)
+if (!repo || !file) {
+ console.error('Usage: npm run get-contributors user/repo')
+ process.exit(1)
+}
+
+getAllContributors(repo)
+ .then((data) => {
+ // console.log('data:', data)
+ fs.writeFileSync(file, JSON.stringify(data), 'utf8')
+ })
+ .catch(console.error)
diff --git a/.vitepress/theme/components/Contributors.vue b/.vitepress/theme/components/Contributors.vue
new file mode 100644
index 0000000..e690427
--- /dev/null
+++ b/.vitepress/theme/components/Contributors.vue
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
diff --git a/.vitepress/theme/index.js b/.vitepress/theme/index.js
index 4b19d58..683be95 100644
--- a/.vitepress/theme/index.js
+++ b/.vitepress/theme/index.js
@@ -2,6 +2,7 @@ import DefaultTheme from 'vitepress/theme'
import './custom.css'
import 'virtual:group-icons.css'
+import Contributors from './components/Contributors.vue'
import YouTubeEmbed from './components/YouTubeEmbed.vue'
// noinspection JSUnusedGlobalSymbols
@@ -9,6 +10,7 @@ export default {
...DefaultTheme,
enhanceApp({ app }) {
+ app.component('Contributors', Contributors)
app.component('YouTubeEmbed', YouTubeEmbed)
},
}
diff --git a/docs/index.md b/docs/index.md
index d0c5aaa..047d2ea 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -81,3 +81,7 @@ features:
[](https://ko-fi.com/cssnr)
+
+---
+
+
diff --git a/package-lock.json b/package-lock.json
index 1772d33..568479b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4,6 +4,7 @@
"requires": true,
"packages": {
"": {
+ "hasInstallScript": true,
"dependencies": {
"vitepress": "^1.6.4",
"vitepress-plugin-group-icons": "^1.6.3"
diff --git a/package.json b/package.json
index af71ceb..5884beb 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,9 @@
"dev": "vitepress dev .",
"build": "vitepress build .",
"preview": "vitepress preview .",
- "prettier": "npx prettier --check ."
+ "prettier": "npx prettier --check .",
+ "get-contributors": "node .vitepress/get-contributors.js cssnr/stack-deploy-action",
+ "postinstall": "npm run get-contributors"
},
"dependencies": {
"vitepress": "^1.6.4",
From a199eee44562a33f8ac9ae7050a9520809e0f596 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Sun, 7 Sep 2025 01:30:26 -0700
Subject: [PATCH 2/3] Update index.md
---
docs/index.md | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/docs/index.md b/docs/index.md
index 047d2ea..18a2c9f 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -39,8 +39,11 @@ features:
---
+---
+
[](https://github.com/cssnr/stack-deploy-action/tags)
[](https://github.com/cssnr/stack-deploy-action/releases)
[](https://github.com/cssnr/stack-deploy-action/releases/latest)
@@ -82,6 +97,6 @@ features:
----
+Contributors
From 91b690da0c661b9363b551031712430e54ed2fa7 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Sun, 7 Sep 2025 01:40:12 -0700
Subject: [PATCH 3/3] Cleanup get-contributors.js
---
.vitepress/get-contributors.js | 37 ++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/.vitepress/get-contributors.js b/.vitepress/get-contributors.js
index 67fe22d..ec48716 100644
--- a/.vitepress/get-contributors.js
+++ b/.vitepress/get-contributors.js
@@ -1,5 +1,27 @@
#!/usr/bin/env node
const fs = require('fs')
+const path = require('path')
+
+const repo = process.argv[2]
+const file = process.argv[3] ?? '.vitepress/contributors.json'
+console.log(`get-contributors - repo: ${repo} - file: ${file}`)
+
+if (!repo || !file) {
+ console.error('Usage: npm run get-contributors user/repo')
+ process.exit(1)
+}
+
+fs.mkdirSync(path.dirname(file), { recursive: true })
+
+getAllContributors(repo)
+ .then((data) => {
+ // console.log('data:', data)
+ fs.writeFileSync(file, JSON.stringify(data), 'utf8')
+ })
+ .catch((e) => {
+ console.error(e)
+ fs.writeFileSync(file, JSON.stringify([]), 'utf8')
+ })
async function getAllContributors(repo) {
let results = []
@@ -32,18 +54,3 @@ async function getAllContributors(repo) {
return results
}
-
-const repo = process.argv[2]
-const file = process.argv[3] ?? '.vitepress/contributors.json'
-console.log(`get-contributors - repo: ${repo} - file: ${file}`)
-if (!repo || !file) {
- console.error('Usage: npm run get-contributors user/repo')
- process.exit(1)
-}
-
-getAllContributors(repo)
- .then((data) => {
- // console.log('data:', data)
- fs.writeFileSync(file, JSON.stringify(data), 'utf8')
- })
- .catch(console.error)