NativeScript Cli Extension
Перейти к файлу
Stoyan Stratev b8163a4473 update .npmignore 2017-10-31 10:59:48 +02:00
consts Added thumbnail for blank pages 2017-09-26 14:39:00 +03:00
lib do an easier check 2017-10-31 10:00:59 +02:00
test Fixed npm spawn error on windows platforms and addressed comments in the PR 2017-10-19 15:44:22 +03:00
.gitignore Ignore deploy extension file 2017-09-21 10:34:49 +03:00
.npmignore update .npmignore 2017-10-31 10:59:48 +02:00
Gruntfile.js Removed transpile_additional_project from default grunt command for performance issues 2017-09-26 15:34:56 +03:00
LICENSE.txt Added Apache 2.0 license 2017-06-08 14:27:31 +03:00
README.md Update readme 2017-09-26 15:55:56 +03:00
package.json 0.3.2 2017-10-31 10:44:47 +02:00
tsconfig.json Added initial project files 2017-05-02 10:18:40 +03:00
tslint.json Add new tslint rules and apply some refactoring. 2017-08-18 13:58:37 +03:00

README.md

nativescript-starter-kits

A NativeScript CLI extension for managing templates

Automatic Installation

You can install this extension using the Nativescript CLI

$ tns extension install nativescript-starter-kits

Manual Installation and Development

Download the GIT repository in you favorite projects directory

$ git clone git@github.com:NativeScript/nativescript-starter-kits.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

These commands will create a .tgz file in the extension folder

Install the npm package

$ tns extension install <path to nativescript-starter-kits>.tgz

Public API

Get proper nativescript reference

const pathToPackage = require("global-modules-path").getPath("nativescript", "tns");
const tns = require(pathToPackage);

Load all available extensions

/**
     * @name loadExtensions
     * @description Loads all currently installed extensions
     * @return {Promise<any>[]} - On Success: Array of Promises, one for each installed extension
*/
Promise.all(tns.extensibilityService.loadExtensions()).then((loadedExtensions) => {
    console.log("All extensions loaded successfully!");
}).catch((error) => {
    console.error(error);
});
Get details for all installed templates
/**
     * @name getTemplates
     * @description List all available 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 a single 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);
});

Run tests

Before running the test you need to transpile all files and dependencies.

$ grunt pack
$ npm run test

Issues

If you have found an issue with this extension, please report the problem in the Issues section.