Skip to content

Commit cdc7219

Browse files
committed
feat(appx): more customizable manifest fields
* Package.Identity.Name (default name) - build.appx.identityName * Package.Properties.DisplayName (default productName) - build.appx.displayName * Package.Properties.PublisherDisplayName (default companyName) - build.appx.publisherDisplayName
1 parent b9e9861 commit cdc7219

File tree

6 files changed

+81
-35
lines changed

6 files changed

+81
-35
lines changed

docs/Options.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Don't customize paths to background and icon, — just follow conventions.
2727
* [Application package.json](#AppMetadata)
2828
* [Development package.json](#DevMetadata)
2929
* [.build](#BuildMetadata)
30+
* [.build.appx](#AppXOptions)
3031
* [.build.dmg](#DmgOptions)
3132
* [.build.dmg.window](#DmgWindow)
3233
* [.build.fileAssociations](#FileAssociation)
@@ -93,6 +94,19 @@ Don't customize paths to background and icon, — just follow conventions.
9394
| forceCodeSigning | <a name="BuildMetadata-forceCodeSigning"></a>Whether to fail if application will be not signed (to prevent unsigned app if code signing configuration is not correct).
9495
| directories | <a name="BuildMetadata-directories"></a>See [.directories](#MetadataDirectories)
9596

97+
<a name="AppXOptions"></a>
98+
### `.build.appx`
99+
100+
Please see [Windows AppX docs](https://msdn.microsoft.com/en-us/library/windows/apps/br211453.aspx).
101+
102+
| Name | Description
103+
| --- | ---
104+
| backgroundColor | <a name="AppXOptions-backgroundColor"></a>The background color of the app tile. Please see [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx).
105+
| publisher | <a name="AppXOptions-publisher"></a>* Describes the publisher information. The Publisher attribute must match the publisher subject information of the certificate used to sign a package. For now, required.
106+
| displayName | <a name="AppXOptions-displayName"></a>A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).
107+
| publisherDisplayName | <a name="AppXOptions-publisherDisplayName"></a>A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx).
108+
| identityName | <a name="AppXOptions-identityName"></a>Describes the contents of the package. The Name attribute is case-sensitive. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx).
109+
96110
<a name="DmgOptions"></a>
97111
### `.build.dmg`
98112

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,8 @@
134134
],
135135
"setupTestFrameworkScriptFile": "<rootDir>/test/jestSetup.js"
136136
},
137-
"typings": "./out/electron-builder.d.ts"
137+
"typings": "./out/electron-builder.d.ts",
138+
"publishConfig": {
139+
"tag": "next"
140+
}
138141
}

src/options/winOptions.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,36 @@ export interface SquirrelWindowsOptions extends WinBuildOptions {
179179
readonly useAppIdAsId?: boolean
180180
}
181181

182+
/*
183+
### `.build.appx`
184+
185+
Please see [Windows AppX docs](https://msdn.microsoft.com/en-us/library/windows/apps/br211453.aspx).
186+
*/
182187
export interface AppXOptions {
183-
// readonly flatten?: boolean
188+
/*
189+
The background color of the app tile. Please see [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx).
190+
*/
184191
readonly backgroundColor?: string | null
192+
185193
readonly makeappxArgs?: Array<string> | null
186194

195+
/*
196+
Describes the publisher information. The Publisher attribute must match the publisher subject information of the certificate used to sign a package. For now, required.
197+
*/
187198
readonly publisher?: string | null
188-
}
199+
200+
/*
201+
A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).
202+
*/
203+
readonly displayName?: string | null
204+
205+
/*
206+
A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx).
207+
*/
208+
readonly publisherDisplayName?: string | null
209+
210+
/*
211+
Describes the contents of the package. The Name attribute is case-sensitive. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx).
212+
*/
213+
readonly identityName?: string | null
214+
}

src/targets/appx.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,24 @@ export default class AppXTarget extends Target {
7777
case "publisher":
7878
return this.options.publisher!
7979

80-
case "author":
81-
return appInfo.companyName
80+
case "publisherDisplayName":
81+
return this.options.publisherDisplayName || appInfo.companyName
8282

8383
case "version":
8484
return appInfo.versionInWeirdWindowsForm
8585

8686
case "name":
8787
return appInfo.name
88+
89+
case "identityName":
90+
return this.options.identityName || appInfo.name
8891

8992
case "executable":
9093
return `app\\${appInfo.productFilename}.exe`
9194

9295
case "displayName":
93-
return appInfo.productName
94-
96+
return this.options.displayName || appInfo.productName
97+
9598
case "description":
9699
return appInfo.description || appInfo.productName
97100

templates/appx/appxmanifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
44
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
55
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
6-
<Identity Name="${name}"
6+
<Identity Name="${identityName}"
77
ProcessorArchitecture="${arch}"
88
Publisher="${publisher}"
99
Version="${version}" />
1010
<Properties>
1111
<DisplayName>${displayName}</DisplayName>
12-
<PublisherDisplayName>${author}</PublisherDisplayName>
12+
<PublisherDisplayName>${publisherDisplayName}</PublisherDisplayName>
1313
<Description>${description}</Description>
1414
<Logo>assets\${safeName}.50x50.png</Logo>
1515
</Properties>

test/yarn.js

100755100644
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ let getEolFromFile = (() => {
619619

620620
const buffer = yield readFileBuffer(path);
621621

622-
for (const i = 0; i < buffer.length; ++i) {
622+
for (let i = 0; i < buffer.length; ++i) {
623623
if (buffer[i] === cr) {
624624
return '\r\n';
625625
}
@@ -1168,7 +1168,7 @@ const _camelCase = __webpack_require__(343);
11681168
function sortAlpha(a, b) {
11691169
// sort alphabetically in a deterministic way
11701170
const shortLen = Math.min(a.length, b.length);
1171-
for (const i = 0; i < shortLen; i++) {
1171+
for (let i = 0; i < shortLen; i++) {
11721172
const aChar = a.charCodeAt(i);
11731173
const bChar = b.charCodeAt(i);
11741174
if (aChar !== bChar) {
@@ -30177,7 +30177,7 @@ class NpmRegistry extends (_baseRegistry || _load_baseRegistry()).default {
3017730177
return this.token;
3017830178
}
3017930179

30180-
for (const registry of [this.getRegistry(packageName), '', DEFAULT_REGISTRY]) {
30180+
for (let registry of [this.getRegistry(packageName), '', DEFAULT_REGISTRY]) {
3018130181
registry = registry.replace(/^https?:/, '');
3018230182

3018330183
// Check for bearer token.
@@ -33047,7 +33047,7 @@ function queue(arr, promiseProducer) {
3304733047
}
3304833048

3304933049
return new Promise((resolve, reject) => {
33050-
for (const i = 0; i < concurrency; i++) {
33050+
for (let i = 0; i < concurrency; i++) {
3305133051
next();
3305233052
}
3305333053

@@ -35628,7 +35628,7 @@ function _stringify(obj, options) {
3562835628

3562935629
let addedKeys = [];
3563035630

35631-
for (const i = 0; i < keys.length; i++) {
35631+
for (let i = 0; i < keys.length; i++) {
3563235632
const key = keys[i];
3563335633
const val = obj[key];
3563435634
if (val == null || addedKeys.indexOf(key) >= 0) {
@@ -35640,7 +35640,7 @@ function _stringify(obj, options) {
3564035640

3564135641
// get all keys that have the same value equality, we only want this for objects
3564235642
if (typeof val === 'object') {
35643-
for (const j = i + 1; j < keys.length; j++) {
35643+
for (let j = i + 1; j < keys.length; j++) {
3564435644
const key = keys[j];
3564535645
if (val === obj[key]) {
3564635646
valKeys.push(key);
@@ -41695,7 +41695,7 @@ function* tokenise(input) {
4169541695
} else if (input[0] === ' ') {
4169641696
if (lastNewline) {
4169741697
let indent = '';
41698-
for (const i = 0; input[i] === ' '; i++) {
41698+
for (let i = 0; input[i] === ' '; i++) {
4169941699
indent += input[i];
4170041700
}
4170141701

@@ -41711,7 +41711,7 @@ function* tokenise(input) {
4171141711
} else if (input[0] === '"') {
4171241712
let val = '';
4171341713

41714-
for (const i = 0;; i++) {
41714+
for (let i = 0;; i++) {
4171541715
const currentChar = input[i];
4171641716
val += currentChar;
4171741717

@@ -41736,7 +41736,7 @@ function* tokenise(input) {
4173641736
}
4173741737
} else if (/^[0-9]/.test(input)) {
4173841738
let val = '';
41739-
for (const i = 0; /^[0-9]$/.test(input[i]); i++) {
41739+
for (let i = 0; /^[0-9]$/.test(input[i]); i++) {
4174041740
val += input[i];
4174141741
}
4174241742
chop = val.length;
@@ -41756,7 +41756,7 @@ function* tokenise(input) {
4175641756
chop++;
4175741757
} else if (/^[a-zA-Z]/g.test(input)) {
4175841758
let name = "";
41759-
for (const i = 0; i < input.length; i++) {
41759+
for (let i = 0; i < input.length; i++) {
4176041760
const char = input[i];
4176141761
if (char === ':' || char === ' ' || char === '\n' || char === ',') {
4176241762
break;
@@ -42117,7 +42117,7 @@ class JSONReporter extends (_baseReporter || _load_baseReporter()).default {
4211742117
this._dump('activitySetStart', { id, total, workers });
4211842118

4211942119
const spinners = [];
42120-
for (const i = 0; i < workers; i++) {
42120+
for (let i = 0; i < workers; i++) {
4212142121
let current = 0;
4212242122
let header = '';
4212342123

@@ -50746,7 +50746,7 @@ class PackageLinker {
5074650746

5074750747
// find a dependency in the tree above us that matches
5074850748
let searchPatterns = [];
50749-
for (const request of ref.requests) {
50749+
for (let request of ref.requests) {
5075050750
do {
5075150751
// get resolved pattern for this request
5075250752
const dep = this.resolver.getResolvedPattern(request.pattern);
@@ -61410,7 +61410,7 @@ let args = process.argv.slice(2);
6141061410

6141161411
// ignore all arguments after a --
6141261412
let endArgs = [];
61413-
for (const i = 0; i < args.length; i++) {
61413+
for (let i = 0; i < args.length; i++) {
6141461414
const arg = args[i];
6141561415
if (arg === '--') {
6141661416
endArgs = args.slice(i + 1);
@@ -63721,7 +63721,7 @@ let run = exports.run = (() => {
6372163721
if (human !== hoistedKey) {
6372263722
const humanParts = human.split('#');
6372363723

63724-
for (const i = 0; i < humanParts.length; i++) {
63724+
for (let i = 0; i < humanParts.length; i++) {
6372563725
const humanPart = humanParts[i];
6372663726

6372763727
if (hoistedParts[0] === humanPart) {
@@ -63763,7 +63763,7 @@ let run = exports.run = (() => {
6376363763
// find the package that this will resolve to, factoring in hoisting
6376463764
const possibles = [];
6376563765
let depPkgLoc;
63766-
for (const i = parts.length; i >= 0; i--) {
63766+
for (let i = parts.length; i >= 0; i--) {
6376763767
const myParts = parts.slice(0, i).concat(name);
6376863768

6376963769
// build package.json location for this position
@@ -68195,7 +68195,7 @@ class PackageHoister {
6819568195
const name = parts.pop();
6819668196

6819768197
//
68198-
for (const i = parts.length - 1; i >= 0; i--) {
68198+
for (let i = parts.length - 1; i >= 0; i--) {
6819968199
const checkParts = parts.slice(0, i).concat(name);
6820068200
const checkKey = this.implodeKey(checkParts);
6820168201
info.addHistory(`Looked at ${ checkKey } for a match`);
@@ -68342,7 +68342,7 @@ class PackageHoister {
6834268342
*/
6834368343

6834468344
taintParents(info, processParts, start) {
68345-
for (const i = start; i < processParts.length; i++) {
68345+
for (let i = start; i < processParts.length; i++) {
6834668346
const parts = processParts.slice(0, i).concat(info.pkg.name);
6834768347
const key = this.implodeKey(parts);
6834868348

@@ -68388,7 +68388,7 @@ class PackageHoister {
6838868388
// decompress the location and push it to the flat tree. this path could be made
6838968389
const parts = [];
6839068390
const keyParts = key.split('#');
68391-
for (const i = 0; i < keyParts.length; i++) {
68391+
for (let i = 0; i < keyParts.length; i++) {
6839268392
const key = keyParts.slice(0, i + 1).join('#');
6839368393
const hoisted = this.tree.get(key);
6839468394
invariant(hoisted, 'expected hoisted manifest');
@@ -69535,7 +69535,7 @@ class BaseRegistry {
6953569535

6953669536
mergeEnv(prefix) {
6953769537
// try environment variables
69538-
for (const key in process.env) {
69538+
for (let key in process.env) {
6953969539
key = key.toLowerCase();
6954069540

6954169541
// only accept keys prefixed with the prefix
@@ -69869,14 +69869,14 @@ class ConsoleReporter extends (_baseReporter || _load_baseReporter()).default {
6986969869

6987069870
// get column widths
6987169871
const cols = [];
69872-
for (const i = 0; i < head.length; i++) {
69872+
for (let i = 0; i < head.length; i++) {
6987369873
const widths = rows.map(row => this.format.stripColor(row[i]).length);
6987469874
cols[i] = Math.max(...widths);
6987569875
}
6987669876

6987769877
//
6987869878
const builtRows = rows.map(row => {
69879-
for (const i = 0; i < row.length; i++) {
69879+
for (let i = 0; i < row.length; i++) {
6988069880
const field = row[i];
6988169881
const padding = cols[i] - this.format.stripColor(field).length;
6988269882

@@ -70024,11 +70024,11 @@ class ConsoleReporter extends (_baseReporter || _load_baseReporter()).default {
7002470024

7002570025
const spinners = [];
7002670026

70027-
for (const i = 1; i < workers; i++) {
70027+
for (let i = 1; i < workers; i++) {
7002870028
this.log('');
7002970029
}
7003070030

70031-
for (const i = 0; i < workers; i++) {
70031+
for (let i = 0; i < workers; i++) {
7003270032
const spinner = new (_spinnerProgress || _load_spinnerProgress()).default(this.stderr, i);
7003370033
spinner.start();
7003470034

@@ -70128,7 +70128,7 @@ class ConsoleReporter extends (_baseReporter || _load_baseReporter()).default {
7012870128
return new Promise(resolve => {
7012970129
this.info(header);
7013070130

70131-
for (const i = 0; i < questions.length; i++) {
70131+
for (let i = 0; i < questions.length; i++) {
7013270132
this.log(` ${ this.format.dim(`${ i + 1 })`) } ${ questions[i] }`);
7013370133
}
7013470134

@@ -70211,7 +70211,7 @@ function sortTrees(trees) {
7021170211
function recurseTree(tree, level, recurseFunc) {
7021270212
const treeLen = tree.length;
7021370213
const treeEnd = treeLen - 1;
70214-
for (const i = 0; i < treeLen; i++) {
70214+
for (let i = 0; i < treeLen; i++) {
7021570215
recurseFunc(tree[i], level + 1, i === treeEnd);
7021670216
}
7021770217
}
@@ -71627,7 +71627,7 @@ exports.default = (() => {
7162771627
if (Array.isArray(licenses) && !info.license) {
7162871628
let licenseTypes = [];
7162971629

71630-
for (const license of licenses) {
71630+
for (let license of licenses) {
7163171631
if (license && typeof license === 'object') {
7163271632
license = license.type;
7163371633
}

0 commit comments

Comments
 (0)