Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS X Lion Support #2

Open
joemccann opened this issue Mar 31, 2013 · 10 comments
Open

Mac OS X Lion Support #2

joemccann opened this issue Mar 31, 2013 · 10 comments

Comments

@joemccann
Copy link

First off, great work.

I'm curious though how to create a .app executable for Mac OS X Lion.

I've read the following:

  1. download and extract appjs-0.0.20-darwin-ia32.zip
  2. cd to data/ and then run npm install appjs-package
  3. Save app.js to data/app.js
  4. Save package.json to data/package.json
    5.download example-apps/ and run them with appjs to check that everything is setup correctly.

at: http://appjs.delightfulsoftware.com/

Step five isn't clear, particularly the "run them with appjs" piece. How do you "run them with appjs"?

Finally, how can we take an appjs app and package it so it is a .app file.

@sihorton
Copy link
Owner

sihorton commented Apr 2, 2013

Hi Joe,
In a terminal type:

$basedir/data/bin/node --harmony $basedir/data/app.js "path_to_app_file"

where "$basedir" is the full path the node executable that you found in the appjs-0.0.20-darwin-ia32.zip file that you extracted, then you can pass in path to the app.js file for your application if running from a directory or the path to the .app file.

To create the .app file you can hopefully extract appjs-appPackager to a folder and then from the terminal appPackager "path_to_application_folder" and it should output a .app file.

I have not tested on Mac architecture yet so that is why the instructions are unclear. I was waiting until the next version of appjs but maybe I should just jump in and try and get this architecture supported as well. Let me know how you get along and I will also try to get this functioning on a Mac and then post an update to the instructions.

@joemccann
Copy link
Author

Thanks for the reply. Sadly, this doesn't work even in the examples directory of appjs-appPackager:

node appPackager.js example

It errors out with:

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

RangeError: Maximum call stack size exceeded

Thoughts?

@sihorton
Copy link
Owner

sihorton commented Apr 2, 2013

What version of node are you using? That looks like a depreciated warning that it is giving. If you type in:

node

then it should enter the REPL and you can type in

process.version

to get the version number of node, I think it should be working with 0.8.x, you can give the absolute path to the version of node that is part of the appjs 0.20 distributable for appjs available from appjs.org.

There are some example apps available from http://appjs.delightfulsoftware.com/example-apps/ so for example helloWorld.appjs should give you an example of the expected layout of the application. It is really just a zip file so you can rename the extension to be .zip and then extract the contents to view. Unfortunately the libraries I was using are not that well featured so if you take a normal zip and rename extension to .appjs it probably won't work. You can also pass the path to the .appjs file to appPackager and it should unpack the package for you.

See if that helps you to get further with the tool.

@joemccann
Copy link
Author

ahh, yeah derp, forgot to path it to the node 0.8.x binary

./data/bin/node appPackager.js example

@joemccann
Copy link
Author

But now, I get this, but no .app file (folder)

scanning node_modules
wrote example/deploy/adm-zip-0.1.5-darwin.modpack
wrote example/package.json
scanning folder: example
wrote example/deploy/example.appjs.json
.DS_Store
app.js
excluding:deploy
example.appjs
excluding:node_modules
package.json
packagedApp.js
wrote  example/deploy/adm-zip-0.1.5-darwin.modpack.gz
wrote example/deploy/example.appjs
wrote example/deploy/example.appjs.zip 155k

@joemccann
Copy link
Author

thoughts?

@sihorton
Copy link
Owner

sihorton commented Apr 3, 2013

If you look in example/deploy there should be a file example.appjs that is the packaged app -- it is cross platform so you can run that on a windows or linux box. If you use extensions then there is support for automatically downloading and installing native or js modules although it needs to be improved a little.

@sihorton
Copy link
Owner

sihorton commented Apr 3, 2013

So you can take the example folder and then change the app.js script and the data/contents folder adding in your javascript / html / images etc, then you use the packager to turn it all into a single file and then can run from that file.

@joemccann
Copy link
Author

What do you mean if I "use extensions"?

Essentially, I want to be able to add this to my "Applications" folder with all my other Mac apps. None of the generated files from appPackager create a .app file. How do I do this?

Thanks for your help, but it's not clear to me. =)

@sihorton
Copy link
Owner

sihorton commented Apr 3, 2013

ok, appjs combines nodejs and webkit into a single executable. You can then write desktop applications by using web technologies (html5 / javascript). The disadvantage with "normal" html5 apps is that you cannot access the desktop and read and write files and so on (this would be a security problem). However appjs gets around this limitation by enabling communication between nodejs and webkit so the nodejs part can read and write to disk and even read the serial port and do whatever it wants. In the example demo the "app.js" part is run inside nodejs and so has no security restrictions. The data/contents folder holds your html5 web application that is run in webkit.

The appjs-appPackager is a script that takes this directory structure and then creates a single file containing everything (a .appjs file) this makes it much nicer to handle and allows you to send your app to someone else. Nodejs can use native extensions (written in C) and also javascript extensions. These let you access databases and do many different things.

For Mac I know that you can get a directory called something.app and the OS will then treat it like an application so you can launch it etc. I have done work on windows and linux to make these .appjs files integrate with the desktop but not yet done that on Mac. Ideally though it should not be too difficult to alter the format (is there a default script name to launch the app?) and then rather than having a compressed file like .appjs it could be a directory instead.

Hope that makes more sense, the tool does not yet create mac .app output yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants