Compare commits
68 commits
Author | SHA1 | Date | |
---|---|---|---|
c6bf9b5d36 | |||
7001c990fa | |||
e33b1cd3ae | |||
bb509c6df8 | |||
6b67469c45 | |||
7def8a9f9f | |||
6ae6be6e72 | |||
7c4a4c979b | |||
dbb24642c7 | |||
a73c7795c8 | |||
7d321732f6 | |||
cd25655124 | |||
40c7a9e5d8 | |||
92fe3d8c0a | |||
23af739ee4 | |||
5bc7712731 | |||
2c7a153aa5 | |||
03da338591 | |||
ad78833fb4 | |||
a60f40f239 | |||
4ad183b1d1 | |||
b0f6540f9d | |||
51dcf05601 | |||
1b6d2d9d56 | |||
![]() |
9826ad1104 | ||
![]() |
158603da24 | ||
![]() |
53671859ab | ||
![]() |
93c5d18ea0 | ||
![]() |
7ee0364da5 | ||
![]() |
92a157c65b | ||
![]() |
b52d80429e | ||
![]() |
3dc56a1f5b | ||
![]() |
9ca707c369 | ||
![]() |
ef9552adea | ||
![]() |
0c34e74d39 | ||
![]() |
dc72482582 | ||
![]() |
fd9c7d7780 | ||
![]() |
8d927fe64a | ||
![]() |
b3d3543269 | ||
![]() |
9229ca5f15 | ||
![]() |
cb9c410848 | ||
![]() |
83fab55fcb | ||
![]() |
a7f37f0547 | ||
![]() |
ffaebcac35 | ||
![]() |
22a97e11da | ||
![]() |
2781edec0a | ||
![]() |
c2216a159c | ||
![]() |
94bd112ac9 | ||
![]() |
5c0e04c6c2 | ||
![]() |
2d7a79ef1c | ||
![]() |
efda4f2cfb | ||
![]() |
88df4ec61e | ||
![]() |
f06a593856 | ||
![]() |
fabc7e7049 | ||
![]() |
fbedde3d59 | ||
![]() |
fac829e6d0 | ||
![]() |
1c31acb86b | ||
![]() |
e2238fcc16 | ||
![]() |
e0f4df209c | ||
![]() |
c589e26abd | ||
![]() |
3a9643b7af | ||
![]() |
353b3ec54b | ||
![]() |
0035fc8220 | ||
![]() |
a4aac2c863 | ||
![]() |
0383e939ed | ||
![]() |
b75f9105a4 | ||
![]() |
82d7189199 | ||
![]() |
a192e9544c |
29 changed files with 6161 additions and 13995 deletions
11
.build.yml
Normal file
11
.build.yml
Normal 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}"
|
|
@ -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
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
.astro
|
||||
node_modules
|
||||
|
||||
npm-debug.log*
|
||||
|
|
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.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"
|
||||
}
|
||||
}
|
||||
|
|
24
LICENSE
Normal file
24
LICENSE
Normal file
|
@ -0,0 +1,24 @@
|
|||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2022, Ayo Ayco
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
62
README.md
62
README.md
|
@ -1,31 +1,73 @@
|
|||
# Astro Github Stats
|
||||
> [!Note]
|
||||
> Project moved to [SourceHut](https://git.sr.ht/~ayoayco/astro-github-stats)
|
||||
|
||||
Embed github stats in your Astro page ✨
|
||||
# Astro GitHub Stats ✨
|
||||
|
||||
# Usage
|
||||
[](https://www.npmjs.com/package/astro-github-stats)
|
||||
[](https://www.npmjs.com/package/astro-github-stats)
|
||||
[](https://www.npmjs.com/package/astro-github-stats)
|
||||
[](https://github.com/ayoayco/astro-github-stats)
|
||||
|
||||
Install in use in your Astro project:
|
||||
Embed GitHub stats on your [Astro](https://astro.build) page ✨
|
||||
|
||||
Features:
|
||||
|
||||
1. Embed GitHub Account stats (with or without icons)
|
||||
1. Embed GitHub Account top languages
|
||||
1. Embed GitHub Repositories info with stars
|
||||
|
||||
# Installation
|
||||
|
||||
```
|
||||
npm i astro-github-stats
|
||||
```
|
||||
|
||||
Then use in your Astro page:
|
||||
# Usage
|
||||
|
||||
```
|
||||
Then use on your Astro page:
|
||||
|
||||
```astro
|
||||
---
|
||||
import GithubStats from 'astro-github-stats';
|
||||
---
|
||||
|
||||
<!-- show your account stats -->
|
||||
<GithubStats username="ayoayco" />
|
||||
|
||||
<!-- show your account stats w/ icons -->
|
||||
<GithubStats username="ayoayco" showIcons={true} />
|
||||
|
||||
<!-- show your account top languages -->
|
||||
<GithubStats username="ayoayco" topLanguages={true} />
|
||||
|
||||
<!-- show a repo card with info and stars -->
|
||||
<GithubStats username="withastro" repo="astro" />
|
||||
```
|
||||
|
||||
# Showcase
|
||||

|
||||
# Screenshots
|
||||
|
||||
Example Account Card:
|
||||
|
||||

|
||||
|
||||
Example Account Card with Icons:
|
||||
|
||||
<img width="505" alt="Screen Shot 2022-09-30 at 10 59 39 PM" src="https://user-images.githubusercontent.com/4262489/193355585-c5c7b1c3-6682-4157-a013-94f8a5a21a20.png">
|
||||
|
||||
|
||||
Example Account Top Languages:
|
||||
|
||||
<img width="312" alt="Screen Shot 2022-09-29 at 9 09 05 PM" src="https://user-images.githubusercontent.com/4262489/193121588-9737c861-d08a-4103-9d9b-11bcd0c7c713.png">
|
||||
|
||||
Example Repo Card:
|
||||
|
||||

|
||||
|
||||
# Future plans
|
||||
|
||||
This is a wrapper for [github-readme-stats](https://github.com/anuraghazra/github-readme-stats). Other features will be supported later:
|
||||
1. repo stats card
|
||||
Initially this is a wrapper for [github-readme-stats](https://github.com/anuraghazra/github-readme-stats) supporting the basic github account stats card. Other features can be supported later, depending on demand:
|
||||
|
||||
1. themes
|
||||
1. account top languages
|
||||
|
||||
_Please report issues found or suggestions in the [project issues page](https://github.com/ayoayco/astro-github-stats/issues)_
|
||||
|
|
19
demo/.gitignore
vendored
Normal file
19
demo/.gitignore
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
# build output
|
||||
dist/
|
||||
|
||||
# dependencies
|
||||
node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
.env.production
|
||||
|
||||
# macOS-specific files
|
||||
.DS_Store
|
4
demo/.vscode/extensions.json
vendored
Normal file
4
demo/.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"recommendations": ["astro-build.astro-vscode"],
|
||||
"unwantedRecommendations": []
|
||||
}
|
11
demo/.vscode/launch.json
vendored
Normal file
11
demo/.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "./node_modules/.bin/astro dev",
|
||||
"name": "Development server",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
45
demo/README.md
Normal file
45
demo/README.md
Normal file
|
@ -0,0 +1,45 @@
|
|||
# Astro Starter Kit: Minimal
|
||||
|
||||
```
|
||||
npm create astro@latest -- --template minimal
|
||||
```
|
||||
|
||||
[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/minimal)
|
||||
|
||||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
||||
|
||||
## 🚀 Project Structure
|
||||
|
||||
Inside of your Astro project, you'll see the following folders and files:
|
||||
|
||||
```
|
||||
/
|
||||
├── public/
|
||||
├── src/
|
||||
│ └── pages/
|
||||
│ └── index.astro
|
||||
└── package.json
|
||||
```
|
||||
|
||||
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
|
||||
|
||||
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
|
||||
|
||||
Any static assets, like images, can be placed in the `public/` directory.
|
||||
|
||||
## 🧞 Commands
|
||||
|
||||
All commands are run from the root of the project, from a terminal:
|
||||
|
||||
| Command | Action |
|
||||
| :--------------------- | :----------------------------------------------- |
|
||||
| `npm install` | Installs dependencies |
|
||||
| `npm run dev` | Starts local dev server at `localhost:3000` |
|
||||
| `npm run build` | Build your production site to `./dist/` |
|
||||
| `npm run preview` | Preview your build locally, before deploying |
|
||||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
|
||||
| `npm run astro --help` | Get help using the Astro CLI |
|
||||
|
||||
## 👀 Want to learn more?
|
||||
|
||||
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
|
8
demo/astro.config.mjs
Normal file
8
demo/astro.config.mjs
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { defineConfig } from 'astro/config'
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
image: {
|
||||
// domains: ['github-readme-stats.vercel.app'],
|
||||
},
|
||||
})
|
29
demo/package.json
Normal file
29
demo/package.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "@example/minimal",
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^2.0.6"
|
||||
},
|
||||
"description": "``` npm create astro@latest -- --template minimal ```",
|
||||
"main": "index.js",
|
||||
"devDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ayoayco/astro-github-stats.git"
|
||||
},
|
||||
"author": "Ayo Ayco",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ayoayco/astro-github-stats/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ayoayco/astro-github-stats#readme"
|
||||
}
|
13
demo/public/favicon.svg
Normal file
13
demo/public/favicon.svg
Normal file
|
@ -0,0 +1,13 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 36 36">
|
||||
<path fill="#000" d="M22.25 4h-8.5a1 1 0 0 0-.96.73l-5.54 19.4a.5.5 0 0 0 .62.62l5.05-1.44a2 2 0 0 0 1.38-1.4l3.22-11.66a.5.5 0 0 1 .96 0l3.22 11.67a2 2 0 0 0 1.38 1.39l5.05 1.44a.5.5 0 0 0 .62-.62l-5.54-19.4a1 1 0 0 0-.96-.73Z"/>
|
||||
<path fill="url(#gradient)" d="M18 28a7.63 7.63 0 0 1-5-2c-1.4 2.1-.35 4.35.6 5.55.14.17.41.07.47-.15.44-1.8 2.93-1.22 2.93.6 0 2.28.87 3.4 1.72 3.81.34.16.59-.2.49-.56-.31-1.05-.29-2.46 1.29-3.25 3-1.5 3.17-4.83 2.5-6-.67.67-2.6 2-5 2Z"/>
|
||||
<defs>
|
||||
<linearGradient id="gradient" x1="16" x2="16" y1="32" y2="24" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#000"/>
|
||||
<stop offset="1" stop-color="#000" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<style>
|
||||
@media (prefers-color-scheme:dark){:root{filter:invert(100%)}}
|
||||
</style>
|
||||
</svg>
|
After Width: | Height: | Size: 873 B |
2
demo/src/env.d.ts
vendored
Normal file
2
demo/src/env.d.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
||||
/// <reference types="astro/client" />
|
28
demo/src/pages/index.astro
Normal file
28
demo/src/pages/index.astro
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
import GithubStats from '../../../'
|
||||
---
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>Astro</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Astro Github Stats</h1>
|
||||
|
||||
<h3>Account Stats</h3>
|
||||
<GithubStats username="ayoayco" />
|
||||
|
||||
<h3>Account Stats</h3>
|
||||
<GithubStats username="ayoayco" showIcons={true} />
|
||||
|
||||
<h3>Account Top Languages</h3>
|
||||
<GithubStats username="ayoayco" topLanguages={true} />
|
||||
|
||||
<h3>Repository Card</h3>
|
||||
<GithubStats username="withastro" repo="astro" />
|
||||
</body>
|
||||
</html>
|
3
demo/tsconfig.json
Normal file
3
demo/tsconfig.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/strictest"
|
||||
}
|
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';
|
||||
export default GithubStats;
|
||||
export * from './src/GithubStats.astro';
|
||||
import GithubStats from './src/GithubStats.astro'
|
||||
export default GithubStats
|
||||
export * from './src/GithubStats.astro'
|
||||
|
|
13875
package-lock.json
generated
13875
package-lock.json
generated
File diff suppressed because it is too large
Load diff
61
package.json
61
package.json
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "astro-github-stats",
|
||||
"description": "Embed github stats in your Astro page",
|
||||
"description": "Embed GitHub stats in your Astro page ✨",
|
||||
"repository": "https://github.com/ayoayco/astro-github-stats",
|
||||
"homepage": "https://github.com/ayoayco/astro-github-stats",
|
||||
"version": "0.1.0",
|
||||
"homepage": "https://ayco.io/showcase/astro-github-stats",
|
||||
"version": "0.8.0",
|
||||
"author": {
|
||||
"name": "Ayo Ayco",
|
||||
"email": "ramon.aycojr@gmail.com",
|
||||
"email": "ayo@ayco.io",
|
||||
"url": "https://ayco.io"
|
||||
},
|
||||
"type": "module",
|
||||
|
@ -23,31 +23,38 @@
|
|||
"ui"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "mocha --parallel --timeout 15000",
|
||||
"format": "prettier -w .",
|
||||
"lint": "eslint . --ext .ts,.js",
|
||||
"build": "tsc"
|
||||
"start": "npm run dev -w demo",
|
||||
"dev": "npm run dev -w demo",
|
||||
"format": "prettier . --write",
|
||||
"lint": "eslint . --config eslint.config.mjs",
|
||||
"build": "tsc",
|
||||
"demo": "npm run dev -w demo",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.3.3",
|
||||
"@types/eslint": "^8.4.6",
|
||||
"@types/mocha": "^9.1.1",
|
||||
"@types/node": "^18.7.18",
|
||||
"@types/prettier": "^2.7.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
||||
"@typescript-eslint/parser": "^5.37.0",
|
||||
"astro": "^1.0.0",
|
||||
"astro-component-tester": "^0.6.0",
|
||||
"chai": "^4.3.6",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"mocha": "^10.0.0",
|
||||
"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": "^1.0.0"
|
||||
}
|
||||
"astro": ">=5.0.0"
|
||||
},
|
||||
"license": "ISC",
|
||||
"workspaces": [
|
||||
"demo"
|
||||
]
|
||||
}
|
||||
|
|
5767
pnpm-lock.yaml
Normal file
5767
pnpm-lock.yaml
Normal file
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,6 +1,29 @@
|
|||
---
|
||||
const { username } = Astro.props;
|
||||
const url = "https://github-readme-stats.vercel.app/api/"
|
||||
+ `?username=${username}`;
|
||||
import {Image} from 'astro:assets'
|
||||
export interface Props {
|
||||
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}`
|
||||
|
||||
let alt = `GitHub stats for account: ${username}`
|
||||
|
||||
if (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}`
|
||||
}
|
||||
|
||||
alt = altText || alt
|
||||
---
|
||||
<img src={url} />
|
||||
|
||||
<Image inferSize={true} src={url} alt={alt} />
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# `test` directory
|
||||
|
||||
This folder contain tests for your component(s). This templates makes no assumption regarding your way of writting code. You can either write the code first and then the tests or the reverse (known as Test-Driven Development). Ultimately, what's important is that your code works and is tested to prove it!
|
||||
|
||||
Included in this template is [astro-component-tester](https://github.com/Princesseuh/astro-component-tester), a tool made to help you test the output of your component(s), check out its GitHub page for more info on how to use it
|
||||
|
||||
A commented example test (see `example.test.js`) is included in this folder to help you learn how to write a basic test for your project
|
|
@ -1,24 +0,0 @@
|
|||
import { expect } from 'chai';
|
||||
import { getComponentOutput } from 'astro-component-tester';
|
||||
|
||||
describe('Example Tests', () => {
|
||||
// Simple test to get us started with the syntax
|
||||
it('should equal 2', () => {
|
||||
expect(1 + 1).to.equal(2);
|
||||
});
|
||||
|
||||
// This show us how to write a test for our component's output using astro-component-tester
|
||||
describe('Component test', async () => {
|
||||
let component;
|
||||
|
||||
// First get the component's output, this returns an object containing the generated html (`.html`)
|
||||
before(async () => {
|
||||
component = await getComponentOutput('./src/GithubStats.astro');
|
||||
});
|
||||
|
||||
// Unless you modified /src/Component.astro, this should pass, as the component is empty apart from the frontmatter and new lines
|
||||
it('example component should not be empty', () => {
|
||||
expect(component.html).not.to.equal('\n');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue