Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/scripts/json-tags-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function getWatchersDictionary(json) {
return getDictionary(json["watch"]);
}

function getBuildCommandsDictionary(json) {
return getDictionary(json["buildCommand"]);
}

function getDictionary(json) {
var result = [];
for (var i in json) {
Expand All @@ -31,4 +35,5 @@ module.exports.getScriptsDictionary = getScriptsDictionary;
module.exports.getDescriptionsDictionary = getDescriptionsDictionary;
module.exports.getCategoriesDictionary = getCategoriesDictionary;
module.exports.getShortCommandsDictionary = getShortCommandsDictionary;
module.exports.getWatchersDictionary = getWatchersDictionary;
module.exports.getWatchersDictionary = getWatchersDictionary;
module.exports.getBuildCommandsDictionary = getBuildCommandsDictionary;
16 changes: 14 additions & 2 deletions src/scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ function writeToSrcJson(inputParams) {
const devDepsTag = "devDependencies";
const descriptionsTag = "descriptions";
const shortCommandsTag = "shortCommands";
const buildCommandsTag = "buildCommand"
const categoriesTag = "categories";
var path = inputParams.pluginSrcFolder + "/package.json";
let jsonFile = fs.readFileSync(path);
Expand Down Expand Up @@ -360,19 +361,22 @@ function writeToSrcJson(inputParams) {
var ndJson = {};
var pluginScriptsJson = {};
var pluginDescriptionsJson = {};
var pluginDShortCommandsJson = {};
var pluginShortCommandsJson = {};
var pluginBuildCommandJson = {};
var pluginCategoriesJson = {};
var pluginWatchJson = {};
var pluginScripts = updateScripts(predefinedScripts, pluginScriptsJson);
var descriptions = updateDescriptions(predefinedScripts, pluginDescriptionsJson);
var shortCommands = updateShortCommands(predefinedScripts, pluginDShortCommandsJson);
var shortCommands = updateShortCommands(predefinedScripts, pluginShortCommandsJson);
var buildCommand = updateBuildCommands(predefinedScripts, pluginBuildCommandJson);
var categories = updateCategories(predefinedScripts, pluginCategoriesJson);
var pluginWatch = updateWatch(predefinedScripts, pluginWatchJson);
ndJson[scriptsTag] = pluginScripts;
ndJson[watchTag] = pluginWatch;
ndJson[devDepsTag] = newDevDeps;
ndJson[descriptionsTag] = descriptions;
ndJson[shortCommandsTag] = shortCommands;
ndJson[buildCommandsTag] = buildCommand;
ndJson[categoriesTag] = categories;
var ndJsonPath = inputParams.pluginSrcFolder + "/node_modules/nativescript-dev-debugging/scripts/nd-package.json";
fs.writeFileSync(ndJsonPath, JSON.stringify(ndJson, null, "\t"));
Expand Down Expand Up @@ -495,6 +499,14 @@ function updateShortCommands(scripts, jsonDevDeps) {
return jsonDevDeps;
}

function updateBuildCommands(scripts, jsonDevDeps) {
scripts.forEach((script) => {
jsonDevDeps[script.key] = script.buildCommand;
});

return jsonDevDeps;
}

function updateCategories(newDevDependencies, json) {
newDevDependencies.forEach((dep) => {
json[dep.key] = dep.category;
Expand Down
114 changes: 39 additions & 75 deletions src/scripts/predefined-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,64 +46,73 @@ function getPluginPreDefinedScripts(srcPath, demoFolder, demoAngularFolder, demo
},
{
key: "nd.demo.android",
value: "npm run nd.build.native.android && npm run nd.open.android.studio && npm run nd.demo.tns.run.android",
value: "npm run nd.open.android.studio && npm run nd.demo.tns.run.android",
description: "Runs your 'demo' app and opens Android Studio. After that use 'Attach debugger to Android process (demo)' to debug the native source code",
buildCommand: "npm run nd.build.native.android",
category: "android debug",
shortCommands: ["demo android simulator attach", "demo android device attach"]
},
{
key: "nd.demo.ios",
value: "npm run nd.build.simulator.native.ios && npm run nd.open.xcode && npm run nd.demo.tns.run.ios",
value: "npm run nd.open.xcode && npm run nd.demo.tns.run.ios",
description: "Runs your 'demo' app and opens Xcode. After that use 'Attach to process by PID or Name (demo)' to debug the native source code. (for simulator)",
buildCommand: "npm run nd.build.simulator.native.ios",
category: "ios debug",
shortCommands: ["demo ios simulator attach"]
},
{
key: "nd.demo.ios.device",
value: "npm run nd.build.device.native.ios && npm run nd.open.xcode && npm run nd.demo.tns.run.ios",
value: "npm run nd.open.xcode && npm run nd.demo.tns.run.ios",
description: "Runs your 'demo' app and opens Xcode. After that use 'Attach to process by PID or Name (demo)' to debug the native source code. (for real device)",
buildCommand: "npm run nd.build.device.native.ios",
category: "ios debug",
shortCommands: ["demo ios device attach"]
},
{
key: "nd.demo.angular.android",
value: "npm run nd.build.native.android && npm run nd.open.android.studio && npm run nd.demo.angular.tns.run.android",
value: "npm run nd.open.android.studio && npm run nd.demo.angular.tns.run.android",
description: "Runs your 'demo-angular' app and opens Android Studio. After that use 'Attach debugger to Android process (demo)' to debug the native source code",
buildCommand: "npm run nd.build.native.android",
category: "android debug",
shortCommands: ["demo-angular android simulator attach", "demo-angular android device attach"]
},
{
key: "nd.demo.angular.ios",
value: "npm run nd.build.simulator.native.ios && npm run nd.open.xcode && npm run nd.demo.angular.tns.run.ios",
value: "npm run nd.open.xcode && npm run nd.demo.angular.tns.run.ios",
description: "Runs your 'demo-angular' app and opens Xcode. After that use 'Attach to process by PID or Name (demo)' to debug the native source code. (for simulator)",
buildCommand: "npm run nd.build.simulator.native.ios",
category: "ios debug",
shortCommands: ["demo-angular ios simulator attach"]
},
{
key: "nd.demo.angular.ios.device",
value: "npm run nd.build.device.native.ios && npm run nd.open.xcode && npm run nd.demo.angular.tns.run.ios",
value: "npm run nd.open.xcode && npm run nd.demo.angular.tns.run.ios",
description: "Runs your 'demo-angular' app and opens Xcode. After that use 'Attach to process by PID or Name (demo)' to debug the native source code. (for real device)",
buildCommand: "npm run nd.build.device.native.ios",
category: "ios debug",
shortCommands: ["demo-angular ios device attach"]
},
{
key: "nd.demo.vue.android",
value: "npm run nd.build.native.android && npm run nd.open.android.studio && npm run nd.demo.vue.tns.run.android",
value: "npm run nd.open.android.studio && npm run nd.demo.vue.tns.run.android",
description: "Runs your 'demo-vue' app and opens Android Studio. After that use 'Attach debugger to Android process (demo)' to debug the native source code",
buildCommand: "npm run nd.build.native.android",
category: "android debug",
shortCommands: ["demo-vue android simulator attach", "demo-vue android device attach"]
},
{
key: "nd.demo.vue.ios",
value: "npm run nd.build.simulator.native.ios && npm run nd.open.xcode && npm run nd.demo.vue.tns.run.ios",
value: "npm run nd.open.xcode && npm run nd.demo.vue.tns.run.ios",
description: "Runs your 'demo-vue' app and opens Xcode. After that use 'Attach to process by PID or Name (demo)' to debug the native source code. (for simulator)",
buildCommand: "npm run nd.build.simulator.native.ios",
category: "ios debug",
shortCommands: ["demo-vue ios simulator attach"]
},
{
key: "nd.demo.vue.ios.device",
value: "npm run nd.build.device.native.ios && npm run nd.open.xcode && npm run nd.demo.vue.tns.run.ios",
value: "npm run nd.open.xcode && npm run nd.demo.vue.tns.run.ios",
description: "Runs your 'demo-vue' app and opens Xcode. After that use 'Attach to process by PID or Name (demo)' to debug the native source code. (for real device)",
buildCommand: "npm run nd.build.device.native.ios",
category: "ios debug",
shortCommands: ["demo-vue ios device attach"]
},
Expand Down Expand Up @@ -137,64 +146,11 @@ function getPluginPreDefinedScripts(srcPath, demoFolder, demoAngularFolder, demo
description: "Rebuilds the plugin's native source code and opens it in Xcode. (for real device)",
category: "secondary"
},
{
key: "nd.build.run.device.demo.app.ios",
value: "npm run nd.build.device.native.ios" + " && npm run nd.demo.tns.run.ios",
description: "Build the native code and executes 'tns run ios' for the 'demo' app",
category: "secondary"
},
{
key: "nd.build.run.simulator.demo.app.ios",
value: "npm run nd.build.simulator.native.ios" + " && npm run nd.demo.tns.run.ios",
description: "Build the native code and executes 'tns run ios' for the 'demo' app",
category: "secondary"
},
{
key: "nd.build.run.demo.app.android",
value: "npm run nd.build.native.android" + " && npm run nd.demo.tns.run.android",
description: "Build the native code and executes 'tns run android' for the 'demo' app",
category: "secondary"
},
{
key: "nd.build.run.demo.angular.app.ios",
value: "npm run nd.build.device.native.ios " + " && npm run nd.demo.angular.tns.run.ios",
description: "Build the native code and executes 'tns run ios' for the 'demo angular' app",
category: "secondary"
},
{
key: "nd.build.run.simulator.demo.angular.app.ios",
value: "npm run nd.build.simulator.native.ios " + " && npm run nd.demo.angular.tns.run.ios",
description: "Build the native code and executes 'tns run ios' for the 'demo angular' app",
category: "secondary"
},
{
key: "nd.build.run.demo.angular.app.android",
value: "npm run nd.build.native.android " + " && npm run nd.demo.angular.tns.run.android",
description: "Build the native code and executes 'tns run android' for the 'demo angular' app",
category: "secondary"
},
{
key: "nd.build.run.demo.vue.app.ios",
value: "npm run nd.build.device.native.ios " + " && npm run nd.demo.vue.tns.run.ios",
description: "Build the native code and executes 'tns run ios' for the 'demo vue' app",
category: "secondary"
},
{
key: "nd.build.run.simulator.demo.vue.app.ios",
value: "npm run nd.build.simulator.native.ios " + " && npm run nd.demo.vue.tns.run.ios",
description: "Build the native code and executes 'tns run ios' for the 'demo vue' app",
category: "secondary"
},
{
key: "nd.build.run.demo.vue.app.android",
value: "npm run nd.build.native.android " + " && npm run nd.demo.vue.tns.run.android",
description: "Build the native code and executes 'tns run android' for the 'demo vue' app",
category: "secondary"
},
{
key: "nd.demo.run.watch.android",
value: "npm run nd.open.android.studio && npm run nd.build.run.demo.app.android",
value: "npm run nd.open.android.studio && npm run nd.demo.tns.run.android",
shortCommands: ["demo android simulator attach & watch", "demo android device attach & watch"],
buildCommand: "npm run nd.build.native.android",
patterns: [
androidSourcePath
],
Expand All @@ -203,26 +159,29 @@ function getPluginPreDefinedScripts(srcPath, demoFolder, demoAngularFolder, demo
},
{
key: "nd.demo.run.watch.ios",
value: "npm run nd.open.xcode && npm run nd.build.run.simulator.demo.app.ios",
value: "npm run nd.open.xcode && npm run nd.demo.tns.run.ios",
shortCommands: ["demo ios simulator attach & watch"],
buildCommand: "npm run nd.build.simulator.native.ios",
patterns: [
iosSourcePath
],
extensions: ["h", "m"]
},
{
key: "nd.demo.run.watch.device.ios",
value: "npm run nd.open.xcode && npm run nd.build.run.device.demo.app.ios",
value: "npm run nd.open.xcode && npm run npm run nd.demo.tns.run.ios",
shortCommands: ["demo ios device attach & watch"],
buildCommand: "npm run nd.build.device.native.ios",
patterns: [
iosSourcePath
],
extensions: ["h", "m"]
},
{
key: "nd.demo.angular.run.watch.android",
value: "npm run nd.open.android.studio && npm run nd.build.run.demo.angular.app.android",
value: "npm run nd.open.android.studio && npm run nd.demo.angular.tns.run.android",
shortCommands: ["demo-angular android simulator attach & watch", "demo-angular android device attach & watch"],
buildCommand: "npm run nd.build.native.android",
patterns: [
androidSourcePath
],
Expand All @@ -231,26 +190,29 @@ function getPluginPreDefinedScripts(srcPath, demoFolder, demoAngularFolder, demo
},
{
key: "nd.demo.angular.run.watch.ios",
value: "npm run nd.open.xcode && npm run nd.build.run.simulator.demo.angular.app.ios",
value: "npm run nd.open.xcode && npm run npm run nd.demo.angular.tns.run.ios",
shortCommands: ["demo-angular ios simulator attach & watch"],
buildCommand: "npm run nd.build.simulator.native.ios",
patterns: [
iosSourcePath
],
extensions: ["h", "m"]
},
{
key: "nd.demo.angular.run.watch.device.ios",
value: "npm run nd.open.xcode && npm run nd.build.run.demo.angular.app.ios",
value: "npm run nd.open.xcode && npm run nd.demo.angular.tns.run.ios",
shortCommands: ["demo-angular ios device attach & watch"],
buildCommand: "npm run nd.build.device.native.ios",
patterns: [
iosSourcePath
],
extensions: ["h", "m"]
},
{
key: "nd.demo.vue.run.watch.android",
value: "npm run nd.open.android.studio && npm run nd.build.run.demo.vue.app.android",
value: "npm run nd.open.android.studio && npm run nd.demo.vue.tns.run.android",
shortCommands: ["demo-vue android simulator attach & watch", "demo-vue android device attach & watch"],
buildCommand: "npm run nd.build.native.android",
patterns: [
androidSourcePath
],
Expand All @@ -261,17 +223,19 @@ function getPluginPreDefinedScripts(srcPath, demoFolder, demoAngularFolder, demo
},
{
key: "nd.demo.vue.run.watch.ios",
value: "npm run nd.open.xcode && npm run nd.build.run.simulator.demo.vue.app.ios",
value: "npm run nd.open.xcode && npm run npm run nd.demo.vue.tns.run.ios",
shortCommands: ["demo-vue ios simulator attach & watch"],
buildCommand: "npm run nd.build.simulator.native.ios",
patterns: [
iosSourcePath
],
extensions: ["h", "m"]
},
{
key: "nd.demo.vue.run.watch.device.ios",
value: "npm run nd.open.xcode && npm run nd.build.run.demo.vue.app.ios",
value: "npm run nd.open.xcode && npm run nd.demo.vue.tns.run.ios",
shortCommands: ["demo-vue ios device attach & watch"],
buildCommand: "npm run nd.build.device.native.ios",
patterns: [
iosSourcePath
],
Expand All @@ -285,7 +249,7 @@ function getPluginPreDefinedScripts(srcPath, demoFolder, demoAngularFolder, demo
},
{
key: "nd.demo.tns.run.ios",
value: "cd " + demoFolder + " && tns build ios && tns run ios --syncAllFiles" + provisioningParam,
value: "cd " + demoFolder + " && tns run ios --syncAllFiles" + provisioningParam,
description: "Runs the 'demo' app on iOS with '--syncAllFiles' argument",
category: "secondary"
},
Expand All @@ -297,7 +261,7 @@ function getPluginPreDefinedScripts(srcPath, demoFolder, demoAngularFolder, demo
},
{
key: "nd.demo.angular.tns.run.ios",
value: "cd " + demoAngularFolder + " && tns build ios && tns run ios --syncAllFiles" + provisioningParam,
value: "cd " + demoAngularFolder + " && tns run ios --syncAllFiles" + provisioningParam,
description: "Runs the 'demo-angular' app on iOS with '--syncAllFiles' argument",
category: "secondary"
},
Expand All @@ -309,7 +273,7 @@ function getPluginPreDefinedScripts(srcPath, demoFolder, demoAngularFolder, demo
},
{
key: "nd.demo.vue.tns.run.ios",
value: "cd " + demoVueFolder + " && tns build ios && tns run ios --syncAllFiles" + provisioningParam,
value: "cd " + demoVueFolder + " && tns run ios --syncAllFiles" + provisioningParam,
description: "Runs the 'demo-vue' app on iOS with '--syncAllFiles' argument",
category: "secondary"
},
Expand Down
Loading