Skip to content

Commit 42f9f77

Browse files
committed
Merge remote-tracking branch 'nativescript/main'
# Conflicts: # CHANGELOG.md # lib/services/webpack/webpack-compiler-service.ts # package-lock.json # package.json
2 parents 29d85ad + 9eac531 commit 42f9f77

22 files changed

+344
-130
lines changed

lib/commands/appstore-upload.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export class PublishIOS implements ICommand {
5454
const user = await this.$applePortalSessionService.createUserSession(
5555
{ username, password },
5656
{
57-
applicationSpecificPassword: this.$options
58-
.appleApplicationSpecificPassword,
57+
applicationSpecificPassword:
58+
this.$options.appleApplicationSpecificPassword,
5959
sessionBase64: this.$options.appleSessionBase64,
6060
requireInteractiveConsole: true,
6161
requireApplicationSpecificPassword: true,
@@ -91,14 +91,12 @@ export class PublishIOS implements ICommand {
9191
mobileProvisionIdentifier
9292
);
9393

94-
// As we need to build the package for device
95-
this.$options.forDevice = true;
9694
this.$options.provision = mobileProvisionIdentifier;
9795

9896
const buildData = new IOSBuildData(
9997
this.$projectData.projectDir,
10098
platform,
101-
{ ...this.$options.argv, watch: false }
99+
{ ...this.$options.argv, buildForAppStore: true, watch: false }
102100
);
103101
ipaFilePath = await this.$buildController.prepareAndBuild(buildData);
104102
} else {
@@ -118,8 +116,8 @@ export class PublishIOS implements ICommand {
118116
await this.$itmsTransporterService.upload({
119117
credentials: { username, password },
120118
user,
121-
applicationSpecificPassword: this.$options
122-
.appleApplicationSpecificPassword,
119+
applicationSpecificPassword:
120+
this.$options.appleApplicationSpecificPassword,
123121
ipaFilePath,
124122
shouldExtractIpa: !!this.$options.ipa,
125123
verboseLogging: this.$logger.getLevel() === "TRACE",

lib/commands/create-project.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class CreateProjectCommand implements ICommand {
203203
this.$logger.printMarkdown(`# Let’s create a NativeScript app!`);
204204
this.$logger.printMarkdown(`
205205
Answer the following questions to help us build the right app for you. (Note: you
206-
can skip this prompt next time using the --template option, or the --ng, --react, --vue, --svelte, --ts, or --js flags.)
206+
can skip this prompt next time using the --template option, or using --ng, --react, --solid, --svelte, --vue, --ts, or --js flags.)
207207
`);
208208
}
209209
}
@@ -366,6 +366,11 @@ can skip this prompt next time using the --template option, or the --ng, --react
366366
value: constants.RESERVED_TEMPLATE_NAMES.solid,
367367
description: CreateProjectCommand.HelloWorldTemplateDescription,
368368
},
369+
{
370+
key: `${CreateProjectCommand.HelloWorldTemplateKey} using TypeScript`,
371+
value: constants.RESERVED_TEMPLATE_NAMES.solidts,
372+
description: `${CreateProjectCommand.HelloWorldTemplateDescription} using TypeScript`,
373+
},
369374
{
370375
key: CreateProjectCommand.BlankVisionTemplateKey,
371376
value: "@nativescript/template-blank-solid-vision",

lib/common/mobile/android/android-ini-file-parser.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,28 @@ export class AndroidIniFileParser implements Mobile.IAndroidIniFileParser {
2020
contents,
2121
(result: Mobile.IAvdInfo, line: string) => {
2222
const parsedLine = line.split("=");
23-
const key = parsedLine[0];
23+
24+
const key = parsedLine[0]?.trim();
25+
const value = parsedLine[1]?.trim();
2426
switch (key) {
2527
case "target":
26-
result.target = parsedLine[1];
28+
result.target = value;
2729
result.targetNum = this.readTargetNum(result.target);
2830
break;
2931
case "path":
3032
case "AvdId":
31-
result[_.lowerFirst(key)] = parsedLine[1];
33+
result[_.lowerFirst(key)] = value;
3234
break;
3335
case "hw.device.name":
34-
result.device = parsedLine[1];
36+
result.device = value;
3537
break;
3638
case "avd.ini.displayname":
37-
result.displayName = parsedLine[1];
39+
result.displayName = value;
3840
break;
3941
case "abi.type":
4042
case "skin.name":
4143
case "sdcard.size":
42-
result[key.split(".")[0]] = parsedLine[1];
44+
result[key.split(".")[0]] = value;
4345
break;
4446
}
4547
return result;

lib/common/mobile/android/logcat-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export class LogcatHelper implements Mobile.ILogcatHelper {
231231
];
232232

233233
if (appId) {
234-
logcatCommand.push(`--regex=START.*${appId}`);
234+
logcatCommand.push(`--regex=Start.*${appId}`);
235235
}
236236

237237
const appStartTrackingStream = await adb.executeCommand(logcatCommand, {

lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export const RESERVED_TEMPLATE_NAMES: IStringDictionary = {
147147
reactjs: "@nativescript/template-blank-react",
148148
solid: "@nativescript/template-blank-solid",
149149
solidjs: "@nativescript/template-blank-solid",
150+
solidts: "@nativescript/template-blank-solid-ts",
150151
svelte: "@nativescript/template-blank-svelte",
151152
// vision templates
152153
vision: "@nativescript/template-hello-world-ts-vision",

lib/controllers/prepare-controller.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class PrepareController extends EventEmitter {
198198
};
199199
}
200200

201-
await this.writeRuntimePackageJson(projectData, platformData);
201+
await this.writeRuntimePackageJson(projectData, platformData, prepareData);
202202

203203
await this.$projectChangesService.savePrepareInfo(
204204
platformData,
@@ -441,7 +441,8 @@ export class PrepareController extends EventEmitter {
441441
*/
442442
public async writeRuntimePackageJson(
443443
projectData: IProjectData,
444-
platformData: IPlatformData
444+
platformData: IPlatformData,
445+
prepareData: IPrepareData = null
445446
) {
446447
const configInfo = this.$projectConfigService.detectProjectConfigs(
447448
projectData.projectDir
@@ -559,6 +560,10 @@ export class PrepareController extends EventEmitter {
559560
);
560561
}
561562

563+
if (prepareData?.uniqueBundle) {
564+
packageData.main = `${packageData.main}.${prepareData.uniqueBundle}`;
565+
}
566+
562567
this.$fs.writeJson(packagePath, packageData);
563568
}
564569

lib/data/prepare-data.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export class PrepareData extends ControllerDataBase {
99
public watch?: boolean;
1010
public watchNative: boolean = true;
1111
public hostProjectPath?: string;
12+
public uniqueBundle: number;
1213

1314
constructor(
1415
public projectDir: string,
@@ -43,6 +44,8 @@ export class PrepareData extends ControllerDataBase {
4344
this.watchNative = data.watchNative;
4445
}
4546
this.hostProjectPath = data.hostProjectPath;
47+
48+
this.uniqueBundle = !this.watch && data.uniqueBundle ? Date.now() : 0;
4649
}
4750
}
4851

lib/declarations.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ interface IOptions
711711
dryRun: boolean;
712712

713713
platformOverride: string;
714-
714+
uniqueBundle: boolean;
715715
// allow arbitrary options
716716
[optionName: string]: any;
717717
}

lib/definitions/prepare.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ declare global {
1414

1515
// embedding
1616
hostProjectPath?: string;
17+
18+
uniqueBundle: number;
1719
}
1820

1921
interface IiOSCodeSigningData {

lib/key-commands/index.ts

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,34 @@ export class ShiftA implements IKeyCommand {
5050
private $projectData: IProjectData
5151
) {}
5252

53+
getAndroidStudioPath(): string | null {
54+
const os = currentPlatform();
55+
56+
if (os === "darwin") {
57+
const possibleStudioPaths = [
58+
"/Applications/Android Studio.app",
59+
`${process.env.HOME}/Applications/Android Studio.app`,
60+
];
61+
62+
return possibleStudioPaths.find((p) => fs.existsSync(p)) || null;
63+
} else if (os === "win32") {
64+
const studioPath = path.join(
65+
"C:",
66+
"Program Files",
67+
"Android",
68+
"Android Studio",
69+
"bin",
70+
"studio64.exe"
71+
);
72+
return fs.existsSync(studioPath) ? studioPath : null;
73+
} else if (os === "linux") {
74+
const studioPath = "/usr/local/android-studio/bin/studio.sh";
75+
return fs.existsSync(studioPath) ? studioPath : null;
76+
}
77+
78+
return null;
79+
}
80+
5381
async execute(): Promise<void> {
5482
this.$liveSyncCommandHelper.validatePlatform(this.platform);
5583
this.$projectData.initializeProjectData();
@@ -65,53 +93,32 @@ export class ShiftA implements IKeyCommand {
6593
}
6694
}
6795

68-
const os = currentPlatform();
96+
let studioPath = null;
6997

70-
if (os === "darwin") {
71-
const possibleStudioPaths = [
72-
"/Applications/Android Studio.app",
73-
`${process.env.HOME}/Applications/Android Studio.app`,
74-
];
98+
studioPath = process.env.NATIVESCRIPT_ANDROID_STUDIO_PATH;
7599

76-
const studioPath = possibleStudioPaths.find((p) => {
77-
this.$logger.trace(`Checking for Android Studio at ${p}`);
78-
return fs.existsSync(p);
79-
});
100+
if (!studioPath) {
101+
studioPath = this.getAndroidStudioPath();
80102

81103
if (!studioPath) {
82104
this.$logger.error(
83-
"Android Studio is not installed, or not in a standard location."
105+
"Android Studio is not installed, or is not in a standard location. Use NATIVESCRIPT_ANDROID_STUDIO_PATH."
84106
);
85107
return;
86108
}
109+
}
110+
111+
const os = currentPlatform();
112+
if (os === "darwin") {
87113
this.$childProcess.exec(`open -a "${studioPath}" ${androidDir}`);
88114
} else if (os === "win32") {
89-
const studioPath = path.join(
90-
"C:",
91-
"Program Files",
92-
"Android",
93-
"Android Studio",
94-
"bin",
95-
"studio64.exe"
96-
);
97-
if (!fs.existsSync(studioPath)) {
98-
this.$logger.error("Android Studio is not installed");
99-
return;
100-
}
101-
102115
const child = this.$childProcess.spawn(studioPath, [androidDir], {
103116
detached: true,
104117
stdio: "ignore",
105118
});
106119
child.unref();
107120
} else if (os === "linux") {
108-
if (!fs.existsSync(`/usr/local/android-studio/bin/studio.sh`)) {
109-
this.$logger.error("Android Studio is not installed");
110-
return;
111-
}
112-
this.$childProcess.exec(
113-
`/usr/local/android-studio/bin/studio.sh ${androidDir}`
114-
);
121+
this.$childProcess.exec(`${studioPath} ${androidDir}`);
115122
}
116123
}
117124
}

0 commit comments

Comments
 (0)