Git Product home page Git Product logo

lone's Introduction

lone

Turn node.js apps into standalone executables.

npm install -g lone && lone ./path-to-app;
your app is ready: ./path-to-app/dist/app_OSX_64

explain

neat trick, but how? a slight twist on how node-webkit does it.

  1. get the node source
  2. add lone/_third_party_main.js to library files in node.gyp
  3. compile node
  4. run npm install on ./path-to-app
  5. put everything from ./path-to-app in a tarball
  6. mkdir -p ./path-to-app/dist && cat out/Release/node app.tar.gz > ./path-to-app/dist/app_OSX_64
  7. when app_OSX_64is executed, node calls _third_party_main.js
  8. read app_OSX_64 looking for a boundary where node stops and the app tarball begins
  9. slice out the app tarball into a buffer that's inflated into a tmp directory and run
  10. marinate, rotate, and cover

Gulp + GitHub Releases

Your source gets published to npm but how do you make your shiny new binaries available for easy downloading? Here's a gulp task that will build your binaries with lone and then upload them to GitHub releases.

First, we'll need some extra dev deps so:

npm install --save-dev gulp async github-release gulp-rename keepup

Now add a gulpfile.js to the root of your project:

var gulp = require('gulp'),
  exec = require('child_process').exec,
  async = require('async'),
  release = require('github-release'),
  rename = require('gulp-rename'),
  keepup = require('keepup');

// Delete crap we don't need, which ends up saving several megabytes.
function cleanup(cb){
  var tasks = [],
    blobs = '{test*,doc*,example*,bench*,image*,tool*,lcov-report*}',
    paths = [
      './node_modules/**/' + blobs,
      './node_modules/**/node_modules/**/' + blobs,
      './node_modules/**/node_modules/**/node_modules/**/' + blobs,
      './node_modules/**/node_modules/.bin',
      './node_modules/**/node_modules/**/node_modules/.bin'
    ];

  tasks = paths.map(function(p){
    return function(done){
      exec('rm -rf ' + p, done);
    };
  });
  tasks.push(function(done){exec('npm dedupe', done);});
  async.parallel(tasks, cb);
}

gulp.task('dist', function(cb){
  cleanup(function(){
    console.log('  → creating binaries for distribution');
    keepup('./node_modules/.bin/lone ')
      .on('data', function(buf){process.stdout.write(buf);})
      .on('stderr', function(buf){process.stderr.write(buf);})
      .on('complete', function(){
        var finalName = pkg.name + '_' + platform;
        if(platform === 'windows') finalName += '.exe';

        console.log('  ✔︎ Binary created: ' + path.resolve(
          __dirname + '/../dist/' + finalName));

        console.log('  → uploading release to github');

        gulp.src('./.lone/dist/' + pkg.name)
          .pipe(rename(finalName))
          .pipe(release(pkg))
          .on('end', function(){
            console.log('  ✔︎ Dist complete and uploaded to github');
            cb();
          });
      })
      .on('crash', function(data){
        console.log('  ✘ Binary build failed.  Check logs.  (exit code '+data.code+')');
        cb(new Error('Binary build failed.  Check logs.  (exit code '+data.code+')'));
      });
  });
});

Now we just run gulp dist on any platform and our app binaries are avilable on GitHub without having to mess around with windows paths or cygwin.

License

MIT

Continuum of making computers do things

3 classes of solutions: cli, "status bar", gui.

Naive model of methods for implementing solutions:

  • scripts: perl, bash, python, BAT
  • module: publish to pypi, npm, artifactory, etc
  • native cli: c*, qt, many-others, way it's always been done
  • dynamic cli: lone, go compile
  • dynamic gui: node-webkit, atom-shell, brackets-shell
  • native gui: Cocoa, winfx
class upsides downsides
script worksforme 30 scripts to start mongod and none correct
module reusable in web need toolchain, language bias, etc
native cli what people want. hard, expensive
dynamic cli what people want. emerging
dynamic gui what people want. emerging
native gui what people want. really really hard

Status Bar Apps

Usually a feature of native gui apps, "status bar" apps (eg cloudup, dropbox, etc) should have a home of their own rather than glumping into lone's scope. This statusbar module might use lone under the hood, but definitely needs to be separate. Rumps is an example python impl.

BitBar is another exciting new project to solve this need. When paired with @sindresorhus/bitbar, writing these apps could not be much easier.

lone's People

Contributors

greenkeeper[bot] avatar imlucas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lone's Issues

Distribution

make gulp tasks into their own module(s) .Also might want to rename a few things (eg dist -> build & publish)

  • gulp build
  • gulp publish

An in-range update of tar is breaking the build 🚨

Version 2.2.1 of tar just got published.

Branch Build failing 🚨
Dependency tar
Current Version 2.2.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As tar is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of which is breaking the build 🚨

Version 1.2.13 of which just got published.

Branch Build failing 🚨
Dependency which
Current Version 1.2.12
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As which is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

node flags support

For running with --harmony, --harmony_proxies, etc. so we can write ES6 standalone executables.

Unzip Native Bindings

AdmZip + sardines is damn hard to debug and haven't been able to make headway on the png corruption. Try patching in node-unzip on the fly.

Native addon support

Let's fix this once and for all.

  • Properly set gyp env vars (bsonic test currently failing because of ABI incompat Expected 47, got 43.. just fixed this for 10gen/compass)
  • Fork node-gyp and add a gyp var to src/win_delay_load_hook.c

Improve boot time

Template tag or something so we don't have to wait to unpack the payload zip before we can test if its already in temp.

As well, including offsets will make startup time of apps dramatically faster to startup as we can statically fseek on the contents:

{
   "offsets": {
     "node": [0, 18371812],
     "app": [18371813, 24786323]
   }
}

Make it easier to reuse host binaries

Now that I can build on windows, I don't want to do it again. Build to ./lone/build/{{app name}} and if that's already there, skip the compile step.

auto-generate release notes

all the gh stuff should be peeled off into it's own module, but just want to get this written down somewhere.

@lalitkapoor/github-changes looks like a good fit. also have some common stuff (eg prompt for auth) that would be handy on this end.

chef also had their JIRA specific generator, but cant remember the name right now.

Use semver.io for resolving node versions

  • We should start respecting engines from package.json.
  • We shouldn't have to publish a new patch when a new version is released
  • We should be able to test against unstable node releases

An in-range update of request is breaking the build 🚨

Version 2.80.0 of request just got published.

Branch Build failing 🚨
Dependency request
Current Version 2.79.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As request is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 31 commits .

  • f422111 2.80.0
  • bce66a5 Merge pull request #2571 from JamesMGreene/fix_ipv6_host_header
  • ff6d6c6 Correctly format the Host header for IPv6 addresses
  • 667e923 Merge pull request #2558 from request/FredKSchott-patch-1
  • 6862553 Merge pull request #2221 from calamarico/change_readme
  • 8d78bd0 Update README.md example snippet
  • 60f6a00 Merge pull request #2452 from nicjansma/master
  • da077f7 Merge pull request #2553 from request/issue-template
  • 921ebee small change to template wording
  • 256deea add ISSUE_TEMPLATE, move PR template
  • fec1f2b reorder PULL_REQUEST_TEMPLATE sections
  • 2046cf3 Merge pull request #2539 from request/FredKSchott-patch-1
  • 0ea3d47 Merge pull request #2524 from request/greenkeeper-caseless-0.12.0
  • 3f57975 Use performance-now instead of custom solution
  • a9ad38a Ensure only the properties we expect are there

There are 31 commits in total. See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Figure out gyp black magic

Need to use the gyp that's included in our freshly built binary which we can actually call now. Before bundling, add the below to the path and call npm install

~/.lone/node-v0.10.30/deps/npm/bin/node-gyp-bin/

Kill derp.

The fever to make things work made a bunch of crap leak in. Get rid of the whole config passing thing and replace pieces with vinyl-fs and others.

An in-range update of async is breaking the build 🚨

Version 2.1.5 of async just got published.

Branch Build failing 🚨
Dependency async
Current Version 2.1.4
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As async is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

options for "compile as a service"

As we always wanted, a REST api that calls lone so cross-platform can really shine. Might just be a @wercker box? Maybe ping node-pre-gyp on what they're doing/have already researched.

Fix travis builds

Building node from source fails:

  lone:compile:make stdout +639ms   g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8  -pthread -Wall -Wextra -Wno-unused-parameter -m64 -B/home/travis/build/mongodb-js/lone/test/.lone/node-v5.8.0/third_party/binutils/Linux_x64/Release/bin -fno-strict-aliasing -m64 -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/travis/build/mongodb-js/lone/test/.lone/node-v5.8.0/out/Release/.deps//home/travis/build/mongodb-js/lone/test/.lone/node-v5.8.0/out/Release/obj.target/v8_base/deps/v8/src/accessors.o.d.raw   -c -o /home/travis/build/mongodb-js/lone/test/.lone/node-v5.8.0/out/Release/obj.target/v8_base/deps/v8/src/accessors.o ../deps/v8/src/accessors.cc
  lone:compile:make stderr +126ms In file included from ../deps/v8/src/accessors.h:8:0,
                 from ../deps/v8/src/accessors.cc:5:
../deps/v8/include/v8.h:469:1: error: expected unqualified-id before ‘using’
  lone:compile:make stderr +2ms ../deps/v8/include/v8.h:856:1: error: expected unqualified-id before ‘using’
  lone:compile:make stderr +190ms In file included from ../deps/v8/src/accessors.h:11:0,
                 from ../deps/v8/src/accessors.cc:5:
../deps/v8/src/handles.h:76:7: error: template argument required for ‘class Handle’
../deps/v8/src/handles.h:76:20: error: expected initializer before ‘:’ token
  lone:compile:make stderr +0ms ../deps/v8/src/handles.h:147:7: error: template argument required for ‘class MaybeHandle’
../deps/v8/src/handles.h:147:25: error: invalid type in declaration before ‘{’ token
../deps/v8/src/handles.h:147:25: error: template declaration of ‘int v8::internal::final’
../deps/v8/src/handles.h:148:2: error: expected primary-expression before ‘public’
../deps/v8/src/handles.h:148:2: error: expected ‘}’ before ‘public’
../deps/v8/src/handles.h:150:25: error: expected class-name before ‘(’ token
../deps/v8/src/handles.h:155:41: error: ISO C++ forbids declaration of ‘MaybeHandle’ with no type [-fpermissive]
../deps/v8/src/handles.h:155:41: error: declaration of template ‘template<class S> int v8::internal::MaybeHandle(v8::internal::Handle<T>)’
../deps/v8/src/globals.h:415:29: error: conflicts with previous declaration ‘template<class T> struct v8::internal::MaybeHandle’
../deps/v8/src/globals.h:415:29: error: previous non-function declaration ‘template<class T> struct v8::internal::MaybeHandle’
../deps/v8/src/handles.h:155:41: error: conflicts with function declaration ‘template<class S> int v8::internal::MaybeHandle(v8::internal::Handle<T>)’
../deps/v8/src/handles.h: In function ‘int v8::internal::MaybeHandle(v8::internal::Handle<T>)’:
../deps/v8/src/handles.h:156:9: error: only constructors take member initializers
../deps/v8/src/handles.h:156:36: error: expected type-specifier before ‘T’
../deps/v8/src/handles.h:156:36: error: expected ‘>’ before ‘T’
../deps/v8/src/handles.h:156:36: error: expected ‘(’ before ‘T’
../deps/v8/src/handles.h:156:36: error: ‘T’ was not declared in this scope
../deps/v8/src/handles.h:156:39: error: expected primary-expression before ‘>’ token
../deps/v8/src/handles.h:206:26: error: expected ‘{’ before ‘;’ token
../deps/v8/src/handles.h:206:26: warning: no return statement in function returning non-void [-Wreturn-type]
../deps/v8/src/handles.h: At global scope:
../deps/v8/src/handles.h:211:3: error: ‘friend’ used outside of class
../deps/v8/src/handles.h:214:3: error: ‘friend’ used outside of class
../deps/v8/src/handles.h:218:29: error: ‘v8::hash_value’ declared as an ‘inline’ variable
../deps/v8/src/handles.h:218:29: warning: ‘always_inline’ attribute ignored [-Wattributes]
../deps/v8/src/handles.h:218:29: error: template declaration of ‘size_t v8::hash_value’
../deps/v8/src/handles.h:218:29: error: ‘MaybeHandle’ was not declared in this scope
../deps/v8/src/handles.h:218:29: note: suggested alternative:
../deps/v8/src/globals.h:415:29: note:   ‘v8::internal::MaybeHandle’
../deps/v8/src/handles.h:218:42: error: expected primary-expression before ‘>’ token
../deps/v8/src/handles.h:218:44: error: ‘maybe_handle’ was not declared in this scope
../deps/v8/src/handles.h:237:7: error: redefinition of ‘class v8::HandleScope’
../deps/v8/include/v8.h:873:17: error: previous definition of ‘class v8::HandleScope’
../deps/v8/src/handles.h:302:27: error: variable ‘v8::DeferredHandleScope v8::final’ has initializer but incomplete type
../deps/v8/src/handles.h:303:2: error: expected primary-expression before ‘public’
../deps/v8/src/handles.h:303:2: error: expected ‘}’ before ‘public’
../deps/v8/src/handles.h:303:2: error: expected ‘,’ or ‘;’ before ‘public’
../deps/v8/src/handles.h:308:3: error: ‘DeferredHandles’ does not name a type
../deps/v8/src/handles.h:309:25: error: expected constructor, destructor, or type conversion before ‘;’ token
../deps/v8/src/handles.h:311:2: error: expected unqualified-id before ‘private’
../deps/v8/src/handles.h:314:3: error: ‘HandleScopeImplementer’ does not name a type
../deps/v8/src/handles.h:321:3: error: ‘friend’ used outside of class
../deps/v8/src/handles.h:327:23: error: variable ‘SealHandleScope final’ has initializer but incomplete type
../deps/v8/src/handles.h:328:2: error: expected primary-expression before ‘public’
../deps/v8/src/handles.h:328:2: error: expected ‘}’ before ‘public’
../deps/v8/src/handles.h:328:2: error: expected ‘,’ or ‘;’ before ‘public’
../deps/v8/src/handles.h:331:20: error: declaration of ‘~SealHandleScope’ as non-member
../deps/v8/src/handles.h:340:1: error: expected declaration before ‘}’ token
  lone:compile:make stderr +20ms make[1]: *** [/home/travis/build/mongodb-js/lone/test/.lone/node-v5.8.0/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1
  lone:compile:make stderr +1ms make: *** [node] Error 2
  lone:compile:make exit code +0ms 2

windows: binary add-on loading

why is process.dlopen undefined?

load "C:\\Users\\lucas\\AppData\\Local\\bsonic\\node_modules\\bson\\ext\\win32\\ia32\\bson.node" for module "C:\\Users\\
lucas\\AppData\\Local\\bsonic\\node_modules\\bson\\ext\\win32\\ia32\\bson.node" extension ".node" handler undefined
js-bson: Error: The specified module could not be found.
C:\Users\lucas\AppData\Local\bsonic\node_modules\bson\ext\win32\ia32\bson.node
    at Module.load (module.js:360:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:368:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\lucas\AppData\Local\bsonic\node_modules\bson\ext\index.js:8:11)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:360:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:368:17)
load "C:\\Users\\lucas\\AppData\\Local\\bsonic\\node_modules\\bson\\build\\Release\\bson.node" for module "C:\\Users\\lu
cas\\AppData\\Local\\bsonic\\node_modules\\bson\\build\\Release\\bson.node" extension ".node" handler undefined
js-bson: Failed to load c++ bson extension, using pure JS version

windows build slave

Don't know what the status of travis windows support is, but need to get something in place.

An in-range update of yargs is breaking the build 🚨

Version 6.6.0 of yargs just got published.

Branch Build failing 🚨
Dependency yargs
Current Version 6.5.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As yargs is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 7 commits .

  • e5613f0 chore(release): 6.6.0
  • 19a897b refactor: use process.stdout.columns instead of window-size (#737)
  • 66573c8 feat: split demand() into demandCommand()/demandOption() (#740)
  • 5883779 feat: implement conflicts() for defining mutually exclusive arguments; thanks @madcampos! (#741)
  • f755e27 fix: [object Object] was accidentally being populated on options object (#736)
  • 27e1a57 feat: support for positional argument aliases (#727)
  • 9bdaab7 fix: do not use cwd when resolving package.json for yargs parsing config (#726)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

status bar apps

several folks have asked about this and perhaps it would be easier to start with than cli -> full blown node-webkit apps? A pythons impl looks like: https://github.com/jaredks/rumps

All its really about: packaging node-objc + the "installer" side for registering with launchctl

[windows] exe bails out?

can build the exe. app runs just fine on windows 8. exe starts, get the first few lines of express init debugging and then just bails :/

An in-range update of debug is breaking the build 🚨

Version 2.6.0 of debug just got published.

Branch Build failing 🚨
Dependency debug
Current Version 2.5.2
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As debug is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 4 commits .

  • ac5ccae release 2.6.0
  • 5895595 better null pointer checks for browser useColors
  • 6646130 remove explicit window.debug export (#404)
  • 62df220 Deprecate DEBUG_FD (#405)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.