-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't prepare the project on preview command #4142
Conversation
Prepare is needed only to compile typescript and sass files. `preview-sync` hook is added to `nativescript-dev-typescript` and `nativescript-dev-sass` plugins in order to handle the compilation. This way the preview command will be faster as no prepare will be executed.
run ci |
@@ -8,6 +8,16 @@ declare global { | |||
stopLiveSync(): Promise<void>; | |||
} | |||
|
|||
interface IPreviewAppFilesService { | |||
getInitialFilesPayload(data: IPreviewAppLiveSyncData, platform: string, deviceId?: string): FilesPayload; | |||
getFilesPayload(data: IPreviewAppLiveSyncData, filesData: IPreviewAppFilesData, platform: string, deviceId?: string): FilesPayload; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data -> liveSyncData
.filter(file => !_.includes(this.excludedFiles, path.basename(file))) | ||
.filter(file => !_.includes(this.excludedFileExtensions, path.extname(file))); | ||
|
||
this.$logger.trace(`Transferring ${filesToTransfer.join("\n")}.`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transferring
is not the proper verb for this method
@@ -78,7 +66,7 @@ export class PreviewAppLiveSyncService implements IPreviewAppLiveSyncService { | |||
const hookArgs = this.getHookArgs(data, device); | |||
await this.$hooksService.executeBeforeHooks("preview-sync", { hookArgs }); | |||
await this.$previewAppPluginsService.comparePluginsOnDevice(data, device); | |||
const payloads = await this.syncFilesForPlatformSafe(data, device.platform, { isInitialSync: true, useHotModuleReload: data.useHotModuleReload }); | |||
const payloads = await this.syncInitialFilesForPlatformSafe(data, device.platform); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syncInitialFilesForPlatformSafe -> getInitialFilesForPlatformSafe
and
initializePreviewForDevice -> getInitialFilesForDevice
|
||
try { | ||
const payloads = this.$previewAppFilesService.getInitialFilesPayload(data, platform); | ||
this.$logger.info(`Successfully synced changes for platform ${platform}.`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully synced changes for platform... -> Successfully sent initial files for platform...
@@ -106,14 +94,45 @@ export class PreviewAppLiveSyncService implements IPreviewAppLiveSyncService { | |||
return result; | |||
} | |||
|
|||
private async syncInitialFilesForPlatformSafe(data: IPreviewAppLiveSyncData, platform: string): Promise<FilesPayload> { | |||
this.$logger.info(`Start syncing changes for platform ${platform}.`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start syncing changes for platform... -> Start sending initial files for platform...
this.$logger.info(`Successfully synced changes for platform ${platform}.`); | ||
return payloads; | ||
} catch (err) { | ||
this.$logger.warn(`Unable to apply changes for platform ${platform}. Error is: ${err}, ${JSON.stringify(err, null, 2)}.`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${JSON.stringify(err, null, 2)} -> helper
run ci |
PR Checklist
What is the current behavior?
Project is prepared when
tns preview
command is executedWhat is the new behavior?
Project is not prepared when
tns preview
command is executedFixes/Implements/Closes #[Issue Number].
#4141