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
+116
View File
@@ -0,0 +1,116 @@
import fs from 'fs';
import path from 'path';
import { spawn } from 'child_process';
const args = process.argv.slice(2);
const normalizedArgs = args[0] === '--' ? args.slice(1) : args;
const [platformArg, arch = ''] = normalizedArgs;
const currentPlatform =
platformArg ??
(process.platform === 'darwin'
? 'macos'
: process.platform === 'win32'
? 'windows'
: 'linux');
const workspaceRoot = process.cwd();
const executablesRoot = path.join(workspaceRoot, 'dist', 'executables');
const remoteDebuggingPort = '9222';
function ensureFile(filePath) {
return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
}
function findUnpackedExecutable(prefix, executableNames) {
if (!fs.existsSync(executablesRoot)) {
return undefined;
}
const unpackedDirs = fs
.readdirSync(executablesRoot, { withFileTypes: true })
.filter(
(entry) =>
entry.isDirectory() &&
entry.name.startsWith(prefix) &&
entry.name.endsWith('-unpacked')
)
.map((entry) => path.join(executablesRoot, entry.name));
for (const unpackedDir of unpackedDirs) {
for (const executableName of executableNames) {
const executablePath = path.join(unpackedDir, executableName);
if (ensureFile(executablePath)) {
return executablePath;
}
}
}
return undefined;
}
function resolvePackagedExecutable() {
if (currentPlatform === 'macos') {
const candidates = [
{
arch: 'x64',
executable: path.join(
executablesRoot,
'mac',
'IPTVnator.app',
'Contents',
'MacOS',
'IPTVnator'
),
},
{
arch: 'arm64',
executable: path.join(
executablesRoot,
'mac-arm64',
'IPTVnator.app',
'Contents',
'MacOS',
'IPTVnator'
),
},
];
const match = candidates.find(
(candidate) => (!arch || candidate.arch === arch) && ensureFile(candidate.executable)
);
return match?.executable;
}
if (currentPlatform === 'windows') {
return findUnpackedExecutable('win', ['IPTVnator.exe']);
}
if (currentPlatform === 'linux') {
return findUnpackedExecutable('linux', ['IPTVnator', 'iptvnator']);
}
return undefined;
}
const executable = resolvePackagedExecutable();
if (!executable) {
console.error(
`Unable to resolve a packaged executable for ${currentPlatform}${arch ? ` (${arch})` : ''}.`
);
process.exit(1);
}
console.log(`Launching packaged app: ${executable}`);
console.log(
`After the window opens, connect with: agent-browser --cdp ${remoteDebuggingPort} tab list`
);
const child = spawn(executable, [`--remote-debugging-port=${remoteDebuggingPort}`], {
stdio: 'inherit',
detached: false,
});
child.on('exit', (code) => {
process.exit(code ?? 0);
});
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env node
import { readdirSync } from 'node:fs';
import path from 'node:path';
import { spawnSync } from 'node:child_process';
import process from 'node:process';
const [targetDir, ...jestArgs] = process.argv.slice(2);
if (!targetDir) {
console.error(
'Usage: node tools/testing/run-web-esm-lib-tests.mjs <directory> [jest args...]'
);
process.exit(1);
}
const workspaceRoot = process.cwd();
const absoluteTargetDir = path.resolve(workspaceRoot, targetDir);
function collectSpecFiles(directory) {
const entries = readdirSync(directory, { withFileTypes: true });
const specFiles = [];
for (const entry of entries) {
const fullPath = path.join(directory, entry.name);
if (entry.isDirectory()) {
specFiles.push(...collectSpecFiles(fullPath));
continue;
}
if (
entry.isFile() &&
(entry.name.endsWith('.spec.ts') || entry.name.endsWith('.test.ts'))
) {
specFiles.push(fullPath);
}
}
return specFiles;
}
const specFiles = collectSpecFiles(absoluteTargetDir).sort();
if (specFiles.length === 0) {
console.error(`No spec files found under ${targetDir}`);
process.exit(1);
}
const jestBin = path.resolve(workspaceRoot, 'node_modules/jest/bin/jest.js');
const jestConfig = path.resolve(
workspaceRoot,
'jest.web-esm.workspace.ts'
);
const result = spawnSync(
process.execPath,
[jestBin, '--config', jestConfig, '--runTestsByPath', ...specFiles, ...jestArgs],
{
env: process.env,
stdio: 'inherit',
}
);
process.exit(result.status ?? 1);