ZappaJS 1.0.3 is out!

12 views
Skip to first unread message

step...@shimaore.net

unread,
Sep 6, 2014, 3:02:02 PM9/6/14
to zap...@googlegroups.com
Hello,

ZappaJS 1.0.3 is out. This version has its full regression test suite
updated for Express 4, you should check it out!
Most of the examples/* have been updated as well (except for the share_*
examples, which require more research into Socket.IO changes).

I would appreciate feedback on whether you would prefer to see
Express dependencies taken out of Zappa (i.e. move `express` from
dependencies to devDependencies) so that you may update Express versions
in your applications without waiting for a new version of ZappaJS 1.x.
I've already removed the hardcoded dependency on Socket.IO, this is
reflected in the new README:
https://github.com/zappajs/zappajs/tree/express-4

Documentation is next :}
S.

klr...@gmail.com

unread,
Sep 7, 2014, 4:45:51 AM9/7/14
to zap...@googlegroups.com
Hi Stephane,

awesome work, thanks.

Did the same with teacup playing with koa so the old views work mostly.

It is a good idea to take out express, if there were no speed bumps I'd even suggest taking out coffeescript as it seems that people are using various versions because of yield syntax preferences, I use this currently https://github.com/xixixao/coffee-script ("-->" and "==>") for Zappa 0.4 and koa in devopment though  staying on trodden paths in production. Some wandered off to CS sibling http://livescript.net/ (from Coco). Luther, Calvin, Zwingli, Anabaptists...

K.

klr...@gmail.com

unread,
Sep 7, 2014, 5:05:07 AM9/7/14
to zap...@googlegroups.com
hmm, alubbe just posted this on the CS list, in case someone is not on it

-------- Original Message --------
Subject: Re: [coffeescript] using 'yield' automatically turns functions into generators (#3240)
Date: Sat, 06 Sep 2014 08:36:16 -0700
From: alubbe <notifi...@github.com>
Reply-To: jashkenas/coffeescript <reply+i-22761503-19218cfada1961a...@reply.github.com>
To: jashkenas/coffeescript <coffee...@noreply.github.com>

so here is the long awaited update, merge-ready. Includes yield, yield from, yield return and yield within if statements, operations, etc.

In short, we can now write awesome controller code like this:

exports.search = ->
  if user = yield User.findOne(username: @params.searchTerm)
    @body = user
  else if project = yield Project.findOne(name: @params.searchTerm)
    @body = project
  else
    @body = result: "No user or Project found!"

In long, generators are now implicit. The function body is scanned for yield/yield from and then turned into a generators. To create a generator that does not yield, just use coffee -> yield return. Test suite is included & updated.

El sábado, 6 de septiembre de 2014 21:02:02 UTC+2, Stephane escribió:

step...@shimaore.net

unread,
Sep 7, 2014, 7:01:00 AM9/7/14
to zap...@googlegroups.com
Hi K,

> It is a good idea to take out express,

Well I thought about it overnight, basically the options are:

1) Keep the existing (0.x) behavior and hardcode Express;
dependencies: "express": "4.8.8"
@express = require 'express'

Obviously doesn't work well since it prevents easy upgrades to Express
independently from Zappa.

2) Leave Express dependency open, latest Express 4 is used
dependencies: "express": "^4"
@express = require 'express'

Basically we lose control over everything, tests are meaningless.

3) Do not include Express in ZappaJS
@express = require 'express'

Makes first-time use more difficult, you need to manually install
express; also need to remember to `npm install --save` even for
old-timers. Too cumbersome.

4) Hardcode Express but allow to override it using an option (similar to
what was implemented by twhtanghk for socket.io);
dependencies: "express": "4.8.8"
@express = options.express ? require 'express'

I think 1-3 all have maintainability / dependency graph / test issues,
and #4 is the best approach: it provides a meaningul, tested default,
but allows power-users to upgrade at will. It's also consistent with how
we treat socket.io.
This can also be extended to express-session and serve-static if needed.


There's a similar-but-not-quite-identical issue with jquery, sammy, and
socket.io-client. The current (1.0.4) README says:

If you also intend to @use 'zappa' or reference ZappaJS's client
Javascript (which is the case for most of the examples):

npm install socket.io-client jquery git+https://github.com/quirkey/sammy.git

which in retrospect is the worst thing I could have done. :( I'll revert
this to provide defaults and allow override.


While I'm at it I might reference the comments I made in GH#102 and
summarize them here:

- No backported solutions to middleware. Use the new Express middleware
packages:

@use (require 'body-parser').urlencoded()

- Extended ZappaJS to require the module on the fly:

@use morgan:'combined'

works as long as you `npm install morgan` in your app.

- Added `@session` as a reference to the `export-session` module in the
root scope:

ExpressRedisStore = (require 'connect-redis') @session
@use session:
store: new ExpressRedisStore redis_config
secret: the_secret

> if there were no speed bumps I'd even suggest taking out coffeescript

Yup, coffee-script is only a devDependency now.
S.

Srdjan Strbanovic

unread,
Sep 7, 2014, 12:47:58 PM9/7/14
to zap...@googlegroups.com
Awesome! Thanks!

step...@shimaore.net

unread,
Sep 7, 2014, 5:53:08 PM9/7/14
to zap...@googlegroups.com
Hello again,

[I wrote earlier:]
> Most of the examples/* have been updated as well (except for the share_*
> examples, which require more research into Socket.IO changes).

Those have also been updated.

> Documentation is next :}

I went over the documentation and believe it is up-to-date. I still need
to sync between the examples in the documentation and their counterparts
in the test suite to make sure the examples in the documentation actually
pass tests, but that's an ongoing effort.


In the meantime I released the first version of ZappaJS with Express-4
I would consider ready for serious testing and numbered it 1.1.0. I'd
appreciate any feedback you'd have regarding this new release!

...And thank you to everyone who chimed in, your support is much
appreciated!-)
Stéphane

klr...@gmail.com

unread,
Sep 8, 2014, 3:41:58 AM9/8/14
to zap...@googlegroups.com
Absolutely, flavour 4 is the best IMHO 


El sábado, 6 de septiembre de 2014 21:02:02 UTC+2, Stephane escribió:
Reply all
Reply to author
Forward
0 new messages