Skip to content

Commit 99af642

Browse files
committed
fix comments
1 parent b7cc39a commit 99af642

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

packages/app-builder-lib/src/packager.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,16 @@ export class Packager {
600600
if (config.buildDependenciesFromSource === true && platform.nodeName !== process.platform) {
601601
log.info({ reason: "platform is different and buildDependenciesFromSource is set to true" }, "skipped dependencies rebuild")
602602
} else {
603-
await installOrRebuild(config, this.appDir, this.projectDir, {
604-
frameworkInfo,
605-
platform: platform.nodeName,
606-
arch: Arch[arch],
607-
productionDeps: this.getNodeDependencyInfo(null, false) as Lazy<Array<NodeModuleDirInfo>>,
608-
})
603+
await installOrRebuild(
604+
config,
605+
{ appDir: this.appDir, projectDir: this.projectDir },
606+
{
607+
frameworkInfo,
608+
platform: platform.nodeName,
609+
arch: Arch[arch],
610+
productionDeps: this.getNodeDependencyInfo(null, false) as Lazy<Array<NodeModuleDirInfo>>,
611+
}
612+
)
609613
}
610614
}
611615
}

packages/app-builder-lib/src/util/yarn.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { PM, detect, getPackageManagerVersion } from "../node-module-collector"
1111
import { NodeModuleDirInfo } from "./packageDependencies"
1212
import { rebuild as remoteRebuild } from "./rebuild/rebuild"
1313

14-
export async function installOrRebuild(config: Configuration, appDir: string, projectDir: string, options: RebuildOptions, forceInstall = false) {
14+
export async function installOrRebuild(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions, forceInstall = false) {
1515
const effectiveOptions: RebuildOptions = {
1616
buildFromSource: config.buildDependenciesFromSource === true,
1717
additionalArgs: asArray(config.npmArgs),
@@ -28,9 +28,9 @@ export async function installOrRebuild(config: Configuration, appDir: string, pr
2828
}
2929

3030
if (forceInstall || !isDependenciesInstalled) {
31-
await installDependencies(config, appDir, projectDir, effectiveOptions)
31+
await installDependencies(config, { appDir, projectDir }, effectiveOptions)
3232
} else {
33-
await rebuild(config, appDir, projectDir, effectiveOptions)
33+
await rebuild(config, { appDir, projectDir }, effectiveOptions)
3434
}
3535
}
3636

@@ -90,7 +90,7 @@ async function checkYarnBerry(pm: PM) {
9090
return version.split(".")[0] >= "2"
9191
}
9292

93-
async function installDependencies(config: Configuration, appDir: string, projectDir: string, options: RebuildOptions): Promise<any> {
93+
async function installDependencies(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions): Promise<any> {
9494
const platform = options.platform || process.platform
9595
const arch = options.arch || process.arch
9696
const additionalArgs = options.additionalArgs
@@ -121,7 +121,7 @@ async function installDependencies(config: Configuration, appDir: string, projec
121121

122122
// Some native dependencies no longer use `install` hook for building their native module, (yarn 3+ removed implicit link of `install` and `rebuild` steps)
123123
// https://github.com/electron-userland/electron-builder/issues/8024
124-
return rebuild(config, appDir, projectDir, options)
124+
return rebuild(config, { appDir, projectDir }, options)
125125
}
126126

127127
export async function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo) {
@@ -168,8 +168,13 @@ export interface RebuildOptions {
168168
additionalArgs?: Array<string> | null
169169
}
170170

171+
export interface DirectoryPaths {
172+
appDir: string
173+
projectDir: string
174+
}
175+
171176
/** @internal */
172-
export async function rebuild(config: Configuration, appDir: string, projectDir: string, options: RebuildOptions) {
177+
export async function rebuild(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions) {
173178
const configuration = {
174179
dependencies: await options.productionDeps.value,
175180
nodeExecPath: process.execPath,

packages/electron-builder/src/cli/install-app-deps.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ export async function installAppDeps(args: any) {
5757
// if two package.json — force full install (user wants to install/update app deps in addition to dev)
5858
await installOrRebuild(
5959
config,
60-
appDir,
61-
projectDir,
60+
{
61+
appDir,
62+
projectDir,
63+
},
6264
{
6365
frameworkInfo: { version, useCustomDist: true },
6466
platform: args.platform,

0 commit comments

Comments
 (0)