forked from EddyVerbruggen/nativescript-nodeify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interim fix for issue ^EddyVerbruggen#65
- Loading branch information
XO Mayuresh
committed
Oct 29, 2019
1 parent
d24c34e
commit 01ebf17
Showing
2 changed files
with
26 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
module.exports = function ($logger, $projectData, $platformsData, hookArgs) { | ||
var path = require("path"); | ||
var platformName = hookArgs.platform.toLowerCase(); | ||
module.exports = function ($logger, $projectData, $injector, hookArgs) { | ||
var path = require('path'); | ||
var platformName = (hookArgs.checkForChangesOpts && hookArgs.checkForChangesOpts.platform) || (hookArgs.prepareData && hookArgs.prepareData.platform); | ||
const platformsData = getPlatformsData($injector); | ||
|
||
var appDestinationDir = platformsData.getPlatformData(platformName).appDestinationDirectoryPath; | ||
|
||
//appDestinationDir is the platform specific app folder. For Android, this will be YOUR_PROJECT_ROOT/platforms/android/src/main/assets/ | ||
var appDestinationDir = $platformsData.getPlatformData(platformName).appDestinationDirectoryPath; | ||
var patchNpmPackageDir = path.join(appDestinationDir, "app", "tns_modules", "nativescript-nodeify", "patch-npm-packages.js"); | ||
var patchNpmPackageDir = path.join(appDestinationDir, 'app', 'tns_modules', 'nativescript-nodeify', 'patch-npm-packages.js'); | ||
|
||
//Calling patch-npm-packages.js under platforms to patch the node_modules in the platforms folder. | ||
//This will leave the source code folder YOUR_PROJECT_ROOT/node_modules untouched. | ||
var patchNpmPackage = require(patchNpmPackageDir); | ||
var patchNpmPackage = require("./patch-npm-packages.js"); | ||
|
||
patchNpmPackage($logger, $projectData, hookArgs.changesInfo); | ||
patchNpmPackage($logger, $projectData, hookArgs); | ||
} | ||
|
||
function getPlatformsData($injector) { | ||
try { | ||
return $injector.resolve("platformsData"); | ||
} catch (err) { | ||
return $injector.resolve("platformsDataService"); | ||
} | ||
} |