1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00
-added cli support (thanks @rohit-smpx)
-arguments for fork
-you can now sort and order repos
-fixed bugs
This commit is contained in:
imfunny 2019-05-23 15:27:23 +05:30 committed by GitHub
parent 81e8302b22
commit 6fb6408534
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1853 additions and 1056 deletions

View file

@ -11,31 +11,29 @@ Check out this [live demo](https://imfunniee.github.io/gitfolio/) to see gitfoli
# Getting Started # Getting Started
### Let's Install
Install gitfolio
```sh
npm i -g gitfolio
```
### Let's Build ### Let's Build
a. Clone this repo or simply download it.
```sh ```sh
git clone https://github.com/imfunniee/gitfolio.git gitfolio build <username>
``` ```
This will build your website using your GitHub username and put it in the `/dist` folder.
b. `cd` into the repo you just cloned or downloaded. To run your website use `run` command
```sh
cd gitfolio # Navigate into the project folder
npm i # Install the required dependencies
```
c. Gitfolio is now ready to be used. The command
```sh ```sh
node build --name [username] gitfolio build <username>
``` ```
Will build your website using your GitHub username and put it in the `dist/` folder.
d. To run your website navigate to `./dist/index.html` in your browser. [you won't see blogs until you are on localhost]
🎉 Congrats, you just made yourself a personal website! 🎉 Congrats, you just made yourself a personal website!
> if you get stuck somewhere or get an error, please create an issue
### Let's Customize ### Let's Customize
@ -44,7 +42,7 @@ d. To run your website navigate to `./dist/index.html` in your browser. [you won
To include forks on your personal website just provide `-f` or `--fork` argument while building To include forks on your personal website just provide `-f` or `--fork` argument while building
``` ```
$ node build --name username -f $ gitfolio build username -f
``` ```
#### Sorting Repos #### Sorting Repos
@ -52,7 +50,7 @@ $ node build --name username -f
To sort repos provide `--sort [sortBy]` argument while building. Where `[sortBy]` can be `star`, `created`, `updated`, `pushed`,`full_name`. Default: `created` To sort repos provide `--sort [sortBy]` argument while building. Where `[sortBy]` can be `star`, `created`, `updated`, `pushed`,`full_name`. Default: `created`
``` ```
$ node build --name username --sort star $ gitfolio build username --sort star
``` ```
#### Ordering Repos #### Ordering Repos
@ -60,7 +58,7 @@ $ node build --name username --sort star
To order the sorted repos provide `--order [orderBy]` argument while building. Where `[orderBy]` can be `asc` or `desc`. Default: `asc` To order the sorted repos provide `--order [orderBy]` argument while building. Where `[orderBy]` can be `asc` or `desc`. Default: `asc`
``` ```
$ node build --name username --sort star --order desc $ gitfolio build username --sort star --order desc
``` ```
#### Customize Themes #### Customize Themes
@ -73,7 +71,7 @@ Themes are specified using the `--theme [theme-name]` flag when running the `bui
For example, the following command will build the website with the dark theme For example, the following command will build the website with the dark theme
``` ```
$ node build --name username --theme dark $ gitfolio build username --theme dark
``` ```
#### Customize background image #### Customize background image
@ -81,7 +79,7 @@ $ node build --name username --theme dark
To customize the background image just provide `--background [url]` argument while building To customize the background image just provide `--background [url]` argument while building
``` ```
$ node build --name username --background https://images.unsplash.com/photo-1557277770-baf0ca74f908?w=1634 $ gitfolio build username --background https://images.unsplash.com/photo-1557277770-baf0ca74f908?w=1634
``` ```
You could also add in your custom CSS inside `index.css` to give it a more personal feel. You could also add in your custom CSS inside `index.css` to give it a more personal feel.
@ -99,7 +97,7 @@ Go To `username.github.io` your site should be up!!
To update your info, simply run To update your info, simply run
``` ```
$ node update $ gitfolio update
``` ```
This will update your info and your repository info. This will update your info and your repository info.
@ -111,7 +109,7 @@ To Update background or theme you need to run `build` command again.
To add your first blog run this command. To add your first blog run this command.
``` ```
$ node blog --title my-first-blog $ gitfolio blog my-first-blog
``` ```
> (use "-" instead of spaces) > (use "-" instead of spaces)
@ -142,11 +140,12 @@ More Arguments for Blog
> (use "-" instead of spaces) > (use "-" instead of spaces)
## Support ## Support
Support me by buying me a coffee ☕ Support me to make more projects like this by Buying me a Coffee ☕
<a href="https://www.buymeacoffee.com/imfunniee" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a> <a href="https://www.buymeacoffee.com/imfunniee" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;"></a>
## License ## License
![GitHub](https://img.shields.io/github/license/imfunniee/gitfolio.svg) ![GitHub](https://img.shields.io/github/license/imfunniee/gitfolio.svg)

View file

@ -287,6 +287,7 @@ body{
font-size:24px; font-size:24px;
font-weight:bold; font-weight:bold;
margin:1vh 0px; margin:1vh 0px;
padding:0px 1px;
word-wrap: break-word; word-wrap: break-word;
} }

View file

@ -7,6 +7,7 @@ process.env.OUT_DIR = process.env.OUT_DIR || process.cwd();
const {buildCommand} = require('../build'); const {buildCommand} = require('../build');
const {updateCommand} = require('../update'); const {updateCommand} = require('../update');
const {blogCommand} = require('../blog'); const {blogCommand} = require('../blog');
const {runCommand} = require('../run');
const {version} = require('../package.json'); const {version} = require('../package.json');
program program
@ -21,6 +22,7 @@ program
program program
.command('update') .command('update')
.description('Update user and repository data')
.action(updateCommand); .action(updateCommand);
program program
@ -31,6 +33,11 @@ program
.option('-f, --folder [folder]', 'give folder a title (use "-" instead of spaces)') .option('-f, --folder [folder]', 'give folder a title (use "-" instead of spaces)')
.action(blogCommand); .action(blogCommand);
program
.command('run')
.description('Run build files')
.action(runCommand);
program.on('command:*', () => { program.on('command:*', () => {
console.log('Unknown Command: ' + program.args.join(' ')) console.log('Unknown Command: ' + program.args.join(' '))
program.help() program.help()

View file

@ -64,5 +64,5 @@ function blogCommand(title, program) {
} }
module.exports = { module.exports = {
blogCommand, blogCommand
}; };

View file

@ -83,5 +83,5 @@ async function buildCommand(username, program) {
} }
module.exports = { module.exports = {
buildCommand, buildCommand
}; };

764
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{ {
"name": "gitfolio", "name": "gitfolio",
"version": "0.1.2", "version": "0.1.3",
"description": "portfolio website for showcasing your work", "description": "a portfolio website for everyone to showcase your work",
"main": "build.js", "main": "build.js",
"bin": "bin/gitfolio.js", "bin": "bin/gitfolio.js",
"scripts": { "scripts": {
@ -34,9 +34,13 @@
"dependencies": { "dependencies": {
"bluebird": "^3.5.4", "bluebird": "^3.5.4",
"commander": "^2.20.0", "commander": "^2.20.0",
"express": "^4.17.0",
"github-emoji": "^1.1.0", "github-emoji": "^1.1.0",
"got": "^9.6.0", "got": "^9.6.0",
"handlebars": "^4.1.2", "handlebars": "^4.1.2",
"jsdom": "^15.1.0" "jsdom": "^15.1.0",
"ncp": "^2.0.0",
"open": "^6.3.0",
"x-default-browser": "^0.4.0"
} }
} }

View file

@ -126,7 +126,7 @@ module.exports.updateHTML = (username, sort, order, includeFork) => {
}); });
fs.writeFile(`${outDir}/index.html`, '<!DOCTYPE html>' + window.document.documentElement.outerHTML, function (error) { fs.writeFile(`${outDir}/index.html`, '<!DOCTYPE html>' + window.document.documentElement.outerHTML, function (error) {
if (error) throw error; if (error) throw error;
console.log("Build Complete"); console.log(`Build Complete, Files can be Found @ ${outDir}`);
}); });
} catch (error) { } catch (error) {
console.log(error); console.log(error);

25
run.js Normal file
View file

@ -0,0 +1,25 @@
const express = require('express');
const open = require('open');
const defaultBrowser = require('x-default-browser');
const app = express();
app.use(express.static(__dirname + '/dist'));
function runCommand(){
app.get('/',function(req,res){
res.sendFile('/index.html');
});
app.listen(3000);
defaultBrowser(function (err, res) {
if(err) throw err;
(async () => {
await open('http://localhost:3000', {app: res.commonName});
console.log("ctrl + c to exit");
})();
});
}
module.exports = {
runCommand
};

View file

@ -1,5 +1,4 @@
const fs = require('fs'); const {getConfig} = require('./utils');
const {getConfig, outDir} = require('./utils');
const {updateHTML} = require('./populate'); const {updateHTML} = require('./populate');
async function updateCommand() { async function updateCommand() {
@ -16,5 +15,5 @@ async function updateCommand() {
} }
module.exports = { module.exports = {
updateCommand, updateCommand
}; };

View file

@ -35,5 +35,5 @@ async function getBlog() {
module.exports = { module.exports = {
outDir, outDir,
getConfig, getConfig,
getBlog, getBlog
}; };