{"id":13733463,"url":"https://github.com/imlucas/lone","last_synced_at":"2025-05-08T09:32:07.771Z","repository":{"id":14664635,"uuid":"17383235","full_name":"imlucas/lone","owner":"imlucas","description":"Turn node.js apps into standalone executables","archived":false,"fork":false,"pushed_at":"2017-04-20T18:19:27.000Z","size":8469,"stargazers_count":49,"open_issues_count":13,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-21T02:45:05.497Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imlucas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-03T23:01:36.000Z","updated_at":"2025-02-22T17:19:19.000Z","dependencies_parsed_at":"2022-09-05T14:50:51.476Z","dependency_job_id":null,"html_url":"https://github.com/imlucas/lone","commit_stats":null,"previous_names":["mongodb-js/lone"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imlucas%2Flone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imlucas%2Flone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imlucas%2Flone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imlucas%2Flone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imlucas","download_url":"https://codeload.github.com/imlucas/lone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253036603,"owners_count":21844245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T03:00:43.547Z","updated_at":"2025-05-08T09:32:05.584Z","avatar_url":"https://github.com/imlucas.png","language":"JavaScript","funding_links":[],"categories":["Packaging"],"sub_categories":["Flexbox"],"readme":"# lone [![][travis_img]][travis_url] [![][appv_img]][appv_url] [![][npm_img]][npm_url]\n\n\u003e Turn node.js apps into standalone executables.\n\n```\nnpm install -g lone \u0026\u0026 lone ./path-to-app;\nyour app is ready: ./path-to-app/dist/app_OSX_64\n```\n\n## explain\n\nneat trick, but how? a slight twist on how node-webkit does it.\n\n1. get the node source\n2. add `lone/_third_party_main.js` to library files in `node.gyp`\n3. compile node\n4. run `npm install` on `./path-to-app`\n5. put everything from `./path-to-app` in a tarball\n6. `mkdir -p ./path-to-app/dist \u0026\u0026 cat out/Release/node app.tar.gz \u003e ./path-to-app/dist/app_OSX_64`\n7. when `app_OSX_64`is executed, node calls `_third_party_main.js`\n8. read `app_OSX_64` looking for a boundary where node stops and the app tarball begins\n9. slice out the app tarball into a buffer that's inflated into a tmp directory and run\n10. marinate, rotate, and cover\n\n## Gulp + GitHub Releases\n\nYour source gets published to npm but how do you make your shiny new binaries\navailable for easy downloading?  Here's a gulp task that will build\nyour binaries with lone and then upload them to GitHub releases.\n\nFirst, we'll need some extra dev deps so:\n\n```\nnpm install --save-dev gulp async github-release gulp-rename keepup\n```\n\nNow add a `gulpfile.js` to the root of your project:\n\n```javascript\nvar gulp = require('gulp'),\n  exec = require('child_process').exec,\n  async = require('async'),\n  release = require('github-release'),\n  rename = require('gulp-rename'),\n  keepup = require('keepup');\n\n// Delete crap we don't need, which ends up saving several megabytes.\nfunction cleanup(cb){\n  var tasks = [],\n    blobs = '{test*,doc*,example*,bench*,image*,tool*,lcov-report*}',\n    paths = [\n      './node_modules/**/' + blobs,\n      './node_modules/**/node_modules/**/' + blobs,\n      './node_modules/**/node_modules/**/node_modules/**/' + blobs,\n      './node_modules/**/node_modules/.bin',\n      './node_modules/**/node_modules/**/node_modules/.bin'\n    ];\n\n  tasks = paths.map(function(p){\n    return function(done){\n      exec('rm -rf ' + p, done);\n    };\n  });\n  tasks.push(function(done){exec('npm dedupe', done);});\n  async.parallel(tasks, cb);\n}\n\ngulp.task('dist', function(cb){\n  cleanup(function(){\n    console.log('  → creating binaries for distribution');\n    keepup('./node_modules/.bin/lone ')\n      .on('data', function(buf){process.stdout.write(buf);})\n      .on('stderr', function(buf){process.stderr.write(buf);})\n      .on('complete', function(){\n        var finalName = pkg.name + '_' + platform;\n        if(platform === 'windows') finalName += '.exe';\n\n        console.log('  ✔︎ Binary created: ' + path.resolve(\n          __dirname + '/../dist/' + finalName));\n\n        console.log('  → uploading release to github');\n\n        gulp.src('./.lone/dist/' + pkg.name)\n          .pipe(rename(finalName))\n          .pipe(release(pkg))\n          .on('end', function(){\n            console.log('  ✔︎ Dist complete and uploaded to github');\n            cb();\n          });\n      })\n      .on('crash', function(data){\n        console.log('  ✘ Binary build failed.  Check logs.  (exit code '+data.code+')');\n        cb(new Error('Binary build failed.  Check logs.  (exit code '+data.code+')'));\n      });\n  });\n});\n```\n\nNow we just run `gulp dist` on any platform and our app binaries are avilable\non GitHub without having to mess around with windows paths or cygwin.\n\n## License\n\nMIT\n\n## Continuum of making computers do things\n\n3 classes of solutions: cli, \"status bar\", gui.\n\nNaive model of methods for implementing solutions:\n\n- scripts: perl, bash, python, BAT\n- module: publish to pypi, npm, artifactory, etc\n- native cli: c*, qt, many-others, way it's always been done\n- dynamic cli: `lone`, `go compile`\n- dynamic gui: node-webkit, atom-shell, brackets-shell\n- native gui: Cocoa, winfx\n\n|      class       |      upsides      |                  downsides                  |\n| :--------------- | :---------------- | :------------------------------------------ |\n| script           | worksforme        | 30 scripts to start mongod and none correct |\n| module           | reusable in web   | need toolchain, language bias, etc          |\n| native cli       | what people want. | hard, expensive                             |\n| dynamic cli      | what people want. | emerging                                    |\n| dynamic gui      | what people want. | emerging                                    |\n| native gui       | what people want. | really really hard                          |\n\n## Status Bar Apps\n\nUsually a feature of native gui apps, \"status bar\" apps (eg cloudup, dropbox, etc)\nshould have a home of their own rather than glumping into lone's scope.\nThis statusbar module might use lone under the hood, but definitely needs to\nbe separate.  [Rumps](https://github.com/jaredks/rumps) is an example python impl.\n\n[BitBar][bitbar] is another exciting new project to solve this need.  When paired with\n[@sindresorhus/bitbar][bitbar js], writing these apps could not be much easier.\n\n[bitbar js]: https://github.com/sindresorhus/bitbar \n[bitbar]: https://github.com/matryer/bitbar\n\n\n[travis_img]: https://secure.travis-ci.org/mongodb-js/lone.png\n[travis_url]: https://travis-ci.org/mongodb-js/lone\n[npm_img]: https://img.shields.io/npm/v/lone.svg?style=flat-square\n[npm_url]: https://www.npmjs.org/package/lone\n[appv_img]: https://ci.appveyor.com/api/projects/status/github/imlucas/lone\n[appv_url]: https://ci.appveyor.com/project/imlucas/lone\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimlucas%2Flone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimlucas%2Flone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimlucas%2Flone/lists"}