Skip to content

Commit b470af0

Browse files
author
Tsvetan Raikov
committed
Added an option to control whether tns-modules should be skipped during livesync
1 parent 06ba384 commit b470af0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/declarations.ts

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ interface IOptions extends ICommonOptions {
9393
tnsModulesVersion: string;
9494
teamId: string;
9595
rebuild: boolean;
96+
syncAllFiles: boolean;
9697
}
9798

9899
interface IInitService {

lib/options.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export class Options extends commonOptionsLibPath.OptionsBase {
3737
bundle: {type: OptionType.Boolean },
3838
all: {type: OptionType.Boolean },
3939
teamId: { type: OptionType.String },
40-
rebuild: { type: OptionType.Boolean, default: true }
40+
rebuild: { type: OptionType.Boolean, default: true },
41+
syncAllFiles: { type: OptionType.Boolean }
4142
},
4243
path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
4344
$errors, $staticConfig);

lib/providers/livesync-provider.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export class LiveSyncProvider implements ILiveSyncProvider {
77
private $platformService: IPlatformService,
88
private $platformsData: IPlatformsData,
99
private $logger: ILogger,
10+
private $options: IOptions,
1011
private $childProcess: IChildProcess) { }
1112

1213
private static FAST_SYNC_FILE_EXTENSIONS = [".css", ".xml" ,".html"];
@@ -65,7 +66,12 @@ export class LiveSyncProvider implements ILiveSyncProvider {
6566
temp.track();
6667
let tempZip = temp.path({prefix: "sync", suffix: ".zip"});
6768
this.$logger.trace("Creating zip file: " + tempZip);
68-
this.$childProcess.spawnFromEvent("zip", [ "-r", "-0", tempZip, "app" ], "close", { cwd: path.dirname(projectFilesPath) }).wait();
69+
70+
if (this.$options.syncAllFiles) {
71+
this.$childProcess.spawnFromEvent("zip", [ "-r", "-0", tempZip, "app" ], "close", { cwd: path.dirname(projectFilesPath) }).wait();
72+
} else {
73+
this.$childProcess.spawnFromEvent("zip", [ "-r", "-0", tempZip, "app", "-x", "app/tns_modules/*" ], "close", { cwd: path.dirname(projectFilesPath) }).wait();
74+
}
6975

7076
deviceAppData.device.fileSystem.transferFiles(deviceAppData, [{
7177
getLocalPath: () => tempZip,

0 commit comments

Comments
 (0)