Skip to content

Commit

Permalink
feat: do not override HOME env on reinstall deps, use devdir for nodegyp
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jun 5, 2017
1 parent 15a6745 commit ae0f668
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 113 deletions.
1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 0 additions & 110 deletions docs/api/electron-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ Developer API only. See [[Options]] for user documentation.
<dd></dd>
<dt><a href="#module_electron-builder/out/publish/PublishManager">electron-builder/out/publish/PublishManager</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/repositoryInfo">electron-builder/out/repositoryInfo</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/targets/appImage">electron-builder/out/targets/appImage</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/targets/appx">electron-builder/out/targets/appx</a></dt>
Expand All @@ -40,8 +38,6 @@ Developer API only. See [[Options]] for user documentation.
<dd></dd>
<dt><a href="#module_electron-builder/out/targets/dmg">electron-builder/out/targets/dmg</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/targets/dmgLicense">electron-builder/out/targets/dmgLicense</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/targets/fpm">electron-builder/out/targets/fpm</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/targets/LinuxTargetHelper">electron-builder/out/targets/LinuxTargetHelper</a></dt>
Expand All @@ -62,8 +58,6 @@ Developer API only. See [[Options]] for user documentation.
<dd></dd>
<dt><a href="#module_electron-builder/out/winPackager">electron-builder/out/winPackager</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/yarn">electron-builder/out/yarn</a></dt>
<dd></dd>
</dl>

<a name="module_electron-builder"></a>
Expand Down Expand Up @@ -1486,36 +1480,6 @@ Developer API only. See [[Options]] for user documentation.
| publishConfigs | <code>Array&lt;[PublishConfiguration](Publishing-Artifacts#PublishConfiguration)&gt;</code> \| <code>null</code> |
| arch | <code>[Arch](electron-builder-core#Arch)</code> \| <code>null</code> |

<a name="module_electron-builder/out/repositoryInfo"></a>

## electron-builder/out/repositoryInfo

* [electron-builder/out/repositoryInfo](#module_electron-builder/out/repositoryInfo)
* [`.RepositorySlug`](#RepositorySlug)
* [`.getRepositoryInfo(projectDir, metadata, devMetadata)`](#module_electron-builder/out/repositoryInfo.getRepositoryInfo) ⇒ <code>Promise&lt; \| module:hosted-git-info.Info&gt;</code>

<a name="RepositorySlug"></a>

### `RepositorySlug`
**Kind**: interface of [<code>electron-builder/out/repositoryInfo</code>](#module_electron-builder/out/repositoryInfo)
**Properties**

| Name | Type |
| --- | --- |
| **user**| <code>string</code> |
| **project**| <code>string</code> |

<a name="module_electron-builder/out/repositoryInfo.getRepositoryInfo"></a>

### `electron-builder/out/repositoryInfo.getRepositoryInfo(projectDir, metadata, devMetadata)` ⇒ <code>Promise&lt; \| module:hosted-git-info.Info&gt;</code>
**Kind**: method of [<code>electron-builder/out/repositoryInfo</code>](#module_electron-builder/out/repositoryInfo)

| Param | Type |
| --- | --- |
| projectDir | <code>string</code> |
| metadata | <code>[Metadata](Options#Metadata)</code> |
| devMetadata | <code>[Metadata](Options#Metadata)</code> |

<a name="module_electron-builder/out/targets/appImage"></a>

## electron-builder/out/targets/appImage
Expand Down Expand Up @@ -1665,19 +1629,6 @@ Developer API only. See [[Options]] for user documentation.
| readWrite | <code>boolean</code> |
| task | <code>callback</code> |

<a name="module_electron-builder/out/targets/dmgLicense"></a>

## electron-builder/out/targets/dmgLicense
<a name="module_electron-builder/out/targets/dmgLicense.addLicenseToDmg"></a>

### `electron-builder/out/targets/dmgLicense.addLicenseToDmg(packager, dmgPath)` ⇒ <code>Promise&lt;void&gt;</code>
**Kind**: method of [<code>electron-builder/out/targets/dmgLicense</code>](#module_electron-builder/out/targets/dmgLicense)

| Param | Type |
| --- | --- |
| packager | <code>[PlatformPackager](#PlatformPackager)&lt;any&gt;</code> |
| dmgPath | <code>string</code> |

<a name="module_electron-builder/out/targets/fpm"></a>

## electron-builder/out/targets/fpm
Expand Down Expand Up @@ -2527,66 +2478,5 @@ Developer API only. See [[Options]] for user documentation.
| --- | --- |
| appInfo | <code>[AppInfo](#AppInfo)</code> |

<a name="module_electron-builder/out/yarn"></a>

## electron-builder/out/yarn

* [electron-builder/out/yarn](#module_electron-builder/out/yarn)
* [`.DesktopFrameworkInfo`](#DesktopFrameworkInfo)
* [`.getGypEnv(frameworkInfo, platform, arch, buildFromSource)`](#module_electron-builder/out/yarn.getGypEnv) ⇒ <code>any</code>
* [`.installOrRebuild(config, appDir, frameworkInfo, platform, arch, forceInstall)`](#module_electron-builder/out/yarn.installOrRebuild) ⇒ <code>Promise&lt;void&gt;</code>
* [`.rebuild(appDir, frameworkInfo, platform, arch, additionalArgs, buildFromSource)`](#module_electron-builder/out/yarn.rebuild) ⇒ <code>Promise&lt;void&gt;</code>

<a name="DesktopFrameworkInfo"></a>

### `DesktopFrameworkInfo`
**Kind**: interface of [<code>electron-builder/out/yarn</code>](#module_electron-builder/out/yarn)
**Properties**

| Name | Type |
| --- | --- |
| **version**| <code>string</code> |
| **useCustomDist**| <code>boolean</code> |

<a name="module_electron-builder/out/yarn.getGypEnv"></a>

### `electron-builder/out/yarn.getGypEnv(frameworkInfo, platform, arch, buildFromSource)` ⇒ <code>any</code>
**Kind**: method of [<code>electron-builder/out/yarn</code>](#module_electron-builder/out/yarn)

| Param | Type |
| --- | --- |
| frameworkInfo | <code>[DesktopFrameworkInfo](#DesktopFrameworkInfo)</code> |
| platform | <code>string</code> |
| arch | <code>string</code> |
| buildFromSource | <code>boolean</code> |

<a name="module_electron-builder/out/yarn.installOrRebuild"></a>

### `electron-builder/out/yarn.installOrRebuild(config, appDir, frameworkInfo, platform, arch, forceInstall)` ⇒ <code>Promise&lt;void&gt;</code>
**Kind**: method of [<code>electron-builder/out/yarn</code>](#module_electron-builder/out/yarn)

| Param | Type |
| --- | --- |
| config | <code>[Config](Options#Config)</code> |
| appDir | <code>string</code> |
| frameworkInfo | <code>[DesktopFrameworkInfo](#DesktopFrameworkInfo)</code> |
| platform | <code>string</code> |
| arch | <code>string</code> |
| forceInstall | <code>boolean</code> |

<a name="module_electron-builder/out/yarn.rebuild"></a>

### `electron-builder/out/yarn.rebuild(appDir, frameworkInfo, platform, arch, additionalArgs, buildFromSource)` ⇒ <code>Promise&lt;void&gt;</code>
**Kind**: method of [<code>electron-builder/out/yarn</code>](#module_electron-builder/out/yarn)

| Param | Type |
| --- | --- |
| appDir | <code>string</code> |
| frameworkInfo | <code>[DesktopFrameworkInfo](#DesktopFrameworkInfo)</code> |
| platform | <code>string</code> |
| arch | <code>string</code> |
| additionalArgs | <code>Array&lt;string&gt;</code> |
| buildFromSource | <code>boolean</code> |


<!-- end of generated block -->
12 changes: 9 additions & 3 deletions packages/electron-builder/src/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export interface DesktopFrameworkInfo {
useCustomDist: boolean
}

function getElectronGypCacheDir() {
return path.join(homedir(), ".electron-gyp")
}

export function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: string, arch: string, buildFromSource: boolean) {
if (!frameworkInfo.useCustomDist) {
return Object.assign({}, process.env, {
Expand All @@ -32,7 +36,7 @@ export function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: string,
})
}

const gypHome = path.join(homedir(), ".electron-gyp")
// https://github.com/nodejs/node-gyp/issues/21
return Object.assign({}, process.env, {
npm_config_disturl: "https://atom.io/download/electron",
npm_config_target: frameworkInfo.version,
Expand All @@ -41,8 +45,8 @@ export function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: string,
npm_config_target_arch: arch,
npm_config_platform: platform,
npm_config_build_from_source: buildFromSource,
HOME: gypHome,
USERPROFILE: gypHome,
npm_config_devdir: getElectronGypCacheDir(),

})
}

Expand All @@ -59,6 +63,8 @@ function installDependencies(appDir: string, frameworkInfo: DesktopFrameworkInfo
execArgs.push("--cache-min", "999999999")
}

execArgs.push("--devdir", getElectronGypCacheDir())

if (execPath == null) {
execPath = getPackageToolPath()
}
Expand Down
3 changes: 3 additions & 0 deletions packages/jsdoc2md.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ async function main() {
"!***/*-cliOptions.js",
"!***/*-license.js",
"!***/*-util-filter.js",
"!***/*-yarn.js",
"!***/*-dmgLicense.js",
"!***/*-repositoryInfo.js",
], {cwd: source}))
.filter(it => !userFiles.includes(it))

Expand Down

0 comments on commit ae0f668

Please sign in to comment.