1
0
mirror of https://github.com/GenderDysphoria/GenderDysphoria.fyi.git synced 2025-11-25 12:32:42 +00:00

Migrate to Node 16 (#118)

* Node 16: fix build dependencies

* Node 16: fix Bootstrap dependency problem

* Node 16: fix error in HTML writer

* Node 16: move await to proper place (h/t alliejones)
This commit is contained in:
Bill Garrett
2023-01-02 14:03:02 -08:00
committed by GitHub
parent 71990af059
commit 2f90e668cd
16 changed files with 25402 additions and 5246 deletions

View File

@@ -16,7 +16,7 @@ module.exports = exports = class Asset extends File {
this.serializable.push(
'dimensions',
'sizes',
'sizes'
);
}

View File

@@ -22,12 +22,12 @@ module.exports = exports = class Manifest {
this.stat = memoizeAsync((f) =>
fs.stat(resolve(f))
.catch(() => null)
.then((stats) => (stats && Math.floor(stats.mtimeMs / 1000))),
.then((stats) => (stats && Math.floor(stats.mtimeMs / 1000)))
);
this.revFile = memoizeAsync((f) =>
readFile(f)
.then(revHash)
.catch(() => null),
.catch(() => null)
);
this.isProd = prod;

View File

@@ -66,7 +66,7 @@ function markdown (mode, input, data, hbs) {
input = stripHtml(input
.replace(/<!--\[[\s\S]*?\]-->/g, '')
.replace(/æææ[\s\S]*?æææ/gi, '')
.replace(/\{!\{([\s\S]*?)\}!\}/mg, ''),
.replace(/\{!\{([\s\S]*?)\}!\}/mg, '')
).result.trim();
if (input.length > 1000) input = input.slice(0, 1000) + '…';
@@ -276,7 +276,7 @@ class Injectables {
const frame = handybars.makeContext(hash, env);
try {
const contents = self._template(tpath, (s) =>
handybars(`<span class="svg-icon" style="{{#if this.size}}width:{{this.size}};height:{{this.size}};{{/if}}{{this.style}}">${s}</span>`),
handybars(`<span class="svg-icon" style="{{#if this.size}}width:{{this.size}};height:{{this.size}};{{/if}}{{this.style}}">${s}</span>`)
)(frame);
return handybars.safe(contents);

View File

@@ -19,8 +19,8 @@ module.exports = exports = async function favicon () {
const input = any(await Promise.all(
MATCHES.map((f) =>
fs.exists(resolve(f)).then((y) => y && f),
),
fs.exists(resolve(f)).then((y) => y && f)
)
));
if (!input) return [];

View File

@@ -22,7 +22,7 @@ module.exports = exports = class Files {
this.assets = assets || [];
this._getTitlecard = memoize(() =>
find(assets, { name: 'titlecard', dir: this.base }),
find(assets, { name: 'titlecard', dir: this.base })
);
this._getWebReady = memoize(() => assets && keyBy(assets.map((a) => a.webready), 'name'));

View File

@@ -7,7 +7,7 @@ module.exports = exports = function (md) {
(state) => {
state.tokens = flatten(state.tokens.map(descend).filter(Boolean));
return false;
},
}
);
};

View File

@@ -113,7 +113,7 @@ function is (...args) {
IS_LOOKUP.get(a)
|| (isFunction(a) && a)
|| (isRegExp(a) && re(a))
|| equals(a),
|| equals(a)
);
if (args.length === 1) return (tok) => args[0](tok);
return (tok) => anyBy(args, (check) => check(tok));
@@ -124,7 +124,7 @@ function isAll (...args) {
IS_LOOKUP.get(a)
|| (isFunction(a) && a)
|| (isRegExp(a) && re(a))
|| equals(a),
|| equals(a)
);
if (args.length === 1) return (tok) => args[0](tok);
return (tok) => allBy(args, (check) => check(tok));
@@ -184,7 +184,7 @@ function ucfirst (input) {
function ucsentence (input) {
return input.replace(/((?:\S[^.?!]*)[.?!]*)/g, (txt) =>
txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(),
txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
);
}
@@ -674,7 +674,7 @@ function uniq (collection, predicate = null) {
function keyBy (collection, predicate) {
predicate = iteratee(predicate);
return mapReduce(collection, (value, key, index) =>
[ predicate(value, key, index), value ],
[ predicate(value, key, index), value ]
);
}
@@ -706,7 +706,7 @@ function omit (collection, predicate) {
return mapReduce(collection, (value, key, index) =>
(predicate(value, key, index)
? [ undefined, undefined ]
: [ key, value ]),
: [ key, value ])
);
}
@@ -718,7 +718,7 @@ function omit (collection, predicate) {
return mapReduce(collection, (value, key) =>
(predicate.includes(key)
? [ undefined, undefined ]
: [ key, value ]),
: [ key, value ])
);
}
@@ -729,7 +729,7 @@ function pick (collection, predicate) {
return mapReduce(collection, (value, key, index) =>
(predicate(value, key, index)
? [ key, value ]
: [ undefined, undefined ]),
: [ undefined, undefined ])
);
}
@@ -805,9 +805,11 @@ function pathinate (object, delimiter = '.') {
/**
* Iterates over a collection and generates an object based on tuple returned from the iteratee.
*
* @param {Object|Array|Map|Set} collection
* @param {Function} iteratee Callback invoked for each item, receives `value, key, index`, returns `[key, value]`;
* @return {Object}
* @param cb
* @returns {Object}
*/
function mapReduce (collection, cb) {
if (!collection) return {};
@@ -887,7 +889,7 @@ function flatten (collection, depth = Infinity) {
? flatten(val, depth - 1)
: [ val ]
)),
[],
[]
);
}

View File

@@ -132,7 +132,7 @@ function processPages (engines, pages, posts, prod) {
}
try {
html = shrink(html);
html = await shrink(html);
} catch (e) {
e.message = `Error while minifying page "${page.input}": ${e.message.slice(0, 50)}`;
throw e;
@@ -145,7 +145,7 @@ function processPages (engines, pages, posts, prod) {
await Promise.all([
fs.writeFile(output, Buffer.from(html)),
page.json && fs.writeFile(resolve('dist', page.json), Buffer.from(
prod ? JSON.stringify(json) : JSON.stringify(json, null, 2),
prod ? JSON.stringify(json) : JSON.stringify(json, null, 2)
)),
]);
});

View File

@@ -30,7 +30,7 @@ module.exports = exports = class Page extends File {
'dateModified',
'classes',
'flags',
'siblings',
'siblings'
);
this.engine = this._engine();

View File

@@ -13,7 +13,7 @@ module.exports = exports = async function scripts (prod) {
require.resolve('magnific-popup'),
require.resolve('popper.js/dist/umd/popper.js'),
require.resolve('bootstrap/js/dist/util.js'),
require.resolve('bootstrap/js/dist/dropdown.js'),
require.resolve('bootstrap/js/dist/dropdown.js')
);
const globalScript = new ClientScript('js/global.js');