mikaelbr / node-osascript

A stream for Apple Open Scripting Architecture (OSA) through AppleScript or Javascript
MIT License
54 stars 5 forks source link

Add flags to make it possible to change return styles from osascript #3

Closed mischah closed 9 years ago

mischah commented 9 years ago

Makes it possible to return a string representation of an JavaScript object from JXA back in the node.js world:

// Default return
osascript('(function(){return ["foo",5, {foo: "barz"}]})()', function (data) {
  console.log(data); // foo, 5, foo:barz
});

// JSON parsable return
osascript('(function(){return ["foo",5, {foo: "barz"}]})()', {flags: ['-s', 's']}, function (data) {
  console.log(data); // ["foo", 5, {"foo":"barz"}]
});

See examples/js/return.js and osascript man page


I could squash commits if you prefer a shorter history :octocat:

mischah commented 9 years ago

Did you had a chance to review the changes?

Reason for my reminder. I need this changes in my itunes cli and referencing my fork for now in my package.json. But I would like to get rid of this ;)

mikaelbr commented 9 years ago

Oh, yeah. Sorry. This totally slipped through the cracks within a busy schedule. I looked at it, but didn't get the chance to test it out and merge. But it looks good! Thanks for your help!

mikaelbr commented 9 years ago

I've also added you as a collaborator to the project, so you can merge the PR yourself :+1:

mischah commented 9 years ago

Thanks man :blush:

Would you add me as collaborator to the npm too?

cd path/to/node-osascript
npm owner add mischah

Otherwise I would ping you as soon as the new version is ready to publish on npm.

mikaelbr commented 9 years ago

I'm happy to add you as collaborator on NPM as well. Same username as here? (edit, saw you posted your username above)

Deployment rutines (strictly following semver):

  1. Bump version according to semver in package.json
  2. Create commit with the bumped version
  3. Create git tag (github release) (e.g. git tag -a v1.1.0 -m "v1.1.0")
  4. npm publish

(I'm using a tool (mversion) for steps 1. to 3., but feel free to do what ever you want).

mischah commented 9 years ago

Thanks. Same Deployment routines I like to use :ok_hand:

mikaelbr commented 9 years ago

I also try to update the release log when it makes sense. Haven't done too good of a job in this repo, though.

mikaelbr commented 9 years ago

Btw, I've added you to NPM: https://www.npmjs.com/package/osascript

mischah commented 9 years ago

Thanks :sparkling_heart: