Compare commits

..

168 Commits

Author SHA1 Message Date
Jared Allard 5dc698be9d minor comsetic logging fix. vbump to v0.4.1 2015-08-09 08:42:18 -07:00
Jared Allard 1bf334399b fix second run issues with --flag enabled. better error handling 2015-08-09 08:32:18 -07:00
Jared Allard a30db5fc5d package: finally got around to adding contrib 2015-06-29 10:41:16 -07:00
Jared Allard 77cfcf0da4 retarget 2.3.1 for nexe 2015-06-26 18:36:26 -07:00
Jared Allard d8541a82ac readme: note on output. 2015-06-26 18:30:35 -07:00
Jared Allard 489bd0f0fe exe: fixes #122, implement base nexe package field 2015-06-26 18:27:26 -07:00
Jared Allard a3f30bf783 nexe: vbump / remove devdepends 2015-06-26 15:30:02 -07:00
Jared Allard 61ff0b1052 changelog: maintainer fix 2015-06-19 21:49:15 -07:00
Jared Allard e02d39a6bf manifest: async 0.9.0 => 1.2.1 2015-06-19 21:46:00 -07:00
Jared Allard ca414f03db readme: author update 2015-06-19 21:43:23 -07:00
Jared Allard 4200724316 readme: clairify that all platforms require python 2015-05-31 11:53:07 -07:00
Jared Allard 686f67fac2 readme: clairify building requirements. 2015-05-31 11:50:54 -07:00
RainbowDashDC 494618cca1 nexe: vbump and dependencies. 2015-05-01 13:29:42 -07:00
Jared Allard 86fe200bfd Merge pull request #114 from shivamadhavan/master
Updated version of dependency builtins to 1.0.1 ( inclusion of console to the built in module list )
2015-04-16 21:11:54 -07:00
Shiva Kumar Madhavan c272f52994 Updated version of dependency builtins to 1.0.1 ( inclusion of console to the built in module list ) 2015-04-16 17:17:08 +08:00
Craig Jefferds 93ed48a537 Merge pull request #111 from lahdekorpi/patch-1
Fixed typo in README.md
2015-03-30 08:51:44 -07:00
Toni Lähdekorpi 740e3f441d Fixed typo in README.md 2015-03-30 18:51:18 +03:00
Jared Allard 8204feadaa Add 'readline' not include rule.
For some reason nexe attempts to include readline, this solves it. readline is a bultin of node as of 10
2015-03-20 22:08:31 -07:00
Jared Allard cdf53e133b Update README.md
Fixing a spelling mistake. Ugh.
2015-03-20 10:55:09 -07:00
Jared Allard 65c07d4e4a Update README to show new feature 2015-03-20 09:26:30 -07:00
Jared Allard 4c3443655e Merge pull request #108 from crcn/iojs
Implement io.js support! And a few fixes
2015-03-20 09:20:39 -07:00
RainbowDashDC 6d20d4da22 Fixes #107, implements --framework/-F. Fetchs iojs latest. 2015-03-19 23:50:48 -07:00
RainbowDashDC b72b14b6c3 Initial iojs support. 2015-03-16 10:36:39 -07:00
Jared Allard 9134bcf351 Add waffle.io board label 2015-03-08 20:49:52 -07:00
Christopher Karper 1c0d8d0fc0 Freshened up all dependencies 2015-02-22 21:32:59 -05:00
Christopher Karper a7c3fda721 Updated deps 2015-02-22 15:05:47 -05:00
Christopher Karper 7d75480a6f Renamed relative to absolute 2015-02-21 19:42:04 -05:00
Christopher Karper 67361b27e1 Update README.md
Added myself as a maintainer.
2015-02-21 19:35:17 -05:00
Christopher Karper 3b6f9ff4b7 This was bothering me... 2015-02-21 19:02:16 -05:00
RainbowDashDC 6fcfb10e38 Update changelog for 0.3.6 and 0.3.7 2015-02-21 01:32:20 -05:00
RainbowDashDC 06cab4f43b Publish new version to hopefully fix #103 2015-02-21 01:16:34 -05:00
Craig Jefferds 2cacd8340b Update README.md 2015-02-18 14:18:47 -08:00
Craig Jefferds 0e90ac9f16 Update README.md 2015-02-18 14:18:29 -08:00
Jared Allard efd3f78c9d Merge pull request #102 from gitter-badger/gitter-badge
Add a Gitter chat badge to README.md
2015-02-18 13:40:14 -08:00
The Gitter Badger 54967d1ab0 Added Gitter badge 2015-02-18 19:35:28 +00:00
RainbowDashDC bb489a3cb7 Fixes #98 by giving win32 a 100 length progress bar. 2015-02-15 19:38:35 -08:00
Jared Allard 6097c20204 Merge pull request #101 from CKarper/master
Lighter weight way to accomplish the exclusion of the sys module
2015-02-15 15:00:05 -08:00
Christopher Karper 39665a8d5c Lighter weight way to accomplish the exclusion of the sys module 2015-02-15 17:51:05 -05:00
Jared Allard f49ece0c86 Merge pull request #100 from CKarper/master
Stub to ignore require('sys')
2015-02-15 12:57:05 -08:00
Christopher Karper 5aca22d28e This handles embedding 'bin' scripts with shebang interpreter directives at the start 2015-02-15 15:02:58 -05:00
Christopher Karper e79b0fb23e Stub to ignore require('sys') 2015-02-15 14:52:40 -05:00
RainbowDashDC cac698609c V bump to solve critical error. 2015-02-15 11:10:34 -08:00
RainbowDashDC b040337a94 Fixes #99, resolves #97 by warning on missing file. New examples. New log functions 2015-02-15 11:05:24 -08:00
Jared Allard 06d7730802 Merge pull request #96 from CKarper/patch-1
Support .json extensions in require() resolution
2015-02-15 07:39:13 -08:00
Christopher Karper ad4da1d193 Support .json extensions in require() resolution
Embarrassingly simple fix.  Added .json to the list of extensions to search when a require with no extension is found.  

This resolves #57
2015-02-15 00:33:28 -05:00
RainbowDashDC 5927b45e70 Add changelog.md, add resourceFiles to example, MIT-LICENSE.txt => LICENSE.txt 2015-02-14 19:53:30 -08:00
RainbowDashDC e4155c8fed Version bump 0.3.5, update depends 2015-02-14 09:44:49 -08:00
RainbowDashDC e91f5b52af Add example, fix outdated examples 2015-02-14 01:57:54 -08:00
RainbowDashDC 3b1d5a9fe1 Modify readme, implement cross-plat --python <loc> closes #94 2015-02-14 01:50:32 -08:00
Jared Allard 3ac298fe4f Merge pull request #95 from LorenzGardner/master
Make process.argv consistent in the child fork case
2015-02-09 17:46:51 -08:00
Lorenz Gardner 229f0516c6 Merge branch 'master' of https://github.com/LorenzGardner/nexe 2015-02-09 16:06:29 -06:00
Lorenz Gardner 29d5f6aaeb Make process.argv consistent in the child fork cas
(argv.[0] must = the executable)
2015-02-09 16:05:09 -06:00
LorenzGardner 174599df30 Merge pull request #2 from crcn/master
Pull in changes to master
2015-02-09 15:56:29 -06:00
Jared Allard 3ca6bbbda2 Merge pull request #93 from LorenzGardner/embedFiles
Embed files
2015-01-31 18:56:18 -08:00
Lorenz Gardner 97dbd37068 Add support for embedded files. 2015-01-06 19:05:01 -06:00
Lorenz Gardner b615e125c0 Make the example code demonstrate forked process and dynamic require 2015-01-05 17:58:57 -06:00
LorenzGardner c34f6719b5 Merge pull request #1 from crcn/master
update
2014-12-30 12:07:37 -06:00
Craig Jefferds 2342fe6fdd Merge pull request #92 from LorenzGardner/child.fork
Add child_process.fork support.
2014-12-23 19:59:18 -03:00
LorenzGardner 333cc697c3 update read me mentioning usage of child_process.fork 2014-12-23 12:16:49 -06:00
Lorenz Gardner ece4b2d62a Add child_process.fork support. 2014-12-23 12:01:33 -06:00
Craig Jefferds ba62973dca Merge pull request #88 from LorenzGardner/master
Add support for JSON files, and __dirname
2014-12-19 16:05:25 -08:00
LorenzGardner 9b5892e6ad clarify workaround for native module support 2014-12-19 14:23:40 -06:00
Lorenz Gardner f7ad9a8e83 It actually makes way more sense for __driname to be exectuable dir rather
than the cwd.
2014-12-18 18:02:48 -06:00
LorenzGardner 7c1331bed8 Update README.md
update the readme to explain how to workaround the limitations (not supporting dynamic require statements and lack of native module support the pseudo support of __dirname)
2014-12-18 17:46:55 -06:00
Lorenz Gardner e55dacf8c8 Merge branch 'JSON-Support'
Conflicts:
	lib/bundle.js
2014-12-18 17:02:29 -06:00
Lorenz Gardner ec79ff85d4 add __dirname support 2014-12-17 18:52:04 -06:00
Lorenz Gardner 99a8cbe9b3 Add JSON support for require statments. 2014-12-17 13:09:00 -06:00
LorenzIndus f458298ffb update version of builtins in deps
Get the fix they did to include the "constants" builtin module.
2014-12-17 08:48:01 -06:00
Craig Jefferds c3fa94a2e5 Merge pull request #83 from rknell/patch-1
Update README.md
2014-11-04 14:41:23 -08:00
rknell 961f72b1d9 Update README.md
Adding missing comma to example
2014-11-05 07:57:53 +10:00
Craig Jefferds d91d91fc2b Merge pull request #82 from RainbowDashDC/master
Prevent Windows Paths from causing issues.
2014-10-27 18:21:34 -07:00
Jared Allard 273bfa3e4d Prevent Windows Paths from causing issues. 2014-10-27 15:14:55 -07:00
Craig Condon 31b01469c7 v bump 2014-10-10 09:23:51 -07:00
Craig Condon b94d0c3719 Merge branch 'master' of github.com:crcn/nexe 2014-10-10 09:23:31 -07:00
Craig Condon 275a7b025b fix issue loading native modules 2014-10-10 09:23:20 -07:00
Craig Jefferds 71d7b97736 Update README.md 2014-09-19 12:09:10 -07:00
Craig Jefferds faf0a85b36 Merge pull request #78 from tm1000/patch-1
Update README.md
2014-09-16 11:31:11 -07:00
Craig Jefferds 56578c09b1 Merge pull request #79 from tm1000/patch-2
Remove all non-ascii code from external sources
2014-09-16 11:31:01 -07:00
Andrew Nagy 6ad1ec436c Remove all non-ascii code from external sources
Remove all non-ascii code from external sources
2014-09-16 10:32:45 -07:00
Andrew Nagy 62461dbc41 Update README.md
Fix the documentation :-)
2014-09-12 16:14:04 -07:00
Craig Jefferds 7f34aa8854 Merge pull request #74 from caffeinewriter/replace-yargs
Replace optimist with yargs
2014-08-29 19:13:00 -07:00
Brandon Anzaldi 76072f6df9 Replace optimist with yargs in nexe bin 2014-08-29 18:44:52 -07:00
Brandon Anzaldi 83daa5553b Replace Optimist with Yargs in Package.json 2014-08-29 18:43:06 -07:00
Craig Condon ff09ef6755 cleanup 2014-08-10 23:46:38 -07:00
Craig Condon 85c8831248 include all node.js builtins 2014-08-10 23:32:01 -07:00
Craig Condon 3d2ae606ef v bump 2014-07-30 12:22:50 -07:00
Craig Condon d4f27aea7f filter http 2014-07-30 12:22:37 -07:00
Craig Condon 87abd1a295 remove commented out code 2014-07-30 11:38:16 -07:00
Craig Condon 9fd462da2f v bump 2014-07-30 11:37:20 -07:00
Craig Condon 60849404a2 remove sardines - move into nexe. Use bundle.js 2014-07-30 11:37:05 -07:00
Craig Condon 00fa37fff0 start on using browserify 2014-07-30 11:12:20 -07:00
Craig Condon 270350fda6 fix #48 - ability to just run ----> bundle /Users/craig/Developer/Public/nexe/lib/index.js
unable to include script /Users/craig/Developer/Public/nexe/lib/exe.js from /Users/craig/Developer/Public/nexe/lib/index.js, Error: Cannot find module 'nexe'
    at Function.module.exports [as sync] (/Users/craig/Developer/Public/nexe/node_modules/sardines/node_modules/amdify/node_modules/resolve/lib/sync.js:32:11)
    at resolvePath (/Users/craig/Developer/Public/nexe/node_modules/sardines/node_modules/amdify/lib/pathInfo.js:135:20)
    at self.getPathInfo (/Users/craig/Developer/Public/nexe/node_modules/sardines/node_modules/amdify/lib/pathInfo.js:88:24)
    at /Users/craig/Developer/Public/nexe/node_modules/sardines/node_modules/amdify/lib/analyzeDeps.js:324:13
    at /Users/craig/Developer/Public/nexe/node_modules/async/lib/async.js:111:13
    at Array.forEach (native)
    at _each (/Users/craig/Developer/Public/nexe/node_modules/async/lib/async.js:32:24)
    at Object.async.each (/Users/craig/Developer/Public/nexe/node_modules/async/lib/async.js:110:9)
    at scanRequired (/Users/craig/Developer/Public/nexe/node_modules/sardines/node_modules/amdify/lib/analyzeDeps.js:321:9)
    at Function.on.success.deps.forEach.dep.source (/Users/craig/Developer/Public/nexe/node_modules/sardines/node_modules/amdify/lib/analyzeDeps.js:245:5) in cwd. Resolves package.json main script
2014-05-28 10:47:52 -07:00
Craig Condon dd2aa5a831 Merge pull request #55 from fritx/patch-1
Update README.md
2014-05-28 10:28:08 -07:00
Fritz Lin afc7140b6b Update README.md
Better style with Code Usage in README.md
2014-05-28 22:02:28 +08:00
Craig Condon 1d47091304 v bump 2014-05-13 11:42:44 -07:00
Craig Condon 36bbdd4aa9 Merge pull request #52 from jhbruhn/master
Windows support
2014-05-12 14:40:28 -07:00
Jan-Henrik e73804a4dd Added Windows support to Readme 2014-05-12 20:33:04 +02:00
Jan-Henrik bd1152357e Added Windows Support using vcbuild.bat 2014-05-12 20:29:02 +02:00
Craig Condon c53f229848 added progress to package.json 2014-03-06 11:28:00 -08:00
Craig Condon 3cb81249d8 Merge pull request #46 from northshorenetworks/master
Updated README.md
2014-02-28 19:43:16 -08:00
Adam Snodgrass 518fbc7280 Updated README.md 2014-02-28 21:40:59 -06:00
Craig Condon dd5607886a Merge pull request #45 from northshorenetworks/master
Remove duplicate _log definition in monkeypatch.js
2014-02-28 19:39:44 -08:00
Adam Snodgrass 666774b5b5 Remove duplicate _log definition 2014-02-28 21:35:56 -06:00
Adam Snodgrass 3f75ae462e Merge pull request #2 from crcn/master
Pull in crcn/nexe master changes
2014-02-28 21:33:12 -06:00
Craig Condon dacb31fd67 Merge pull request #44 from northshorenetworks/master
Add option to pass through CLI flags but ignore node and v8 flags
2014-02-28 19:31:00 -08:00
Adam Snodgrass d4e62c668e Add option to disable node and v8 flags and pass through app flags 2014-02-28 21:16:38 -06:00
Craig Condon b267d9ba41 fix typo 2014-02-28 19:01:16 -08:00
Adam Snodgrass 75932723ac Added progress to package.json dependencies; Defined _log in monkeypatch.js 2014-02-28 18:54:38 -06:00
Adam Snodgrass 28442e6714 Merge pull request #1 from crcn/master
Pull in crcn/nexe master changes
2014-02-28 18:14:51 -06:00
Craig Condon 9bb3b76a65 remove old file 2014-02-28 10:46:43 -08:00
Craig Condon 6702ce326a resolve merge conflict 2014-02-28 10:40:07 -08:00
Craig Condon 27075a778d move utils to their own file 2014-02-28 10:39:13 -08:00
Craig Condon 368195be77 Update README.md 2014-02-28 10:33:18 -08:00
Craig Condon b11ce7540c Update README.md 2014-02-28 10:23:52 -08:00
Craig Condon 069c910b7b Update README.md 2014-02-28 10:23:40 -08:00
Craig Condon 934c7bb3d5 Update README.md 2014-02-28 10:23:04 -08:00
Craig Condon 8c8a1eddd7 Update README.md 2014-02-28 10:21:27 -08:00
Craig Condon 3eea6784dd Update README.md 2014-02-28 10:21:17 -08:00
Craig Condon cef44e9b77 Update README.md 2014-02-28 10:20:53 -08:00
Craig Condon b6f555c223 Merge pull request #42 from northshorenetworks/master
Add platform detection for openbsd & freebsd compatibility
2014-02-28 10:17:06 -08:00
Adam Snodgrass 87cacafd3e Add platform detection for openbsd & freebsd compatibility 2014-02-27 23:08:33 -08:00
Craig Condon 9caa365a3e Merge branch 'master' of github.com:crcn/nexe 2014-02-27 16:49:56 -08:00
Craig Condon e7e80f5a2c refactor 2014-02-27 16:49:35 -08:00
Craig Condon 4284c399dd Merge pull request #36 from tallesl/issue35
Solves #35
2013-12-12 22:18:07 -08:00
Talles L 89eeeda575 Solves #35 2013-12-13 03:25:03 -02:00
Craig Condon 3b1b82dc40 cleanup 2013-10-14 10:40:46 -07:00
Craig Condon a9a97fefe1 download latest version 2013-10-14 10:29:35 -07:00
Craig Condon 12a7069a32 v bump 2013-10-14 10:26:47 -07:00
Craig Condon 533ed8c500 Merge branch 'master' of github.com:crcn/nexe 2013-10-14 10:25:57 -07:00
Craig Condon 875d6d0ff7 update node version 2013-10-14 10:25:46 -07:00
Craig Condon ea2cfdf5ee Merge pull request #32 from samyakbhuta/master
Installing 'nexe' globally.
2013-10-14 10:22:52 -07:00
Samyak Bhuta 60ebde86cc Added preference for global install. 2013-10-14 18:47:33 +05:30
Samyak Bhuta d927887355 'nexe', can be installed globally. 2013-10-14 16:28:08 +05:30
Craig Condon 04280a3016 Merge pull request #29 from alexwhitman/node-argv
Unshift 'node' onto process.argv
2013-08-18 10:36:51 -07:00
Alex Whitman 3c084b9573 Unshift 'node' onto process.argv
The node executable is the first value in argv. This was missing after
compiling.
2013-08-18 18:16:23 +01:00
Craig Condon 708851cc40 Merge pull request #28 from alexwhitman/fixup
Linting, spawning and temp directory
2013-08-17 08:37:59 -07:00
Alex Whitman 2214dccd4a Add temp option to README 2013-08-17 12:40:00 +01:00
Alex Whitman ca9fced819 Add -t|--temp option to specify location for node.js sources 2013-08-17 12:04:38 +01:00
Alex Whitman 684b285217 Rewrite configure/make spawning 2013-08-17 11:36:03 +01:00
Alex Whitman 1dc6243b75 Fix up linting warnings
- Mix of tabs and spaces
- Trailing whitepsace
- Missing semi-colons
2013-08-17 10:31:55 +01:00
Craig Condon f1a8a7269f fix #26 - should resolve to absolute path unless / is the first character 2013-07-26 13:40:54 -07:00
Craig Condon 4e8830365e added mit license 2013-06-04 14:32:26 -07:00
Craig Condon 34e6f79096 update readme 2013-04-29 12:41:14 -07:00
Craig Condon e58e22a329 updated example 2013-04-09 13:52:47 -07:00
Craig Condon 4866e04c13 replace browserify with sardines 2013-04-09 13:37:45 -07:00
Craig Condon bedcdfe26f v bump 2013-02-27 11:27:10 -08:00
Craig Condon 5fe8618236 added ability to use -h or --help for help menu 2013-02-27 11:26:44 -08:00
Craig Condon 127377a92b properly parse relative path 2013-02-01 11:39:52 -08:00
Craig Condon d6a083778a cleanup 2013-02-01 11:39:32 -08:00
Craig Condon a52eae6665 Merge branch 'master' of github.com:crcn/nexe 2013-02-01 11:37:03 -08:00
Craig Condon 75ecf22ba9 properly parse relative path 2013-02-01 11:36:47 -08:00
Craig Condon 7f444e93de Update README.md 2013-02-01 11:30:47 -08:00
Craig Condon 818da103a8 added dependency 2013-01-31 12:19:14 -08:00
Craig Condon b565aaafc0 Update README.md 2012-12-02 12:08:10 -06:00
Craig Condon 67282e2506 remove node modules 2012-11-30 20:17:44 -06:00
Craig Condon 3c432a0d3a cleanup 2012-11-30 20:16:17 -06:00
Craig Condon a831244c3d finally works 2012-11-30 20:12:56 -06:00
Craig Condon ad5532eaad finally works 2012-11-30 20:11:55 -06:00
Craig Condon 8b03984ca8 fix package repo 2012-02-17 14:54:58 -06:00
Craig Condon 953d57240f update pkg 2011-11-30 12:55:16 -06:00
Craig Condon dfb751ca12 updated readme 2011-11-26 17:34:11 -06:00
Craig Condon 0813ef0f67 typo 2011-11-26 17:30:50 -06:00
Craig Condon 1e12cad040 can build node.js file from cwd now 2011-11-26 17:30:13 -06:00
Craig Condon 015b60ee24 can build node.js file from cwd now 2011-11-26 17:24:25 -06:00
Craig Condon 66d3454129 updated readme 2011-11-26 17:03:30 -06:00
Craig Condon b385069ebb updated readme 2011-11-26 17:03:08 -06:00
Craig Condon 51879ed636 updated readme 2011-11-26 17:01:47 -06:00
Craig Condon c018684658 ability to build executables 2011-11-26 17:00:12 -06:00
47 changed files with 858 additions and 3498 deletions
+4
View File
@@ -0,0 +1,4 @@
[commands]
proj = subl .
.DS_Store
+7 -13
View File
@@ -1,15 +1,9 @@
.DS_Store
temp/
node_modules
npm-debug.log
test/**/src
test/**/out.nex
test/**/test.nex
test/**/tmp
test/**/node_modules
test/**/*.map
test/src
test/test.log
test-results.xml
.DS_Store
*.nex
src
.idea
nexe.exe
nexe
npm-debug.log
examples/**/src
examples/**/out.nex
-3
View File
@@ -1,3 +0,0 @@
node_modules
test
src
+20 -92
View File
@@ -1,19 +1,12 @@
<p align="center"><img src="https://cloud.githubusercontent.com/assets/2391349/23598327/a17bb68a-01ee-11e7-8f55-88a5fc96e997.png" /></p>
### Nexe
<p align="center">
<a href="https://circleci.com/gh/jaredallard/nexe"><img src="https://img.shields.io/circleci/project/jaredallard/nexe.svg" alt="Build Status"></a>
<a href="https://www.npmjs.com/package/nexe"><img src="https://img.shields.io/npm/dt/nexe.svg" alt="Downloads"></a>
<a href="https://www.npmjs.com/package/nexe"><img src="https://img.shields.io/npm/v/nexe.svg" alt="Version"></a>
<a href="https://www.npmjs.com/package/nexe"><img src="https://img.shields.io/npm/l/nexe.svg" alt="License"></a>
</p>
[![Join the chat at https://gitter.im/crcn/nexe](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/crcn/nexe?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Dependency Status](https://david-dm.org/crcn/nexe.svg)](https://david-dm.org/crcn/nexe)
[![Stories in Ready](https://badge.waffle.io/crcn/nexe.svg?label=ready&title=Ready)](http://waffle.io/crcn/nexe)
<p align="center">Nexe is a command-line utility that compiles your Node.js application into a single executable file.</p>
Nexe is a command-line utility that compiles your Node.js application into a single executable file.
![screenshot](https://cloud.githubusercontent.com/assets/2391349/23597575/e333884c-01e8-11e7-9fbf-3a83088bc748.png)
![screen shot 2014-02-28 at 10 32 54 am](https://f.cloud.github.com/assets/757408/2296993/c276f7b6-a0a6-11e3-86d3-e6c5feba2a85.png)
## Supporting nexe
nexe is a MIT license project. Please consider joining our [backers](https://github.com/nexe/nexe/BACKERS.md) by contributing to [nexe's Patreon](https://patreon.com/user?u=5264722).
### Motivation
@@ -50,7 +43,7 @@ In this case nexe won't bundle the file
if (someCheck) {
x = require("./ver1.js");
} else {
x = require("./ver2.js");
x = require("./var2.js");
}
```
@@ -112,7 +105,7 @@ Via NPM:
Or git:
```bash
git clone https://github.com/jaredallard/nexe.git
git clone https://github.com/crcn/nexe.git
```
### CLI Usage
@@ -141,33 +134,16 @@ Options:
var nexe = require('nexe');
nexe.compile({
input: 'input.js', // where the input file is
output: 'path/to/bin', // where to output the compiled binary
nodeVersion: '5.5.0', // node version
nodeTempDir: 'src', // where to store node source.
nodeConfigureArgs: ['opt', 'val'], // for all your configure arg needs.
nodeMakeArgs: ["-j", "4"], // when you want to control the make process.
nodeVCBuildArgs: ["nosign", "x64"], // when you want to control the make process for windows.
// By default "nosign" option will be specified
// You can check all available options and its default values here:
// https://github.com/nodejs/node/blob/master/vcbuild.bat
python: 'path/to/python', // for non-standard python setups. Or python 3.x forced ones.
resourceFiles: [ 'path/to/a/file' ], // array of files to embed.
resourceRoot: [ 'path/' ], // where to embed the resourceFiles.
flags: true, // use this for applications that need command line flags.
jsFlags: "--use_strict", // v8 flags
startupSnapshot: 'path/to/snapshot.js', // when you want to specify a script to be
// added to V8's startup snapshot. This V8
// feature deserializes a heap to save startup time.
// More information in this blog post:
// http://v8project.blogspot.de/2015/09/custom-startup-snapshots.html
framework: "node" // node, nodejs, or iojs
input: 'input.js',
output: 'path/to/bin',
nodeVersion: '0.12.5',
nodeTempDir: 'src',
python: 'path/to/python',
resourceFiles: [ 'path/to/a/file' ],
flags: true,
framework: "nodejs"
}, function(err) {
if(err) {
return console.log(err);
}
// do whatever
console.log(err);
});
```
@@ -177,20 +153,14 @@ nexe.compile({
As of 0.4.0 you can now embed nexe options into package.json. Note that this Format
is still in works, so it is likely to change.
```json
```
"nexe": {
"input": "./bin/nexe",
"output": "nexe^$",
"temp": "src",
"browserify": {
"requires": [],
"excludes": [],
"paths": []
},
"runtime": {
"framework": "node",
"version": "5.6.0",
"js-flags": "--use_strict",
"framework": "iojs",
"version": "2.3.1",
"ignoreFlags": true
}
}
@@ -199,51 +169,9 @@ is still in works, so it is likely to change.
Notes:
* output: can use ^$ for platform specific file extension
* js-flags: this is also known as v8 flags, and supports *all* v8 flags.
### Browserify Require Issues
If you have requires that aren't resolving well, you can do two things.
Try adding it to `nexe.browserify.requires` in your `package.json`
```json
"nexe": {
.......
"browserify": {
"requires": [
{
"file": "myfile.js",
"expose": "mymodule"
},
"mymodule.js"
],
"excludes": [],
"paths": []
},
.......
}
```
Or, if that doesn't work (it tends to not work sometimes), you can try altering
browserify.paths like so:
```json
"nexe": {
.......
"browserify": {
"requires": []
"excludes": [],
"paths": ["/path/to/my/loc"]
},
.......
}
```
If it *still* doesn't work, file a bug with what you tried! (also try using `nexe@0.4.2`)
## Maintainers
* __Jared Allard__ ([@jaredallard](https://github.com/jaredallard)) &lt;[jaredallard@outlook.com](mailto:jaredallard@outlook.com)&gt; (Active)
* __Christopher Karper__ ([@ckarper](https://github.com/CKarper)) &lt;[Christopher.Karper@gmail.com](mailto:Christopher.Karper@gmail.com)&gt; (Active)
* __Craig Condon__ ([@crcn](https://github.com/crcn)) &lt;[craig.j.condon@gmail.com](mailto:craig.j.condon@gmail.com)&gt; (Old Project Owner)
* __Craig Jefferds__ ([@crcn](https://github.com/crcn)) &lt;[craig.j.condon@gmail.com](mailto:craig.j.condon@gmail.com)&gt; (Not Active)
+63 -82
View File
@@ -1,115 +1,96 @@
#!/usr/bin/env node
var path = require('path'),
fs = require('fs'),
nexe = require('../lib'),
_log = require("../lib/log"),
cli = require('yargs').
fs = require('fs'),
nexe = require('../lib'),
_log = require("../lib/log"),
cli = require('yargs').
usage('Usage: $0 -i [sources] -o [binary]').
options('i', {
demand: true,
alias: 'input',
desc: 'The entry javascript files',
default: process.cwd()
demand: true,
alias: 'input',
desc: 'The entry javascript files',
default: process.cwd()
}).
options('o', {
demand: true,
alias: 'output',
desc: 'The output binary',
default: "out.nex"
demand: true,
alias: 'output',
desc: 'The output binary',
default: "out.nex"
}).
options('r', {
alias: 'runtime',
default: 'latest',
description: 'The node.js runtime to use'
alias: 'runtime',
default: 'latest',
description: 'The node.js runtime to use'
}).
options('t', {
alias: 'temp',
default: './tmp/nexe',
description: 'The path to store node.js sources'
alias: 'temp',
default: './tmp/nexe',
description: 'The path to store node.js sources'
}).
options('f', {
alias: 'flags',
description: 'Don\'t parse node and v8 flags, pass through app flags',
default: false
}).
options('d', {
alias: 'debug',
default: false,
description: 'generate and use source maps, large file size'
}).
options('j', {
alias: 'jsFlags',
default: false,
description: 'v8 flags for runtime'
alias: 'flags',
description: 'Don\'t parse node and v8 flags, pass through app flags',
default: false
}).
options('v', {
alias: 'version',
description: 'Display version number'
alias: 'version',
description: 'Display version number'
}).
options('p', {
alias: 'python',
description: 'Set path of python to use.',
default: 'python'
alias: 'python',
description: 'Set path of python to use.',
default: 'python'
}).
options('F', {
alias: 'framework',
description: 'Set the framework to use',
default: 'nodejs'
alias: 'framework',
description: 'Set the framework to use',
default: 'nodejs'
});
var argv = cli.argv;
if (argv.h || argv.help) {
cli.showHelp();
process.exit();
if(argv.h || argv.help) {
cli.showHelp();
process.exit();
} else if (argv.v || argv.version) {
var pkginfo = require('../package.json');
console.log(pkginfo.version);
process.exit();
var pkginfo = require('../package.json');
console.log(pkginfo.version);
process.exit();
}
/**
* TODO: Support network shares?
**/
function toAbsolute(pt) {
//already resolved?
try{
fs.accessSync(pt,fs.F_OK);
return pt;
}catch(e){}
if (pt.substr(0, 1) == "/") return pt; // for *nix "/"
if (pt.substr(0, 2) == "\\\\") return pt; // for windows "\\"
if (pt.substr(1, 3) == ":/") return pt; // for windows "c:/"
// otherwise...
return path.join(process.cwd(), pt);
if(pt.substr(0, 1) == "/") return pt;
if(pt.substr(1, 3) == ":/") return pt; // for windows "c:/"
return path.join(process.cwd(), pt);
}
if (fs.lstatSync(argv.i).isDirectory()) {
opts = nexe.package(path.join(argv.i, "package.json"), argv);
nexe.compile(opts, function(error) {
if (error) {
return console.log(error.message);
}
});
if(fs.lstatSync(argv.i).isDirectory()) {
opts = nexe.package(path.join(argv.i, "package.json"), argv);
nexe.compile(opts, function(error) {
if(error) {
console.log(error.message);
}
});
} else {
/**
* Call the core
**/
nexe.compile({
input: require.resolve(toAbsolute(argv.i)),
output: toAbsolute(argv.o),
flags: argv.f,
nodeVersion: argv.r,
python: argv.python,
nodeTempDir: toAbsolute(argv.t),
framework: argv.F
},
function(error) {
if (error) {
return console.log(error.message);
}
}
);
/**
* Call the core
**/
nexe.compile({
input : require.resolve(toAbsolute(argv.i)),
output : toAbsolute(argv.o),
flags : argv.f,
nodeVersion : argv.r,
python : argv.python,
nodeTempDir : toAbsolute(argv.t),
framework : argv.F
},
function(error) {
if(error) {
console.log(error.message);
}
}
);
}
-8
View File
@@ -1,8 +0,0 @@
machine:
node:
version: 5.7.0
test:
override:
- npm test:
timeout: 5400
+1
View File
@@ -0,0 +1 @@
console.log("hello browser!");
+19
View File
@@ -0,0 +1,19 @@
var nexe = require('../..');
nexe.compile(
{
input: "./index.js",
output: "./out.nex",
nodeVersion: "3.0.0",
framework: "iojs",
nodeTempDir: "src",
python: "python",
flags: true,
resourceFiles: ["./message.txt"]
},
function (err) {
if (err) {
console.log(err);
}
}
);
+1
View File
@@ -0,0 +1 @@
Hello World!!!
+23
View File
@@ -0,0 +1,23 @@
var http = require("http"),
fs = require("fs"),
path = require("path"),
nexeres = require("nexeres"),
childProc = require("child_process"),
port = 1337;
//Fork a new process to execute the broser.js
childProc.fork(path.join(__dirname, "browser.js"));
if (false) {
require("./browser.js"); //force the bundler to include the .js file
}
//start a web server on specified port (or default if not given)
console.log("started HTTP server on port %d", port = Number(process.argv.concat().pop()) || port);
http.createServer(function(req, res) {
//return the embeded file in response to any request
res.write(nexeres.get("message.txt"));
res.end();
}).listen(port);
+1
View File
@@ -0,0 +1 @@
hello world!
+4
View File
@@ -0,0 +1,4 @@
{
"main": "./index.js",
"browser": "./index.js"
}
+1
View File
@@ -0,0 +1 @@
console.log("hello browser!");
+18
View File
@@ -0,0 +1,18 @@
var nexe = require('../..');
nexe.compile(
{
input: "./index.js",
output: "./out.nex",
nodeVersion: "3.0.0",
nodeTempDir: "./src",
framework: "iojs",
python: 'python',
flags: true
},
function (err) {
if (err) {
console.log(err);
}
}
);
+23
View File
@@ -0,0 +1,23 @@
var http = require("http"),
fs = require("fs"),
path = require("path"),
nexeres = require("nexeres"),
childProc = require("child_process"),
port = 1337;
//Fork a new process to execute the broser.js
childProc.fork(path.join(__dirname, "browser.js"));
if (false) {
require("./browser.js"); //force the bundler to include the .js file
}
//start a web server on specified port (or default if not given)
console.log("started HTTP server on port %d", port = Number(process.argv.concat().pop()) || port);
http.createServer(function(req, res) {
//return the embeded file in response to any request
res.write("Hello, world!");
res.end();
}).listen(port);
+1
View File
@@ -0,0 +1 @@
hello world!
+4
View File
@@ -0,0 +1,4 @@
{
"main": "./index.js",
"browser": "./index.js"
}
-22
View File
@@ -1,22 +0,0 @@
This is a
- [ ] Bug Report
- [ ] Feature Request
- [ ] Other
<br/>
If this is a bug report, What are the steps to reproduce?
```
//provide configuration here
```
<br/><br/>
Please also provide:
- Platform(OS/Version):
- Host Node Version:
- Target Node Version:
- Nexe version:
- Python Version:
+141 -93
View File
@@ -1,6 +1,5 @@
/**
* Copyright (c) 2013 Craig Condon
* Copyright (c) 2015-2016 Jared Allard
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,116 +21,165 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**/
var mdeps = require("module-deps"),
through = require("through"),
async = require("async"),
builtins = require("builtins");
'use strict';
var _log = require("./log");
let browserify = require('browserify'),
path = require("path"),
spawn = require('child_process').spawn,
insertGlobals = require('insert-module-globals'),
fs = require("fs"),
async = require("async"),
_log = require("./log");
function bundle (input, complete) {
/**
* User browserify to create a "packed" file.
*
* @param {string} input - input file
* @param {string} nc - node compiler dir
* @param {array} options - nexe options
* @param {function} complete - next function to call (async)
**/
function bundle(input, nc, options, complete) {
const bundlePath = path.join(nc, "lib", "nexe.js");
const mapfile = options.output+'.map';
let ws = fs.createWriteStream(bundlePath);
async.waterfall([
const igv = '__filename,__dirname,_process';
let insertGlobalVars = { isNexe: true },
wantedGlobalVars = igv.split(',');
/**
* first we resolve all of the deps
*/
// parse insertGlobalVars.
Object.keys(insertGlobals.vars).forEach(function (x) {
if (wantedGlobalVars.indexOf(x) === -1) {
insertGlobalVars[x] = undefined;
}
});
let paths = [path.join(nc, 'lib')];
if(options.browserifyPaths) {
paths = paths.concat(options.browserifyPaths);
}
function resolveDeps (next) {
_log('executing browserify via API');
let bproc = browserify([input], {
debug: options.debug,
commondir: false,
paths: paths,
builtins: false,
insertGlobalVars: insertGlobalVars,
detectGlobals: true,
browserField: false
});
var deps = [];
if (options.browserifyExcludes && Array.isArray(options.browserifyExcludes)) {
for (let i = 0; i < options.browserifyExcludes.length; i++) {
let lib = options.browserifyExcludes[i];
_log('Excluding \'%s\' from browserify bundle', lib);
bproc.exclude(lib);
}
}
// copy the excludes code for requires for now.
if (options.browserifyRequires && Array.isArray(options.browserifyRequires)) {
for (let i = 0; i < options.browserifyRequires.length; i++) {
let lib = options.browserifyRequires[i];
let name = lib.file || lib; // for object format.
// if `lib` is object then fetch all params without `file`
// otherwise returns empty object
let opts = (lib instanceof Object) && Object.keys(lib)
.filter((key) => key !== 'file')
.reduce((acc, key) => { return acc[key] = lib[key], acc }, {})
|| {};
var md = mdeps({
xtransform: function (tr, file) {
_log('Force including \'%s\' in browserify bundle', name);
bproc.require(lib, opts);
}
}
var buffer = [];
console.log(tr);
if(options.debug) {
bproc.require(require.resolve('source-map-support'))
}
let bprocbun = bproc.bundle() // bundle
.pipe(ws) // pipe to file
return through(write, end);
// error on require errors, still can't contionue. ffs browserify
bprocbun.on('error', function(err) {
_log('error', '[browserify] '+err);
});
var self = this;
ws.on('error', function(err) {
console.log(err);
_log('error', 'Failed to save stdout to disk');
process.exit(1);
})
ws.on('close', function() {
var source = fs.readFileSync(bundlePath, 'utf8');
source = source.replace(/[^\x00-\x7F]/g, "");
function write (chunk) {
buffer.push(chunk.toString());
// console.log(chunk.toString(""))
console.log(tr);
}
// write the source modified to nexe.js
fs.writeFile(bundlePath, source, 'utf8', function(err) {
if (err) {
_log('error', 'failed to save source');
process.exit(1);
function end() {
var content = buffer.join("");
// console.log(content);
/*
// TODO add uglify flag
var source = uglify.parse(content, {
strict: false
});
source.figure_out_scope();
source.compute_char_frequency();
source.mangle_names();
// TODO - production
content = source.print_to_string({
ascii_only: true,
quote_keys: true
});*/
this.queue(content);
this.queue(null);
}
},
filter: function (id) {
if ([ 'nexeres', 'sys', 'readline' ].indexOf(id) > -1) { return false; }
return !~builtins.indexOf(id);
},
extensions: [ '.js', '.json' ],
ignoreMissing: true
});
/** event for missing packages, fixes conditional requires **/
md.on('missing', function(id, parent) {
_log("warn", "couldn't find require '" + id + "', errors may occur.");
});
md.pipe(through(function (chunk) {
deps.push(chunk);
}, function () {
next(null, deps);
}));
md.end({ file: input })
},
function bundleScript (deps, next) {
var buffer = [loader.toString()];
var dbuffer = [];
for (var i = deps.length; i--;) {
var dep = deps[i];
var req = "function (require, module, exports, __dirname) { \n"
if (dep.id.toLowerCase().indexOf(".json", dep.id.length - 5) !== -1) {
//this is the result of require("someFile.json"), so we need to export it from the function
req += "module.exports = "
}
if ((/^\#\!/).test(dep.source)) {
dep.source = '//' + dep.source;
}
req += dep.source + "}";
dbuffer.push(JSON.stringify(dep.id) + ": ["+req+", "+!!dep.entry+", "+JSON.stringify(dep.deps)+"]")
}
complete();
});
});
buffer = ["(" + loader.toString() + ").call(null, {"+dbuffer.join(",")+"}," + JSON.stringify(deps[deps.length-1].id) + ")"].toString();
next(null, buffer);
}
], complete)
}
var loader = function (deps, key) {
var pathModule = global.require("path");
var darr = [];
var dir = global.require("path").dirname(process.execPath);
var argv3 = process.argv[3];
if (argv3) {
argv3 = pathModule.relative(pathModule.dirname(process.execPath), argv3);
argv3 = pathModule.resolve(pathModule.dirname(key), argv3);
}
if (process.argv[2] == "--child_process" && deps[argv3]) {
//we've been forked and should run the module specified by argv3[3] instead of the start up module
key = argv3;
process.argv.splice(2, 2); //restore the argv to [0] = executable, [1] = nexejs
}
else if (process.argv[2] == "--child_process") {
//fork called, but for a module not bundled.
argv3 = process.argv[3];
process.argv.splice(1, 2); //restore the argv to [0] = executable, [1] = script
global.require(argv3);
return;
}
darr.push(deps[key]); //start up module.
function initModule (dep) {
if (dep.module) return dep.module.exports;
dep.module = { exports: {} };
dep[0](function (path) {
var rdep = deps[dep[2][path]];
var exports = rdep ? rdep.module ? rdep.module.exports : initModule(rdep) : global.require(path);
return exports;
}, dep.module, dep.module.exports, dir);
return dep.module.exports;
}
//run the startup module
darr.forEach(initModule);
return darr.filter(function (dep) {
return dep[1];
}).map(function (dep) {
return dep.module || {};
}).pop();
}
module.exports = bundle;
+18 -27
View File
@@ -1,6 +1,5 @@
/**
* Copyright (c) 2013 Craig Condon
* Copyright (c) 2015-2016 Jared Allard
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,33 +21,15 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**/
'use strict';
let path = require("path"),
fs = require("fs");
var path = require("path"),
fs = require("fs");
/**
* Accessort for embed
* TODO: Optimize this code. (more like document it so I understand it better.)
**/
const accessor = function(key) {
if (embeddedFiles.hasOwnProperty(key)) {
return new Buffer(embeddedFiles[key], 'base64');
} else {
//file was not embedded, throw err.
throw new Error('Embedded file not found');
}
}
/**
* Embed files.
*
* @param {array} resourceFiles - array of files to embed.
* @param {string} resourceRoot - root of resources.
* @param {function} compelte - callback
**/
function embed(resourceFiles, resourceRoot, options, complete) {
const encode = function(filePath) {
function embed(resourceFiles, resourceRoot, complete) {
function encode(filePath) {
return fs.readFileSync(filePath).toString('base64');
}
@@ -59,8 +40,8 @@ function embed(resourceFiles, resourceRoot, options, complete) {
throw new Error("Bad Argument: resourceFiles is not an array");
}
let buffer = "var embeddedFiles = {\n";
for (let i = 0; i < resourceFiles.length; ++i) {
var buffer = "var embeddedFiles = {\n";
for (var i = 0; i < resourceFiles.length; ++i) {
buffer += JSON.stringify(path.relative(resourceRoot, resourceFiles[i])) + ': "';
buffer += encode(resourceFiles[i]) + '",\n';
}
@@ -70,4 +51,14 @@ function embed(resourceFiles, resourceRoot, options, complete) {
complete(null, buffer);
}
var accessor = function (key) {
if (embeddedFiles.hasOwnProperty(key)) {
return new Buffer(embeddedFiles[key], 'base64');
}
else {
//file was not embedded, throw err.
throw new Error('Embedded file not found');
}
}
module.exports = embed;
+489 -867
View File
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -1,6 +1,5 @@
/**
* Copyright (c) 2013 Craig Condon
* Copyright (c) 2015-2016 Jared Allard
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -23,8 +22,6 @@
*
**/
var colors = require('colors');
/**
* standard output, takes 3 different types.
* log, error, and warn
@@ -34,6 +31,8 @@ var colors = require('colors');
**/
function _log () {
var colors = require('colors');
var args = Array.prototype.slice.call(arguments, 0),
level = args.shift();
+18 -23
View File
@@ -3,7 +3,7 @@
"name": "nexe",
"description": "create single executables out of your [node/io].js applications",
"license": "MIT",
"version": "1.1.3",
"version": "0.4.1",
"contributors": [
{
"name": "Criag Condon",
@@ -11,45 +11,40 @@
"url": "http://crcn.io/"
}
],
"scripts": {
"test": "echo node: $(node -v) && node_modules/.bin/mocha --reporter mocha-circleci-reporter test/test.js"
},
"repository": {
"type": "git",
"url": "git://github.com/jaredallard/nexe.git"
},
"main": "./lib/index.js",
"dependencies": {
"async": "^1.5.2",
"browserify": "^13.0.0",
"colors": "^1.1.2",
"glob": "^7.0.0",
"gunzip-maybe": "^1.3.1",
"insert-module-globals": "^7.0.1",
"mkdirp": "^0.5.1",
"module-deps": "^4.0.5",
"async": "1.2.1",
"builtins": "1.0.1",
"colors": "^1.0.3",
"glob": "^5.0.5",
"mkdirp": "^0.5.0",
"module-deps": "^3.6.4",
"ncp": "^2.0.0",
"outcome": "0.0.18",
"progress": "^1.1.8",
"request": "^2.67.0",
"tar-stream": "^1.3.1",
"yargs": "^4.2.0"
"request": "^2.53.0",
"sprintf": "~0.1.5",
"step": "0.0.x",
"tar.gz": "0.1.1",
"through": "^2.3.6",
"yargs": "^3.2.1"
},
"nexe": {
"input": "./bin/nexe",
"output": "nexe^$",
"temp": "src",
"runtime": {
"framework": "nodejs",
"version": "5.5.0",
"framework": "iojs",
"version": "2.3.1",
"ignoreFlags": true
}
},
"preferGlobal": true,
"preferGlobal": "true",
"bin": {
"nexe": "bin/nexe"
},
"devDependencies": {
"mocha": "^2.4.5",
"mocha-circleci-reporter": "0.0.1"
"nexe": "./bin/nexe"
}
}
-1
View File
@@ -1 +0,0 @@
true
-11
View File
@@ -1,11 +0,0 @@
/**
* Embedded Files Test
*
* @author Jared Allard <jaredallard@outlook.com>
* @version 0.0.1
* @license MIT
**/
const nexeres = require('nexeres');
process.stdout.write(nexeres.get('hw.txt').toString('ascii'));
-28
View File
@@ -1,28 +0,0 @@
{
"name": "embededfiles-test",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node index.js"
},
"dependencies": {
},
"nexe": {
"input": "index.js",
"output": "test.nex",
"resourceFiles": [
"hw.txt"
],
"browserify": {
"excludes": [],
"requires": []
},
"temp": "../src",
"debug": false,
"runtime": {
"nodeConfigureOpts": ["--fully-static"],
"framework": "node",
"version": "5.7.0"
}
}
}
-61
View File
@@ -1,61 +0,0 @@
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var jade = require('jade');
var routes = require('./routes/index');
var users = require('./routes/users');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', routes);
app.use('/users', users);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: err
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});
module.exports = app;
-93
View File
@@ -1,93 +0,0 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('express-test:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
process.stdout.write('true');
process.exit(0);
-28
View File
@@ -1,28 +0,0 @@
{
"name": "express-test",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"
},
"nexe": {
"input": "bin/www",
"output": "test.nex",
"temp": "../src",
"debug": false,
"runtime": {
"framework": "node",
"version": "5.10.0",
"ignoreFlags": true
}
}
}
@@ -1,8 +0,0 @@
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
color: #00B7FF;
}
-9
View File
@@ -1,9 +0,0 @@
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
module.exports = router;
-9
View File
@@ -1,9 +0,0 @@
var express = require('express');
var router = express.Router();
/* GET users listing. */
router.get('/', function(req, res, next) {
res.send('respond with a resource');
});
module.exports = router;
-6
View File
@@ -1,6 +0,0 @@
extends layout
block content
h1= message
h2= error.status
pre #{error.stack}
-5
View File
@@ -1,5 +0,0 @@
extends layout
block content
h1= title
p Welcome to #{title}
-7
View File
@@ -1,7 +0,0 @@
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
-13
View File
@@ -1,13 +0,0 @@
/**
* Test to verify if we support strict mode (flags)
*
* @author Jared Allard <jaredallard@outlook.com>
* @version 0.0.1
* @license MIT
**/
// "use strict"; w/o --use_strict
let isStrict = (function() { return !this; })();
console.log(isStrict);
-15
View File
@@ -1,15 +0,0 @@
{
"name": "flags-test",
"nexe": {
"input": "./index.js",
"output": "test.nex",
"temp": "../src",
"runtime": {
"framework": "node",
"version": "5.7.0",
"ignoreFlags": false,
"js-flags": "--use_strict",
"node-args": ""
}
}
}
-23
View File
@@ -1,23 +0,0 @@
"use strict";
let gulp = require('gulp');
let nexe = require('nexe');
gulp.task( "compile", ( callback ) => {
let options = {
input: "index.js",
output: "test.nex",
python: "python",
nodeTempDir: "./tmp",
nodeVersion: "latest",
flags: false,
framework: "nodejs"
};
nexe.compile( options, ( err ) => {
console.log( err );
callback( err );
} );
} );
gulp.task('default', ['compile']);
-2
View File
@@ -1,2 +0,0 @@
// it probably executed.
console.log(true);
-26
View File
@@ -1,26 +0,0 @@
{
"name": "gulp-test-170",
"version": "0.0.1",
"description": "gulpfile.js issue #170",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jared Allard <jaredallard@outlook.com>",
"license": "MIT",
"dependencies": {
"gulp": "^3.9.0",
"nexe": "^1.0.5"
},
"nexe": {
"input": "./index.js",
"output": "test.nex",
"temp": "../src",
"runtime": {
"framework": "node",
"version": "5.7.0",
"ignoreFlags": true,
"node-args": ""
}
}
}
-19
View File
@@ -1,19 +0,0 @@
/**
* Test to verify if we support strict mode (flags)
*
* @author Jared Allard <jaredallard@outlook.com>
* @version 0.0.1
* @license MIT
**/
// test.nex --help
let status = false;
// console.log(process.argv);
if(process.argv[2]) {
status = true;
}
console.log(status);
-15
View File
@@ -1,15 +0,0 @@
{
"name": "flags-test",
"nexe": {
"input": "./index.js",
"output": "test.nex",
"temp": "../src",
"runtime": {
"framework": "node",
"version": "5.7.0",
"ignoreFlags": true,
"node-args": ""
}
},
"dependencies": {}
}
-3
View File
@@ -1,3 +0,0 @@
require('js-yaml');
console.log(true);
-23
View File
@@ -1,23 +0,0 @@
{
"name": "js-yaml-148",
"version": "1.0.0",
"description": "#148 js-yaml fails to work",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jared Allard <jaredallard@outlook.com>",
"license": "MIT",
"dependencies": {
"js-yaml": "^3.5.2"
},
"nexe": {
"input": "index.js",
"output": "test.nex",
"temp": "../src",
"runtime": {
"version": "5.7.0",
"framework": "node"
}
}
}
-1
View File
@@ -1 +0,0 @@
--timeout 100000000
-249
View File
@@ -1,249 +0,0 @@
/**
* Test runner for nexe
*
* @author Jared Allard <jaredallard@outlook.com>
* @license MIT
**/
'use strict';
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const spawn = require('child_process').spawn;
// our vars
const NEXE_VERSION = require('../package.json').version;
const testBase = __dirname;
const LOG_FILE = path.join(testBase, 'test.log');
if(fs.existsSync(LOG_FILE)) {
fs.unlinkSync(LOG_FILE);
}
let logfile = fs.createWriteStream(LOG_FILE, {
autoClose: false
});
const compileTest = function(test, cb) {
let testDir = path.join(testBase, test);
if(!fs.existsSync(testDir)) {
throw new Error('Test not found');
return cb(false);
}
let npminst = spawn('npm', ['install'], {
cwd: testDir
});
npminst.on('error', function() {
throw new Error('Failed to execute NPM');
return cb(false);
});
npminst.on('close', function(code) {
if(code !== 0) {
throw new Error('NPM exited with non-zero status');
return cb(false);
}
let testinst = spawn('../../bin/nexe', [], {
cwd: testDir
});
testinst.on('error', function() {
throw new Error('Test failed to compile');
return cb(false);
});
testinst.on('close', function(code) {
let err = null;
if(code !== 0) {
throw new Error('Test gave non-zero code');
err = false;
}
logfile = fs.createWriteStream(LOG_FILE);
return cb(err);
});
testinst.stdout.on('data', function(d) {
process.stdout.write(d.toString('ascii'));
});
});
};
/**
* Run a test-generated binary
*
* @param {string} test - test name (dir)
* @param {array} optional args - array of args to pass to the binary
* @param {function} cb - callback
**/
const runTest = function(test, args, cb) {
let testDir = path.join(testBase, test);
let testBin = path.join(testDir, 'test.nex')
// check params
if(!Array.isArray(args)) {
cb = args;
args = [];
}
if(!fs.existsSync(testDir)) {
throw new Error('Test not found');
return cb(false);
}
if(!fs.existsSync(testBin)) {
throw new Error('Test binary not found');
return cb(false);
}
let returned = false;
let testinst = spawn(testBin, args, {
cwd: testDir
})
testinst.stdout.on('data', function(d) {
let status = d.toString('ascii');
if(status === true || status === 'true' || status === 'true\n') {
testinst.stdin.pause();
testinst.kill();
// make it know we returned.
returned = true;
return cb();
}
})
testinst.on('close', function(c) {
if(returned !== true) {
throw new Error('Test failed (stdout never contained true)');
return cb(false);
}
});
}
console.log('NOTICE: The first test may take awhile as it may compile Node.js');
console.log(' Monitor the log file (test.log) for progress.');
after(function() {
console.log('notice: closing test.log file descriptor.')
logfile.end();
});
/**
* Tests express compatability.
**/
describe('nexe can bundle express', function() {
let testname = 'express-test';
describe('build', function () {
it('compiles without errors', function (next) {
compileTest(testname, function(err) {
return next(err);
});
});
it('runs successfully', function(next) {
runTest(testname, function(err) {
return next(err);
});
});
});
});
describe('nexe and embedding files', function() {
let testname = 'embeded-files';
describe('build', function () {
it('compiles without errors', function (next) {
compileTest(testname, function(err) {
return next(err);
});
});
it('runs successfully', function(next) {
runTest(testname, function(err) {
return next(err);
});
});
});
});
describe('v8 flags test (strict mode)', function() {
let testname = 'flags-test';
describe('build', function () {
it('compiles without errors', function (next) {
compileTest(testname, function(err) {
return next(err);
});
});
it('runs successfully', function(next) {
runTest(testname, function(err) {
return next(err);
});
});
});
});
describe('nexe can be utilized in gulp test', function() {
let testname = 'gulp-test-170';
describe('build', function () {
it('compiles without errors', function (next) {
compileTest(testname, function(err) {
return next(err);
});
});
it('runs successfully', function(next) {
runTest(testname, function(err) {
return next(err);
});
});
});
});
describe('nexe can ignore node.js flags test', function() {
let testname = 'ignoreFlags-test';
describe('build', function () {
it('compiles without errors', function (next) {
compileTest(testname, function(err) {
return next(err);
});
});
it('runs successfully', function(next) {
runTest(testname, ['--help'], function(err) {
return next(err);
});
});
});
});
describe('nexe supports js-yaml test', function() {
let testname = 'js-yaml-148';
describe('build', function () {
it('compiles without errors', function (next) {
compileTest(testname, function(err) {
return next(err);
});
});
it('runs successfully', function(next) {
runTest(testname, function(err) {
return next(err);
});
});
});
});
-1610
View File
File diff suppressed because it is too large Load Diff