A NativeScript CLI extension for managing templates
Download the GIT repository in you favorite projects directory
$ git clone git@github.com:borisKarastanev/UiKitsCliExtension.git
Run the following commands to install all dependencies, transpile all Ts files and to pack the extension.
$ npm i --ignore-scripts
$ npm i -g grunt-cli (only in case you do not have it installed globally)
$ grunt
$ grunt pack
Install the npm package
$ tns extension install <path to nativescript-ui-kits>.tgz
const tns = require("nativescript");
Load all available extensions
tns.extensibilityService.loadExtensions();
/**
* @name getTemplates
* @description List all downloaded templates
* @return {Promise<Array<any>>} - On Success: Array of Objects with Details about each template
*/
tns.templateService.getTemplates().then((templates) => {
console.log(templates);
}).catch((error) => {
console.error(error);
});
/**
* @name getAppTemplateDetails
* @description The method returns details about an app template.
* @param {string} templateName - The name of the template
* @returns {Promise<any>} - Object with details about the app template
*/
getAppTemplateDetails(templateName: string): any;
tns.templateService.getAppTemplateDetails("templateName").then((details) => {
console.log(details);
}).catch((error) => {
console.error(error);
});
/**
* @name getPageTemplateDetails
* @description The method returns details about a page template in JSON Format
* @param {string} templateName The name of the template
* @returns {Promise<any>} - Object with details about the page template
*/
getPageTemplateDetails(templateName: string): any;
tns.templateService.getPageTemplateDetails("templateName").then((details) => {
console.log(details);
}).catch((error) => {
console.error(error);
});
/**
* @name addPage
* @description Add page
* @param {String} pageName - Name of the page you want to add
* @param {String} location - The template location
* @returns {Promise<any>} - Object with operation details
*/
addPage(pageName: string, location: string): any;
tns.templateService.addPage("pageName", process.cwd()).then((success) => {
console.log(success);
}).catch((error) => {
console.error(error);
});
/**
* @name checkTemplateFlavor
* @description Check templates flavors E.g [@angularTs, vanillaJs, Ts ]
* @param {string} templateName - The name of the template
* @returns {string} - Template flavor
*/
checkTemplateFlavor(templateName: string): string;
let flavor = tns.templateService.checkTemplateFlavor("templateName");
/**
* @name getTemplateVersion
* @description Get the template current version
* @param {string} templateName - The name of the template
* @returns {string} - Template version
*/
getTemplateVersion(templateName: string): string;
let version = tns.templateService.getTemplateVersion("templateName");
/**
* @name getTemplateDescription
* @description Get template description
* @param {string} templateName The name of the template
* @returns {String} - Description about the template
*/
getTemplateDescription(templateName: string): string;
let description = tns.templateService.getTemplateDescription("templateName");