Proyecto App Linux

This commit is contained in:
2026-05-03 23:43:09 +02:00
commit 7482733843
1248 changed files with 189750 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env node
/**
* Downloads the official VLC for Windows x64 zip and unpacks it into
* tools/packaging/bundled-vlc/win64/ (vlc.exe at the root of that folder).
* Used by make-kiratv-windows-nsis.mjs so the NSIS installer ships VLC in resources/vlc.
*
* GPL-2.0+ applies to VLC; see https://www.videolan.org/legal.html
*/
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.resolve(__dirname, '..', '..');
const destDir = path.join(root, 'tools', 'packaging', 'bundled-vlc', 'win64');
const VLC_VERSION = '3.0.21';
const zipName = `vlc-${VLC_VERSION}-win64.zip`;
const zipUrl = `https://get.videolan.org/vlc/${VLC_VERSION}/win64/${zipName}`;
const force = process.argv.includes('--force');
const vlcExe = path.join(destDir, 'vlc.exe');
if (!force && fs.existsSync(vlcExe)) {
console.log('VLC bundle already present:', vlcExe);
console.log('Use --force to re-download.');
process.exit(0);
}
const tmpParent = path.join(root, 'tmp');
fs.mkdirSync(tmpParent, { recursive: true });
const tmpRoot = fs.mkdtempSync(path.join(tmpParent, 'vlc-dl-'));
const zipPath = path.join(tmpRoot, zipName);
const extractDir = path.join(tmpRoot, 'extracted');
try {
console.log('Downloading', zipUrl);
const res = await fetch(zipUrl, { redirect: 'follow' });
if (!res.ok) {
throw new Error(`HTTP ${res.status} ${res.statusText}`);
}
const buf = Buffer.from(await res.arrayBuffer());
fs.writeFileSync(zipPath, buf);
fs.mkdirSync(extractDir, { recursive: true });
if (process.platform === 'win32') {
execSync(`tar -xf "${zipPath}" -C "${extractDir}"`, {
stdio: 'inherit',
shell: true,
});
} else {
execSync(`unzip -o -q "${zipPath}" -d "${extractDir}"`, {
stdio: 'inherit',
});
}
const top = fs.readdirSync(extractDir, { withFileTypes: true });
const innerDir = top.find((e) => e.isDirectory());
if (!innerDir) {
throw new Error('Unexpected zip layout: no top-level directory');
}
const innerPath = path.join(extractDir, innerDir.name);
const innerVlc = path.join(innerPath, 'vlc.exe');
if (!fs.existsSync(innerVlc)) {
throw new Error('Unexpected zip layout: vlc.exe not found under ' + innerPath);
}
fs.rmSync(destDir, { recursive: true, force: true });
fs.mkdirSync(path.dirname(destDir), { recursive: true });
fs.cpSync(innerPath, destDir, { recursive: true });
console.log('VLC extracted to', destDir);
} finally {
fs.rmSync(tmpRoot, { recursive: true, force: true });
}
+72
View File
@@ -0,0 +1,72 @@
const fs = require('fs/promises');
const path = require('path');
function log(message) {
console.log(` - ${message}`);
}
function createLoaderScript({ executableName, productName }) {
return `#!/usr/bin/env bash
set -u
UNPRIVILEGED_USERNS_ENABLED=$(cat /proc/sys/kernel/unprivileged_userns_clone 2>/dev/null)
RESTRICT_UNPRIVILEGED_USERNS=$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null)
SCRIPT_PATH="\${BASH_SOURCE[0]}"
if command -v readlink >/dev/null 2>&1; then
RESOLVED_SCRIPT_PATH=$(readlink -f "$SCRIPT_PATH" 2>/dev/null || true)
if [ -n "$RESOLVED_SCRIPT_PATH" ]; then
SCRIPT_PATH="$RESOLVED_SCRIPT_PATH"
fi
fi
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
APPLY_NO_SANDBOX_FLAG=0
if [ "$UNPRIVILEGED_USERNS_ENABLED" != 1 ] || [ "$RESTRICT_UNPRIVILEGED_USERNS" = 1 ]; then
APPLY_NO_SANDBOX_FLAG=1
fi
if [ "$SCRIPT_DIR" = "/usr/bin" ]; then
SCRIPT_DIR="/opt/${productName}"
fi
EXEC_ARGS=()
if [ "$APPLY_NO_SANDBOX_FLAG" = 1 ]; then
echo "Note: Running with --no-sandbox since unprivileged_userns_clone is disabled or apparmor_restrict_unprivileged_userns is enabled."
EXEC_ARGS+=(--no-sandbox)
fi
exec "$SCRIPT_DIR/${executableName}.bin" "\${EXEC_ARGS[@]}" "$@"
`;
}
async function afterPackHook(params) {
if (params.electronPlatformName !== 'linux') {
return;
}
log('applying Linux launcher sandbox fix');
const executable = path.join(params.appOutDir, params.packager.executableName);
try {
await fs.rename(executable, `${executable}.bin`);
await fs.writeFile(
executable,
createLoaderScript({
executableName: params.packager.executableName,
productName: params.packager.appInfo.productName,
})
);
await fs.chmod(executable, 0o755);
} catch (error) {
log(`failed to create launcher wrapper: ${error.message}`);
throw new Error('Failed to create launcher wrapper');
}
log('Linux launcher sandbox fix applied');
}
module.exports = afterPackHook;
module.exports.createLoaderScript = createLoaderScript;
@@ -0,0 +1,52 @@
#!/usr/bin/env node
/**
* Build KiraTV and package .deb + AppImage for the current machine architecture.
*/
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const workspaceRoot = path.resolve(__dirname, '..', '..');
const configPath = path.join(workspaceRoot, 'electron-builder.json');
function linuxArchFromNode() {
switch (process.arch) {
case 'arm64':
return 'arm64';
case 'arm':
return 'armv7l';
default:
return 'x64';
}
}
const original = fs.readFileSync(configPath, 'utf8');
const config = JSON.parse(original);
const arch = linuxArchFromNode();
config.linux = config.linux ?? {};
config.linux.target = [
{ target: 'deb', arch: [arch] },
{ target: 'AppImage', arch: [arch] },
];
fs.writeFileSync(configPath, JSON.stringify(config, null, 4) + '\n');
const run = (cmd) => {
execSync(cmd, { stdio: 'inherit', cwd: workspaceRoot, env: process.env });
};
try {
const nx = path.join(workspaceRoot, 'node_modules', '.bin', 'nx');
const nxCmd = fs.existsSync(nx) ? `"${nx}"` : 'npx nx';
run(`${nxCmd} run electron-backend:build --configuration=kiratv`);
run(`${nxCmd} run electron-backend:make --configuration=kiratv`);
console.log(
'\nPaquetes generados en dist/executables: .deb y .AppImage (kiratv-*-linux-*).\n'
);
} finally {
fs.writeFileSync(configPath, original);
}
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/env node
/**
* Build KiraTV and package only a .deb for the current machine architecture.
* Temporarily narrows electron-builder linux targets, then restores config.
*/
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const workspaceRoot = path.resolve(__dirname, '..', '..');
const configPath = path.join(workspaceRoot, 'electron-builder.json');
function debArchFromNode() {
switch (process.arch) {
case 'arm64':
return 'arm64';
case 'arm':
return 'armv7l';
default:
return 'x64';
}
}
const original = fs.readFileSync(configPath, 'utf8');
const config = JSON.parse(original);
const arch = debArchFromNode();
config.linux = config.linux ?? {};
config.linux.target = [{ target: 'deb', arch: [arch] }];
fs.writeFileSync(configPath, JSON.stringify(config, null, 4) + '\n');
const run = (cmd) => {
execSync(cmd, { stdio: 'inherit', cwd: workspaceRoot, env: process.env });
};
try {
const nx = path.join(workspaceRoot, 'node_modules', '.bin', 'nx');
const nxCmd = fs.existsSync(nx) ? `"${nx}"` : 'npx nx';
run(`${nxCmd} run electron-backend:build --configuration=kiratv`);
run(`${nxCmd} run electron-backend:make --configuration=kiratv`);
console.log(
'\nPaquete .deb generado en dist/executables (busca kiratv-*-linux-*.deb).\n'
);
} finally {
fs.writeFileSync(configPath, original);
}
@@ -0,0 +1,28 @@
#!/usr/bin/env node
/**
* Linux: .deb + AppImage (arquitectura actual).
* Windows: solo si process.platform === 'win32' → NSIS x64 con VLC embebido.
*/
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.resolve(__dirname, '..', '..');
function run(relScript) {
const p = path.join(root, relScript);
execSync(`node "${p}"`, { stdio: 'inherit', cwd: root, env: process.env });
}
run('tools/packaging/make-kiratv-linux-deb-appimage.mjs');
if (process.platform === 'win32') {
run('tools/packaging/make-kiratv-windows-nsis.mjs');
} else {
console.log(
'\n[Windows] Omitido en este SO. En un PC Windows ejecuta:\n' +
' pnpm run make:kiratv:windows-nsis\n'
);
}
@@ -0,0 +1,89 @@
#!/usr/bin/env node
/**
* Windows only: download bundled VLC, patch electron-builder to ship resources/vlc,
* then build KiraTV NSIS installer (x64).
*/
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
if (process.platform !== 'win32') {
console.error(
'Este script debe ejecutarse en Windows (Node win32).\n' +
'Para generar el .exe con VLC embebido, usa una máquina Windows o un job windows-latest en CI.'
);
process.exit(1);
}
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const workspaceRoot = path.resolve(__dirname, '..', '..');
const configPath = path.join(workspaceRoot, 'electron-builder.json');
execSync(`node "${path.join(__dirname, 'download-vlc-windows.mjs')}"`, {
stdio: 'inherit',
cwd: workspaceRoot,
});
const vlcExe = path.join(
workspaceRoot,
'tools',
'packaging',
'bundled-vlc',
'win64',
'vlc.exe'
);
if (!fs.existsSync(vlcExe)) {
console.error('Missing bundled VLC after download:', vlcExe);
process.exit(1);
}
const original = fs.readFileSync(configPath, 'utf8');
const config = JSON.parse(original);
const baseExtra = Array.isArray(config.extraResources)
? config.extraResources
: config.extraResources
? [config.extraResources]
: [];
config.extraResources = [
...baseExtra.filter((e) => {
if (typeof e === 'string') {
return !String(e).includes('bundled-vlc');
}
if (e && typeof e === 'object' && e.to === 'vlc') {
return false;
}
return true;
}),
{
from: 'tools/packaging/bundled-vlc/win64',
to: 'vlc',
filter: ['**/*'],
},
];
config.win = config.win ?? {};
config.win.target = [{ target: 'nsis', arch: ['x64'] }];
fs.writeFileSync(configPath, JSON.stringify(config, null, 4) + '\n');
const run = (cmd) => {
execSync(cmd, { stdio: 'inherit', cwd: workspaceRoot, env: process.env });
};
try {
const nx = path.join(workspaceRoot, 'node_modules', '.bin', 'nx');
const nxCmd = fs.existsSync(nx) ? `"${nx}"` : 'npx nx';
run(`${nxCmd} run electron-backend:build --configuration=kiratv`);
// On Windows, Nx defaults to the Windows platform. Do not pass --platform/--arch:
// Nx forwards them to dependency targets (web, remote-control-web) and breaks.
run(`${nxCmd} run electron-backend:make --configuration=kiratv`);
console.log(
'\nInstalador NSIS generado en dist/executables (kiratv-*-windows-x64-setup.exe) con VLC en resources/vlc.\n'
);
} finally {
fs.writeFileSync(configPath, original);
}
@@ -0,0 +1,513 @@
import fs from 'fs';
import path from 'path';
const args = process.argv.slice(2);
const normalizedArgs = args[0] === '--' ? args.slice(1) : args;
const [platform, arch = ''] = normalizedArgs;
if (!platform) {
console.error(
'Usage: node tools/packaging/verify-electron-package-layout.mjs <macos|linux|windows> [arch]'
);
process.exit(1);
}
const workspaceRoot = process.cwd();
const executablesRoot = path.join(workspaceRoot, 'dist', 'executables');
const packageJsonPath = path.join(workspaceRoot, 'package.json');
const electronBuilderConfigPath = path.join(
workspaceRoot,
'electron-builder.json'
);
const builderEffectiveConfigPath = path.join(
executablesRoot,
'builder-effective-config.yaml'
);
const flatpakMetainfoPath = path.join(
workspaceRoot,
'apps',
'electron-backend',
'linux',
'com.kiracloud.kiratv.metainfo.xml'
);
const packageMetadata = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const electronBuilderConfig = JSON.parse(
fs.readFileSync(electronBuilderConfigPath, 'utf8')
);
const flatpakFinishArgs = electronBuilderConfig.flatpak?.finishArgs ?? [];
const snapConfigInspection = loadSnapConfigInspection();
const workerRelativeDir = path.join(
'dist',
'apps',
'electron-backend',
'workers'
);
const workerFiles = ['epg-parser.worker.js', 'database.worker.js'];
const nativeModuleRelativeDirs = [
path.join('app.asar.unpacked', 'node_modules'),
path.join('app.asar.unpacked', 'electron-backend', 'node_modules'),
path.join(
'app.asar.unpacked',
'dist',
'apps',
'electron-backend',
'node_modules'
),
];
const linuxExecutableName = getLinuxExecutableName();
function directoryExists(directoryPath) {
return (
fs.existsSync(directoryPath) && fs.statSync(directoryPath).isDirectory()
);
}
function fileExists(filePath) {
return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
}
function getMacResourceDirs() {
const candidates = [
{
arch: 'x64',
directory: path.join(
executablesRoot,
'mac',
'KiraTV.app',
'Contents',
'Resources'
),
},
{
arch: 'arm64',
directory: path.join(
executablesRoot,
'mac-arm64',
'KiraTV.app',
'Contents',
'Resources'
),
},
];
return candidates
.filter((candidate) => !arch || candidate.arch === arch)
.map((candidate) => candidate.directory)
.filter(directoryExists);
}
function getUnpackedResourceDirs(prefix) {
if (!directoryExists(executablesRoot)) {
return [];
}
return fs
.readdirSync(executablesRoot, { withFileTypes: true })
.filter(
(entry) =>
entry.isDirectory() &&
entry.name.startsWith(prefix) &&
entry.name.endsWith('-unpacked')
)
.map((entry) => path.join(executablesRoot, entry.name, 'resources'))
.filter(directoryExists);
}
function getResourceDirs() {
switch (platform) {
case 'macos':
return getMacResourceDirs();
case 'linux':
return getUnpackedResourceDirs('linux');
case 'windows':
return getUnpackedResourceDirs('win');
default:
console.error(`Unsupported platform "${platform}"`);
process.exit(1);
}
}
function sanitizeExecutableName(value) {
return value.replace(/[<>:"/\\|?*\u0000-\u001f]/g, '');
}
function getLinuxExecutableName() {
const configuredExecutableName =
electronBuilderConfig.linux?.executableName ??
electronBuilderConfig.executableName;
if (configuredExecutableName) {
return sanitizeExecutableName(configuredExecutableName);
}
return packageMetadata.name.toLowerCase();
}
function parseYamlScalar(value) {
const normalizedValue = value.trim();
if (normalizedValue === 'true') {
return true;
}
if (normalizedValue === 'false') {
return false;
}
if (normalizedValue === 'null') {
return null;
}
const singleQuotedMatch = normalizedValue.match(/^'(.*)'$/);
if (singleQuotedMatch) {
return singleQuotedMatch[1].replace(/''/g, "'");
}
const doubleQuotedMatch = normalizedValue.match(/^"(.*)"$/);
if (doubleQuotedMatch) {
return doubleQuotedMatch[1].replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
return normalizedValue;
}
function getYamlSectionLines(yamlContent, sectionName) {
const lines = yamlContent.split(/\r?\n/);
const sectionHeader = `${sectionName}:`;
const sectionLines = [];
let isInsideSection = false;
for (const line of lines) {
if (!isInsideSection) {
if (line === sectionHeader) {
isInsideSection = true;
}
continue;
}
if (line.trim() === '') {
sectionLines.push(line);
continue;
}
const indentation = line.match(/^ */)?.[0].length ?? 0;
if (indentation === 0) {
break;
}
sectionLines.push(line);
}
return isInsideSection ? sectionLines : null;
}
function parseIndentedYamlSequence(lines, startIndex, indentation) {
const values = [];
let nextIndex = startIndex;
while (nextIndex < lines.length) {
const line = lines[nextIndex];
const trimmedLine = line.trim();
if (trimmedLine === '') {
nextIndex += 1;
continue;
}
const currentIndentation = line.match(/^ */)?.[0].length ?? 0;
if (currentIndentation < indentation) {
break;
}
if (currentIndentation > indentation || !trimmedLine.startsWith('- ')) {
break;
}
values.push(parseYamlScalar(trimmedLine.slice(2)));
nextIndex += 1;
}
return {
values,
nextIndex,
};
}
function parseIndentedYamlMapping(lines, startIndex, indentation) {
const values = {};
let nextIndex = startIndex;
while (nextIndex < lines.length) {
const line = lines[nextIndex];
const trimmedLine = line.trim();
if (trimmedLine === '') {
nextIndex += 1;
continue;
}
const currentIndentation = line.match(/^ */)?.[0].length ?? 0;
if (currentIndentation < indentation) {
break;
}
if (currentIndentation > indentation) {
break;
}
const separatorIndex = trimmedLine.indexOf(':');
if (separatorIndex === -1) {
break;
}
const key = trimmedLine.slice(0, separatorIndex).trim();
const rawValue = trimmedLine.slice(separatorIndex + 1).trim();
values[key] = parseYamlScalar(rawValue);
nextIndex += 1;
}
return {
values,
nextIndex,
};
}
function parseEffectiveSnapConfig(yamlContent) {
const sectionLines = getYamlSectionLines(yamlContent, 'snap');
if (!sectionLines) {
return null;
}
const snapConfig = {};
for (let index = 0; index < sectionLines.length; index += 1) {
const line = sectionLines[index];
const trimmedLine = line.trim();
if (trimmedLine === '') {
continue;
}
const indentation = line.match(/^ */)?.[0].length ?? 0;
if (indentation !== 2) {
continue;
}
const separatorIndex = trimmedLine.indexOf(':');
if (separatorIndex === -1) {
continue;
}
const key = trimmedLine.slice(0, separatorIndex).trim();
const rawValue = trimmedLine.slice(separatorIndex + 1).trim();
if (rawValue !== '') {
snapConfig[key] = parseYamlScalar(rawValue);
continue;
}
if (key === 'executableArgs') {
const { values, nextIndex } = parseIndentedYamlSequence(
sectionLines,
index + 1,
4
);
snapConfig[key] = values;
index = nextIndex - 1;
continue;
}
if (key === 'environment') {
const { values, nextIndex } = parseIndentedYamlMapping(
sectionLines,
index + 1,
4
);
snapConfig[key] = values;
index = nextIndex - 1;
}
}
return snapConfig;
}
function loadSnapConfigInspection() {
if (fileExists(builderEffectiveConfigPath)) {
const effectiveConfigContent = fs.readFileSync(
builderEffectiveConfigPath,
'utf8'
);
const effectiveSnapConfig = parseEffectiveSnapConfig(
effectiveConfigContent
);
if (effectiveSnapConfig) {
return {
config: effectiveSnapConfig,
sourcePath: builderEffectiveConfigPath,
};
}
}
return {
config: electronBuilderConfig.snap ?? {},
sourcePath: electronBuilderConfigPath,
};
}
function verifyLinuxLauncher(resourceDir, errors) {
const appDir = path.dirname(resourceDir);
const launcherPath = path.join(appDir, linuxExecutableName);
const launcherBinaryPath = `${launcherPath}.bin`;
if (!fileExists(launcherBinaryPath)) {
errors.push(
`Missing Linux launcher binary in ${appDir}: ${path.basename(launcherBinaryPath)}`
);
return;
}
if (!fileExists(launcherPath)) {
errors.push(
`Missing Linux launcher wrapper in ${appDir}: ${path.basename(launcherPath)}`
);
return;
}
const launcherScript = fs.readFileSync(launcherPath, 'utf8');
const requiredMarkers = [
'SCRIPT_PATH="${BASH_SOURCE[0]}"',
'readlink -f "$SCRIPT_PATH"',
`exec "$SCRIPT_DIR/${linuxExecutableName}.bin"`,
];
const missingMarkers = requiredMarkers.filter(
(marker) => !launcherScript.includes(marker)
);
if (missingMarkers.length > 0) {
errors.push(
[
`Linux launcher wrapper is missing symlink-safe logic in ${launcherPath}.`,
'Missing markers:',
...missingMarkers.map((marker) => `- ${marker}`),
].join('\n')
);
}
}
function verifyFlatpakPermissions(errors) {
if (!Array.isArray(flatpakFinishArgs)) {
errors.push('Flatpak finishArgs must be configured as an array.');
return;
}
if (!flatpakFinishArgs.includes('--talk-name=org.freedesktop.Flatpak')) {
errors.push(
'Flatpak finishArgs must include --talk-name=org.freedesktop.Flatpak for host player launching.'
);
}
}
function verifySnapPackagingConfig(errors) {
if (snapConfigInspection.config?.base !== 'core22') {
errors.push(
`Snap config in ${snapConfigInspection.sourcePath} must set base to core22 so packaged native modules stay compatible with the Snap runtime glibc.`
);
}
const snapExecutableArgs = Array.isArray(
snapConfigInspection.config?.executableArgs
)
? snapConfigInspection.config.executableArgs
: [];
if (!snapExecutableArgs.includes('--ozone-platform=x11')) {
errors.push(
`Snap config in ${snapConfigInspection.sourcePath} must include --ozone-platform=x11 in executableArgs.`
);
}
if (snapConfigInspection.config?.allowNativeWayland === true) {
errors.push(
`Snap config in ${snapConfigInspection.sourcePath} must not enable allowNativeWayland while the X11 startup workaround is required.`
);
}
}
function verifyResourceDir(resourceDir) {
const missingWorkers = workerFiles.filter(
(workerFile) =>
!fileExists(path.join(resourceDir, workerRelativeDir, workerFile))
);
const nativeModuleDirs = nativeModuleRelativeDirs.map((relativeDir) =>
path.join(resourceDir, relativeDir)
);
const matchingNativeModuleDir = nativeModuleDirs.find((nativeDir) =>
fileExists(path.join(nativeDir, 'better-sqlite3', 'package.json'))
);
const errors = [];
if (missingWorkers.length > 0) {
errors.push(
`Missing worker artifacts in ${resourceDir}: ${missingWorkers.join(', ')}`
);
}
if (!matchingNativeModuleDir) {
errors.push(
[
`Unable to find unpacked better-sqlite3 in ${resourceDir}.`,
'Checked:',
...nativeModuleDirs.map((nativeDir) => `- ${nativeDir}`),
].join('\n')
);
}
if (platform === 'linux') {
if (!fileExists(flatpakMetainfoPath)) {
errors.push(
`Missing Flatpak metainfo file: ${flatpakMetainfoPath}`
);
}
verifyFlatpakPermissions(errors);
verifySnapPackagingConfig(errors);
verifyLinuxLauncher(resourceDir, errors);
}
return {
resourceDir,
errors,
matchingNativeModuleDir,
};
}
const resourceDirs = getResourceDirs();
if (resourceDirs.length === 0) {
console.error(
`No packaged resource directories found for ${platform}${arch ? ` (${arch})` : ''}.`
);
process.exit(1);
}
const results = resourceDirs.map(verifyResourceDir);
const failures = results.filter((result) => result.errors.length > 0);
for (const result of results) {
console.log(`Verified packaged resources: ${result.resourceDir}`);
if (result.matchingNativeModuleDir) {
console.log(
`Resolved unpacked better-sqlite3 at: ${result.matchingNativeModuleDir}`
);
}
}
if (failures.length > 0) {
for (const failure of failures) {
console.error(failure.errors.join('\n'));
}
process.exit(1);
}