Skip to content

Commit 5811c59

Browse files
committed
fix: support mulitple platforms with hooks #362 and #334
1 parent c1a54e6 commit 5811c59

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

plugin.template.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ SOFTWARE.
4343

4444
<!-- Hooks -->
4545
<hook src="src/scripts/hooks/beforePluginInstall.js" type="before_plugin_install" />
46-
<hook src="src/scripts/hooks/afterPluginInstall.js" type="after_plugin_install" />
47-
<hook src="src/scripts/hooks/afterPluginAdd.js" type="after_plugin_add" />
46+
<hook src="src/scripts/hooks/beforePrepare.js" type="after_plugin_install" />
47+
<hook src="src/scripts/hooks/afterPrepare.js" type="after_plugin_add" />
48+
<hook src="src/scripts/hooks/beforePrepare.js" type="before_prepare" />
49+
<hook src="src/scripts/hooks/afterPrepare.js" type="after_prepare" />
4850

4951
<!-- JavaScript -->
5052
<js-module src="src/branch.js" name="Branch">

plugin.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ SOFTWARE.
4242
</engines>
4343

4444
<!-- Hooks -->
45-
<hook src="src/scripts/hooks/beforePluginInstall.js" type="before_plugin_install" />
46-
<hook src="src/scripts/hooks/afterPluginInstall.js" type="after_plugin_install" />
47-
<hook src="src/scripts/hooks/afterPluginAdd.js" type="after_plugin_add" />
45+
<hook src="src/scripts/hooks/beforePluginInstall.js" type="before_plugin_install" /> <!-- install node modules-->
46+
<hook src="src/scripts/hooks/beforePrepare.js" type="after_plugin_install" /> <!-- support yarn cordova:reset -->
47+
<hook src="src/scripts/hooks/afterPrepare.js" type="after_plugin_add" /> <!-- support yarn cordova:reset -->
48+
<hook src="src/scripts/hooks/beforePrepare.js" type="before_prepare" /> <!-- support multiple platforms -->
49+
<hook src="src/scripts/hooks/afterPrepare.js" type="after_prepare" /> <!-- support multiple platforms -->
4850

4951
<!-- JavaScript -->
5052
<js-module src="src/branch.js" name="Branch">

src/scripts/hooks/afterPluginInstall.js renamed to src/scripts/hooks/afterPrepare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// entry
99
module.exports = run
1010

11-
// after prepare hooks based on platform
11+
// builds after platform config
1212
function run (context) {
1313
var preferences = configPreferences.read(context)
1414
var platforms = context.opts.cordova.platforms

src/scripts/hooks/beforePluginInstall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// entry
77
module.exports = run
88

9-
// before plugin install hooks
9+
// builds before plugin install hooks
1010
function run (context) {
1111
nodeDependencies.install(context)
1212
}

src/scripts/hooks/afterPluginAdd.js renamed to src/scripts/hooks/beforePrepare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// entry
1313
module.exports = run
1414

15-
// after prepare hooks based on platform
15+
// builds before platform config
1616
function run (context) {
1717
var preferences = configPreferences.read(context)
1818
var platforms = context.opts.cordova.platforms

0 commit comments

Comments
 (0)