Skip to content

A {N}ativeScript cli extension for managing {N}ativeScript template starting kits

License

Notifications You must be signed in to change notification settings

borisKarastanev/UiKitsCliExtension

Repository files navigation

uiKitsCliExtension

A NativeScript CLI extension for managing templates

Installation and Development

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

Public API

const tns = require("nativescript");

Load all available extensions

tns.extensibilityService.loadExtensions();
Get details for all installed templates
/**
     * @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);
});
Get details for a single App template
/**
     * @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);
});
Get details for a single Page template
/**
     * @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);
});
Add Page
 /**
     * @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);
});
    
Check Template Flavor
/**
     * @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");
Get Template Version
 /**
     * @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");
Get Template Description
/**
     * @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");

About

A {N}ativeScript cli extension for managing {N}ativeScript template starting kits

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published