Skip to content

cozy/cozy-settings

Repository files navigation

Travis build status shield NPM release version shield Github Release version shield NPM Licence shield

Cozy Settings

What's Cozy?

Cozy Logo

Cozy is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you.

What's Settings?

Cozy Settings make your Cozy configuration easy to manage. Main features are:

  • Connected devices management
  • Storage information

Hack

📌 Note: we recommend to use Yarn instead of NPM for package management. Don't hesitate to install and use it for your Cozy projects, it's now our main node packages tool for Cozy official apps.

Install and run in dev mode

Hacking the Settings app requires you to setup a dev environment.

You can then clone the app repository and install dependencies:

$ git clone https://github.com/cozy/cozy-settings.git
$ cd cozy-settings
$ yarn install

📌 If you use a node environment wrapper like nvm or ndenv, don't forget to set your local node version before doing a yarn install.

Cozy's apps use a standard set of npm scripts to run common tasks. You can so start you development workflow with:

$ cd cozy-settings
$ yarn run watch:server

and point your browser to http://localhost:8090. ⚠️ Be aware that password based actions only works on .localhost domain.

Run it inside the VM

You can easily view your current running app, you can use the cozy-stack docker image:

# in a terminal, run your app in watch mode
$ cd cozy-settings
$ yarn watch:browser
# in another terminal, run the docker container
$ docker run --rm -it -p 8080:8080 -v "$(pwd)/build":/data/cozy-app/settings cozy/cozy-app-dev
or
$ yarn stack:docker

your app is available at http://settings.cozy.tools:8080.

Note about Cozy-ui

Cozy-ui is our frontend stack library that provides common styles and components accross the whole Cozy's apps. You can use it for you own application to follow the official Cozy's guidelines and styles. If you need to develop / hack cozy-ui, it's sometimes more useful to develop on it through another app. You can do it by cloning cozy-ui locally and link it to yarn local index:

git clone https://github.com/cozy/cozy-ui.git
cd cozy-ui
yarn install
yarn link

then go back to your app project and replace the distributed cozy-ui module with the linked one:

cd cozy-settings
yarn link cozy-ui

You can now run the watch task and your project will hot-reload each times a cozy-ui source file is touched.

Tests

Tests are run by mocha under the hood, and written using chai and sinon. You can easily run the tests suite with:

$ cd cozy-settings
$ yarn test

📌 Don't forget to update / create new tests when you contribute to code to keep the app the consistent.

Models

The Cozy datastore stores documents, which can be seen as JSON objects. A doctype is simply a declaration of the fields in a given JSON object, to store similar objects in an homogeneous fashion.

Cozy ships a built-in list of doctypes for representation of most of the common documents (Bills, Contacts, Files, ...).

Whenever your app needs to use a given doctype, you should:

  • Check if this is a standard doctype defined in Cozy itself. If this is the case, you should add a model declaration in your app containing at least the fields listed in the main fields list for this doctype. Note that you can extend the Cozy-provided doctype with your own customs fields. This is typically what is done in Konnectors for the Bill doctype.
  • If no standards doctypes fit your needs, you should define your own doctype in your app. In this case, you do not have to put any field you want in your model, but you should crosscheck other cozy apps to try to homogeneize the names of your fields, so that your doctype data could be reused by other apps. This is typically the case for the Konnector doctype in Konnectors.

Open a Pull-Request

If you want to work on Settings and submit code modifications, feel free to open pull-requests! See the contributing guide for more information about how to properly open pull-requests.

Community

Localization

Localization and translations are handled by Transifex, which is used by all Cozy's apps.

As a translator, you can login to Transifex (using your Github account) and claim an access to the app repository. Locales are pulled when app is build before publishing.

As a developer, you just have to modify json in /src/locales. New locales will be automatically added to Transifex. If you need to pull or push manually locales, you can use Transifex CLI. If you were using a transifex-client, you must move to Transifex CLI to be compatible with the v3 API.

Maintainer

The lead maintainer for Cozy Settings is cozy, send him/her a 🍻 to say hello!

Get in touch

You can reach the Cozy Community by:

License

Cozy Settings is developed by Cozy Cloud and distributed under the AGPL v3 license.