mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
fix: a bunch of stupid things
This commit is contained in:
1 parent
55e6599eaa
commit
6d6a634973
4 files changed
+21
-11
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
node_modules
|
||||
_node_modules
|
||||
package-lock.json
|
||||
.env
|
||||
*.env
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/playwright/.cache/
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
import { readFile } from 'fs/promises';
|
||||
import { DATA_COMPRESSED } from '../../buildAssets/constants';
|
||||
import { readDVPL } from './readDVPL';
|
||||
|
||||
export async function readDVPLFile(file: string) {
|
||||
const path = `${file}${file.endsWith('.dvpl') ? '' : '.dvpl'}`;
|
||||
let path: string;
|
||||
|
||||
if (DATA_COMPRESSED) {
|
||||
path = file.endsWith('.dvpl') ? file : `${file}.dvpl`;
|
||||
} else {
|
||||
path = file.replace('.dvpl', '');
|
||||
}
|
||||
|
||||
const content = await readFile(path);
|
||||
|
||||
if (!DATA_COMPRESSED) return content;
|
||||
|
||||
const dvpl = readDVPL(content);
|
||||
|
||||
return dvpl;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { asset } from '@blitzkit/core';
|
||||
import ProgressBar from 'progress';
|
||||
import { GithubChangeBlob, createBlob } from './createBlob';
|
||||
import { octokit } from './octokit';
|
||||
@@ -19,10 +20,7 @@ export async function commitMultipleFiles(
|
||||
|
||||
await Promise.all(
|
||||
changesRaw.map(async (change) => {
|
||||
const blobPath = `${repoRaw}/${branch}/${change.path}`;
|
||||
const response = await fetch(
|
||||
`https://raw.githubusercontent.com/${blobPath}`,
|
||||
);
|
||||
const response = await fetch(asset(change.path));
|
||||
let isNew: boolean;
|
||||
let isDifferent: boolean;
|
||||
let diff: number;
|
||||
@@ -45,7 +43,7 @@ export async function commitMultipleFiles(
|
||||
isNew = false;
|
||||
const buffer = Buffer.from(await response.arrayBuffer());
|
||||
|
||||
if (buffer.equals(change.content)) {
|
||||
if (buffer.equals(new Uint8Array(change.content))) {
|
||||
diff = 0;
|
||||
isDifferent = false;
|
||||
} else {
|
||||
@@ -54,7 +52,7 @@ export async function commitMultipleFiles(
|
||||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
`Unexpected status code ${response.status} for ${blobPath}`,
|
||||
`Unexpected status code ${response.status} for ${change.path}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,17 +71,17 @@ export async function commitMultipleFiles(
|
||||
|
||||
if (isNew) {
|
||||
console.log(
|
||||
`🟢 (+${change.content.length.toLocaleString()}B) ${blobPath}`,
|
||||
`🟢 (+${change.content.length.toLocaleString()}B) ${change.path}`,
|
||||
);
|
||||
changes.push(change);
|
||||
} else if (isDifferent) {
|
||||
console.log(
|
||||
`🟡 (${diff > 0 ? '+' : ''}${diff.toLocaleString()}B) ${blobPath}`,
|
||||
`🟡 (${diff > 0 ? '+' : ''}${diff.toLocaleString()}B) ${change.path}`,
|
||||
);
|
||||
changes.push(change);
|
||||
} else {
|
||||
console.log(
|
||||
`🔵 (${change.content.length.toLocaleString()}B) ${blobPath}`,
|
||||
`🔵 (${change.content.length.toLocaleString()}B) ${change.path}`,
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
||||
Submodule
+1
Submodule submodules/blitzkit-internal added at 14adb2e456.
Reference in new issue
Block a user