Skip to content

Commit

Permalink
feat: ${buildVersion} macro in artifactName config
Browse files Browse the repository at this point in the history
Close #1527
  • Loading branch information
develar committed May 4, 2017
1 parent 78d9b33 commit 23f0b37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ You can use macros in the file patterns, artifact file name patterns and publish
* `${productName}` — [Sanitized](https://www.npmjs.com/package/sanitize-filename) product name.
* `${version}`
* `${env.ENV_NAME}` — any environment variable.
* Any property of [AppInfo](https://github.com/electron-userland/electron-builder/wiki/electron-builder#AppInfo) (e.g. `buildVersion`, `buildNumber`).

## Source and Destination Directories
You may also specify custom source and destination directories by using JSON objects instead of simple glob patterns.
Expand Down
10 changes: 4 additions & 6 deletions packages/electron-builder/src/platformPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,6 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
const appInfo = this.appInfo
return pattern.replace(/\$\{([_a-zA-Z./*]+)\}/g, (match, p1): string => {
switch (p1) {
case "name":
return appInfo.name

case "version":
return appInfo.version

case "productName":
return appInfo.productFilename

Expand All @@ -377,6 +371,10 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
return this.platform.buildConfigurationKey

default:
if (p1 in appInfo) {
return (<any>appInfo)[p1]
}

if (p1.startsWith("env.")) {
const envName = p1.substring("env.".length)
const envValue = process.env[envName]
Expand Down

0 comments on commit 23f0b37

Please sign in to comment.