Function based off of app version in package.json - node-webkit

I would like to run a function based of the version of my node-webkit app from the package.json file. How do I get this version number?
I'm not talking about:
process.versions['node-webkit'];
Which just shows the node-webkit version.

You can get the manifest as an object in nw, using App. Just extract the version there:
var gui = require('nw.gui');
var myAppVersion = gui.App.manifest.version;
See also https://github.com/rogerwang/node-webkit/wiki/App#manifest

Related

get package last release version with request like web service on github api

exist any way to retrieve the package last version release on github api, i can't find any to it...
expented and output with:
current version: v1.1.0.0
Current documentation:
https://docs.github.com/en/free-pro-team#latest/rest/reference/checks
Package to get the last release version from rquest api:
https://github.com/arcanisgk/BEH-Basic-Error-Handler
with javascript:
let result = await GetVersion('https://api.github.com/repos/arcanisgk/BEH-Basic-Error-Handler/releases/latest');
console.log(result.tag_name);

Disabling Node.js download in KotlinJS Gradle plugin

The version of Node.js that KotlinJS downloads (as of 1.3.40+) seems not to work in Alpine Linux. The docker image I'm using already has Node baked into it, so there's no reason not to use that one.
However, I'm having trouble figuring out how to set download to false (which should cause KotlinJS to build using the node on the PATH).
The relevant section of my build.gradle looks like this:
kotlin {
target {
useCommonJs()
browser()
}
}
Any help would be appreciated!
Looks like it's pretty similar to #talalUcef's answer:
kotlinNodeJs {
download = false
}
Using the KotlinBrowserJs plugin applies the NodeJsRoot plugin.
The NodeJsRoot plugin applies itself, which causes the NodeJsRootExtension to be included under the name kotlinNodeJs.
Thus, I believe, any of the vars here can be set inside a kotlinNodeJs block.
You can add
node {
download = false
}
on your build.gradle file

How to do live reloading / automatic page refresh in elm?

I'm trying to learn elm programing language from here. And it bugs me to manually do page refresh with every little change.
I see that elm-reactor doesn't support live realoading anymore. But what can i do unthil the next release?
I usually use elm-live.
It is very simple and easy to use if you are just compiling Elm to js.
Solved! - gulp magic saves the day!
(this solution works only with Chrome) Here is what I did - based on this: ( Thanks janiczek !! :))
Inside your root directory add a new file named gulpfile.js
Paste this content inside:
gulpfile.js:
evar gulp = require('gulp');
var elm = require('gulp-elm');
var concat = require('gulp-concat');
var plumber = require('gulp-plumber');
var livereload = require('gulp-livereload');
var path = ['*.elm']; // here you adjust the path according with your needs.
// For ex: 'scr/**/*.elm' - maps to every folder and file nested inside the src folder.
gulp.task('elm-init', elm.init);
gulp.task('elm', ['elm-init'], function(){
return gulp.src(path)
.pipe(plumber())
.pipe(elm())
.pipe(concat('elmapp.compiled.js'))
.pipe(gulp.dest('js'))
.pipe(livereload());
});
gulp.task('default',['watch']);
gulp.task('watch', function(){
livereload.listen();
gulp.watch(path,['elm']);
});
You must have gulp installed globally if not run:
npm install gulp -g
Install the gulp dependencies:
npm install gulp-elm gulp-concat gulp-plumber gulp-livereload
Install this extension: (chrome only)
run elm-reactor and open your page in Chrome.
From inside your terminal, at root directory (or wherever your gulpfile.js is) run: gulp
With the elm page tab open, Press LiveReload button on the Chorme Extension. like below and make sure it says:
You are good to go! :)
Elm compiler doesn't like .js files around, so you will still see 2 errors. Ignore them. For me , everything else works as expected.

Can't get PhantomJS to work with a simple example

I've downloaded the executable and created a simlink to /usr/local/bin.
I'm under Mac OSX 10.7
When I then try to run a script that requires some module i.e.
var page = require('webpage').create();
I got an error
undefined:0 ReferenceError: Can't find variable: require
as if 'require' is not seen as a reserved word but interpreted as a variable symbol.
(As an aside, whenever I lunch phantomjs a Sencha Touch icon appears in my Dock)
Your copy of PhantomJS is from an older version. Always get the latest one from http://phantomjs.org.
I had this issue too, and the problem was my version of mocha -- going back to 1.9.0 fixed it.
SenchaTouch 2.0 installs PhantomJS 1.1 somewhere depending on the OS. Under *NIX check where with 'which phantomjs'.
Just modify your bash or whatever configuration file accordingly to remove the Phantomjs included with SenshaTouch from your PATH.

how do I find my AIR Application publisherID?

I need to find the publisherID of my native AIR application so I can use the browser invocation feature.
I have a working AIR Native Application Installer project (.exe) built with FlashBuilder 4.5 as a "signed native installer" using a self-signed certificate.
But I look in the install folder and cannot find the file 'META-INF/AIR/publisherid'. Also, I tried logging 'NativeApplication.nativeApplication.publisherID', but it shows as an empty string.
How do I get a publisherID?
You can invoke an AIR application using the described API even if the publisherID is missing. Just leave it blank, like that:
airSWF.launchApplication(appID, "", arguments);
publisherID is legacy. it's no longer used but continues to be supported for AIR applications compiled with AIR 1.5.2 and earlier.
AIR application descriptor elements: publisherID
you should refer to values in your descriptor file instead. for example, this is how you can obtain the version of your application based on that tag's value in the XML descriptor file:
var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptorFile.namespace();
trace("Version " + descriptor.ns::versionNumber);