npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lone

v0.5.0

Published

Turn node.js apps into standalone executables.

Downloads

146

Readme

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.