Skip to content

Commit 71ab000

Browse files
committed
Merge pull request #1178 from NativeScript/totev/rollback-when-prepare-fails
When prepare fails, delete entire app dir
2 parents 7171d12 + 9237a51 commit 71ab000

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/services/platform-service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,14 @@ export class PlatformService implements IPlatformService {
212212
platformData.platformProjectService.prepareProject().wait();
213213

214214
// Process node_modules folder
215+
let appDir = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
215216
try {
216217
this.$pluginsService.ensureAllDependenciesAreInstalled().wait();
217-
let tnsModulesDestinationPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME, PlatformService.TNS_MODULES_FOLDER_NAME);
218+
let tnsModulesDestinationPath = path.join(appDir, PlatformService.TNS_MODULES_FOLDER_NAME);
218219
this.$broccoliBuilder.prepareNodeModules(tnsModulesDestinationPath, platform, lastModifiedTime).wait();
219220
} catch(error) {
220221
this.$logger.debug(error);
221-
shell.rm("-rf", appResourcesDirectoryPath);
222+
shell.rm("-rf", appDir);
222223
this.$errors.failWithoutHelp(`Processing node_modules failed. ${error}`);
223224
}
224225

0 commit comments

Comments
 (0)