Tag Archives: {N}

NativeScript: Announcing {N} plugin tracking site

If you are like me occasionally you have to find a plugin and you go and check the npmjs.com site and do a search for NativeScript and then peruse a ton of entries; some relevant and some not so much.

Well, last night as I was finally working on updating my manually done plugin list (http://github.com/nathanaela/nativescript-plugins) ; I realized that the number of plugins was just getting to be too great for me to now be manually tracking them all.

So I set out to create something that could automate everything; I found a site/project called react.parts that was open source.  I quickly downloaded the source and glanced through it and promptly borrowed the data updater component.   I made a huge number of changes to the updater, some was just fixing some bugs and some was that I needed totally different fields for my purpose.    I am happy to announce today it runs on one of my servers every night getting and building the dataset for the all new NativeScript plugin site:

http://plugins.nativescript.rocks

The site as of today, Feb 18, 2016, the site lists 86 different plugins, my old manual list only had 45.   As the authors fill in data in the plugins, the data will automatically be updated and added.

We have a total of 33 different authors making NativeScript plugins!   Not bad for less than a year, and Eddy Verbruggen has the most plugins; at a count of 12 of them!  Wow, way to go Eddy!

For you plugin authors you need to make sure you have in your main package.json, the following items to get listed properly.   Some of these items if missing will be considered a minor issue; others will cause your plugin to NOT show up.  At this time you MUST have a link to the github repo that hosts it, you also must have either "nativescript" or "{N}" in your keywords.

If you want the Windows, iOS or Android icon to show up on your plugin, you need to use one of those key words also in your "keywords" OR you need to make sure you have them in your nativescript.platforms object.

Please make sure you include a version, and a license field; this is very helpful for people to quickly see in the list.  And example of the fields is what I use for my nativescript-zxing plugin.

{
  "name": "nativescript-zxing",
  "version": "1.0.0",
  "description": "A Simple ZXing barcode reader/writer wrapper",
  "main": "zxing.js",
  "nativescript": {
   "platforms": {
      "android": "1.4.0",
        "ios": "1.4.0"
   }
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/nathanaela/nativescript-zxing.git"
  },
  "keywords": [
    "NativeScript", "Barcode", "JavaScript", "Android", "iOS", "ZXing"
  ],
  "author": {
    "name": "Nathanael Anderson",
    "email": "nathan@master-technology.com"
  },
  "bugs": {
    "url": "https://github.com/nathanaela/nativescript-zxing/issues"
  },
  "license": {
    "type": "APACHE",
    "url": "https://github.com/nathanaela/nativescript-zxing/blob/master/LICENSE"
  },
  "homepage": "https://github.com/nathanaela/nativescript-zxing",
  "readmeFilename": "README.md"
}

Please note, it updates the data nightly, so if you submit changes; and you don't see it show up in 24 hours; ping me and I'll check into what is going on...

NativeScript: Upgrading to v1.60

Since I have been posting these since the early versions of NativeScript; I figured I would continue.   It has been several months since the last major upgrade and this version has all sorts of bug fixes and new goodies.   The changelog is available at https://github.com/NativeScript/NativeScript/releases/tag/v1.6.0

Some of the new features that I'm looking forward to trying out is new percentage(%) width/height code.   This should allow us to build even better screens.  And the massively upgraded CSS selector code which now allows CSS selectors like we use on the web.

1. npm install -g nativescript
if you now look at your nativescript --version you should have a nice v1.6.0 show up.  You only have to do this one time.

2. npm install tns-core-modules@latest --save
What, that is it to install all the new core modules?  WooHoo, so simple!   Make sure you do this on EACH of your projects!

3. tns platform remove android AND/OR tns platform remove ios
Please note before you run the above commands if you have made ANY changes to the xcode project, plists or the Android manifest; you might want to back them up first, or you will have to manually make those changes again.  Again this has to be done for EACH of your projects...

4. tns platform add android AND/OR tns platform add ios
This also needs to be done for each project.  You can do a type package.json or cat package.json and you should see everything say "1.6.0"

Again a big Kudos for the teams involved in making the updated from v1.3 onward so seamless; if you look at my prior upgrade posts you can see how much EASIER it is to upgrade now.

Tow Gotcha's on Android: when you convert to v1.6.0 (I assume they will fix it in 1.6.1), if you get a "Unhandled Exception -- Java.lang.RuntimeException: Unable to create application" when your app starts.  The easy solution for this that involves fixing your app.js file; as you probably have something attempting to get the application context.   The simple solution is to rewrite your app.js file to be:

var application = require("application");
if (global.android) {
    application.start({moduleName: "main-page"});
}

// All your custom initialization code 
// including any additional require statements...

if (!global.android) {
    application.start({moduleName: "main-page"});
}

Second gotcha, DO NOT USE clearHistory: true in any of your navigation calls, this will corrupt the navigation and cause some majorly WEIRD issues.