Skip to content

Commit f93708b

Browse files
committed
split the identiityName and applicationid detect
1 parent 83aad7d commit f93708b

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

packages/app-builder-lib/scheme.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
"type": "boolean"
154154
},
155155
"applicationId": {
156-
"description": "The application id. Defaults to `identityName`.",
156+
"description": "The application id. Defaults to `identityName`. This string contains alpha-numeric fields separated by periods. Each field must begin with an ASCII alphabetic character",
157157
"type": "string"
158158
},
159159
"artifactName": {

packages/app-builder-lib/src/options/AppXOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { TargetSpecificOptions } from "../core"
22

33
export interface AppXOptions extends TargetSpecificOptions {
44
/**
5-
* The application id. Defaults to `identityName`.
5+
* The application id. Defaults to `identityName` This string contains alpha-numeric fields separated by periods. Each field must begin with an ASCII alphabetic character.
66
*/
77
readonly applicationId?: string
88

packages/app-builder-lib/src/targets/AppxTarget.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,17 @@ export default class AppXTarget extends Target {
226226
case "applicationId": {
227227
const result = options.applicationId || options.identityName || appInfo.name
228228
const validCharactersRegex = /^[a-zA-Z0-9.-]+$/
229-
if (result.length < 3 || result.length > 50) {
230-
const message = `Appx Application.Id with a value between 3 and 50 characters in length`
229+
const identitynumber = parseInt(result[0], 10)
230+
if (!isNaN(identitynumber)) {
231+
log.warn(`Remove the ${identitynumber}`)
232+
result = result.replace(identitynumber,'')
233+
}
234+
235+
if (result.length < 1 || result.length > 64) {
236+
const message = `Appx Application.Id with a value between 1 and 64 characters in length`
231237
throw new InvalidConfigurationError(message)
232238
} else if (!validCharactersRegex.test(result)) {
233-
const message = `AppX Application.Id cat be consists of alpha-numeric, period, and dash characters"`
239+
const message = `AppX Application.Id cat be consists of alpha-numeric and period"`
234240
throw new InvalidConfigurationError(message)
235241
} else if (restrictedApplicationIdValues.includes(result.toUpperCase())) {
236242
const message = `AppX Application.Id cannot be some values`
@@ -243,8 +249,25 @@ export default class AppXTarget extends Target {
243249
return result
244250
}
245251

246-
case "identityName":
247-
return options.identityName || appInfo.name
252+
case "identityName": {
253+
const result = options.identityName || appInfo.name
254+
const validCharactersRegex = /^[a-zA-Z0-9.-]+$/
255+
if (result.length < 3 || result.length > 50) {
256+
const message = `Appx identityName.Id with a value between 3 and 50 characters in length`
257+
throw new InvalidConfigurationError(message)
258+
} else if (!validCharactersRegex.test(result)) {
259+
const message = `AppX identityName.Id cat be consists of alpha-numeric, period, and dash characters"`
260+
throw new InvalidConfigurationError(message)
261+
} else if (restrictedApplicationIdValues.includes(result.toUpperCase())) {
262+
const message = `AppX identityName.Id cannot be some values`
263+
throw new InvalidConfigurationError(message)
264+
} else if (result == null && options.identityName == null) {
265+
const message = `Please set appx.identityName or name`
266+
throw new InvalidConfigurationError(message)
267+
}
268+
269+
return result
270+
}
248271

249272
case "executable":
250273
return executable

0 commit comments

Comments
 (0)