Commit 3560db66 authored by Hugo NOUTS's avatar Hugo NOUTS
Browse files

Initial commit

parents
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
[*.{jade,pug}]
trim_trailing_whitespace = false
[*.styl]
indent_style = space
indent_size = 2
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended' // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-var-requires": "warn",
"react/prop-types": "warn"
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
};
*Please explain what this PR does here.*
#### Checklist
Before merging this PR, the following things must have been done:
- [ ] Faithful integration of the mockups at all screen sizes
- [ ] Tested on supported browsers, including responsive mode (IE11 and Edge, Chrome >= 42, 2 latest versions of Firefox and Safari)
- [ ] Localized in english and french
- [ ] All changes have test coverage
- [ ] Updated README, if necessary
- [ ] Make sure commit messages rely on the [Commitizen](http://commitizen.github.io/cz-cli/) format
If this PR relies on changes in one of our internal libraries (cozy-client-js or cozy-ui, for example), please also do the following things:
- [ ] The package.json and yarn.lock files include the correct dependency version, in those versions have been released
- [ ] [cozy-client-js](https://github.com/cozy/cozy-client-js) documentation and tests are up to date
- [ ] [cozy-ui](https://github.com/cozy/cozy-ui) documentation and style guides are up to date
*(If not, please remove this last section.)*
# NPM
node_modules/
npm-debug.log
yarn-error.log
# Build
build/
# Data
data/*
# Coverage
coverage/
# Locales
**/locales/*
!**/locales/en.json
# transifex
.transifexrc
# Coverage
coverage/
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
desktop.ini
# Mobile
targets/mobile/hooks
targets/mobile/platforms
targets/mobile/plugins
targets/mobile/www
targets/mobile/keys
targets/mobile/res/icons
targets/mobile/res/screens
targets/mobile/icon.png
targets/mobile/store
# fastlane
mobile/fastlane/README.md
mobile/fastlane/report.xml
mobile/fastlane/Error*.png
mobile/fastlane/Preview.html
mobile/Preview.html
# Default
# /!\ KEEP THIS SECTION THE LAST ONE
!.gitkeep
image: docker:git
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ''
stages:
- test
- build
- build_release
build:
stage: build
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- dev
- master
build_release:
stage: build
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
only:
- tags
mr_sonarqube:
stage: test
only:
- merge_requests
image: skilldlabs/sonar-scanner:4.0.0
script:
- >
sonar-scanner
-Dsonar.projectName="llle"
-Dsonar.projectVersion=1.0
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectBaseDir=.
-Dsonar.host.url=${SONAR_URL}
-Dsonar.projectKey=${CI_PROJECT_PATH_SLUG}
-Dsonar.login=${SONAR_TOKEN}
sonarqube:
stage: test
only:
- dev
image: skilldlabs/sonar-scanner:4.0.0
script:
- >
sonar-scanner
-Dsonar.projectName="llle"
-Dsonar.projectVersion=1.0
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectBaseDir=.
-Dsonar.host.url=${SONAR_URL}
-Dsonar.projectKey=${CI_PROJECT_PATH_SLUG}
-Dsonar.login=${SONAR_TOKEN}
{
"endOfLine": "auto",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
{
"blocks": "never",
"brackets": {
"expect": "never",
"error": true
},
"colons": {
"expect": "never",
"error": true
},
"colors": {
"expect": "always",
"error": true
},
"commaSpace": {
"expect": "always",
"error": true
},
"commentSpace": {
"expect": "always",
"error": true
},
"cssLiteral": "never",
"customProperties": [],
"depthLimit": 4,
"duplicates": {
"expect": true,
"error": true
},
"efficient": {
"expect": "always",
"error": true
},
"exclude": [],
"extendPref": "@extend",
"globalDupe": {
"expect": true,
"error": true
},
"groupOutputByFile": {
"expect": true,
"error": true
},
"indentPref": {
"expect": 4,
"error": true
},
"leadingZero": {
"expect": "never",
"error": true
},
"maxErrors": false,
"maxWarnings": false,
"mixed": {
"expect": true,
"error": true
},
"mixins": ["top-padded","right-padded","bottom-padded","left-padded","vertically-padded","horizontally-padded","padded","top-spaced","right-spaced","bottom-spaced","left-spaced","vertically-spaced","horizontally-spaced","spaced","hide","reset"],
"namingConvention": {
"expect": "lowercase-dash",
"error": true
},
"namingConventionStrict": false,
"none": {
"expect": "never",
"error": true
},
"noImportant": {
"expect": true,
"error": true
},
"parenSpace": {
"expect": "never",
"error": true
},
"placeholders": {
"expect": "always",
"error": true
},
"prefixVarsWithDollar": false,
"quotePref": {
"expect": "single",
"error": true
},
"reporterOptions": {
"columns": ["lineData", "severity", "description", "rule"],
"columnSplitter": " ",
"showHeaders": false,
"truncate": true
},
"semicolons": {
"expect": "never",
"error": true
},
"sortOrder": false,
"stackedProperties": {
"expect": "never",
"error": true
},
"trailingWhitespace": {
"expect": "never",
"error": true
},
"universal": {
"expect": "never",
"error": true
},
"valid": {
"expect": true,
"error": true
},
"zeroUnits": {
"expect": "never",
"error": true
},
"zIndexNormalize": {
"expect": 1,
"error": true
}
}
[https://www.transifex.com]
hostname = https://www.transifex.com
username =
token =
language: node_js
matrix:
fast_finish: true
node_js:
- '8'
branches:
only:
- master
# tags
- /^\d+\.\d+\.\d+(\-beta.\d+)?$/
env:
global:
# GITHUB_TOKEN for yarn deploy script
# to generate yours : travis encrypt GITHUB_TOKEN=<your_GITHUB_TOKEN> -r hsubtil/llle --org
# REGISTRY_TOKEN for yarn cozyPublish script
# to generate yours : travis encrypt REGISTRY_TOKEN=<your_REGISTRY_TOKEN> -r hsubtil/llle --org
# N.B.: the --org option is needed only for public repositories
cache:
yarn: true
directories:
- node_modules
before_install:
- curl -fsSL https://bootstrap.pypa.io/get-pip.py | python - --user
- travis_retry pip install --user transifex-client==0.12.5
- install -m0644 .transifexrc.tpl ~/.transifexrc
- echo "password = $TX_PASSWD" >> ~/.transifexrc
stages:
- prebuild
- build
jobs:
include:
- name: 'Lint'
stage: 'prebuild'
script: yarn lint
- name: 'Tests'
stage: 'prebuild'
script: yarn test
- name: 'Build app'
stage: 'build'
before_install:
- curl -fsSL https://bootstrap.pypa.io/get-pip.py | python - --user
- travis_retry pip install --user transifex-client==0.12.5
- install -m0644 .transifexrc.tpl ~/.transifexrc
- echo "password = $TX_PASSWD" >> ~/.transifexrc
script: yarn build
deploy:
- provider: script
repo: hsubtil/llle
skip-cleanup: true
# deploy the build on a build branch and publish to the Cozy registry
script: DEPLOY_BRANCH=build && yarn deploy && yarn cozyPublish
on:
branch: master
- provider: script
repo: hsubtil/llle
skip-cleanup: true
# publish stable or beta versions using Github Releases (git tag)
script: DEPLOY_BRANCH=build && yarn cozyPublish
on:
tags: true
[main]
host = https://www.transifex.com
[<project_slug.resource_slug>]
file_filter = src/locales/<lang>.json
source_file = src/locales/en.json
source_lang = en
type = KEYVALUEJSON
{
"peacock.color": "#6495ED",
"workbench.colorCustomizations": {
"activityBar.background": "#92b4f2",
"activityBar.activeBorder": "#e41b62",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#e41b62",
"activityBarBadge.foreground": "#e7e7e7",
"titleBar.activeBackground": "#6495ed",
"titleBar.inactiveBackground": "#6495ed99",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveForeground": "#15202b99",
"statusBar.background": "#6495ed",
"statusBarItem.hoverBackground": "#3676e8",
"statusBar.foreground": "#15202b"
},
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnPaste": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],
"gitlab.instanceUrl": "https://forge.grandlyon.com/web-et-numerique/llle",
"gitlab.ignoreCertificateErrors": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"gitlab.showPipelineUpdateNotifications": true,
"sonarlint.connectedMode.project": {
"projectKey": "llle"
},
"cSpell.words": [
"CONSO",
"Dataload",
"MULTIFLUID",
"Picto",
"barchart",
"elec",
"luxon"
]
}
# How to contribute to LyonLivingLabEnergy?
Thank you for your interest in contributing to this Cozy application! There are many ways to contribute, and we appreciate all of them.
## Security Issues
If you discover a security issue, please bring it to our attention right away! Please **DO NOT** file a public issue, instead send your report privately to security AT cozycloud DOT cc.
Security reports are greatly appreciated and we will publicly thank you for it. We currently do not offer a paid security bounty program, but are not ruling it out in the future.
## Bug Reports
While bugs are unfortunate, they're a reality in software. We can't fix what we don't know about, so please report liberally. If you're not sure if something is a bug or not, feel free to file a bug anyway.
Opening an issue is as easy as following [this link][issues] and filling out the fields. Here are some things you can write about your bug:
- A short summary
- What did you try, step by step?
- What did you expect?
- What did happen instead?
- What is the version of the LyonLivingLabEnergy app?
## Pull Requests
Please keep in mind that:
- Pull-Requests point to the `master` branch
- You need to cover your code and feature by tests
- You may add documentation in the `/docs` directory to explain your choices if needed
- We recommend to use [task lists][checkbox] to explain steps / features in your Pull-Request description
- you do _not_ need to build app to submit a PR
- you should update the Transifex source locale file if you modify it for your feature needs (see [Localization section in README][localization])
### Workflow
Pull requests are the primary mechanism we use to change Cozy. GitHub itself has some [great documentation][pr] on using the Pull Request feature. We use the _fork and pull_ model described there.
#### Step 1: Fork
Fork the project on GitHub and [check out your copy locally][forking].
```
$ git clone github.com/hsubtil/llle.git
$ cd llle
$ git remote add fork git://github.com/yourusername/llle.git
```
#### Step 2: Branch
Create a branch and start hacking:
```
$ git checkout -b my-branch origin/master
```
#### Step 3: Code
Well, we think you know how to do that. Just be sure to follow the coding guidelines from the community ([standard JS][stdjs], comment the code, etc).
#### Step 4: Test
Don't forget to add tests and be sure they are green:
```
$ cd llle
$ npm run test
```
#### Step 5: Commit
Writing [good commit messages][commitmsg] is important. A commit message should describe what changed and why.
Please follow the [Conventional Commits Specification][conventional-commits] to write your commits.
#### Step 6: Rebase
Use `git rebase` (_not_ `git merge`) to sync your work from time to time.
```
$ git fetch origin
$ git rebase origin/master my-branch
```
#### Step 7: Push
```
$ git push -u fork my-branch
```
Go to https://github.com/yourusername/llle and select your branch. Click the 'Pull Request' button and fill out the form.
Alternatively, you can use [hub] to open the pull request from your terminal:
```
$ git pull-request -b master -m "My PR message" -o
```
Pull requests are usually reviewed within a few days. If there are comments to address, apply your changes in a separate commit and push that to your branch. Post a comment in the pull request afterwards; GitHub doesn't send out notifications when you add commits.
## Writing documentation
Documentation improvements are very welcome. We try to keep a good documentation in the `/docs` folder. But, you know, we are developers, we can forget to document important stuff that look obvious to us. And documentation can always be improved.
## Translations
The LyonLivingLabEnergy is translated on a platform called [Transifex][tx]. [This tutorial][tx-start] can help you to learn how to make your first steps here. If you have any question, don't hesitate to ask us!
## Community
You can help us by making our community even more vibrant. For example, you can write a blog post, take some videos, answer the questions on [the forum][forum], organize new meetups, and speak about what you like in Cozy!
[conventional-commits]: https://conventionalcommits.org
[issues]: https://github.com/hsubtil/llle/issues/new
[pr]: https://help.github.com/categories/collaborating-with-issues-and-pull-requests/
[forking]: http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html
[stdjs]: http://standardjs.com/
[commitmsg]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[localization]: https://github.com/hsubtil/llle/blob/master/README.md#localization
[hub]: https://hub.github.com/
[tx]: https://www.transifex.com/cozy/
[tx-start]: http://docs.transifex.com/getting-started/translators/
[forum]: https://forum.cozy.io/
FROM node:10.15.0 as builder
ARG BUILD_CMD
# Add application files
COPY ./package.json /app/package.json
WORKDIR /app
# Copy the project
COPY . /app
# Install npm dependencies
RUN yarn install
# Build
RUN yarn build
FROM busybox
# Add application files
RUN mkdir -p /var/www/llle
COPY --from=builder /app/build /var/www/llle
This diff is collapsed.
# LyonLivingLabEnergy
## What's LyonLivingLabEnergy?
LyonLivingLabEnergy (LLLE) is a mobile-first app allowing citizen to visualise easily their energy consumption (electricity, gas, water ...). The app allow simple and more advanced data visualisation
but give also some tips on how to reduce energy consumption.
## Hack
_:pushpin: Note:_ we recommend to use [Yarn] instead of NPM for package management. Don't hesitate to [install][yarn-install] and use it for your Cozy projects, it's now our main node packages tool for Cozy official apps.
### Install
Hacking the Cozy LyonLivingLabEnergy app requires you to [setup a dev environment][setup].
You can then clone the app repository and install dependencies:
```sh
$ git clone git@forge.grandlyon.com:web-et-numerique/llle.git
$ cd llle
$ yarn install
```
:pushpin: 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, like watch, lint, test, build…
### Run it inside a default Cozy using Docker
First of all get cozy dev image :
```sh
$ docker pull cozy/cozy-app-dev
```
Then you can run your application inside a Cozy thanks to the [cozy-stack docker image][cozy-stack-docker]: