Skip to content

Commit 9b1f7aa

Browse files
committed
fix: works correctly with projects with .nsconfig file on tns preview command
1 parent 6167820 commit 9b1f7aa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/services/livesync/playground/preview-app-livesync-service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@ export class PreviewAppLiveSyncService implements IPreviewAppLiveSyncService {
110110
}
111111

112112
private getFilesPayload(platformData: IPlatformData, projectData: IProjectData, files?: string[]): FilesPayload {
113-
const appFolderPath = path.join(projectData.projectDir, APP_FOLDER_NAME);
114113
const platformsAppFolderPath = path.join(platformData.appDestinationDirectoryPath, APP_FOLDER_NAME);
115114

116115
if (files && files.length) {
117-
files = files.map(file => path.join(platformsAppFolderPath, path.relative(appFolderPath, file)));
116+
files = files.map(file => this.$projectFilesProvider.mapFilePath(file, platformData.normalizedPlatformName, projectData));
118117
} else {
119118
files = this.$projectFilesManager.getProjectFiles(platformsAppFolderPath);
120119
}

test/services/playground/preview-app-livesync-service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ function createTestInjector(options?: {
148148
onDeviceFileName: path.basename(filePath),
149149
shouldIncludeFile: true
150150
};
151-
}
151+
},
152+
mapFilePath: (filePath: string) => path.join(path.join(platformsDirPath, "app"), path.relative(path.join(projectDirPath, "app"), filePath))
152153
});
153154
injector.register("hooksService", {
154155
executeBeforeHooks: (name: string, args: any) => {

0 commit comments

Comments
 (0)