NativeScript Cli Extension
Перейти к файлу
Manol Donev 2f1c2138d7
Merge pull request #46 from NativeScript/etabakov/update-license-year
update LICENSE year
2019-01-07 14:35:02 +02:00
consts Added thumbnail for blank pages 2017-09-26 14:39:00 +03:00
lib fix: pages do not support non-default app path from nsconfig.json 2018-09-12 17:07:57 +03:00
test fix: pages do not support non-default app path from nsconfig.json 2018-09-12 17:07:57 +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
CODE_OF_CONDUCT.md chore: update community files 2018-01-18 16:32:07 +02:00
Gruntfile.js Removed transpile_additional_project from default grunt command for performance issues 2017-09-26 15:34:56 +03:00
LICENSE chore: update community files 2019-01-07 12:52:54 +02:00
README.md Update readme 2017-09-26 15:55:56 +03:00
package.json chor: update lodash version 2018-09-12 17:11:08 +03: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.