Compare commits

..

26 commits
v0.6.0 ... main

Author SHA1 Message Date
c6bf9b5d36 chore: fix typo 2025-02-09 14:57:05 +01:00
7001c990fa chore: add link to sh 2025-02-09 14:56:12 +01:00
e33b1cd3ae chore: add auto mirror to github build script 2025-02-09 14:52:51 +01:00
bb509c6df8 Merge branch 'main' of https://github.com/ayoayco/astro-github-stats 2025-02-09 14:50:50 +01:00
6b67469c45 Merge branch 'main' of github.com:ayoayco/astro-github-stats 2025-01-26 21:31:51 +01:00
7def8a9f9f 0.8.0 2025-01-08 14:36:35 +01:00
6ae6be6e72 feat: use astro's Image component 2025-01-08 14:36:23 +01:00
7c4a4c979b 0.7.4 2025-01-08 14:23:39 +01:00
dbb24642c7 chore: update peer dep 2025-01-08 14:23:32 +01:00
a73c7795c8 chore: update peer dep 2025-01-08 14:22:00 +01:00
7d321732f6 0.7.3 2025-01-08 14:21:39 +01:00
cd25655124 0.7.2 2025-01-08 14:20:30 +01:00
40c7a9e5d8 0.7.1 2024-12-26 01:08:47 +01:00
92fe3d8c0a chore: format code 2024-12-26 01:08:20 +01:00
23af739ee4 chore: set up eslint 2024-12-26 01:08:14 +01:00
5bc7712731 chore: set up prettier 2024-12-26 01:00:32 +01:00
2c7a153aa5 chore(deps): update astro 2024-12-26 00:57:46 +01:00
03da338591 chore: add husky 2024-12-25 21:37:22 +01:00
ad78833fb4 chore: set up eslint 2024-12-25 21:36:45 +01:00
a60f40f239 0.7.2 2024-12-21 00:51:32 +01:00
4ad183b1d1 0.7.1 2024-12-21 00:49:45 +01:00
b0f6540f9d chore(deps): update astro 2024-12-21 00:49:34 +01:00
51dcf05601 chore(deps): update astro 2024-09-13 22:07:01 +02:00
1b6d2d9d56 chore(deps): update astro 2024-09-13 22:03:57 +02:00
Ayo
9826ad1104 0.7.0 2023-12-07 15:28:34 +01:00
Ayo
158603da24 chore: support astro v4 2023-12-07 15:28:27 +01:00
20 changed files with 5913 additions and 13918 deletions

11
.build.yml Normal file
View file

@ -0,0 +1,11 @@
image: alpine/edge
secrets:
- bbfcb6dc-7c4a-42ee-a11a-022f0339a133
environment:
REPO: astro-github-stats
GH_USER: ayoayco
tasks:
- push-mirror: |
cd ~/"${REPO}"
git config --global credential.helper store
git push --mirror "https://github.com/${GH_USER}/${REPO}"

View file

@ -1 +0,0 @@
test/**/*.js

View file

@ -1,17 +0,0 @@
/** @type {import("@types/eslint").Linter.Config} */
module.exports = {
env: {
node: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
rules: {
// We don't want to leak logging into our user's console unless it's an error
'no-console': ['error', { allow: ['warn', 'error'] }],
},
};

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.astro
node_modules
npm-debug.log*

1
.husky/pre-commit Normal file
View file

@ -0,0 +1 @@
npm run lint

7
.prettierignore Normal file
View file

@ -0,0 +1,7 @@
# someday let's think about formatting html
**/*.html
**/*.md
**/*.css
**/*.yml
**/*.yaml

View file

@ -1,24 +0,0 @@
/** @type {import("@types/prettier").Options} */
module.exports = {
printWidth: 100,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: true,
plugins: ['./node_modules/prettier-plugin-astro'],
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
{
files: ['.*', '*.json', '*.md', '*.toml', '*.yml'],
options: {
useTabs: false,
},
},
],
};

13
.vscode/settings.json vendored
View file

@ -1,8 +1,15 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"cSpell.words": ["Astro"],
"prettier.documentSelectors": ["**/*.astro"]
"prettier.documentSelectors": ["**/*.astro"],
"prettier.configPath": "",
"prettier.ignorePath": "",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

View file

@ -1,3 +1,6 @@
> [!Note]
> Project moved to [SourceHut](https://git.sr.ht/~ayoayco/astro-github-stats)
# Astro GitHub Stats ✨
[![npm](https://img.shields.io/npm/v/astro-github-stats)](https://www.npmjs.com/package/astro-github-stats)

View file

@ -1,4 +1,8 @@
import { defineConfig } from 'astro/config';
import { defineConfig } from 'astro/config'
// https://astro.build/config
export default defineConfig({});
export default defineConfig({
image: {
// domains: ['github-readme-stats.vercel.app'],
},
})

1
demo/src/env.d.ts vendored
View file

@ -1 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

View file

@ -1,5 +1,5 @@
---
import GithubStats from '../../../';
import GithubStats from '../../../'
---
<html lang="en">

41
eslint.config.mjs Normal file
View file

@ -0,0 +1,41 @@
import globals from 'globals'
import eslintPluginAstro from 'eslint-plugin-astro'
import jsPlugin from '@eslint/js'
import tseslint from 'typescript-eslint'
import astroParser from 'astro-eslint-parser'
export default [
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
// add more generic rule sets here, such as:
jsPlugin.configs.recommended,
...tseslint.configs.recommended,
...eslintPluginAstro.configs['recommended'],
...eslintPluginAstro.configs['jsx-a11y-recommended'],
{
ignores: [
'dist/*',
'.output/*',
'.astro/*',
'site/*',
'templates/*',
'**/node_modules/*',
'**/env.d.ts',
],
},
{
files: ['**/*.astro'],
languageOptions: {
parser: astroParser,
parserOptions: {
parser: tseslint.parser,
},
},
},
]

View file

@ -1,3 +1,3 @@
import GithubStats from './src/GithubStats.astro';
export default GithubStats;
export * from './src/GithubStats.astro';
import GithubStats from './src/GithubStats.astro'
export default GithubStats
export * from './src/GithubStats.astro'

13835
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
"description": "Embed GitHub stats in your Astro page ✨",
"repository": "https://github.com/ayoayco/astro-github-stats",
"homepage": "https://ayco.io/showcase/astro-github-stats",
"version": "0.6.0",
"version": "0.8.0",
"author": {
"name": "Ayo Ayco",
"email": "ayo@ayco.io",
@ -25,26 +25,33 @@
"scripts": {
"start": "npm run dev -w demo",
"dev": "npm run dev -w demo",
"format": "prettier -w .",
"lint": "eslint . --ext .ts,.js",
"format": "prettier . --write",
"lint": "eslint . --config eslint.config.mjs",
"build": "tsc",
"demo": "npm run dev -w demo"
"demo": "npm run dev -w demo",
"prepare": "husky"
},
"devDependencies": {
"@types/eslint": "^8.4.6",
"@types/node": "^18.7.18",
"@types/prettier": "^2.7.0",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1",
"prettier-plugin-astro": "^0.5.4",
"typescript": "^4.8.3"
"@eslint/js": "^9.17.0",
"@types/eslint": "^9.6.1",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^8.18.2",
"@typescript-eslint/parser": "^8.18.2",
"astro-eslint-parser": "^1.1.0",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-astro": "^1.3.1",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.14.0",
"husky": "^9.1.7",
"prettier": "^3.4.2",
"prettier-plugin-astro": "^0.14.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.2"
},
"peerDependencies": {
"astro": "^3.1.4"
"astro": ">=5.0.0"
},
"license": "ISC",
"workspaces": [

5767
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

21
prettier.config.mjs Normal file
View file

@ -0,0 +1,21 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
trailingComma: 'es5',
tabWidth: 2,
semi: false,
singleQuote: true,
plugins: ['prettier-plugin-astro'],
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
],
}
export default config

View file

@ -1,28 +1,29 @@
---
import {Image} from 'astro:assets'
export interface Props {
username: string;
topLanguages?: boolean;
repo?: string;
showIcons?: boolean;
altText?: string;
username: string
topLanguages?: boolean
repo?: string
showIcons?: boolean
altText?: string
}
const { username, repo, topLanguages, showIcons, altText } = Astro.props;
const baseUrl = 'https://github-readme-stats.vercel.app/api/';
let url = `${baseUrl}?username=${username}&show_icons=${!!showIcons}`;
const { username, repo, topLanguages, showIcons, altText } = Astro.props
const baseUrl = 'https://github-readme-stats.vercel.app/api/'
let url = `${baseUrl}?username=${username}&show_icons=${!!showIcons}`
let alt = `GitHub stats for account: ${username}`;
let alt = `GitHub stats for account: ${username}`
if (repo) {
url = `${baseUrl}/pin/?username=${username}&repo=${repo}`;
alt = `GitHub stats for repository: ${username}/${repo}`;
url = `${baseUrl}/pin/?username=${username}&repo=${repo}`
alt = `GitHub stats for repository: ${username}/${repo}`
}
if (topLanguages) {
url = `${baseUrl}top-langs?username=${username}`;
alt = `GitHub top languages for account: ${username}`;
url = `${baseUrl}top-langs?username=${username}`
alt = `GitHub top languages for account: ${username}`
}
alt = altText || alt;
alt = altText || alt
---
<img src={url} alt={alt} />
<Image inferSize={true} src={url} alt={alt} />