From 9623faab43cf62f143a10ab4cfdc96bd1577c85c Mon Sep 17 00:00:00 2001 From: Ayo Date: Sat, 24 Sep 2022 19:52:17 +0200 Subject: [PATCH] support github account stats --- index.ts | 8 +++----- package-lock.json | 8 ++++---- package.json | 14 ++++++++++---- src/Component.astro | 3 --- src/GithubStats.astro | 9 +++++++++ src/main.ts | 1 - test/example.test.js | 6 +++--- 7 files changed, 29 insertions(+), 20 deletions(-) delete mode 100644 src/Component.astro create mode 100644 src/GithubStats.astro delete mode 100644 src/main.ts diff --git a/index.ts b/index.ts index 6c2a154..8bc1560 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,3 @@ -// Do not write code directly here, instead use the `src` folder! - -// What you should do here is re-exports all the things you want your user to access, ex: -// export { HelloWorld } from "./src/main.ts" -// export type { HelloWorldResult } from "./src/types.ts" +import GithubStats from './src/GithubStats.astro'; +export default GithubStats; +export * from './src/GithubStats.astro'; diff --git a/package-lock.json b/package-lock.json index d4848fe..3778ca2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "astro-component-name", - "version": "0.1.0", + "name": "astro-github-stats", + "version": "0.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "astro-component-name", - "version": "0.1.0", + "name": "astro-github-stats", + "version": "0.0.1", "devDependencies": { "@types/chai": "^4.3.3", "@types/eslint": "^8.4.6", diff --git a/package.json b/package.json index 1e4fdea..6db3761 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,17 @@ { - "name": "astro-component-name", - "version": "0.1.0", + "name": "astro-github-stats", + "version": "0.0.1", + "author": { + "name": "Ayo Ayco", + "email": "ramon.aycojr@gmail.com", + "url": "https://ayco.io" + }, "type": "module", "exports": { ".": "./index.ts" }, "files": [ - "src", + "src/GithubStats.astro", "index.ts" ], "keywords": [ @@ -15,7 +20,8 @@ "scripts": { "test": "mocha --parallel --timeout 15000", "format": "prettier -w .", - "lint": "eslint . --ext .ts,.js" + "lint": "eslint . --ext .ts,.js", + "build": "tsc" }, "devDependencies": { "@types/chai": "^4.3.3", diff --git a/src/Component.astro b/src/Component.astro deleted file mode 100644 index 1057d4e..0000000 --- a/src/Component.astro +++ /dev/null @@ -1,3 +0,0 @@ ---- -// Write your component code in this file! ---- diff --git a/src/GithubStats.astro b/src/GithubStats.astro new file mode 100644 index 0000000..766ada6 --- /dev/null +++ b/src/GithubStats.astro @@ -0,0 +1,9 @@ +--- +const { username } = Astro.props; +const url = "https://github-readme-stats.vercel.app/api/" + + `?username=${username}`; +--- + + + + diff --git a/src/main.ts b/src/main.ts deleted file mode 100644 index 6cf78f3..0000000 --- a/src/main.ts +++ /dev/null @@ -1 +0,0 @@ -// Write your component's code here! diff --git a/test/example.test.js b/test/example.test.js index a0b51e6..7e51e5f 100644 --- a/test/example.test.js +++ b/test/example.test.js @@ -13,12 +13,12 @@ describe('Example Tests', () => { // First get the component's output, this returns an object containing the generated html (`.html`) 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 - it('example component should be empty', () => { - expect(component.html).to.equal('\n'); + it('example component should not be empty', () => { + expect(component.html).not.to.equal('\n'); }); }); });