-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: relocated actions outside of main hooks
- Loading branch information
Showing
5 changed files
with
155 additions
and
119 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// read the app/config.xml | ||
// read the sdk/package.json | ||
(function () { | ||
// properties | ||
'use strict' | ||
var configPrefrences = require('./lib/sdk/configXml.js') | ||
var iosPlist = require('./lib/ios/plist.js') | ||
var iosPreferences = require('./lib/ios/xcodePreferences.js') | ||
var iosAssociatedDomains = require('./lib/ios/associatedDomains.js') | ||
var iosDevelopmentTeam = require('./lib/ios/developmentTeam.js') | ||
// var androidManifest = require('.lib/android/androidManifest.js') | ||
var IOS = 'ios' | ||
var ANDROID = 'android' | ||
|
||
// entry | ||
module.exports = run | ||
|
||
function run (context) { | ||
var preferences = configPrefrences.read(context) | ||
var platforms = context.opts.platforms | ||
|
||
platforms.forEach(function (platform) { | ||
if (platform === ANDROID) { | ||
|
||
} | ||
if (platform === IOS) { | ||
iosPlist.addBranchSettings(preferences) | ||
iosPreferences.enableAssociatedDomains(preferences) | ||
iosAssociatedDomains.addAssociatedDomains(preferences) | ||
iosDevelopmentTeam.addDevelopmentTeam(context, preferences) | ||
} | ||
}) | ||
} | ||
})() |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(function () { | ||
// properties | ||
'use strict' | ||
var nodeDependencies = require('./lib/npm/nodeDependencies.js') | ||
|
||
// entry | ||
module.exports = run | ||
|
||
function run (context) { | ||
nodeDependencies.install(context) | ||
} | ||
})() |
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// read branch config from config.xml | ||
(function () { | ||
// properties | ||
'use strict' | ||
var path = require('path') | ||
var xmlHelper = require('./xmlHelper.js') | ||
|
||
// entry | ||
module.exports = { | ||
read: read | ||
} | ||
|
||
// methods | ||
function read (context) { | ||
var configXml = getConfigXml(context) | ||
var branchXml = getBranchXml(configXml) | ||
var branchPreferences = getBranchPerferences(context, configXml, branchXml) | ||
|
||
validateBranchPreferences(branchPreferences) | ||
|
||
return branchPreferences | ||
} | ||
|
||
function getBranchPerferences (context, configXml, branchXml) { | ||
var projectRoot = getProjectRoot(context) | ||
var projectPlatform = getProjectPlatform(context) | ||
var bundleId = (configXml.widget['$'].hasOwnProperty('id')) ? configXml.widget['$']['id'] : null | ||
var bundleName = (configXml.widget.hasOwnProperty('name')) ? configXml.widget.name[0] : null | ||
var branchKey = (branchXml.hasOwnProperty('branch-key')) ? branchXml['branch-key'][0]['$']['value'] : null | ||
var uriScheme = (branchXml.hasOwnProperty('uri-scheme')) ? branchXml['uri-scheme'][0]['$']['value'] : null | ||
var linkDomain = (branchXml.hasOwnProperty('link-domain')) ? branchXml['link-domain'][0]['$']['value'] : null | ||
var iosTeamId = (branchXml.hasOwnProperty('ios-team-id')) ? branchXml['ios-team-id'][0]['$']['value'] : null | ||
var androidPrefix = (branchXml.hasOwnProperty('android-prefix')) ? branchXml['android-prefix'][0]['$']['value'] : null | ||
|
||
return { | ||
'projectRoot': projectRoot, | ||
'projectPlatform': projectPlatform, | ||
'bundleId': bundleId, | ||
'bundleName': bundleName, | ||
'branchKey': branchKey, | ||
'uriScheme': uriScheme, | ||
'linkDomain': linkDomain, | ||
'iosTeamId': iosTeamId, | ||
'androidPrefix': androidPrefix | ||
} | ||
} | ||
|
||
function getProjectRoot (context) { | ||
return context.opts.projectRoot | ||
} | ||
|
||
function getProjectPlatform (context) { | ||
// pre-5.0 cordova structure | ||
try { | ||
return context.requireCordovaModule('cordova-lib/src/plugman/platforms').ios | ||
} catch (e) { | ||
return context.requireCordovaModule('cordova-lib/src/plugman/platforms/ios') | ||
} | ||
} | ||
|
||
function getConfigXml (context) { | ||
// read data from projects root config.xml file | ||
var projectRoot = getProjectRoot(context) | ||
var pathToConfigXml = path.join(projectRoot, 'config.xml') | ||
var configXml = xmlHelper.readXmlAsJson(pathToConfigXml) | ||
|
||
if (configXml == null) { | ||
throw new Error('config.xml not found! Please, check that it exist in your project\'s root directory.') | ||
} | ||
|
||
return configXml | ||
} | ||
|
||
function getBranchXml (configXml) { | ||
var branchConfig = configXml.widget['branch-config'] | ||
|
||
if (branchConfig == null || branchConfig.length === 0) { | ||
throw new Error('<branch-config> tag is not set in the config.xml. The Branch SDK is not properly installed.') | ||
} | ||
|
||
return branchConfig[0] | ||
} | ||
|
||
function validateBranchPreferences (preferences) { | ||
if (preferences.bundleId === null) { | ||
throw new Error('Branch SDK plugin is missing "widget id" in your config.xml') | ||
} | ||
if (preferences.bundleName === null) { | ||
throw new Error('Branch SDK plugin is missing "name" in your config.xml') | ||
} | ||
if (preferences.branchKey === null) { | ||
throw new Error('Branch SDK plugin is missing "branch-key" in <branch-config> in your config.xml') | ||
} | ||
if (preferences.uriScheme === null) { | ||
throw new Error('Branch SDK plugin is missing "uri-scheme" in <branch-config> in your config.xml') | ||
} | ||
if (preferences.linkDomain === null) { | ||
throw new Error('Branch SDK plugin is missing "uri-scheme" in <branch-config> in your config.xml') | ||
} | ||
if (preferences.iosTeamId === null) { | ||
throw new Error('Branch SDK plugin is missing "ios-team-id" in <branch-config> in your config.xml') | ||
} | ||
} | ||
})() |