-
-
Notifications
You must be signed in to change notification settings - Fork 198
Closed
Description
Currently the native project templates (iOS and android) are taken from runtimes.
We should allow using custom templates, as there are some cases when the current template should be changed/extended, so you have to modify the platforms dir and commit it to source control.
The idea is to have new option for platform add command, for example --platform-template that will specify from where to take the native project template. The path to template should be saved in package.json under nativescript key, for example:
{
"nativescript": {
"id": "org.nativescript.appNativeTemplates",
"tns-android": {
"version": "1.6.1",
"template": "./myAndroidTemplateDir"
},
"tns-ios": {
"version": "1.6.0",
"template": "./myiOSTemplateDir"
}
},
"dependencies": {
"tns-core-modules": "1.6.0"
}
}CLI commands should work in the following way:
tns platform add android --platform-template ./myAndroidTemplateDir- adds latest android runtime and copies the native project template frommyAndroidTemplateDir. The value of the template should be written inpackage.json.tns platform add android:- when there's no
tns-androidentry inpackage.json- work as usual - latest runtime and get native template from it. - when there's
tns-androidentry inpackage.jsonand there'stemplatedefine in it - use the specified runtime version and the native template from the value oftemplateproperty.
- when there's no
- When platform is not added, executing
tns prepare <platform>,tns build <platform>,tns deploy <platform>,tns emulate <platform>,tns run <platform>,tns test <platform>should add the platform. In case--platform-templateis passed to any of these commands, we should respect it and do the same astns platform add.
Same is valid for iOS related commands.
The value for template could be anything that can be npm installed - local directory, npm package, github url, .tgz.