Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compiler error and test updates #5449

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
29 changes: 14 additions & 15 deletions packages/app-builder-lib/src/targets/LinuxTargetHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { asArray, isEmptyOrSpaces, log } from "builder-util"
import { asArray, isEmptyOrSpaces, log, exists } from "builder-util"
import { outputFile } from "fs-extra"
import { Lazy } from "lazy-val"
import { LinuxTargetSpecificOptions } from ".."
Expand Down Expand Up @@ -52,22 +52,21 @@ export class LinuxTargetHelper {
// must be name without spaces and other special characters, but not product name used
private async computeDesktopIcons(): Promise<Array<IconInfo>> {
const packager = this.packager
const iconDir = packager.platformSpecificBuildOptions.icon
const sources = iconDir == null ? [] : [iconDir]

const commonConfiguration = packager.config
const icnsPath = (commonConfiguration.mac || {}).icon || commonConfiguration.icon
if (icnsPath != null) {
sources.push(icnsPath)
}

// if no explicit sources are defined, default to buildResources directory
if (sources.length < 1) {
sources.push('./')
mmaietta marked this conversation as resolved.
Show resolved Hide resolved
}
const { platformSpecificBuildOptions, config } = packager

const sources = [
platformSpecificBuildOptions.icon,
config.mac?.icon ?? config.icon
].filter(str => !!str) as string[]

// If no explicit sources are defined, fallback to buildResources directory, then default framework icon
const fallbackSources = [
config.directories?.buildResources,
...asArray(packager.getDefaultFrameworkIcon())
].filter(async filepath => filepath && await exists(filepath)) as string[]

// 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
}
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export { Arch, getArchCliNames, toLinuxArchString, getArchSuffix, ArchType, arch
export { AsyncTaskManager } from "./asyncTaskManager"
export { DebugLogger } from "./DebugLogger"

export { copyFile } from "./fs"
export { copyFile, exists } from "./fs"
export { asArray } from "builder-util-runtime"

export { deepAssign } from "./deepAssign"
Expand Down
22 changes: 16 additions & 6 deletions packages/dmg-builder/src/dmgLicense.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -9,7 +10,15 @@ 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

export async function addLicenseToDmg(packager: PlatformPackager<any>, dmgPath: string): Promise<Object | null> {
// License Specifications
// https://github.com/argv-minus-one/dmg-license/blob/HEAD/docs/License%20Specifications.md
type LicenseConfig = {
'$schema': string
body: any[]
labels: any[]
}

export async function addLicenseToDmg(packager: PlatformPackager<any>, dmgPath: string): Promise<LicenseConfig | null> {
const licenseFiles = await getLicenseFiles(packager)
if (licenseFiles.length === 0) {
return null
Expand All @@ -19,11 +28,11 @@ export async function addLicenseToDmg(packager: PlatformPackager<any>, dmgPath:
packager.debugLogger.add("dmg.licenseFiles", licenseFiles)
packager.debugLogger.add("dmg.licenseButtons", licenseButtonFiles)

const jsonFile = {
'$schema': 'https://github.com/argv-minus-one/dmg-license/raw/master/schema.json',
const jsonFile: LicenseConfig = {
"$schema": "https://github.com/argv-minus-one/dmg-license/raw/master/schema.json",
// defaultLang: '',
body: [] as any,
labels: [] as any
body: [],
labels: []
}

for (const file of licenseFiles) {
Expand All @@ -34,7 +43,8 @@ export async function addLicenseToDmg(packager: PlatformPackager<any>, dmgPath:
}

for (const button of licenseButtonFiles) {
let 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
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/licensebuttons_en.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
lang: English
lang: en-US
languageName: English
agree: Agree
disagree: Disagree
print: Print
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/licensebuttons_fr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"lang": "Français",
"lang": "fr-FR",
"languageName": "Français",
"agree": "J'accepte",
"disagree": "Je refuse",
"print": "Imprimer",
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/licensebuttons_ja.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"lang": "日本語",
"lang": "ja-JP",
"languageName": "日本語",
"agree": "同意する",
"disagree": "同意しない",
"print": "印刷する",
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/licensebuttons_ko.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"lang": "한국어",
"lang": "ko-KR",
"languageName": "한국어",
"agree": "한국어",
"disagree": "동의하지 않는다",
"print": "인쇄",
Expand Down
13 changes: 13 additions & 0 deletions test/snapshots/linux/snapTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -283,6 +284,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -363,6 +365,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -433,6 +436,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -597,6 +601,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -762,6 +767,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -927,6 +933,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -1093,6 +1100,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -1152,6 +1160,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -1353,6 +1362,7 @@ Object {
},
},
"summary": "Test App ßW",
"title": "Test App ßW",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -1554,6 +1564,7 @@ Object {
},
},
"summary": "Test App ßW",
"title": "Test App ßW",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -1627,6 +1638,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down Expand Up @@ -1706,6 +1718,7 @@ Object {
},
},
"summary": "Sep",
"title": "Sep",
"version": "1.1.0",
}
`;
Expand Down
Loading