Skip to content

Commit b3ee6b9

Browse files
authored
Merge pull request #1970 from NativeScript/raikov/livesync-skip-files-option
Added an option to control whether tns-modules should be skipped during livesync
2 parents b4aca8d + 02769cc commit b3ee6b9

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/declarations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ interface IOptions extends ICommonOptions {
9999
tnsModulesVersion: string;
100100
teamId: string;
101101
rebuild: boolean;
102+
syncAllFiles: boolean;
102103
}
103104

104105
interface IInitService {

lib/options.ts

Lines changed: 2 additions & 1 deletion
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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class LiveSyncProvider implements ILiveSyncProvider {
1010
private $platformsData: IPlatformsData,
1111
private $logger: ILogger,
1212
private $childProcess: IChildProcess,
13+
private $options: IOptions,
1314
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants) { }
1415

1516
private static FAST_SYNC_FILE_EXTENSIONS = [".css", ".xml" ,".html"];
@@ -88,7 +89,12 @@ export class LiveSyncProvider implements ILiveSyncProvider {
8889
temp.track();
8990
let tempZip = temp.path({prefix: "sync", suffix: ".zip"});
9091
this.$logger.trace("Creating zip file: " + tempZip);
91-
this.$childProcess.spawnFromEvent("zip", [ "-r", "-0", tempZip, "app", "-x", "app/tns_modules/*" ], "close", { cwd: path.dirname(projectFilesPath) }).wait();
92+
93+
if (this.$options.syncAllFiles) {
94+
this.$childProcess.spawnFromEvent("zip", [ "-r", "-0", tempZip, "app" ], "close", { cwd: path.dirname(projectFilesPath) }).wait();
95+
} else {
96+
this.$childProcess.spawnFromEvent("zip", [ "-r", "-0", tempZip, "app", "-x", "app/tns_modules/*" ], "close", { cwd: path.dirname(projectFilesPath) }).wait();
97+
}
9298

9399
deviceAppData.device.fileSystem.transferFiles(deviceAppData, [{
94100
getLocalPath: () => tempZip,

0 commit comments

Comments
 (0)