diff --git a/gruntfile.js b/gruntfile.js index c19f45151..a8ae3a331 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -34,13 +34,15 @@ module.exports = function(grunt) { return updatePackageDef(content, function(contentAsObject) { contentAsObject.version = localCfg.packageVersion; if (currentAppName.indexOf("template-") == 0) { - var templateName = currentAppName.substring(0, "template-".length); + var templateName = currentAppName.substring("template-".length); contentAsObject.name = "tns-" + currentAppName; contentAsObject.description = "Nativescript " + templateName + " template"; + contentAsObject.keywords = addKeywords(contentAsObject.keywords, "template"); } else { contentAsObject.name = "tns-samples-" + currentAppName; contentAsObject.description = "Nativescript " + currentAppName + " sample application"; + contentAsObject.keywords = addKeywords(contentAsObject.keywords, "sample"); } contentAsObject.license = "BSD"; if (!contentAsObject.repository) { @@ -55,6 +57,16 @@ module.exports = function(grunt) { }); }; + var addKeywords = function(originalKeywords, newKeywords) { + var originalKeywordsArr = []; + if (typeof(originalKeywords) == "string") { + originalKeywordsArr = originalKeywords.split(" "); + } + var newKeywordsArr = newKeywords.split(" "); + var combinedKeywordsArr = originalKeywordsArr.concat(newKeywordsArr); + return combinedKeywordsArr.join(" "); + }; + var updateDefinitionsPackageDef = function(content, srcPath) { return updatePackageDef(content, function(contentAsObject) { contentAsObject.version = localCfg.packageVersion;