You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm talking about the logic behind setting the appropriate fields for App ID, App Name and App Version in the files package.json and config.xml.
Current situation
The most common strategy is to set the attribute in both files iff a value for
it was given to cordovaCreate. Exceptions are
App ID in package.json: set attribute if value given else set to helloworld
App Version in both files: always set to 1.0.0
Pain Points
Strategies employed for setting the attributes differ
Falling back to hard coded defaults is not very flexible (e.g. I usually start my version numbering at 0.1.0)
Proposal
For every file f and every attribute attr, do the following
if(attrinopts){// Save attribute value passed to cordovaCreate to ff[attr]=opts[attr]}elseif(attrinf){// Attribute already present in f and no override specified// => Leave the existing value untouched}elseif(isRequired(attr,f)){handleMissingRequiredAttribute(attr,f)}
where isRequired would have to be defined adequately
and handleMissingRequiredAttribute could either:
Throw an error (my preference)
Save some hard coded fallback value to f (possibly warn that f is invalid)
I'm talking about the logic behind setting the appropriate fields for App ID,
App Name and App Version in the files
package.json
andconfig.xml
.Current situation
The most common strategy is to set the attribute in both files iff a value for
it was given to
cordovaCreate
. Exceptions arepackage.json
: set attribute if value given else set tohelloworld
1.0.0
Pain Points
0.1.0
)Proposal
For every file
f
and every attributeattr
, do the followingwhere
isRequired
would have to be defined adequatelyand
handleMissingRequiredAttribute
could either:f
(possibly warn thatf
is invalid)Related issues
CB-12274 - widget version number not copied from template config.xml file
Migrated from #89
The text was updated successfully, but these errors were encountered: