Compare commits

..

No commits in common. "main" and "v0.5.0" have entirely different histories.
main ... v0.5.0

24 changed files with 13998 additions and 5939 deletions

View file

@ -1,11 +0,0 @@
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
.eslintignore Normal file
View file

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

17
.eslintrc.cjs Normal file
View file

@ -0,0 +1,17 @@
/** @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,4 +1,3 @@
.astro
node_modules
npm-debug.log*

View file

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

View file

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

24
.prettierrc.cjs Normal file
View file

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

24
LICENSE
View file

@ -1,24 +0,0 @@
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.

View file

@ -1,6 +1,3 @@
> [!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)
@ -16,7 +13,7 @@ Features:
1. Embed GitHub Account top languages
1. Embed GitHub Repositories info with stars
# Installation
# Insatllation
```
npm i astro-github-stats

View file

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

View file

@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.6"
"astro": "^1.4.2"
},
"description": "``` npm create astro@latest -- --template minimal ```",
"main": "index.js",

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

@ -1,2 +1 @@
/// <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">

View file

@ -1,41 +0,0 @@
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';

13875
package-lock.json generated Normal file

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.8.0",
"version": "0.5.0",
"author": {
"name": "Ayo Ayco",
"email": "ayo@ayco.io",
@ -25,33 +25,33 @@
"scripts": {
"start": "npm run dev -w demo",
"dev": "npm run dev -w demo",
"format": "prettier . --write",
"lint": "eslint . --config eslint.config.mjs",
"test": "mocha --parallel --timeout 15000",
"format": "prettier -w .",
"lint": "eslint . --ext .ts,.js",
"build": "tsc",
"demo": "npm run dev -w demo",
"prepare": "husky"
"demo": "npm run dev -w demo"
},
"devDependencies": {
"@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"
"@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"
},
"peerDependencies": {
"astro": ">=5.0.0"
"astro": "^1.0.0"
},
"license": "ISC",
"workspaces": [

File diff suppressed because it is too large Load diff

View file

@ -1,21 +0,0 @@
/**
* @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,29 +1,28 @@
---
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;
---
<Image inferSize={true} src={url} alt={alt} />
<img src={url} alt={alt} />

7
test/README.md Normal file
View file

@ -0,0 +1,7 @@
# `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

24
test/example.test.js Normal file
View file

@ -0,0 +1,24 @@
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');
});
});
});