mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +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
|
||||||
_node_modules
|
_node_modules
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.env
|
*.env
|
||||||
/test-results/
|
/test-results/
|
||||||
/playwright-report/
|
/playwright-report/
|
||||||
/playwright/.cache/
|
/playwright/.cache/
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
import { readFile } from 'fs/promises';
|
import { readFile } from 'fs/promises';
|
||||||
|
import { DATA_COMPRESSED } from '../../buildAssets/constants';
|
||||||
import { readDVPL } from './readDVPL';
|
import { readDVPL } from './readDVPL';
|
||||||
|
|
||||||
export async function readDVPLFile(file: string) {
|
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);
|
const content = await readFile(path);
|
||||||
|
|
||||||
|
if (!DATA_COMPRESSED) return content;
|
||||||
|
|
||||||
const dvpl = readDVPL(content);
|
const dvpl = readDVPL(content);
|
||||||
|
|
||||||
return dvpl;
|
return dvpl;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { asset } from '@blitzkit/core';
|
||||||
import ProgressBar from 'progress';
|
import ProgressBar from 'progress';
|
||||||
import { GithubChangeBlob, createBlob } from './createBlob';
|
import { GithubChangeBlob, createBlob } from './createBlob';
|
||||||
import { octokit } from './octokit';
|
import { octokit } from './octokit';
|
||||||
@@ -19,10 +20,7 @@ export async function commitMultipleFiles(
|
|||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
changesRaw.map(async (change) => {
|
changesRaw.map(async (change) => {
|
||||||
const blobPath = `${repoRaw}/${branch}/${change.path}`;
|
const response = await fetch(asset(change.path));
|
||||||
const response = await fetch(
|
|
||||||
`https://raw.githubusercontent.com/${blobPath}`,
|
|
||||||
);
|
|
||||||
let isNew: boolean;
|
let isNew: boolean;
|
||||||
let isDifferent: boolean;
|
let isDifferent: boolean;
|
||||||
let diff: number;
|
let diff: number;
|
||||||
@@ -45,7 +43,7 @@ export async function commitMultipleFiles(
|
|||||||
isNew = false;
|
isNew = false;
|
||||||
const buffer = Buffer.from(await response.arrayBuffer());
|
const buffer = Buffer.from(await response.arrayBuffer());
|
||||||
|
|
||||||
if (buffer.equals(change.content)) {
|
if (buffer.equals(new Uint8Array(change.content))) {
|
||||||
diff = 0;
|
diff = 0;
|
||||||
isDifferent = false;
|
isDifferent = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -54,7 +52,7 @@ export async function commitMultipleFiles(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
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) {
|
if (isNew) {
|
||||||
console.log(
|
console.log(
|
||||||
`🟢 (+${change.content.length.toLocaleString()}B) ${blobPath}`,
|
`🟢 (+${change.content.length.toLocaleString()}B) ${change.path}`,
|
||||||
);
|
);
|
||||||
changes.push(change);
|
changes.push(change);
|
||||||
} else if (isDifferent) {
|
} else if (isDifferent) {
|
||||||
console.log(
|
console.log(
|
||||||
`🟡 (${diff > 0 ? '+' : ''}${diff.toLocaleString()}B) ${blobPath}`,
|
`🟡 (${diff > 0 ? '+' : ''}${diff.toLocaleString()}B) ${change.path}`,
|
||||||
);
|
);
|
||||||
changes.push(change);
|
changes.push(change);
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
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