NMF-earth / nmf-app

Understand and reduce your carbon footprint 🌱 iOS & Android.
https://nmf.earth
GNU General Public License v3.0
508 stars 157 forks source link
android climate-change expo functional-programming global-warming hacktoberfest ios openfoodfacts react-native redux-toolkit sustainability typescript zero-waste

🌱 NMF.earth app

Understand and reduce your carbon footprint


app-store google-play


figma


screenshots

Depfu Contributor Covenant Build Status runs with expo

Repository for the NMF.earth React Native application, built with Expo, Redux Toolkit and Typescript. Design can be found on Figma.


πŸ“Š Data source

Carbon data comes from NMF's carbon footprint repo while barcode product scanned data comes from Open Food Facts api.


πŸ“¦ Getting started

Installing Dependencies:

$ yarn

Running the app:

$ yarn start

For starting the app on a specific OS:

$ yarn ios | yarn android

Copy the 2 files that contain secrets and replace them with yours

$ cp .env.example .env


πŸ‘©πŸΎβ€πŸ’» Development

You can check this manually by running:

$ yarn lint

or

$ yarn typescript

You can ask eslint to fix issues by running:

$ yarn lint:fix


πŸ›  Testing

Use the following command to run unit tests with coverage:

$ yarn test

Use the following to update unit tests

$ yarn test -u

Use the following to run unit tests in watch mode while developing:

$ yarn test --watch


🎨 Storybook

Stories (*.story.tsx) can be automatically added to storyLoader.js with :

$ yarn prestorybook


πŸ“— Sustainable guide

To place new .md files inside guides folder or modify existing guide and then run node scripts/generate-guides.js to generate a new sustainable guide. Images can be used in the .md as follow: ![Earth](earth.png) and should be place in assets/images/guide.


For methodology screen, just run node scripts/generate-methodology.js to update methodology.json from methodology.md.


For emission info screen, just run node scripts/generate-emission-info.js to update emission-info.json from assets/emission-info/markdown/*.md.


πŸ—£ Translations

You can help us with translate the app with our online tool POEditor. Any help is appreciate and no coding skills are needed πŸ€—

PS: please do not use send translations made by Google translate or similar.


Generate

Run node scripts/generate-translation-files.js in order to create the files needed for the new language you want to add to the app.

Manage Files

Run node scripts/poeditor/group-translation-files.js to generate 1 JSON file per language, with all the translation vars in it. From there, you can easily make any edit you want. When you're done, you can run node scripts/poeditor/spread-translation-files.js to merge your edits and spread them into all the translation files across the repo.


πŸš€ Deployment

Any tag starting with v will runs expo publish. During this step app.example.json is used to generate an app.json file for expo's deployment, this is done with the following script scripts/generate-app-json.js.


πŸ— Build

First you need to configure SENTRY_AUTH_TOKEN and SENTRY_DSN secrets on expo.dev and then define projectId in app.config.js. Then run npm install dotenv and place your secrets inside .env file that you need to create with SENTRY_AUTH_TOKEN and SENTRY_DSN, like in .env.example.

Run eas build -p ios to build for the App Store Connect and eas build -p android for the Google Play Console.


πŸ‘¨β€πŸ’» Contribute ❀️

More than 40 developers have contribute to the app, thanks a lot to them!

Have a look to contributing.md if you want to contribute!


πŸ† Backers

A big thank you to ChristopherΒ Gwilliams and to the Phelps family for their amazing contribution to the Kickstarter!


©️ Open source - licence

Repository and contributions are under GNU General Public License v3.0