mirror of
https://github.com/dilllxd/gitfolio.git
synced 2024-08-14 22:28:09 +00:00
fixed #35
so umm looks like when you used update it would clear out config.json file, resaon being i was updating the html with only one argument and it needed 4 lol mb
This commit is contained in:
parent
e7fed0a3d7
commit
5ff9146ff5
2 changed files with 16 additions and 3 deletions
12
build.js
12
build.js
|
@ -58,7 +58,7 @@ async function populateCSS() {
|
|||
themeSource = themeSource.toString('utf-8');
|
||||
let themeTemplate = hbs.compile(themeSource);
|
||||
let styles = themeTemplate({
|
||||
'background': `${process.background || 'https://images.unsplash.com/photo-1553748024-d1b27fb3f960?w=1450'}`
|
||||
'background': `${program.background || 'https://images.unsplash.com/photo-1553748024-d1b27fb3f960?w=1450'}`
|
||||
})
|
||||
/* Add the user-specified styles to the new stylesheet */
|
||||
await fs.appendFileAsync(stylesheet, styles);
|
||||
|
@ -70,6 +70,15 @@ async function populateCSS() {
|
|||
await fs.writeFileAsync(config, JSON.stringify(data, null, ' '));
|
||||
}
|
||||
|
||||
async function populateConfig(sort, order, includeFork) {
|
||||
let data = await fs.readFileAsync(config);
|
||||
data = JSON.parse(data);
|
||||
data[0].sort = sort;
|
||||
data[0].order = order;
|
||||
data[0].includeFork = includeFork;
|
||||
await fs.writeFileAsync(config, JSON.stringify(data, null, ' '));
|
||||
}
|
||||
|
||||
populateCSS();
|
||||
|
||||
if (program.name) {
|
||||
|
@ -82,6 +91,7 @@ if (program.name) {
|
|||
if(program.fork){
|
||||
includeFork = true;
|
||||
}
|
||||
populateConfig(sort, order, includeFork);
|
||||
updateHTML(('%s', program.name), sort, order, includeFork);
|
||||
} else {
|
||||
console.error("Error: Please provide a GitHub username.");
|
||||
|
|
|
@ -5,9 +5,12 @@ fs.readFile("./dist/config.json", function (err , data) {
|
|||
if (err) throw err;
|
||||
data = JSON.parse(data);
|
||||
var username = data[0].username;
|
||||
if(!username || username == null){
|
||||
var sort = data[0].sort;
|
||||
var order = data[0].order;
|
||||
var includeFork = data[0].includeFork;
|
||||
if(username == null || sort == null || order == null || includeFork == null){
|
||||
console.log("username not found in config.json, please run build command before using update");
|
||||
return;
|
||||
}
|
||||
updateHTML(username);
|
||||
updateHTML(username, sort, order, includeFork);
|
||||
});
|
Loading…
Reference in a new issue