parent
4a5f2340b0
commit
d59a097ff7
@ -0,0 +1,16 @@ |
||||
{ |
||||
"log": { |
||||
"Changelogs": [ |
||||
"Added this changelog!", |
||||
"Dynamically displays changelog information from multiple versions" |
||||
], |
||||
"Dev stuff": [ |
||||
"Added a tool to create changelogs for me!", |
||||
"I'm really lazy :)" |
||||
] |
||||
}, |
||||
"version": { |
||||
"name": "Alpha", |
||||
"semver": "1.3.7" |
||||
} |
||||
} |
@ -0,0 +1,44 @@ |
||||
const readline = require('readline'); |
||||
const fs = require('fs'); |
||||
const cp = require('child_process'); |
||||
|
||||
const rl = readline.createInterface({input: process.stdin, output: process.stdout}); |
||||
const input = async question => {return new Promise(r => {rl.question(question, (ans) => {r(ans);});});}; |
||||
|
||||
let cl = {}; |
||||
let v; |
||||
|
||||
const ask = async () => { |
||||
const addGroup = async () => { |
||||
let conf = await input("\nWould you like to add a new group? "); |
||||
if (['y', 'ye', 'yes', 'sure'].includes(conf.trim().toLowerCase())) { |
||||
let gn = await input("What is the group's name? "); |
||||
cl[gn] = []; |
||||
const addItem = async () => { |
||||
let item = await input("Add an item: "); |
||||
if (item.trim().toLowerCase() !== "done") { |
||||
cl[gn].push(item); |
||||
await addItem(); |
||||
} |
||||
}; |
||||
await addItem(); |
||||
await addGroup(); |
||||
} |
||||
}; |
||||
|
||||
v = await input('What version are you making a changelog for? '); |
||||
await addGroup(); |
||||
|
||||
fs.writeFileSync(`./json/changelogs/${v.trim().toLowerCase()}.json`, JSON.stringify({log: cl, version: {name: "Alpha", semver: v}})); |
||||
|
||||
await input("I've made the changelog for you! Press enter when you're ready to create the release tag."); |
||||
|
||||
cp.exec(`npm version ${v.trim().toLowerCase()}`, function(error, stdout, stderr) { |
||||
if (error) {console.error(error);} |
||||
if (stdout) {console.log(stdout);} |
||||
if (stdout) {console.log(stderr);} |
||||
}); |
||||
|
||||
console.log('\nDone!'); |
||||
}; |
||||
ask(); |
@ -0,0 +1,73 @@ |
||||
const fs = require('fs'); |
||||
const Mousetrap = require('../dep/mousetrap'); |
||||
|
||||
const preModal = require('../modal/pre'); |
||||
const postModal = require('../modal/post'); |
||||
|
||||
const changelogs = fs.readdirSync('./json/changelogs').filter(file => file.endsWith('.json')); |
||||
|
||||
module.exports = () => { |
||||
if (window.kade.modal) {return;} |
||||
preModal('changelog-modal'); |
||||
let modalOut = document.createElement('div'); |
||||
modalOut.className = 'modal'; |
||||
modalOut.id = 'changelog-modal'; |
||||
document.body.appendChild(modalOut); |
||||
let modal = document.createElement('div'); |
||||
modal.className = 'modal-wrapper'; |
||||
modalOut.appendChild(modal); |
||||
let title = document.createElement('h2'); |
||||
title.innerHTML = 'FileKade - Changelog'; |
||||
modal.appendChild(title); |
||||
|
||||
let clw = document.createElement('div'); |
||||
clw.className = 'changelog-wrapper'; |
||||
modal.appendChild(clw); |
||||
|
||||
changelogs.forEach(changelog => { |
||||
changelog = require(`../../json/changelogs/${changelog}`); |
||||
let w = document.createElement('div'); |
||||
w.className = 'changelog-version-container'; |
||||
clw.appendChild(w); |
||||
let subtitle = document.createElement('h2'); |
||||
subtitle.className = 'subtitle'; |
||||
subtitle.innerHTML = changelog.version.name + ' ' + changelog.version.semver + (window.kade.version.name === changelog.version.name ? ' (Current)' : ''); |
||||
w.appendChild(subtitle); |
||||
let cl = changelog.log; |
||||
Object.keys(cl).forEach(group => { |
||||
let gc = document.createElement('div'); |
||||
gc.className = 'changelog-group-container'; |
||||
w.appendChild(gc); |
||||
let gt = document.createElement('p'); |
||||
gt.innerHTML = group; |
||||
gt.className = 'changelog-group-name'; |
||||
gc.appendChild(gt); |
||||
let ul = document.createElement('ul'); |
||||
gc.appendChild(ul); |
||||
cl[group].forEach(item => { |
||||
let li = document.createElement('li'); |
||||
ul.appendChild(li); |
||||
let itemp = document.createElement('p'); |
||||
itemp.innerHTML = item; |
||||
li.appendChild(itemp); |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
let msm = new Mousetrap(modal); |
||||
msm.bind('esc', () => { |
||||
modalOut.remove(); |
||||
postModal(modalOut.id); |
||||
}); |
||||
|
||||
let close = document.createElement('a'); |
||||
close.className = 'close-button'; |
||||
close.onclick = () => { |
||||
modalOut.remove(); |
||||
postModal(modalOut.id); |
||||
}; |
||||
let closeWrap = document.createElement('div'); |
||||
closeWrap.className = 'close-button-wrapper'; |
||||
modal.appendChild(closeWrap); |
||||
closeWrap.appendChild(close); |
||||
} |
Loading…
Reference in new issue