chore: set up commitlint, husky, and prettier (#1451)

* chore: add prettier configuration

Signed-off-by: Xe Iaso <me@xeiaso.net>

* format: run prettier tree-wide

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore(prettier): ignore intentionally ungrammatical files

Signed-off-by: Xe Iaso <me@xeiaso.net>

* ci: add PR title lint rule

Signed-off-by: Xe Iaso <me@xeiaso.net>

* ci: add DCO check

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore: add commitlint and husky

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore: add CONTRIBUTING guidelines

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore: set SKIP_INTEGRATION in precommit tests

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore: update spelling

Signed-off-by: Xe Iaso <me@xeiaso.net>

* ci(dco): remove reopened trigger

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore: remove dead file

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore(prettier): don't format nginx includes

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2026-02-15 13:19:12 +00:00
committed by GitHub
parent 005750903d
commit bf5d66222c
165 changed files with 2854 additions and 1621 deletions

View File

@@ -1,4 +1,4 @@
import { Sha256 } from '@aws-crypto/sha256-js';
import { Sha256 } from "@aws-crypto/sha256-js";
const calculateSHA256 = (text) => {
const hash = new Sha256();
@@ -12,7 +12,7 @@ function toHexString(arr: Uint8Array): string {
.join("");
}
addEventListener('message', async ({ data: eventData }) => {
addEventListener("message", async ({ data: eventData }) => {
const { data, difficulty, threads } = eventData;
let nonce = eventData.nonce;
const isMainThread = nonce === 0;
@@ -21,7 +21,7 @@ addEventListener('message', async ({ data: eventData }) => {
const requiredZeroBytes = Math.floor(difficulty / 2);
const isDifficultyOdd = difficulty % 2 !== 0;
for (; ;) {
for (;;) {
const hashBuffer = await calculateSHA256(data + nonce);
const hashArray = new Uint8Array(hashBuffer);
@@ -34,7 +34,7 @@ addEventListener('message', async ({ data: eventData }) => {
}
if (isValid && isDifficultyOdd) {
if ((hashArray[requiredZeroBytes] >> 4) !== 0) {
if (hashArray[requiredZeroBytes] >> 4 !== 0) {
isValid = false;
}
}
@@ -55,7 +55,7 @@ addEventListener('message', async ({ data: eventData }) => {
/* Truncate the decimal portion of the nonce. This is a bit of an evil bit
* hack, but it works reliably enough. The core of why this works is:
*
*
* > 13.4 % 1 !== 0
* true
* > 13 % 1 !== 0
@@ -70,4 +70,4 @@ addEventListener('message', async ({ data: eventData }) => {
postMessage(nonce);
}
}
});
});

View File

@@ -6,7 +6,10 @@ const calculateSHA256 = async (input: string) => {
};
const toHexString = (byteArray: Uint8Array) => {
return byteArray.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), "");
return byteArray.reduce(
(str, byte) => str + byte.toString(16).padStart(2, "0"),
"",
);
};
addEventListener("message", async ({ data: eventData }) => {
@@ -18,7 +21,7 @@ addEventListener("message", async ({ data: eventData }) => {
const requiredZeroBytes = Math.floor(difficulty / 2);
const isDifficultyOdd = difficulty % 2 !== 0;
for (; ;) {
for (;;) {
const hashBuffer = await calculateSHA256(data + nonce);
const hashArray = new Uint8Array(hashBuffer);
@@ -31,7 +34,7 @@ addEventListener("message", async ({ data: eventData }) => {
}
if (isValid && isDifficultyOdd) {
if ((hashArray[requiredZeroBytes] >> 4) !== 0) {
if (hashArray[requiredZeroBytes] >> 4 !== 0) {
isValid = false;
}
}
@@ -52,7 +55,7 @@ addEventListener("message", async ({ data: eventData }) => {
/* Truncate the decimal portion of the nonce. This is a bit of an evil bit
* hack, but it works reliably enough. The core of why this works is:
*
*
* > 13.4 % 1 !== 0
* true
* > 13 % 1 !== 0
@@ -67,4 +70,4 @@ addEventListener("message", async ({ data: eventData }) => {
postMessage(nonce);
}
}
});
});