Skip to content

Commit 850b345

Browse files
committed
fix the site
1 parent 373eb85 commit 850b345

3 files changed

Lines changed: 20 additions & 58 deletions

File tree

sites/package-lock.json

Lines changed: 13 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
const path = require('path');
22
const { readFile } = require('fs/promises');
3-
const hasha = require('hasha');
3+
const crypto = require('crypto');
44

55
module.exports = function addHashFilter(absolutePath, callback) {
66
const filePath = path.resolve(__dirname, `../../dist/${absolutePath}`);
77
readFile(filePath, { encoding: 'utf-8' })
8-
.then(content => hasha.async(content))
8+
.then(content => {
9+
const hash = crypto.createHash('sha512');
10+
hash.update(content, 'utf-8');
11+
return hash.digest('hex');
12+
})
913
.then(hash => {
10-
callback(null, `${absolutePath}?hash=${hash.substr(0, 10)}`);
14+
callback(null, `${absolutePath}?hash=${hash.slice(0, 10)}`);
1115
})
1216
.catch(() => callback(null, absolutePath));
1317
};

sites/postcss-preset-env/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
"eslint": "^8.53.0",
9999
"eslint-config-airbnb": "^19.0.4",
100100
"eslint-plugin-import": "^2.28.1",
101-
"hasha": "^6.0.0",
102101
"luxon": "^3.4.4",
103102
"markdown-it": "^13.0.2",
104103
"npm-run-all": "^4.1.5",

0 commit comments

Comments
 (0)