mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Improve keywords
This commit is contained in:
24
gruntfile.js
24
gruntfile.js
@@ -33,18 +33,22 @@ module.exports = function(grunt) {
|
|||||||
var currentAppName = grunt.task.current.data.appName;
|
var currentAppName = grunt.task.current.data.appName;
|
||||||
return updatePackageDef(content, function(contentAsObject) {
|
return updatePackageDef(content, function(contentAsObject) {
|
||||||
contentAsObject.version = localCfg.packageVersion;
|
contentAsObject.version = localCfg.packageVersion;
|
||||||
|
contentAsObject.author = "Telerik <support@telerik.com>";
|
||||||
|
var specificKeywords = ["telerik", "mobile"];
|
||||||
if (currentAppName.indexOf("template-") == 0) {
|
if (currentAppName.indexOf("template-") == 0) {
|
||||||
var templateName = currentAppName.substring("template-".length);
|
var templateName = currentAppName.substring("template-".length);
|
||||||
contentAsObject.name = "tns-" + currentAppName;
|
contentAsObject.name = "tns-" + currentAppName;
|
||||||
contentAsObject.description = "Nativescript " + templateName + " template";
|
contentAsObject.description = "Nativescript " + templateName + " template";
|
||||||
contentAsObject.keywords = addKeywords(contentAsObject.keywords, "template");
|
specificKeywords.push("template");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
contentAsObject.name = "tns-samples-" + currentAppName;
|
contentAsObject.name = "tns-samples-" + currentAppName;
|
||||||
contentAsObject.description = "Nativescript " + currentAppName + " sample application";
|
contentAsObject.description = "Nativescript " + currentAppName + " sample application";
|
||||||
contentAsObject.keywords = addKeywords(contentAsObject.keywords, "sample");
|
specificKeywords.push("sample");
|
||||||
}
|
}
|
||||||
contentAsObject.license = "BSD";
|
contentAsObject.license = "BSD";
|
||||||
|
addKeywords(contentAsObject, specificKeywords);
|
||||||
|
|
||||||
if (!contentAsObject.repository) {
|
if (!contentAsObject.repository) {
|
||||||
contentAsObject.repository = {};
|
contentAsObject.repository = {};
|
||||||
}
|
}
|
||||||
@@ -57,14 +61,16 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var addKeywords = function(originalKeywords, newKeywords) {
|
var addKeywords = function(packageObject, newKeywords) {
|
||||||
var originalKeywordsArr = [];
|
if (!packageObject.keywords) {
|
||||||
if (typeof(originalKeywords) == "string") {
|
packageObject.keywords = newKeywords;
|
||||||
originalKeywordsArr = originalKeywords.split(" ");
|
return;
|
||||||
}
|
}
|
||||||
var newKeywordsArr = newKeywords.split(" ");
|
|
||||||
var combinedKeywordsArr = originalKeywordsArr.concat(newKeywordsArr);
|
if (typeof(packageObject.keywords) == "string") {
|
||||||
return combinedKeywordsArr.join(" ");
|
packageObject.keywords = packageObject.keywords.split(" ");
|
||||||
|
}
|
||||||
|
packageObject.keywords = packageObject.keywords.concat(newKeywords);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateDefinitionsPackageDef = function(content, srcPath) {
|
var updateDefinitionsPackageDef = function(content, srcPath) {
|
||||||
|
|||||||
Reference in New Issue
Block a user