Skip to content

Commit

Permalink
feat(appx): more customizable manifest fields
Browse files Browse the repository at this point in the history
* Package.Identity.Name (default name) - build.appx.identityName
* Package.Properties.DisplayName (default productName) - build.appx.displayName
* Package.Properties.PublisherDisplayName (default companyName) - build.appx.publisherDisplayName
  • Loading branch information
develar committed Dec 16, 2016
1 parent b9e9861 commit cdc7219
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 35 deletions.
14 changes: 14 additions & 0 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Don't customize paths to background and icon, — just follow conventions.
* [Application package.json](#AppMetadata)
* [Development package.json](#DevMetadata)
* [.build](#BuildMetadata)
* [.build.appx](#AppXOptions)
* [.build.dmg](#DmgOptions)
* [.build.dmg.window](#DmgWindow)
* [.build.fileAssociations](#FileAssociation)
Expand Down Expand Up @@ -93,6 +94,19 @@ Don't customize paths to background and icon, — just follow conventions.
| 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).
| directories | <a name="BuildMetadata-directories"></a>See [.directories](#MetadataDirectories)

<a name="AppXOptions"></a>
### `.build.appx`

Please see [Windows AppX docs](https://msdn.microsoft.com/en-us/library/windows/apps/br211453.aspx).

| Name | Description
| --- | ---
| 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).
| 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.
| 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).
| 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).
| 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).

<a name="DmgOptions"></a>
### `.build.dmg`

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,8 @@
],
"setupTestFrameworkScriptFile": "<rootDir>/test/jestSetup.js"
},
"typings": "./out/electron-builder.d.ts"
"typings": "./out/electron-builder.d.ts",
"publishConfig": {
"tag": "next"
}
}
30 changes: 28 additions & 2 deletions src/options/winOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,36 @@ export interface SquirrelWindowsOptions extends WinBuildOptions {
readonly useAppIdAsId?: boolean
}

/*
### `.build.appx`
Please see [Windows AppX docs](https://msdn.microsoft.com/en-us/library/windows/apps/br211453.aspx).
*/
export interface AppXOptions {
// readonly flatten?: boolean
/*
The background color of the app tile. Please see [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx).
*/
readonly backgroundColor?: string | null

readonly makeappxArgs?: Array<string> | null

/*
Describes the publisher information. The Publisher attribute must match the publisher subject information of the certificate used to sign a package. For now, required.
*/
readonly publisher?: string | null
}

/*
A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).
*/
readonly displayName?: string | null

/*
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).
*/
readonly publisherDisplayName?: string | null

/*
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).
*/
readonly identityName?: string | null
}
11 changes: 7 additions & 4 deletions src/targets/appx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,24 @@ export default class AppXTarget extends Target {
case "publisher":
return this.options.publisher!

case "author":
return appInfo.companyName
case "publisherDisplayName":
return this.options.publisherDisplayName || appInfo.companyName

case "version":
return appInfo.versionInWeirdWindowsForm

case "name":
return appInfo.name

case "identityName":
return this.options.identityName || appInfo.name

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

case "displayName":
return appInfo.productName

return this.options.displayName || appInfo.productName
case "description":
return appInfo.description || appInfo.productName

Expand Down
4 changes: 2 additions & 2 deletions templates/appx/appxmanifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
<Identity Name="${name}"
<Identity Name="${identityName}"
ProcessorArchitecture="${arch}"
Publisher="${publisher}"
Version="${version}" />
<Properties>
<DisplayName>${displayName}</DisplayName>
<PublisherDisplayName>${author}</PublisherDisplayName>
<PublisherDisplayName>${publisherDisplayName}</PublisherDisplayName>
<Description>${description}</Description>
<Logo>assets\${safeName}.50x50.png</Logo>
</Properties>
Expand Down
52 changes: 26 additions & 26 deletions test/yarn.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ let getEolFromFile = (() => {

const buffer = yield readFileBuffer(path);

for (const i = 0; i < buffer.length; ++i) {
for (let i = 0; i < buffer.length; ++i) {
if (buffer[i] === cr) {
return '\r\n';
}
Expand Down Expand Up @@ -1168,7 +1168,7 @@ const _camelCase = __webpack_require__(343);
function sortAlpha(a, b) {
// sort alphabetically in a deterministic way
const shortLen = Math.min(a.length, b.length);
for (const i = 0; i < shortLen; i++) {
for (let i = 0; i < shortLen; i++) {
const aChar = a.charCodeAt(i);
const bChar = b.charCodeAt(i);
if (aChar !== bChar) {
Expand Down Expand Up @@ -30177,7 +30177,7 @@ class NpmRegistry extends (_baseRegistry || _load_baseRegistry()).default {
return this.token;
}

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

// Check for bearer token.
Expand Down Expand Up @@ -33047,7 +33047,7 @@ function queue(arr, promiseProducer) {
}

return new Promise((resolve, reject) => {
for (const i = 0; i < concurrency; i++) {
for (let i = 0; i < concurrency; i++) {
next();
}

Expand Down Expand Up @@ -35628,7 +35628,7 @@ function _stringify(obj, options) {

let addedKeys = [];

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

// get all keys that have the same value equality, we only want this for objects
if (typeof val === 'object') {
for (const j = i + 1; j < keys.length; j++) {
for (let j = i + 1; j < keys.length; j++) {
const key = keys[j];
if (val === obj[key]) {
valKeys.push(key);
Expand Down Expand Up @@ -41695,7 +41695,7 @@ function* tokenise(input) {
} else if (input[0] === ' ') {
if (lastNewline) {
let indent = '';
for (const i = 0; input[i] === ' '; i++) {
for (let i = 0; input[i] === ' '; i++) {
indent += input[i];
}

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

for (const i = 0;; i++) {
for (let i = 0;; i++) {
const currentChar = input[i];
val += currentChar;

Expand All @@ -41736,7 +41736,7 @@ function* tokenise(input) {
}
} else if (/^[0-9]/.test(input)) {
let val = '';
for (const i = 0; /^[0-9]$/.test(input[i]); i++) {
for (let i = 0; /^[0-9]$/.test(input[i]); i++) {
val += input[i];
}
chop = val.length;
Expand All @@ -41756,7 +41756,7 @@ function* tokenise(input) {
chop++;
} else if (/^[a-zA-Z]/g.test(input)) {
let name = "";
for (const i = 0; i < input.length; i++) {
for (let i = 0; i < input.length; i++) {
const char = input[i];
if (char === ':' || char === ' ' || char === '\n' || char === ',') {
break;
Expand Down Expand Up @@ -42117,7 +42117,7 @@ class JSONReporter extends (_baseReporter || _load_baseReporter()).default {
this._dump('activitySetStart', { id, total, workers });

const spinners = [];
for (const i = 0; i < workers; i++) {
for (let i = 0; i < workers; i++) {
let current = 0;
let header = '';

Expand Down Expand Up @@ -50746,7 +50746,7 @@ class PackageLinker {

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

// ignore all arguments after a --
let endArgs = [];
for (const i = 0; i < args.length; i++) {
for (let i = 0; i < args.length; i++) {
const arg = args[i];
if (arg === '--') {
endArgs = args.slice(i + 1);
Expand Down Expand Up @@ -63721,7 +63721,7 @@ let run = exports.run = (() => {
if (human !== hoistedKey) {
const humanParts = human.split('#');

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

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

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

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

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

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

mergeEnv(prefix) {
// try environment variables
for (const key in process.env) {
for (let key in process.env) {
key = key.toLowerCase();

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

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

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

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

const spinners = [];

for (const i = 1; i < workers; i++) {
for (let i = 1; i < workers; i++) {
this.log('');
}

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

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

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

Expand Down Expand Up @@ -70211,7 +70211,7 @@ function sortTrees(trees) {
function recurseTree(tree, level, recurseFunc) {
const treeLen = tree.length;
const treeEnd = treeLen - 1;
for (const i = 0; i < treeLen; i++) {
for (let i = 0; i < treeLen; i++) {
recurseFunc(tree[i], level + 1, i === treeEnd);
}
}
Expand Down Expand Up @@ -71627,7 +71627,7 @@ exports.default = (() => {
if (Array.isArray(licenses) && !info.license) {
let licenseTypes = [];

for (const license of licenses) {
for (let license of licenses) {
if (license && typeof license === 'object') {
license = license.type;
}
Expand Down

0 comments on commit cdc7219

Please sign in to comment.