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

feat(appx): Update identityName for windows 10 #8203

Merged
merged 3 commits into from
May 6, 2024
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
5 changes: 5 additions & 0 deletions .changeset/gentle-bags-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

feat(appx): Update identityName for windows 10
43 changes: 38 additions & 5 deletions packages/app-builder-lib/src/targets/AppxTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,31 @@ const vendorAssetsForDefaultAssets: { [key: string]: string } = {
"Wide310x150Logo.png": "SampleAppx.310x150.png",
}

const restrictedApplicationIdValues = [
"CON",
"PRN",
"AUX",
"NUL",
"COM1",
"COM2",
"COM3",
"COM4",
"COM5",
"COM6",
"COM7",
"COM8",
"COM9",
"LPT1",
"LPT2",
"LPT3",
"LPT4",
"LPT5",
"LPT6",
"LPT7",
"LPT8",
"LPT9",
]

const DEFAULT_RESOURCE_LANG = "en-US"

export default class AppXTarget extends Target {
Expand Down Expand Up @@ -200,13 +225,21 @@ export default class AppXTarget extends Target {

case "applicationId": {
const result = options.applicationId || options.identityName || appInfo.name
if (!isNaN(parseInt(result[0], 10))) {
let message = `AppX Application.Id can’t start with numbers: "${result}"`
if (options.applicationId == null) {
message += `\nPlease set appx.applicationId (or correct appx.identityName or name)`
}
const validCharactersRegex = /^[a-zA-Z0-9.-]+$/
if (result.length < 3 || result.length > 50) {
const message = `Appx Application.Id with a value between 3 and 50 characters in length`
throw new InvalidConfigurationError(message)
} else if (!validCharactersRegex.test(result)) {
const message = `AppX Application.Id cat be consists of alpha-numeric, period, and dash characters"`
throw new InvalidConfigurationError(message)
} else if (restrictedApplicationIdValues.includes(result.toUpperCase())) {
const message = `AppX Application.Id cannot be some values`
throw new InvalidConfigurationError(message)
} else if (options.applicationId == null) {
const message = `Please set appx.applicationId (or correct appx.identityName or name)`
throw new InvalidConfigurationError(message)
}

return result
}

Expand Down
Loading