support github account stats
This commit is contained in:
parent
13b5dda0f1
commit
9623faab43
7 changed files with 29 additions and 20 deletions
8
index.ts
8
index.ts
|
@ -1,5 +1,3 @@
|
||||||
// Do not write code directly here, instead use the `src` folder!
|
import GithubStats from './src/GithubStats.astro';
|
||||||
|
export default GithubStats;
|
||||||
// What you should do here is re-exports all the things you want your user to access, ex:
|
export * from './src/GithubStats.astro';
|
||||||
// export { HelloWorld } from "./src/main.ts"
|
|
||||||
// export type { HelloWorldResult } from "./src/types.ts"
|
|
||||||
|
|
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "astro-component-name",
|
"name": "astro-github-stats",
|
||||||
"version": "0.1.0",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "astro-component-name",
|
"name": "astro-github-stats",
|
||||||
"version": "0.1.0",
|
"version": "0.0.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.3.3",
|
"@types/chai": "^4.3.3",
|
||||||
"@types/eslint": "^8.4.6",
|
"@types/eslint": "^8.4.6",
|
||||||
|
|
14
package.json
14
package.json
|
@ -1,12 +1,17 @@
|
||||||
{
|
{
|
||||||
"name": "astro-component-name",
|
"name": "astro-github-stats",
|
||||||
"version": "0.1.0",
|
"version": "0.0.1",
|
||||||
|
"author": {
|
||||||
|
"name": "Ayo Ayco",
|
||||||
|
"email": "ramon.aycojr@gmail.com",
|
||||||
|
"url": "https://ayco.io"
|
||||||
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./index.ts"
|
".": "./index.ts"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"src",
|
"src/GithubStats.astro",
|
||||||
"index.ts"
|
"index.ts"
|
||||||
],
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -15,7 +20,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --parallel --timeout 15000",
|
"test": "mocha --parallel --timeout 15000",
|
||||||
"format": "prettier -w .",
|
"format": "prettier -w .",
|
||||||
"lint": "eslint . --ext .ts,.js"
|
"lint": "eslint . --ext .ts,.js",
|
||||||
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.3.3",
|
"@types/chai": "^4.3.3",
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
// Write your component code in this file!
|
|
||||||
---
|
|
9
src/GithubStats.astro
Normal file
9
src/GithubStats.astro
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
const { username } = Astro.props;
|
||||||
|
const url = "https://github-readme-stats.vercel.app/api/"
|
||||||
|
+ `?username=${username}`;
|
||||||
|
---
|
||||||
|
|
||||||
|
<img src={url} />
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
// Write your component's code here!
|
|
|
@ -13,12 +13,12 @@ describe('Example Tests', () => {
|
||||||
|
|
||||||
// First get the component's output, this returns an object containing the generated html (`.html`)
|
// First get the component's output, this returns an object containing the generated html (`.html`)
|
||||||
before(async () => {
|
before(async () => {
|
||||||
component = await getComponentOutput('./src/Component.astro');
|
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
|
// 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 be empty', () => {
|
it('example component should not be empty', () => {
|
||||||
expect(component.html).to.equal('\n');
|
expect(component.html).not.to.equal('\n');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue