fix(desktop): centralize desktop build script

This commit is contained in:
Mohamed Boudra
2026-05-03 14:35:20 +07:00
parent f993b1d856
commit d4fa12c3f6
4 changed files with 6 additions and 42 deletions

View File

@@ -52,7 +52,6 @@ env:
CHECKOUT_REF: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.checkout_ref || github.ref_name) || github.ref_name }} CHECKOUT_REF: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.checkout_ref || github.ref_name) || github.ref_name }}
SHOULD_PUBLISH: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.publish != 'false' }} SHOULD_PUBLISH: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.publish != 'false' }}
ROLLOUT_HOURS: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.rollout_hours || '24' }} ROLLOUT_HOURS: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.rollout_hours || '24' }}
DESKTOP_WORKSPACE: "@getpaseo/desktop"
DESKTOP_PACKAGE_PATH: "packages/desktop" DESKTOP_PACKAGE_PATH: "packages/desktop"
jobs: jobs:
@@ -148,9 +147,6 @@ jobs:
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`); fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
NODE NODE
- name: Build web app for desktop
run: npm run build:web --workspace=@getpaseo/app
- name: Build desktop release - name: Build desktop release
shell: bash shell: bash
env: env:
@@ -167,7 +163,7 @@ jobs:
build_args=(-- --publish never --mac --${{ matrix.electron_arch }}) build_args=(-- --publish never --mac --${{ matrix.electron_arch }})
build_args+=("-c.publish.releaseType=$RELEASE_TYPE") build_args+=("-c.publish.releaseType=$RELEASE_TYPE")
build_args+=("-c.publish.channel=$RELEASE_CHANNEL") build_args+=("-c.publish.channel=$RELEASE_CHANNEL")
npm run build --workspace="$DESKTOP_WORKSPACE" "${build_args[@]}" npm run build:desktop "${build_args[@]}"
- name: Upload desktop artifacts to release - name: Upload desktop artifacts to release
if: env.SHOULD_PUBLISH == 'true' && env.IS_SMOKE_TAG != 'true' if: env.SHOULD_PUBLISH == 'true' && env.IS_SMOKE_TAG != 'true'
@@ -243,9 +239,6 @@ jobs:
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`); fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
NODE NODE
- name: Build web app for desktop
run: npm run build:web --workspace=@getpaseo/app
- name: Install Linux smoke display - name: Install Linux smoke display
run: sudo apt-get update && sudo apt-get install -y xvfb run: sudo apt-get update && sudo apt-get install -y xvfb
@@ -260,7 +253,7 @@ jobs:
build_args=(-- --publish never --linux --x64) build_args=(-- --publish never --linux --x64)
build_args+=("-c.publish.releaseType=$RELEASE_TYPE") build_args+=("-c.publish.releaseType=$RELEASE_TYPE")
build_args+=("-c.publish.channel=$RELEASE_CHANNEL") build_args+=("-c.publish.channel=$RELEASE_CHANNEL")
npm run build --workspace="$DESKTOP_WORKSPACE" "${build_args[@]}" npm run build:desktop "${build_args[@]}"
- name: Upload desktop artifacts to release - name: Upload desktop artifacts to release
if: env.SHOULD_PUBLISH == 'true' && env.IS_SMOKE_TAG != 'true' if: env.SHOULD_PUBLISH == 'true' && env.IS_SMOKE_TAG != 'true'
@@ -336,17 +329,6 @@ jobs:
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`); fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
NODE NODE
- name: Build workspace dependencies
run: npm run build:workspace-deps --workspace=@getpaseo/app
- name: Build web app for desktop
shell: pwsh
run: |
$patchPath = (Get-Item "$env:GITHUB_WORKSPACE/scripts/metro-config-windows-loader-patch.cjs").FullName
$env:NODE_OPTIONS = "--require=$patchPath"
npx expo export --platform web
working-directory: packages/app
- name: Build desktop release - name: Build desktop release
shell: bash shell: bash
env: env:
@@ -358,7 +340,7 @@ jobs:
build_args=(-- --publish never --win --x64 --arm64) build_args=(-- --publish never --win --x64 --arm64)
build_args+=("-c.publish.releaseType=$RELEASE_TYPE") build_args+=("-c.publish.releaseType=$RELEASE_TYPE")
build_args+=("-c.publish.channel=$RELEASE_CHANNEL") build_args+=("-c.publish.channel=$RELEASE_CHANNEL")
npm run build --workspace="$DESKTOP_WORKSPACE" "${build_args[@]}" npm run build:desktop "${build_args[@]}"
- name: Upload desktop artifacts to release - name: Upload desktop artifacts to release
if: env.SHOULD_PUBLISH == 'true' && env.IS_SMOKE_TAG != 'true' if: env.SHOULD_PUBLISH == 'true' && env.IS_SMOKE_TAG != 'true'

1
package-lock.json generated
View File

@@ -23,6 +23,7 @@
"@types/ws": "^8.5.14", "@types/ws": "^8.5.14",
"@typescript/native-preview": "7.0.0-dev.20260423.1", "@typescript/native-preview": "7.0.0-dev.20260423.1",
"concurrently": "^9.2.1", "concurrently": "^9.2.1",
"cross-env": "^10.1.0",
"get-port-cli": "^3.0.0", "get-port-cli": "^3.0.0",
"js-yaml": "^4.1.1", "js-yaml": "^4.1.1",
"knip": "^5.82.1", "knip": "^5.82.1",

View File

@@ -63,7 +63,7 @@
"web": "npm run web --workspace=@getpaseo/app", "web": "npm run web --workspace=@getpaseo/app",
"dev:desktop": "npm run dev --workspace=@getpaseo/desktop", "dev:desktop": "npm run dev --workspace=@getpaseo/desktop",
"dev:win:desktop": "npm run dev:win --workspace=@getpaseo/desktop", "dev:win:desktop": "npm run dev:win --workspace=@getpaseo/desktop",
"build:desktop": "npm run version:sync-internal && PASEO_WEB_PLATFORM=electron npm run build:web --workspace=@getpaseo/app && npm run build --workspace=@getpaseo/desktop", "build:desktop": "npm run build:workspace-deps --workspace=@getpaseo/app && cd packages/app && cross-env PASEO_WEB_PLATFORM=electron npx expo export --platform web && cd ../.. && npm run build --workspace=@getpaseo/desktop",
"db:query": "npm run db:query --workspace=@getpaseo/server --", "db:query": "npm run db:query --workspace=@getpaseo/server --",
"cli": "npx tsx packages/cli/src/index.js", "cli": "npx tsx packages/cli/src/index.js",
"version": "npm run version:sync-internal && npm run release:prepare && git add -A", "version": "npm run version:sync-internal && npm run release:prepare && git add -A",
@@ -94,6 +94,7 @@
"@types/ws": "^8.5.14", "@types/ws": "^8.5.14",
"@typescript/native-preview": "7.0.0-dev.20260423.1", "@typescript/native-preview": "7.0.0-dev.20260423.1",
"concurrently": "^9.2.1", "concurrently": "^9.2.1",
"cross-env": "^10.1.0",
"get-port-cli": "^3.0.0", "get-port-cli": "^3.0.0",
"js-yaml": "^4.1.1", "js-yaml": "^4.1.1",
"knip": "^5.82.1", "knip": "^5.82.1",

View File

@@ -1,20 +0,0 @@
const fs = require("fs");
const path = require("path");
const Module = require("module");
const metroPackageRoot = path.dirname(require.resolve("metro-config/package.json"));
const metroLoadConfigPath = path.join(metroPackageRoot, "src", "loadConfig.js");
const originalJsLoader = Module._extensions[".js"];
Module._extensions[".js"] = function patchedMetroConfigLoader(module, filename) {
if (filename === metroLoadConfigPath) {
let source = fs.readFileSync(filename, "utf8");
source = source.replace(
"const configModule = await import(absolutePath);",
"const { pathToFileURL } = require('node:url');\n const configModule = await import(pathToFileURL(absolutePath).href);",
);
return module._compile(source, filename);
}
return originalJsLoader(module, filename);
};