Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp: Split gulpfile.js and expanded changes task #1835

Merged
merged 10 commits into from
Jul 19, 2019
Prev Previous commit
Next Next commit
Sorted new components
RunDevelopment committed Mar 25, 2019
commit fff93e071e2f0e228538276d0098be56af094d28
23 changes: 19 additions & 4 deletions gulpfile.js/changelog.js
Original file line number Diff line number Diff line change
@@ -25,8 +25,20 @@ function linkify(cb) {
], cb);
}



function createSortedArray(compareFn) {
const a = [];
a[Symbol.iterator] = function*() {
const copy = [];
for (let i = 0; i < this.length; i++) {
copy.push(this[i]);
}
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved
copy.sort(compareFn);
for (const item of copy) {
yield item;
}
};
return a;
}

function getCommitInfo(line) {
const [, hash, message] = /^([a-f\d]+)\s+(.*)$/i.exec(line);
@@ -68,6 +80,7 @@ const logRanges = {
v1_15_0__HEAD: 'v1.15.0..HEAD',
v1_14_0__v1_15_0: 'v1.14.0..v1.15.0',
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved
};
const strCompare = (a, b) => a.localeCompare(b, 'en');

function changes() {

@@ -77,7 +90,9 @@ function changes() {

const entries = {
'TODO:': {},
'New components': {},
'New components': {
['']: createSortedArray(strCompare)
},
'Updated components': {},
'Updated plugins': {},
'Updated themes': {},
@@ -253,7 +268,7 @@ function changes() {
return `${info.message} [\`${info.hash}\`](https://github.com/PrismJS/prism/commit/${info.hash})`;
}
function printCategory(category, indentation = '') {
for (const subCategory of Object.keys(category).sort((a, b) => a.localeCompare(b, 'en'))) {
for (const subCategory of Object.keys(category).sort(strCompare)) {
if (subCategory) {
md += `${indentation}* __${subCategory}__\n`;
printCategory(category[subCategory], indentation + ' ')