Merge branch 'main' of github.com:ayoayco/astro-github-stats
This commit is contained in:
commit
6b67469c45
15 changed files with 2744 additions and 1264 deletions
|
@ -1 +0,0 @@
|
||||||
test/**/*.js
|
|
|
@ -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
.husky/pre-commit
Normal file
1
.husky/pre-commit
Normal file
|
@ -0,0 +1 @@
|
||||||
|
npm run lint
|
7
.prettierignore
Normal file
7
.prettierignore
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# someday let's think about formatting html
|
||||||
|
**/*.html
|
||||||
|
|
||||||
|
**/*.md
|
||||||
|
**/*.css
|
||||||
|
**/*.yml
|
||||||
|
**/*.yaml
|
|
@ -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
13
.vscode/settings.json
vendored
|
@ -1,8 +1,15 @@
|
||||||
{
|
{
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.codeActionsOnSave": {
|
"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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config'
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({});
|
export default defineConfig({
|
||||||
|
image: {
|
||||||
|
// domains: ['github-readme-stats.vercel.app'],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import GithubStats from '../../../';
|
import GithubStats from '../../../'
|
||||||
---
|
---
|
||||||
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
41
eslint.config.mjs
Normal file
41
eslint.config.mjs
Normal 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
6
index.ts
6
index.ts
|
@ -1,3 +1,3 @@
|
||||||
import GithubStats from './src/GithubStats.astro';
|
import GithubStats from './src/GithubStats.astro'
|
||||||
export default GithubStats;
|
export default GithubStats
|
||||||
export * from './src/GithubStats.astro';
|
export * from './src/GithubStats.astro'
|
||||||
|
|
25
package.json
25
package.json
|
@ -3,7 +3,7 @@
|
||||||
"description": "Embed GitHub stats in your Astro page ✨",
|
"description": "Embed GitHub stats in your Astro page ✨",
|
||||||
"repository": "https://github.com/ayoayco/astro-github-stats",
|
"repository": "https://github.com/ayoayco/astro-github-stats",
|
||||||
"homepage": "https://ayco.io/showcase/astro-github-stats",
|
"homepage": "https://ayco.io/showcase/astro-github-stats",
|
||||||
"version": "0.7.2",
|
"version": "0.7.4",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Ayo Ayco",
|
"name": "Ayo Ayco",
|
||||||
"email": "ayo@ayco.io",
|
"email": "ayo@ayco.io",
|
||||||
|
@ -25,26 +25,33 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npm run dev -w demo",
|
"start": "npm run dev -w demo",
|
||||||
"dev": "npm run dev -w demo",
|
"dev": "npm run dev -w demo",
|
||||||
"format": "prettier -w .",
|
"format": "prettier . --write",
|
||||||
"lint": "eslint . --ext .ts,.js",
|
"lint": "eslint . --config eslint.config.mjs",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"demo": "npm run dev -w demo"
|
"demo": "npm run dev -w demo",
|
||||||
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.17.0",
|
||||||
"@types/eslint": "^9.6.1",
|
"@types/eslint": "^9.6.1",
|
||||||
"@types/node": "^22.10.2",
|
"@types/node": "^22.10.2",
|
||||||
"@types/prettier": "^3.0.0",
|
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.18.1",
|
"@typescript-eslint/parser": "^8.18.2",
|
||||||
"@typescript-eslint/parser": "^8.18.1",
|
"astro-eslint-parser": "^1.1.0",
|
||||||
"eslint": "^9.17.0",
|
"eslint": "^9.17.0",
|
||||||
"eslint-config-prettier": "^9.1.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",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
|
"globals": "^15.14.0",
|
||||||
|
"husky": "^9.1.7",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-astro": "^0.14.1",
|
"prettier-plugin-astro": "^0.14.1",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.7.2",
|
||||||
|
"typescript-eslint": "^8.18.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^4.15"
|
"astro": ">=5.0.0"
|
||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|
3809
pnpm-lock.yaml
3809
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
21
prettier.config.mjs
Normal file
21
prettier.config.mjs
Normal 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
|
|
@ -1,28 +1,29 @@
|
||||||
---
|
---
|
||||||
|
import {Image} from 'astro:assets'
|
||||||
export interface Props {
|
export interface Props {
|
||||||
username: string;
|
username: string
|
||||||
topLanguages?: boolean;
|
topLanguages?: boolean
|
||||||
repo?: string;
|
repo?: string
|
||||||
showIcons?: boolean;
|
showIcons?: boolean
|
||||||
altText?: string;
|
altText?: string
|
||||||
}
|
}
|
||||||
const { username, repo, topLanguages, showIcons, altText } = Astro.props;
|
const { username, repo, topLanguages, showIcons, altText } = Astro.props
|
||||||
const baseUrl = 'https://github-readme-stats.vercel.app/api/';
|
const baseUrl = 'https://github-readme-stats.vercel.app/api/'
|
||||||
let url = `${baseUrl}?username=${username}&show_icons=${!!showIcons}`;
|
let url = `${baseUrl}?username=${username}&show_icons=${!!showIcons}`
|
||||||
|
|
||||||
let alt = `GitHub stats for account: ${username}`;
|
let alt = `GitHub stats for account: ${username}`
|
||||||
|
|
||||||
if (repo) {
|
if (repo) {
|
||||||
url = `${baseUrl}/pin/?username=${username}&repo=${repo}`;
|
url = `${baseUrl}/pin/?username=${username}&repo=${repo}`
|
||||||
alt = `GitHub stats for repository: ${username}/${repo}`;
|
alt = `GitHub stats for repository: ${username}/${repo}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topLanguages) {
|
if (topLanguages) {
|
||||||
url = `${baseUrl}top-langs?username=${username}`;
|
url = `${baseUrl}top-langs?username=${username}`
|
||||||
alt = `GitHub top languages for account: ${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} />
|
||||||
|
|
Loading…
Reference in a new issue