TTP -> MTP, A lot of other stuff #21
1 changed files with 16 additions and 7 deletions
commit
8bff0f503f
|
|
@ -9,7 +9,7 @@ import {
|
||||||
statSync,
|
statSync,
|
||||||
} from "node:fs";
|
} from "node:fs";
|
||||||
import { createHash } from "node:crypto";
|
import { createHash } from "node:crypto";
|
||||||
import { join } from "node:path";
|
import { basename, join } from "node:path";
|
||||||
import packageJson from "../package.json" with { type: "json" };
|
import packageJson from "../package.json" with { type: "json" };
|
||||||
|
|
||||||
const { version } = packageJson;
|
const { version } = packageJson;
|
||||||
|
|
@ -57,6 +57,18 @@ if (existsSync(apkSrc)) {
|
||||||
|
|
||||||
// Electron desktop artifacts
|
// Electron desktop artifacts
|
||||||
const electronReleaseDir = "apps/electron/release";
|
const electronReleaseDir = "apps/electron/release";
|
||||||
|
const electronArtifactPattern = /\.(AppImage|deb|rpm|exe|dmg|zip)$/i;
|
||||||
|
|
||||||
|
function readFilesRecursive(dir: string): string[] {
|
||||||
|
return readdirSync(dir).flatMap((file) => {
|
||||||
|
const filePath = join(dir, file);
|
||||||
|
const stat = statSync(filePath);
|
||||||
|
|
||||||
|
if (stat.isDirectory()) return readFilesRecursive(filePath);
|
||||||
|
if (stat.isFile()) return [filePath];
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const copyElectronArtifacts = () => {
|
const copyElectronArtifacts = () => {
|
||||||
if (!existsSync(electronReleaseDir)) {
|
if (!existsSync(electronReleaseDir)) {
|
||||||
|
|
@ -66,12 +78,9 @@ const copyElectronArtifacts = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const file of readdirSync(electronReleaseDir)) {
|
for (const source of readFilesRecursive(electronReleaseDir)) {
|
||||||
if (file.endsWith(".blockmap") || file.endsWith(".yml")) continue;
|
const file = basename(source);
|
||||||
if (!file.includes(version) && !file.includes(releaseVersion)) continue;
|
if (!electronArtifactPattern.test(file)) continue;
|
||||||
|
|
||||||
const source = join(electronReleaseDir, file);
|
|
||||||
if (!statSync(source).isFile()) continue;
|
|
||||||
|
|
||||||
copyFileSync(source, join(releasesDir, file));
|
copyFileSync(source, join(releasesDir, file));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue