diff --git a/package.json b/package.json index 49a3abc0d4a..10d94ef39a1 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "test": "node ./test/out/helpers/runTests.js skipArtifactPublisher ALL_TESTS=isCi", "test-all": "yarn pretest && node ./test/out/helpers/runTests.js", "test-linux": "docker run --rm -ti -v ${PWD}:/project -v ${PWD##*/}-node-modules:/project/node_modules -v ~/Library/Caches/electron:/root/.cache/electron -v ~/Library/Caches/electron-builder:/root/.cache/electron-builder electronuserland/builder:wine /bin/bash -c \"yarn && TEST_FILES=HoistedNodeModuleTest node ./test/out/helpers/runTests.js\"", + "test-update": "UPDATE_SNAPSHOT=true npm run test", "docker-images": "docker/build.sh", "release": "BABEL_ENV=production yarn compile && ./scripts/publish-packages.sh && conventional-changelog-cli conventional-changelog -p angular -i CHANGELOG.md -s", "schema": "typescript-json-schema packages/app-builder-lib/tsconfig.json Configuration --out packages/app-builder-lib/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks --required && node ./scripts/fix-schema.js", diff --git a/packages/app-builder-lib/src/targets/LinuxTargetHelper.ts b/packages/app-builder-lib/src/targets/LinuxTargetHelper.ts index 7018309eb4f..db7ad2611c3 100644 --- a/packages/app-builder-lib/src/targets/LinuxTargetHelper.ts +++ b/packages/app-builder-lib/src/targets/LinuxTargetHelper.ts @@ -61,13 +61,11 @@ export class LinuxTargetHelper { sources.push(icnsPath) } - // if no explicit sources are defined, default to buildResources directory - if (sources.length < 1) { - sources.push('./') - } + // If no explicit sources are defined, fallback to buildResources directory, then default framework icon + const fallbackSources = [packager.buildResourcesDir, ...asArray(packager.getDefaultFrameworkIcon())] // need to put here and not as default because need to resolve image size - const result = await packager.resolveIcon(sources, asArray(packager.getDefaultFrameworkIcon()), "set") + const result = await packager.resolveIcon(sources, fallbackSources, "set") this.maxIconPath = result[result.length - 1].file return result } diff --git a/packages/dmg-builder/src/dmgLicense.ts b/packages/dmg-builder/src/dmgLicense.ts index 7b09c8d7a32..62dff0be270 100644 --- a/packages/dmg-builder/src/dmgLicense.ts +++ b/packages/dmg-builder/src/dmgLicense.ts @@ -1,4 +1,5 @@ import { exec, log } from "builder-util" +import { safeLoad } from 'js-yaml' import { PlatformPackager } from "app-builder-lib" import { getLicenseFiles } from "app-builder-lib/out/util/license" import { outputFile, readFile, readJson } from "fs-extra" @@ -9,6 +10,8 @@ import { dmgLicenseFromJSON } from 'dmg-license' // DropDMG/dmgbuild a in any case (even if no english, but only ru/de) set to 0 (en_US), well, without docs, just believe that's correct const DEFAULT_REGION_CODE = 0 +// License Specifications +// https://github.com/argv-minus-one/dmg-license/blob/HEAD/docs/License%20Specifications.md type LicenseConfig = { '$schema': string body: any[] @@ -26,7 +29,7 @@ export async function addLicenseToDmg(packager: PlatformPackager, dmgPath: packager.debugLogger.add("dmg.licenseButtons", licenseButtonFiles) const jsonFile: LicenseConfig = { - '$schema': 'https://github.com/argv-minus-one/dmg-license/raw/master/schema.json', + "$schema": "https://github.com/argv-minus-one/dmg-license/raw/master/schema.json", // defaultLang: '', body: [], labels: [] @@ -40,7 +43,8 @@ export async function addLicenseToDmg(packager: PlatformPackager, dmgPath: } for (const button of licenseButtonFiles) { - const label = await readJson(button.file) + const filepath = button.file + const label = filepath.endsWith(".yml") ? safeLoad(await readFile(filepath, "utf-8")) : await readJson(filepath) if (label.description) { // to support original button file format label.message = label.description diff --git a/test/snapshots/linux/snapTest.js.snap b/test/snapshots/linux/snapTest.js.snap index d7362006bf2..0184fbe7db0 100644 --- a/test/snapshots/linux/snapTest.js.snap +++ b/test/snapshots/linux/snapTest.js.snap @@ -71,6 +71,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -283,6 +284,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -363,6 +365,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -433,6 +436,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -597,6 +601,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -762,6 +767,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -927,6 +933,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -1093,6 +1100,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -1152,6 +1160,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -1353,6 +1362,7 @@ Object { }, }, "summary": "Test App ßW", + "title": "Test App ßW", "version": "1.1.0", } `; @@ -1554,6 +1564,7 @@ Object { }, }, "summary": "Test App ßW", + "title": "Test App ßW", "version": "1.1.0", } `; @@ -1627,6 +1638,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; @@ -1706,6 +1718,7 @@ Object { }, }, "summary": "Sep", + "title": "Sep", "version": "1.1.0", } `; diff --git a/test/snapshots/mac/dmgTest.js.snap b/test/snapshots/mac/dmgTest.js.snap index a829570faec..7e4b5c70d61 100644 --- a/test/snapshots/mac/dmgTest.js.snap +++ b/test/snapshots/mac/dmgTest.js.snap @@ -2472,7 +2472,7 @@ Object { } `; -exports[`license rtf 1`] = ` +exports[`license ja 1`] = ` Object { "mac": Array [ Object { @@ -2496,7 +2496,7 @@ Object { } `; -exports[`license rtf 2`] = ` +exports[`license ja 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", @@ -2532,7 +2532,7 @@ Object { } `; -exports[`license ru 1`] = ` +exports[`license rtf 1`] = ` Object { "mac": Array [ Object { @@ -2556,7 +2556,7 @@ Object { } `; -exports[`license ru 2`] = ` +exports[`license rtf 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", diff --git a/test/src/mac/dmgTest.ts b/test/src/mac/dmgTest.ts index 58a0a73c701..07ddda7e75f 100644 --- a/test/src/mac/dmgTest.ts +++ b/test/src/mac/dmgTest.ts @@ -254,14 +254,14 @@ test.ifAll.ifMac("multi language license", app(packagerOptions, { return Promise.all([ // writeFile(path.join(projectDir, "build", "license_en.txt"), "Hi"), fs.writeFile(path.join(projectDir, "build", "license_de.txt"), "Hallo"), - fs.writeFile(path.join(projectDir, "build", "license_ru.txt"), "Привет"), + fs.writeFile(path.join(projectDir, "build", "license_ja.txt"), "こんにちは"), ]) }, })) -test.ifAll.ifMac("license ru", app(packagerOptions, { +test.ifAll.ifMac("license ja", app(packagerOptions, { projectDirCreated: projectDir => { - return fs.writeFile(path.join(projectDir, "build", "license_ru.txt"), "Привет".repeat(12)) + return fs.writeFile(path.join(projectDir, "build", "license_ja.txt"), "こんにちは".repeat(12)) }, }))