Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 09a51e1

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Fix appid inconsistent - NativeScript/nativescript-cli#413
1 parent 740950c commit 09a51e1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

declarations.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ interface ISpawnFromEventOptions {
172172
interface IProjectHelper {
173173
projectDir: string;
174174
generateDefaultAppId(appName: string, baseAppId: string): string;
175+
sanitizeName(appName: string): string;
175176
}
176177

177178
interface IPropertiesParser {

project-helper.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class ProjectHelper implements IProjectHelper {
3939
}
4040

4141
public generateDefaultAppId(appName: string, baseAppId: string): string {
42-
var sanitizedName = _.filter(appName.split(""), (c) => /[a-zA-Z0-9]/.test(c)).join("");
42+
var sanitizedName = this.sanitizeName(appName);
4343
if (sanitizedName) {
4444
if (/^\d+$/.test(sanitizedName)) {
4545
sanitizedName = "the" + sanitizedName;
@@ -50,5 +50,10 @@ export class ProjectHelper implements IProjectHelper {
5050

5151
return util.format("%s.%s", baseAppId, sanitizedName);
5252
}
53+
54+
public sanitizeName(appName: string): string {
55+
var sanitizedName = _.filter(appName.split(""), (c) => /[a-zA-Z0-9]/.test(c)).join("");
56+
return sanitizedName;
57+
}
5358
}
5459
$injector.register("projectHelper", ProjectHelper);

0 commit comments

Comments
 (0)