chore: Refactor build and publish scripts for the desktop application. Replace direct electron-builder calls with a custom script to manage output directory outside of OneDrive/Documents. Update README to reflect new installer location and enhance release directory management with a dedicated module.
This commit is contained in:
@@ -112,7 +112,7 @@ npm run dev
|
|||||||
npm run dist
|
npm run dist
|
||||||
```
|
```
|
||||||
|
|
||||||
El instalador queda en `release/` y se publica en:
|
El instalador queda en `%LOCALAPPDATA%\IPSExtractor-desktop-release\` (fuera de Documents/OneDrive, para evitar bloqueos de `app.asar` en Windows) y se publica en:
|
||||||
|
|
||||||
`s3.builker.xyz/apps-versions/IPSExtractor/{version}/`
|
`s3.builker.xyz/apps-versions/IPSExtractor/{version}/`
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"dist": "npm run build && electron-builder --win && npm run publish:minio",
|
"dist": "npm run build && node scripts/electron-builder-win.mjs && npm run publish:minio",
|
||||||
"dist:win": "npm run dist",
|
"dist:win": "npm run dist",
|
||||||
"dist:local": "npm run build && electron-builder --win",
|
"dist:local": "npm run build && node scripts/electron-builder-win.mjs",
|
||||||
"publish:minio": "node scripts/publish-version.mjs"
|
"publish:minio": "node scripts/publish-version.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Ejecuta electron-builder --win con output fuera de OneDrive/Documents.
|
||||||
|
*/
|
||||||
|
import { spawnSync } from "node:child_process";
|
||||||
|
import { getReleaseDir } from "./release-dir.mjs";
|
||||||
|
|
||||||
|
const outDir = getReleaseDir();
|
||||||
|
console.log(`electron-builder output → ${outDir}`);
|
||||||
|
|
||||||
|
const result = spawnSync(
|
||||||
|
"npx",
|
||||||
|
["electron-builder", "--win", `--config.directories.output=${outDir}`],
|
||||||
|
{
|
||||||
|
stdio: "inherit",
|
||||||
|
shell: true,
|
||||||
|
env: process.env,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit(result.status ?? 1);
|
||||||
@@ -14,12 +14,11 @@
|
|||||||
*/
|
*/
|
||||||
import { createHash } from "node:crypto";
|
import { createHash } from "node:crypto";
|
||||||
import { createReadStream, existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
import { createReadStream, existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
||||||
import { join, dirname } from "node:path";
|
import { join } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
|
||||||
import { S3Client, PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";
|
import { S3Client, PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";
|
||||||
|
import { getReleaseDir, projectRoot } from "./release-dir.mjs";
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const root = projectRoot;
|
||||||
const root = join(__dirname, "..");
|
|
||||||
|
|
||||||
/** Carga KEY=VALUE desde un archivo local (sin dependencia dotenv). */
|
/** Carga KEY=VALUE desde un archivo local (sin dependencia dotenv). */
|
||||||
function loadEnvFile(filePath) {
|
function loadEnvFile(filePath) {
|
||||||
@@ -63,9 +62,11 @@ if (!accessKey || !secretKey) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const setupName = `IPSExtractor-Desktop-${version}-Setup.exe`;
|
const setupName = `IPSExtractor-Desktop-${version}-Setup.exe`;
|
||||||
const setupPath = join(root, "release", setupName);
|
const releaseDir = getReleaseDir();
|
||||||
|
const setupPath = join(releaseDir, setupName);
|
||||||
if (!existsSync(setupPath)) {
|
if (!existsSync(setupPath)) {
|
||||||
console.error(`No se encontró ${setupPath}. Ejecuta antes: npm run dist`);
|
console.error(`No se encontró ${setupPath}. Ejecuta antes: npm run dist`);
|
||||||
|
console.error(`(directorio de release: ${releaseDir})`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Directorio de salida de electron-builder.
|
||||||
|
* Por defecto fuera de Documents/OneDrive para evitar bloqueos de app.asar en Windows.
|
||||||
|
* Override: IPS_DESKTOP_RELEASE_DIR=C:\ruta\absoluta
|
||||||
|
*/
|
||||||
|
import { homedir } from "node:os";
|
||||||
|
import { join, dirname } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
export const projectRoot = join(__dirname, "..");
|
||||||
|
|
||||||
|
export function getReleaseDir() {
|
||||||
|
if (process.env.IPS_DESKTOP_RELEASE_DIR) {
|
||||||
|
return process.env.IPS_DESKTOP_RELEASE_DIR;
|
||||||
|
}
|
||||||
|
const local = process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local");
|
||||||
|
return join(local, "IPSExtractor-desktop-release");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user