cozy-labs / cozy-light

Personal Server Made Easy
http://cozy-labs.github.io/cozy-light/
GNU Affero General Public License v3.0
104 stars 13 forks source link

needs some references about writing applications #8

Closed maboiteaspam closed 8 years ago

maboiteaspam commented 10 years ago

Hi,

I found out the currently lised of non static apps (contacts/tasky/calendar) are not consistent, imho.

It s about both package.json and main script file.

As some examples,

Calendar

https://github.com/cozy-labs/calendar/blob/master/package.json

  "displayName": "Calendar",
  "cozy-permissions": {
    ...
  }

https://github.com/cozy-labs/calendar/blob/master/server.coffee

            callback err, app, server

Files

https://github.com/cozy-labs/files/blob/master/package.json

  "displayName": "Files",
  "cozy-permissions": {
    ...
  }

https://github.com/cozy-labs/files/blob/master/server.coffee

            initialize.afterStart app, server, callback

Contacts

https://github.com/cozy-labs/contacts/blob/master/package.json

  "displayName": "Contacts",
  "cozy-permissions": {
    ...
  },
  "cozy-widget": "/apps/contacts/widget"

https://github.com/cozy-labs/contacts/blob/master/server.js

  return americano.start(options, function(app, server) {
    return callback(null, app, server);
  });

Question are, Shall we use displayName or cozy-displayName ? Is preferred server callback signature equal callback(err, app, server); ? What is cozy-widget / permissions ? Where to find more informations about them ?

thanks for help

frankrousseau commented 10 years ago

Yeah, you're right we definitely have to improve the coherence between apps.

Shall we use displayName or cozy-displayName ?

We should use displayName.

Is preferred server callback signature equal callback(err, app, server); ?

Not sure to undersand but callback(err, app, server); seems fine.

What is cozy-widget / permissions ? Where to find more informations about them ?

Something related to full Cozy, we should remove them.

frankrousseau commented 10 years ago

I cleaned the manifest file. I still have to make the server.coffee files more consistant.

frankrousseau commented 10 years ago

I think now server.coffee files are consistent when they call the final callback.

maboiteaspam commented 10 years ago

i found a difficulty with calendar. When i try to stop cleanly by properly releasing all resources, it stucks when calendar is loaded. It exists properly when it s not loaded. Not sure which resource is not closed.

frankrousseau commented 10 years ago

Ok. I'll look at it.

maboiteaspam commented 9 years ago

On the same topic, recently i re?discovered JSON hyper schema. http://json-schema.org/

I think it s not wide spead yet, to me the idea is fantastic and could help to better describe app.


I want also discuss about the application loading. Now, app must reference it s main field in package.json as the one that shares cozy handlers (start/stop). I think it s kind of intrusive regarding apps, i d like to suggest and evaluate a change to try to load a cozy.js file within the module location instead. Their, the developer can put the logic related to cozy application loading via provided handlers. Also, the developper can keep freedom to set the main field to whatever is needed, or preferred.