@@ -33,18 +33,22 @@ module.exports = function(grunt) {
33
33
var currentAppName = grunt . task . current . data . appName ;
34
34
return updatePackageDef ( content , function ( contentAsObject ) {
35
35
contentAsObject . version = localCfg . packageVersion ;
36
+ contentAsObject . author = "Telerik <support@telerik.com>" ;
37
+ var specificKeywords = [ "telerik" , "mobile" ] ;
36
38
if ( currentAppName . indexOf ( "template-" ) == 0 ) {
37
39
var templateName = currentAppName . substring ( "template-" . length ) ;
38
40
contentAsObject . name = "tns-" + currentAppName ;
39
41
contentAsObject . description = "Nativescript " + templateName + " template" ;
40
- contentAsObject . keywords = addKeywords ( contentAsObject . keywords , "template" ) ;
42
+ specificKeywords . push ( "template" ) ;
41
43
}
42
44
else {
43
45
contentAsObject . name = "tns-samples-" + currentAppName ;
44
46
contentAsObject . description = "Nativescript " + currentAppName + " sample application" ;
45
- contentAsObject . keywords = addKeywords ( contentAsObject . keywords , "sample" ) ;
47
+ specificKeywords . push ( "sample" ) ;
46
48
}
47
49
contentAsObject . license = "BSD" ;
50
+ addKeywords ( contentAsObject , specificKeywords ) ;
51
+
48
52
if ( ! contentAsObject . repository ) {
49
53
contentAsObject . repository = { } ;
50
54
}
@@ -57,14 +61,16 @@ module.exports = function(grunt) {
57
61
} ) ;
58
62
} ;
59
63
60
- var addKeywords = function ( originalKeywords , newKeywords ) {
61
- var originalKeywordsArr = [ ] ;
62
- if ( typeof ( originalKeywords ) == "string" ) {
63
- originalKeywordsArr = originalKeywords . split ( " " ) ;
64
+ var addKeywords = function ( packageObject , newKeywords ) {
65
+ if ( ! packageObject . keywords ) {
66
+ packageObject . keywords = newKeywords ;
67
+ return ;
68
+ }
69
+
70
+ if ( typeof ( packageObject . keywords ) == "string" ) {
71
+ packageObject . keywords = packageObject . keywords . split ( " " ) ;
64
72
}
65
- var newKeywordsArr = newKeywords . split ( " " ) ;
66
- var combinedKeywordsArr = originalKeywordsArr . concat ( newKeywordsArr ) ;
67
- return combinedKeywordsArr . join ( " " ) ;
73
+ packageObject . keywords = packageObject . keywords . concat ( newKeywords ) ;
68
74
} ;
69
75
70
76
var updateDefinitionsPackageDef = function ( content , srcPath ) {
0 commit comments