Skip to content

Commit ee0e5e6

Browse files
committed
Add nativescriptCliPath option
1 parent 8551ac6 commit ee0e5e6

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

package.json

+10
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@
229229
"type": "boolean",
230230
"description": "Whether to sync files from node_modules folder.",
231231
"default": false
232+
},
233+
"nativescriptCliPath": {
234+
"type": "string",
235+
"description": "Path to the nativescript CLI to be used by the NativeScript extension.",
236+
"default": "tns"
232237
}
233238
}
234239
},
@@ -280,6 +285,11 @@
280285
"type": "boolean",
281286
"description": "Whether the app to run in emulator or on a physical device.",
282287
"default": false
288+
},
289+
"nativescriptCliPath": {
290+
"type": "string",
291+
"description": "Path to the nativescript CLI to be used by the NativeScript extension.",
292+
"default": "tns"
283293
}
284294
}
285295
}

src/debug-adapter/webKitAdapterInterfaces.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface ILaunchRequestArgs extends DebugProtocol.LaunchRequestArguments
1414
tnsOutput?: string;
1515
rebuild?: boolean;
1616
syncAllFiles?: boolean;
17+
nativescriptCliPath?: string;
1718
}
1819

1920
export interface IAttachRequestArgs extends DebugProtocol.AttachRequestArguments {
@@ -25,6 +26,7 @@ export interface IAttachRequestArgs extends DebugProtocol.AttachRequestArguments
2526
request: string;
2627
tnsArgs?: string[];
2728
tnsOutput?: string;
29+
nativescriptCliPath?: string;
2830
}
2931

3032
export interface ISetBreakpointsArgs extends DebugProtocol.SetBreakpointsArguments {

src/services/NsCliService.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export class IosProject extends NSProject {
138138

139139
let rebuild = (args.request == "launch") ? (args as ILaunchRequestArgs).rebuild : true;
140140
// build command to execute
141-
let command = new CommandBuilder()
141+
let command = new CommandBuilder(args.nativescriptCliPath)
142142
.appendParam("debug")
143143
.appendParam(this.platform())
144144
.appendParamIf("--emulator", args.emulator)
@@ -232,7 +232,7 @@ export class AndroidProject extends NSProject {
232232
let launched = false;
233233

234234
return new Promise<void>((resolve, reject) => {
235-
let command = new CommandBuilder()
235+
let command = new CommandBuilder(args.nativescriptCliPath)
236236
.appendParam("debug")
237237
.appendParam(this.platform())
238238
.appendParamIf("--emulator", args.emulator)
@@ -286,7 +286,7 @@ export class AndroidProject extends NSProject {
286286

287287
//return Promise.resolve(40001);
288288

289-
let command = new CommandBuilder()
289+
let command = new CommandBuilder(args.nativescriptCliPath)
290290
.appendParam("debug")
291291
.appendParam(this.platform())
292292
.appendParam("--get-port")
@@ -337,10 +337,14 @@ export class AndroidProject extends NSProject {
337337
}
338338

339339
class CommandBuilder {
340-
public static tnsPath: string = 'tns';
341340

341+
private _tnsPath: string;
342342
private _command: string[] = [];
343343

344+
constructor(tnsPath?: string) {
345+
this._tnsPath = tnsPath || "tns";
346+
}
347+
344348
public appendParam(parameter: string): CommandBuilder {
345349
this._command.push(parameter);
346350
return this;
@@ -359,7 +363,7 @@ class CommandBuilder {
359363
}
360364

361365
public build(): { path: string, args: string[] } {
362-
return { path: CommandBuilder.tnsPath, args: this._command };
366+
return { path: this._tnsPath, args: this._command };
363367
}
364368

365369
public buildAsString(): string {

0 commit comments

Comments
 (0)