diff --git a/.env-sample b/.env-sample index 94dfb66..a67a510 100644 --- a/.env-sample +++ b/.env-sample @@ -1 +1 @@ -SERVER_PORT=80 \ No newline at end of file +GITHUB_TOKEN=1234567890 diff --git a/Gruntfile.js b/Gruntfile.js index 06c8a50..b069167 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -58,6 +58,9 @@ module.exports = function(grunt) { /** Configure watch task */ watch: { + options: { + livereload: true, + }, config: { files: [ 'config.json' diff --git a/README.md b/README.md index 2bcad66..d36cd30 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,16 @@ See the [demo][website]. ## 🤖 Installation 1. Prepare your `config.json` change the information according to your credentials. -2. Set `production` to `false` in `config.json` -3. Then run it : +2. Rename `.env-sample` to `.env` and fill in your environment variable (GitHub Tokens) +3. Install node package `npm install` +4. Generate `nodes.json` and `edges.json` by running `node index.js` +5. Then open it : + +### via any local Web Server : +- PHP Server : `php -S 127.0.0.1:80` +- XAMPP, LAMP, MAMP, WAMP Server +- Nginx, Apache +- etc ### via docker run ``` @@ -22,42 +30,43 @@ docker run -d -p 80:80 \ -v /path/to/config.json:/usr/share/nginx/html/config.json \ -v /path/to/avatar.jpg:/usr/share/nginx/html/assets/img/avatar.jpg \ -v /path/to/cover.jpg:/usr/share/nginx/html/assets/img/cover.jpg \ - agung2001/agung2001.github.io:master + -v /path/to/config.json:/usr/share/nginx/html/nodes.json \ + -v /path/to/config.json:/usr/share/nginx/html/edges.json \ + agung2001/agung2001.github.io:latest ``` - NOTE: Don't forget to change the `/path/to/` accordingly -### via manual build -- Install node package `npm i` -- Build asset `grunt build` - - Watch `grunt watch` +## 📝 Notes -## 📚 Notes +### How to Generate GitHub Tokens +Please refer to [GitHub Docs - Creating a personal access token](https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create personal access token. +Please set the expiration to `no expiration` and enable : `Repo` and `User` scope to see the [screenshot](assets/img/scopes.jpg). -### Handle GitHub API Rate Limit -This repo uses GitHub public rest API to generate the graph network. -To buffer the data from the API please set `production` to `false` in `config.json` -Then store the object information into [nodes.json](nodes.json) & [edges.json](edges.json) +### Live Reload +This repo comes with livereload module, to learn more please goto [gruntjs/grunt-contrib-watch](https://github.com/gruntjs/grunt-contrib-watch/blob/main/docs/watch-examples.md#enabling-live-reload-in-your-html) ## 🔥 Development -Running the nginx server -- Rename `.env-sample` to `.env` -- Change `.env` according to your environment -- Docker `docker-compose up` +- Install node package `npm install` + - Generate `nodes.json` and `edges.json` by running `node index.js` +- Build asset `grunt build` + - Watch `grunt watch` + +## 📚 Resources +- [Official Repo](https://github.com/agung2001/agung2001.github.io) +- [GitHub REST API Docs](https://docs.github.com/en/rest) +- [Docker Hub](https://hub.docker.com/r/agung2001/agung2001.github.io) +- [GHCR](https://github.com/agung2001/agung2001.github.io/pkgs/container/agung2001.github.io) ## ⚒️ Built with - [Animate.style](https://animate.style/) +- [Dotenv](https://www.npmjs.com/package/dotenv) - [Fontawesome](https://fontawesome.com/) - [Grunt JS](https://gruntjs.com/) +- [Octokit.js](https://github.com/octokit/octokit.js) - [Svelte JS](https://svelte.dev/) - [TailwindCSS](https://tailwindcss.com/) - [Vis JS](https://visjs.org/) -## 📚 Resources -- [Official Repo](https://github.com/agung2001/agung2001.github.io) -- [GitHub REST API Docs](https://docs.github.com/en/rest) -- [Docker Hub](https://hub.docker.com/r/agung2001/agung2001.github.io) -- [GHCR](https://github.com/agung2001/agung2001.github.io/pkgs/container/agung2001.github.io) - ## ⭐️ Support Help support me by giving a star or [donate][website] diff --git a/assets/build/components/content/bundle.js b/assets/build/components/content/bundle.js index c2f1171..70b6964 100644 --- a/assets/build/components/content/bundle.js +++ b/assets/build/components/content/bundle.js @@ -1 +1 @@ -var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let l,c;function i(t,e){return l||(l=document.createElement("a")),l.href=e,t===l.href}function a(t,e){t.appendChild(e)}function u(t,e,n){t.insertBefore(e,n||null)}function d(t){t.parentNode&&t.parentNode.removeChild(t)}function f(t,e){for(let n=0;nt.removeEventListener(e,n,o)}function $(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function b(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function x(t,e,n){t.classList[n?"add":"remove"](e)}function w(t){c=t}const y=[],v=[],_=[],k=[],C=Promise.resolve();let j=!1;function E(t){_.push(t)}const L=new Set;let T=0;function A(){const t=c;do{for(;T{N.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}else o&&o()}function H(t){t&&t.c()}function M(t,n,s,l){const{fragment:c,after_update:i}=t.$$;c&&c.m(n,s),l||E((()=>{const n=t.$$.on_mount.map(e).filter(r);t.$$.on_destroy?t.$$.on_destroy.push(...n):o(n),t.$$.on_mount=[]})),i.forEach(E)}function G(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function O(t,e){-1===t.$$.dirty[0]&&(y.push(t),j||(j=!0,C.then(A)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const r=o.length?o[0]:n;return h.ctx&&i(h.ctx[t],h.ctx[t]=r)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](r),m&&O(e,t)),n})):[],h.update(),m=!0,o(h.before_update),h.fragment=!!l&&l(h.ctx),r.target){if(r.hydrate){const t=function(t){return Array.from(t.childNodes)}(r.target);h.fragment&&h.fragment.l(t),t.forEach(d)}else h.fragment&&h.fragment.c();r.intro&&S(e.$$.fragment),M(e,r.target,r.anchor,r.customElement),A()}w(g)}class R{$destroy(){G(this,1),this.$destroy=t}$on(e,n){if(!r(n))return t;const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(n),()=>{const t=o.indexOf(n);-1!==t&&o.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function q(t,e,n){const o=t.slice();return o[4]=e[n],o}function I(t,e,n){const o=t.slice();return o[7]=e[n],o[8]=e,o[9]=n,o}function D(t){let e,n,r,s,l,c,i,f,w,y,v,_,k,C,j,E,L=t[7].label+"",T=t[7].caption+"";function A(){return t[2](t[7],t[8],t[9])}function B(){return t[3](t[7],t[8],t[9])}return{c(){e=g("div"),n=g("a"),r=g("i"),l=m(),c=g("div"),i=g("h5"),f=h(L),w=m(),y=g("p"),v=h(T),C=m(),$(r,"class",s=t[7].icon),$(i,"class","font-bold"),$(y,"class","whitespace-nowrap text-xs"),$(c,"class","ml-4"),$(n,"href",_=t[7].link),$(n,"class","animate__animated flex items-center py-2 px-4 rounded"),$(n,"target","_blank"),$(n,"rel","noreferrer"),$(n,"style",k="background-color: "+t[7].color+"; "+(t[7].textColor?`color: ${t[7].textColor};`:"")),x(n,"text-white",!t[7].textColor),x(n,"animate__tada",t[7].animate)},m(t,o){u(t,e,o),a(e,n),a(n,r),a(n,l),a(n,c),a(c,i),a(i,f),a(c,w),a(c,y),a(y,v),a(e,C),j||(E=[p(e,"mouseenter",A),p(e,"mouseleave",B)],j=!0)},p(e,o){t=e,1&o&&s!==(s=t[7].icon)&&$(r,"class",s),1&o&&L!==(L=t[7].label+"")&&b(f,L),1&o&&T!==(T=t[7].caption+"")&&b(v,T),1&o&&_!==(_=t[7].link)&&$(n,"href",_),1&o&&k!==(k="background-color: "+t[7].color+"; "+(t[7].textColor?`color: ${t[7].textColor};`:""))&&$(n,"style",k),1&o&&x(n,"text-white",!t[7].textColor),1&o&&x(n,"animate__tada",t[7].animate)},d(t){t&&d(e),j=!1,o(E)}}}function K(t){let e,n,o,r,s,l,c=t[4].label+"",i=t[4].buttons,p=[];for(let e=0;e(t.buttons=t.buttons.map((t=>({...t,animate:!1}))),t)));return t.$$set=t=>{"config"in t&&n(1,o=t.config)},[r,o,(t,e,o)=>{n(0,e[o].animate=!0,r)},(t,e,o)=>{n(0,e[o].animate=!1,r)}]}class J extends R{constructor(t){super(),P(this,t,F,V,s,{config:1})}}function Q(t,e,n){const o=t.slice();return o[5]=e[n],o}function U(t,e,n){const o=t.slice();return o[8]=e[n],o}function W(e){let n,o;return{c(){n=g("img"),$(n,"height","20"),i(n.src,o=e[8])||$(n,"src",o),$(n,"alt",e[5].label)},m(t,e){u(t,n,e)},p:t,d(t){t&&d(n)}}}function X(t){let e,n,o,r,s,l,c=t[5].label+"",i=t[5].tools,p=[];for(let e=0;e \n ',o=m(),r=g("tbody");for(let t=0;tcode.',$(n,"class","sm:rounded-t-xl h-44 bg-cover bg-center bg-no-repeat"),t=n,a="background-image",null===(u="url('assets/img/cover.jpg')")?t.style.removeProperty(a):t.style.setProperty(a,u,d?"important":""),i(r.src,s="assets/img/avatar.jpg")||$(r,"src","assets/img/avatar.jpg"),$(r,"class","w-44 h-44 -mt-32 mx-auto ring-4 ring-white shadow-xl rounded-full z-99"),$(r,"alt",e[0]),$(h,"class","mt-2 text-2xl text-center font-bold"),$(b,"class","mt-2 text-center text-base font-normal text-gray-500"),$(y,"alt","codeSTACKr's GitHub Stats"),i(y.src,v="https://github-readme-stats.vercel.app/api?username="+e[2]+"&show_icons=true&hide_border=false")||$(y,"src",v),$(k,"alt","DenverCoder1's Top Languages"),i(k.src,C="https://github-readme-stats.vercel.app/api/top-langs/?username="+e[2]+"&langs_count=8&layout=compact&hide_border=false")||$(k,"src",C),$(k,"width","100%"),$(L,"class","pb-4 font-bold text-xl text-blue-600"),$(E,"class","border border-slate-200 p-4"),$(w,"class","my-4 items-center w-full"),$(B,"class","mt-4 text-center text-xs text-gray-400"),$(c,"class","px-6 pt-4 pb-8 sm:px-10")},m(t,e){u(t,n,e),u(t,o,e),u(t,r,e),u(t,l,e),u(t,c,e),a(c,h),a(c,p),a(c,b),a(c,x),a(c,w),a(w,y),a(w,_),a(w,k),a(w,j),a(w,E),a(E,L),a(E,T),N&&N.m(E,null),a(c,A),a(c,B)},p(t,[e]){t[3].length&&N.p(t,e)},i:t,o:t,d(t){t&&d(n),t&&d(o),t&&d(r),t&&d(l),t&&d(c),N&&N.d()}}}function Z(t,e,n){let{config:o}=e,{name:r,tagline:s,username:l,codeEnvironment:c}=o;return t.$$set=t=>{"config"in t&&n(4,o=t.config)},[r,s,l,c,o]}class tt extends R{constructor(t){super(),P(this,t,Z,Y,s,{config:4})}}function et(e){let n,o,r,s,l;return{c(){n=g("div"),o=g("div"),o.innerHTML='

Github Repository

',r=m(),s=g("div"),l=h(e[0]),$(o,"class","p-6"),$(s,"id","github-network"),$(s,"class","svelte-1y5opp7"),$(n,"class","bg-white shadow-xl rounded-lg mb-4")},m(t,e){u(t,n,e),a(n,o),a(n,r),a(n,s),a(s,l)},p(t,[e]){1&e&&b(l,t[0])},i:t,o:t,d(t){t&&d(n)}}}async function nt(t,e,n){let o=await fetch(t),r=await o.json(),s=e[0],l=s.id+1;return r.map((t=>{e.push({id:l,label:t.name,value:t.stargazers_count,url:t.html_url,group:l}),l++})),(n=e.map((t=>({from:t.id,to:s.id})))).splice(0,1),{nodes:e,edges:n}}function ot(t,e,n){let{config:o}=e,r="Loading...";return document.onload=async function(){let{username:t,organizations:e,production:s}=o;try{let n,o;if(s)await fetch("./nodes.json").then((t=>t.json())).then((t=>{n=t})),await fetch("./edges.json").then((t=>t.json())).then((t=>{o=t}));else{let r=`https://api.github.com/users/${t}/repos`,s=await nt(r,[{id:0,label:t,group:1}],[]);n=s.nodes,o=s.edges,await e.map((async t=>{let e=`https://api.github.com/users/${t}/repos`,r=await nt(e,[{id:n.length,label:t,group:n.length}],[]);o.push({from:0,to:n.length}),n.push(...r.nodes),o.push(...r.edges)})),console.log(n),console.log(o)}setTimeout((function(){var t=document.getElementById("github-network"),e={nodes:n,edges:o};new vis.Network(t,e,{nodes:{shape:"dot"},physics:{forceAtlas2Based:{gravitationalConstant:-26,centralGravity:.005,springLength:230,springConstant:.18},maxVelocity:146,solver:"forceAtlas2Based",timestep:.35,stabilization:{iterations:150}}}).on("click",(function(t){if(1===t.nodes.length){let e=n[t.nodes[0]];null!=e.url&&window.open(e.url,"_blank")}}))}),500)}catch(t){n(0,r="Rate Limit Reached!")}}(),t.$$set=t=>{"config"in t&&n(1,o=t.config)},[r,o]}class rt extends R{constructor(t){super(),P(this,t,ot,et,s,{config:1})}}function st(t){let e,n,o,r,s,l,c,i,f;return o=new tt({props:{config:t[0]}}),l=new rt({props:{config:t[0]}}),i=new J({props:{config:t[0]}}),{c(){e=g("div"),n=g("div"),H(o.$$.fragment),r=m(),s=g("div"),H(l.$$.fragment),c=m(),H(i.$$.fragment),$(n,"class","bg-white shadow-xl rounded-lg md:col-span-2"),$(s,"class","md:col-span-4"),$(e,"class","relative sm:mx-auto md:w-3/4 grid sm:grid-rows-1 md:grid-cols-6 gap-4")},m(t,d){u(t,e,d),a(e,n),M(o,n,null),a(e,r),a(e,s),M(l,s,null),a(s,c),M(i,s,null),f=!0},p(t,[e]){const n={};1&e&&(n.config=t[0]),o.$set(n);const r={};1&e&&(r.config=t[0]),l.$set(r);const s={};1&e&&(s.config=t[0]),i.$set(s)},i(t){f||(S(o.$$.fragment,t),S(l.$$.fragment,t),S(i.$$.fragment,t),f=!0)},o(t){z(o.$$.fragment,t),z(l.$$.fragment,t),z(i.$$.fragment,t),f=!1},d(t){t&&d(e),G(o),G(l),G(i)}}}function lt(t,e,n){let{config:o}=e;return t.$$set=t=>{"config"in t&&n(0,o=t.config)},[o]}class ct extends R{constructor(t){super(),P(this,t,lt,st,s,{config:0})}}return async function(){await fetch("./config.json").then((t=>t.json())).then((t=>{let{name:e}=t;document.title=e,new ct({target:document.querySelector("#content"),props:{config:t}})}))}(),app}(); +var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let l,c;function i(t,e){return l||(l=document.createElement("a")),l.href=e,t===l.href}function a(t,e){t.appendChild(e)}function u(t,e,n){t.insertBefore(e,n||null)}function f(t){t.parentNode&&t.parentNode.removeChild(t)}function d(t,e){for(let n=0;nt.removeEventListener(e,n,o)}function b(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function $(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function x(t,e,n){t.classList[n?"add":"remove"](e)}function v(t){c=t}const y=[],w=[],_=[],k=[],C=Promise.resolve();let j=!1;function E(t){_.push(t)}const T=new Set;let L=0;function A(){const t=c;do{for(;L{H.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}else o&&o()}function G(t){t&&t.c()}function M(t,n,s,l){const{fragment:c,after_update:i}=t.$$;c&&c.m(n,s),l||E((()=>{const n=t.$$.on_mount.map(e).filter(r);t.$$.on_destroy?t.$$.on_destroy.push(...n):o(n),t.$$.on_mount=[]})),i.forEach(E)}function P(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function O(t,e){-1===t.$$.dirty[0]&&(y.push(t),j||(j=!0,C.then(A)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const r=o.length?o[0]:n;return h.ctx&&i(h.ctx[t],h.ctx[t]=r)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](r),m&&O(e,t)),n})):[],h.update(),m=!0,o(h.before_update),h.fragment=!!l&&l(h.ctx),r.target){if(r.hydrate){const t=function(t){return Array.from(t.childNodes)}(r.target);h.fragment&&h.fragment.l(t),t.forEach(f)}else h.fragment&&h.fragment.c();r.intro&&N(e.$$.fragment),M(e,r.target,r.anchor,r.customElement),A()}v(g)}class q{$destroy(){P(this,1),this.$destroy=t}$on(e,n){if(!r(n))return t;const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(n),()=>{const t=o.indexOf(n);-1!==t&&o.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function z(t,e,n){const o=t.slice();return o[4]=e[n],o}function I(t,e,n){const o=t.slice();return o[7]=e[n],o[8]=e,o[9]=n,o}function D(t){let e,n,r,s,l,c,i,d,v,y,w,_,k,C,j,E,T=t[7].label+"",L=t[7].caption+"";function A(){return t[2](t[7],t[8],t[9])}function B(){return t[3](t[7],t[8],t[9])}return{c(){e=g("div"),n=g("a"),r=g("i"),l=m(),c=g("div"),i=g("h5"),d=h(T),v=m(),y=g("p"),w=h(L),C=m(),b(r,"class",s=t[7].icon),b(i,"class","font-bold"),b(y,"class","whitespace-nowrap text-xs"),b(c,"class","ml-4"),b(n,"href",_=t[7].link),b(n,"class","animate__animated flex items-center py-2 px-4 rounded"),b(n,"target","_blank"),b(n,"rel","noreferrer"),b(n,"style",k="background-color: "+t[7].color+"; "+(t[7].textColor?`color: ${t[7].textColor};`:"")),x(n,"text-white",!t[7].textColor),x(n,"animate__tada",t[7].animate)},m(t,o){u(t,e,o),a(e,n),a(n,r),a(n,l),a(n,c),a(c,i),a(i,d),a(c,v),a(c,y),a(y,w),a(e,C),j||(E=[p(e,"mouseenter",A),p(e,"mouseleave",B)],j=!0)},p(e,o){t=e,1&o&&s!==(s=t[7].icon)&&b(r,"class",s),1&o&&T!==(T=t[7].label+"")&&$(d,T),1&o&&L!==(L=t[7].caption+"")&&$(w,L),1&o&&_!==(_=t[7].link)&&b(n,"href",_),1&o&&k!==(k="background-color: "+t[7].color+"; "+(t[7].textColor?`color: ${t[7].textColor};`:""))&&b(n,"style",k),1&o&&x(n,"text-white",!t[7].textColor),1&o&&x(n,"animate__tada",t[7].animate)},d(t){t&&f(e),j=!1,o(E)}}}function K(t){let e,n,o,r,s,l,c=t[4].label+"",i=t[4].buttons,p=[];for(let e=0;e(t.buttons=t.buttons.map((t=>({...t,animate:!1}))),t)));return t.$$set=t=>{"config"in t&&n(1,o=t.config)},[r,o,(t,e,o)=>{n(0,e[o].animate=!0,r)},(t,e,o)=>{n(0,e[o].animate=!1,r)}]}class F extends q{constructor(t){super(),R(this,t,W,V,s,{config:1})}}function J(t,e,n){const o=t.slice();return o[5]=e[n],o}function Q(t,e,n){const o=t.slice();return o[8]=e[n],o}function U(e){let n,o;return{c(){n=g("img"),b(n,"height","20"),i(n.src,o=e[8])||b(n,"src",o),b(n,"alt",e[5].label)},m(t,e){u(t,n,e)},p:t,d(t){t&&f(n)}}}function X(t){let e,n,o,r,s,l,c=t[5].label+"",i=t[5].tools,p=[];for(let e=0;e \n ',o=m(),r=g("tbody");for(let t=0;tcode.',b(n,"class","sm:rounded-t-xl h-44 bg-cover bg-center bg-no-repeat"),t=n,a="background-image",null===(u="url('assets/img/cover.jpg')")?t.style.removeProperty(a):t.style.setProperty(a,u,f?"important":""),i(r.src,s="assets/img/avatar.jpg")||b(r,"src","assets/img/avatar.jpg"),b(r,"class","w-44 h-44 -mt-32 mx-auto ring-4 ring-white shadow-xl rounded-full z-99"),b(r,"alt",e[0]),b(h,"class","mt-2 text-2xl text-center font-bold"),b($,"class","mt-2 text-center text-base font-normal text-gray-500"),b(y,"alt","codeSTACKr's GitHub Stats"),i(y.src,w="https://github-readme-stats.vercel.app/api?username="+e[2]+"&show_icons=true&hide_border=false")||b(y,"src",w),b(k,"alt","DenverCoder1's Top Languages"),i(k.src,C="https://github-readme-stats.vercel.app/api/top-langs/?username="+e[2]+"&langs_count=8&layout=compact&hide_border=false")||b(k,"src",C),b(k,"width","100%"),b(T,"class","pb-4 font-bold text-xl text-blue-600"),b(E,"class","border border-slate-200 p-4"),b(v,"class","my-4 items-center w-full"),b(B,"class","mt-4 text-center text-xs text-gray-400"),b(c,"class","px-6 pt-4 pb-8 sm:px-10")},m(t,e){u(t,n,e),u(t,o,e),u(t,r,e),u(t,l,e),u(t,c,e),a(c,h),a(c,p),a(c,$),a(c,x),a(c,v),a(v,y),a(v,_),a(v,k),a(v,j),a(v,E),a(E,T),a(E,L),H&&H.m(E,null),a(c,A),a(c,B)},p(t,[e]){t[3].length&&H.p(t,e)},i:t,o:t,d(t){t&&f(n),t&&f(o),t&&f(r),t&&f(l),t&&f(c),H&&H.d()}}}function Z(t,e,n){let{config:o}=e,{name:r,tagline:s,username:l,codeEnvironment:c}=o;return t.$$set=t=>{"config"in t&&n(4,o=t.config)},[r,s,l,c,o]}class tt extends q{constructor(t){super(),R(this,t,Z,Y,s,{config:4})}}function et(e){let n,o,r,s,l;return{c(){n=g("div"),o=g("div"),o.innerHTML='

Github Repository

',r=m(),s=g("div"),l=h(e[0]),b(o,"class","p-6"),b(s,"id","github-network"),b(s,"class","svelte-1y5opp7"),b(n,"class","bg-white shadow-xl rounded-lg mb-4")},m(t,e){u(t,n,e),a(n,o),a(n,r),a(n,s),a(s,l)},p(t,[e]){1&e&&$(l,t[0])},i:t,o:t,d(t){t&&f(n)}}}function nt(t,e,n){let{config:o}=e,r="Loading...";return document.onload=async function(){let{production:t}=o;try{let e,n;if(await fetch("./nodes.json").then((t=>t.json())).then((t=>{e=t})),await fetch("./edges.json").then((t=>t.json())).then((t=>{n=t})),!t){let t="\n (◔_◔) This method has been obsolete in the latest version of the website!\n Please refers to : https://github.com/agung2001/agung2001.github.io/releases/tag/1.0.2 if you still want to use it.\n The newer version has support GitHub tokens to bypass rate limit, to learn more please refer to https://github.com/agung2001/agung2001.github.io\n ".replace(/ +/g,"");console.log(t)}setTimeout((function(){var t=document.getElementById("github-network"),o={nodes:e,edges:n};new vis.Network(t,o,{nodes:{shape:"dot"},physics:{forceAtlas2Based:{gravitationalConstant:-26,centralGravity:.005,springLength:230,springConstant:.18},maxVelocity:146,solver:"forceAtlas2Based",timestep:.35,stabilization:{iterations:150}}}).on("click",(function(t){if(1===t.nodes.length){let n=e[t.nodes[0]];null!=n.url&&window.open(n.url,"_blank")}}))}),100)}catch(t){n(0,r="Rate Limit Reached!")}}(),t.$$set=t=>{"config"in t&&n(1,o=t.config)},[r,o]}class ot extends q{constructor(t){super(),R(this,t,nt,et,s,{config:1})}}function rt(t){let e,n,o,r,s,l,c,i,d;return o=new tt({props:{config:t[0]}}),l=new ot({props:{config:t[0]}}),i=new F({props:{config:t[0]}}),{c(){e=g("div"),n=g("div"),G(o.$$.fragment),r=m(),s=g("div"),G(l.$$.fragment),c=m(),G(i.$$.fragment),b(n,"class","bg-white shadow-xl rounded-lg md:col-span-2"),b(s,"class","md:col-span-4"),b(e,"class","relative sm:mx-auto md:w-3/4 grid sm:grid-rows-1 md:grid-cols-6 gap-4")},m(t,f){u(t,e,f),a(e,n),M(o,n,null),a(e,r),a(e,s),M(l,s,null),a(s,c),M(i,s,null),d=!0},p(t,[e]){const n={};1&e&&(n.config=t[0]),o.$set(n);const r={};1&e&&(r.config=t[0]),l.$set(r);const s={};1&e&&(s.config=t[0]),i.$set(s)},i(t){d||(N(o.$$.fragment,t),N(l.$$.fragment,t),N(i.$$.fragment,t),d=!0)},o(t){S(o.$$.fragment,t),S(l.$$.fragment,t),S(i.$$.fragment,t),d=!1},d(t){t&&f(e),P(o),P(l),P(i)}}}function st(t,e,n){let{config:o}=e;return t.$$set=t=>{"config"in t&&n(0,o=t.config)},[o]}class lt extends q{constructor(t){super(),R(this,t,st,rt,s,{config:0})}}return async function(){await fetch("./config.json").then((t=>t.json())).then((t=>{let{name:e}=t;console.log(`༼ つ ◕_◕ ༽つ Welcome to ${e} profile page`),document.title=e,new lt({target:document.querySelector("#content"),props:{config:t}})}))}(),app}(); diff --git a/assets/components/content/sections/VisJS.svelte b/assets/components/content/sections/VisJS.svelte index 5b650ab..9e65615 100644 --- a/assets/components/content/sections/VisJS.svelte +++ b/assets/components/content/sections/VisJS.svelte @@ -1,9 +1,6 @@ diff --git a/assets/components/content/src/main.js b/assets/components/content/src/main.js index 89380f4..0419fac 100644 --- a/assets/components/content/src/main.js +++ b/assets/components/content/src/main.js @@ -6,6 +6,11 @@ import App from './App.svelte'; .then((response) => response.json()) .then((config) => { let { name } = config; + + /** Welcome Terminal ASCII */ + console.log(`༼ つ ◕_◕ ༽つ Welcome to ${name} profile page`); + + /** Display Component */ document.title = name; const app = new App({ target: document.querySelector('#content'), diff --git a/assets/img/scopes.jpg b/assets/img/scopes.jpg new file mode 100644 index 0000000..f821c3e Binary files /dev/null and b/assets/img/scopes.jpg differ diff --git a/config.json b/config.json index 796e50e..faea5bf 100644 --- a/config.json +++ b/config.json @@ -66,7 +66,7 @@ }, { "label": "Github", - "caption": "Contribute to open source", + "caption": "Any idea on how to become a GitHub stars?", "link": "https://github.com/agung2001", "icon": "fab fa-github", "color": "#24292f" @@ -94,6 +94,25 @@ } ] }, + { + "label": "Artistudio", + "buttons": [ + { + "label": "Go Packages", + "caption": "Collection of go packages", + "link": "https://pkg.go.dev/search?q=artistudioxyz&m=package", + "icon": "fa-brands fa-golang", + "color": "#007d9c" + }, + { + "label": "GitHub Packages", + "caption": "Collection of container and images", + "link": "https://github.com/orgs/artistudioxyz/packages", + "icon": "fab fa-github", + "color": "#24292f" + } + ] + }, { "label": "Contact", "buttons": [ diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index fb7e227..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: '3' -services: - - agung2001.github.io: - container_name: agung2001.github.io - image: nginx:latest - restart: always - ports: - - ${SERVER_PORT-80}:80 - volumes: - - ${PWD}:/usr/share/nginx/html \ No newline at end of file diff --git a/edges.json b/edges.json index 7ac1169..bdec5ea 100644 --- a/edges.json +++ b/edges.json @@ -1,72 +1 @@ -[ - { - "from": 1, - "to": 0, - "id": "619f712b-6b7d-4fee-8901-0145006dcf0e" - }, - { - "from": 2, - "to": 0, - "id": "2d5f5b55-7271-47e6-92a6-a221200ff595" - }, - { - "from": 3, - "to": 0, - "id": "2870c1da-2958-481b-ab07-d1016b100e3f" - }, - { - "from": 4, - "to": 0, - "id": "c1e89d2c-9216-417d-a64c-c8758997878b" - }, - { - "from": 5, - "to": 0, - "id": "202f0562-72e6-48a7-bb2c-143a4d671ae2" - }, - { - "from": 6, - "to": 0, - "id": "5031ec9e-5d2f-484c-8162-6730a6aa4286" - }, - { - "from": 7, - "to": 0, - "id": "ee383530-04f8-40b9-a365-1ce5038f07fd" - }, - { - "from": 8, - "to": 0, - "id": "a62c01c5-ad35-4653-a10e-039eaecd93d1" - }, - { - "from": 0, - "to": 9, - "id": "80198013-5a16-459e-a8f2-b1f34c79cf3d" - }, - { - "from": 10, - "to": 9, - "id": "5272c2fa-53ee-4667-a388-cc0bb40aba19" - }, - { - "from": 11, - "to": 9, - "id": "001329ca-6f20-4929-9b19-1cccbee9fcf6" - }, - { - "from": 12, - "to": 9, - "id": "04eb840e-d9e2-4ec0-9192-9a1d2b682113" - }, - { - "from": 13, - "to": 9, - "id": "53f1b418-f6eb-45fc-ab2d-c3402a8fa5da" - }, - { - "from": 14, - "to": 9, - "id": "9c30b61a-cd8c-4bfd-ad9a-15452fbbad4e" - } -] \ No newline at end of file +[{"from":1,"to":0},{"from":2,"to":0},{"from":3,"to":0},{"from":4,"to":0},{"from":5,"to":0},{"from":6,"to":0},{"from":7,"to":0},{"from":8,"to":0},{"from":9,"to":0},{"from":10,"to":0},{"from":0,"to":11},{"from":12,"to":11},{"from":13,"to":11},{"from":14,"to":11},{"from":15,"to":11},{"from":16,"to":11},{"from":17,"to":11},{"from":18,"to":11},{"from":19,"to":11}] \ No newline at end of file diff --git a/index.html b/index.html index 6d6cd7a..056deac 100644 --- a/index.html +++ b/index.html @@ -32,9 +32,8 @@ - + + \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..fe4d8ae --- /dev/null +++ b/index.js @@ -0,0 +1,74 @@ +/** Libraries */ +const { Octokit } = require("octokit"); +const fs = require('fs'); +require('dotenv').config(); + +/** Config and Environment Variables */ +const config = JSON.parse( fs.readFileSync('config.json') ); +const GITHUB_TOKEN = process.env.GITHUB_TOKEN +const octokit = new Octokit({ auth: GITHUB_TOKEN }); // Official clients for the GitHub API + +/** Generate Data (nodes.json and edges.json) */ +(async function(){ + /** GenerateEdgesandNodes Function */ + const GenerateEdgesandNodes = (data, nodes, edges) => { + let root = nodes[0]; + + /** Nodes */ + let counter = root.id + 1; + data.map((v) => { + nodes.push({ + id: counter, + label: v.name, + value: v.stargazers_count, + url: v.html_url, + group: counter, + }) + counter++; + }); + + /** Edges */ + edges = nodes.map((v) => ({ from: v.id, to: root.id })); + edges.splice(0, 1); + return { nodes, edges } + } + + /** Graph for User */ + const GraphforUser = async () => { + let nodes, edges; + let { username } = config; + let { data } = await octokit.request('GET /users/{username}/repos', { username }); + data = GenerateEdgesandNodes(data, [{ id: 0, label: config.username, group: 1}], []); + nodes = data.nodes; edges = data.edges; + return { nodes, edges } + } + + /** + * Graph for Organization + * @param data Consists of nodes and edges data from user + * */ + const GraphforOrganizations = async (data) => { + let { nodes, edges } = data; + let { organizations } = config; + for (let i = 0; i < organizations.length; i ++) { + let org = organizations[i]; + let { data } = await octokit.request('GET /orgs/{org}/repos', { org }) + data = GenerateEdgesandNodes(data, [{ id: nodes.length, label: org, group: nodes.length}], []); + edges.push({ from: 0, to: nodes.length }); + nodes.push(...data.nodes); edges.push(...data.edges); + } + return { nodes, edges } + } + + /** Generate Data */ + let data = await GraphforUser() + data = await GraphforOrganizations(data); + + /** Write to File */ + try { + fs.writeFileSync('nodes.json', JSON.stringify(data.nodes)); + fs.writeFileSync('edges.json', JSON.stringify(data.edges)); + console.log('✅ The file has been saved!'); + } catch (e) { console.log(e); } + +})() \ No newline at end of file diff --git a/nodes.json b/nodes.json index d64c941..54a15cc 100644 --- a/nodes.json +++ b/nodes.json @@ -1,103 +1 @@ -[ - { - "id": 0, - "label": "agung2001", - "group": 1 - }, - { - "id": 1, - "label": "agung2001", - "value": 0, - "url": "https://github.com/agung2001/agung2001", - "group": 1 - }, - { - "id": 2, - "label": "agung2001.github.io", - "value": 16, - "url": "https://github.com/agung2001/agung2001.github.io", - "group": 2 - }, - { - "id": 3, - "label": "auto-commit", - "value": 0, - "url": "https://github.com/agung2001/auto-commit", - "group": 3 - }, - { - "id": 4, - "label": "cakechimp", - "value": 0, - "url": "https://github.com/agung2001/cakechimp", - "group": 4 - }, - { - "id": 5, - "label": "docker-lamp", - "value": 0, - "url": "https://github.com/agung2001/docker-lamp", - "group": 5 - }, - { - "id": 6, - "label": "hands-on-laravel", - "value": 0, - "url": "https://github.com/agung2001/hands-on-laravel", - "group": 6 - }, - { - "id": 7, - "label": "HpProbook440G4-hackintosh", - "value": 0, - "url": "https://github.com/agung2001/HpProbook440G4-hackintosh", - "group": 7 - }, - { - "id": 8, - "label": "WordPush", - "value": 0, - "url": "https://github.com/agung2001/WordPush", - "group": 8 - }, - { - "id": 9, - "label": "artistudioxyz", - "group": 9 - }, - { - "id": 10, - "label": "bingopress", - "value": 0, - "url": "https://github.com/artistudioxyz/bingopress", - "group": 10 - }, - { - "id": 11, - "label": "docker-youtrack", - "value": 0, - "url": "https://github.com/artistudioxyz/docker-youtrack", - "group": 11 - }, - { - "id": 12, - "label": "floating-awesome-button", - "value": 0, - "url": "https://github.com/artistudioxyz/floating-awesome-button", - "group": 12 - }, - { - "id": 13, - "label": "triangle-email-template", - "value": 0, - "url": "https://github.com/artistudioxyz/triangle-email-template", - "group": 13 - }, - { - "id": 14, - "label": "wp-plugin-svelte-js", - "value": 7, - "url": "https://github.com/artistudioxyz/wp-plugin-svelte-js", - "group": 14 - } -] \ No newline at end of file +[{"id":0,"label":"agung2001","group":1},{"id":1,"label":"agung2001","value":0,"url":"https://github.com/agung2001/agung2001","group":1},{"id":2,"label":"agung2001.github.io","value":16,"url":"https://github.com/agung2001/agung2001.github.io","group":2},{"id":3,"label":"auto-commit","value":0,"url":"https://github.com/agung2001/auto-commit","group":3},{"id":4,"label":"cakechimp","value":0,"url":"https://github.com/agung2001/cakechimp","group":4},{"id":5,"label":"docker-lamp","value":0,"url":"https://github.com/agung2001/docker-lamp","group":5},{"id":6,"label":"hacktoberfest-practice","value":0,"url":"https://github.com/agung2001/hacktoberfest-practice","group":6},{"id":7,"label":"hands-on-laravel","value":1,"url":"https://github.com/agung2001/hands-on-laravel","group":7},{"id":8,"label":"HpProbook440G4-hackintosh","value":0,"url":"https://github.com/agung2001/HpProbook440G4-hackintosh","group":8},{"id":9,"label":"nielslange.github.io","value":0,"url":"https://github.com/agung2001/nielslange.github.io","group":9},{"id":10,"label":"WordPush","value":0,"url":"https://github.com/agung2001/WordPush","group":10},{"id":11,"label":"artistudioxyz","group":11},{"id":12,"label":"triangle-email-template","value":0,"url":"https://github.com/artistudioxyz/triangle-email-template","group":12},{"id":13,"label":"floating-awesome-button","value":0,"url":"https://github.com/artistudioxyz/floating-awesome-button","group":13},{"id":14,"label":"docker-youtrack","value":0,"url":"https://github.com/artistudioxyz/docker-youtrack","group":14},{"id":15,"label":"wp-plugin-svelte-js","value":8,"url":"https://github.com/artistudioxyz/wp-plugin-svelte-js","group":15},{"id":16,"label":"bingopress","value":0,"url":"https://github.com/artistudioxyz/bingopress","group":16},{"id":17,"label":"dot-framework","value":0,"url":"https://github.com/artistudioxyz/dot-framework","group":17},{"id":18,"label":"aspri","value":3,"url":"https://github.com/artistudioxyz/aspri","group":18},{"id":19,"label":"kuli","value":0,"url":"https://github.com/artistudioxyz/kuli","group":19}] \ No newline at end of file diff --git a/package.json b/package.json index 06a5081..b68700e 100644 --- a/package.json +++ b/package.json @@ -19,5 +19,9 @@ "shelljs": "^0.8.5", "svelte": "^3.0.0", "tailwindcss": "^3.2.4" + }, + "dependencies": { + "dotenv": "^16.0.3", + "octokit": "^2.0.10" } }