From cdc72194c12b9709b3e1d9406a9c1142f030fefc Mon Sep 17 00:00:00 2001 From: develar Date: Fri, 16 Dec 2016 08:56:06 +0100 Subject: [PATCH] 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 --- docs/Options.md | 14 +++++++++ package.json | 5 +++- src/options/winOptions.ts | 30 +++++++++++++++++-- src/targets/appx.ts | 11 ++++--- templates/appx/appxmanifest.xml | 4 +-- test/yarn.js | 52 ++++++++++++++++----------------- 6 files changed, 81 insertions(+), 35 deletions(-) mode change 100755 => 100644 test/yarn.js diff --git a/docs/Options.md b/docs/Options.md index 4d571ebbd4d..252e4e35b5d 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -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) @@ -93,6 +94,19 @@ Don't customize paths to background and icon, — just follow conventions. | forceCodeSigning | Whether to fail if application will be not signed (to prevent unsigned app if code signing configuration is not correct). | directories | See [.directories](#MetadataDirectories) + +### `.build.appx` + +Please see [Windows AppX docs](https://msdn.microsoft.com/en-us/library/windows/apps/br211453.aspx). + +| Name | Description +| --- | --- +| backgroundColor | The background color of the app tile. Please see [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx). +| publisher | * 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 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 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 | 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). + ### `.build.dmg` diff --git a/package.json b/package.json index 5817aa1ee70..16564b34985 100644 --- a/package.json +++ b/package.json @@ -134,5 +134,8 @@ ], "setupTestFrameworkScriptFile": "/test/jestSetup.js" }, - "typings": "./out/electron-builder.d.ts" + "typings": "./out/electron-builder.d.ts", + "publishConfig": { + "tag": "next" + } } diff --git a/src/options/winOptions.ts b/src/options/winOptions.ts index 0f3395eba30..429610c4731 100644 --- a/src/options/winOptions.ts +++ b/src/options/winOptions.ts @@ -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 | 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 -} \ No newline at end of file + + /* + 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 +} diff --git a/src/targets/appx.ts b/src/targets/appx.ts index 3f993d1116c..c22e2247771 100644 --- a/src/targets/appx.ts +++ b/src/targets/appx.ts @@ -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 diff --git a/templates/appx/appxmanifest.xml b/templates/appx/appxmanifest.xml index 017d19385be..2f1cc530543 100644 --- a/templates/appx/appxmanifest.xml +++ b/templates/appx/appxmanifest.xml @@ -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"> - ${displayName} - ${author} + ${publisherDisplayName} ${description} assets\${safeName}.50x50.png diff --git a/test/yarn.js b/test/yarn.js old mode 100755 new mode 100644 index 8099ef598d5..8a0fced5346 --- a/test/yarn.js +++ b/test/yarn.js @@ -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'; } @@ -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) { @@ -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. @@ -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(); } @@ -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) { @@ -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); @@ -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]; } @@ -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; @@ -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; @@ -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; @@ -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 = ''; @@ -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); @@ -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); @@ -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) { @@ -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 @@ -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`); @@ -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); @@ -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'); @@ -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 @@ -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; @@ -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(); @@ -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] }`); } @@ -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); } } @@ -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; }