stats4sd / Picsa-Extension-Toolkit

This is the public repository for the PICSA app, a tool used to support decision making by farmers through the PICSA approach
https://picsa.app
Other
0 stars 1 forks source link

Picsa-Extension-Toolkit

Building:

Update version number in changelog/version, package.json and config.xml if updated hard resources think need to update version in storage.data.ts

Make sure datasets and metadata.json in assets/datasets (not available on git)

Update data from firebase database to budget-tool/data.ts and storage.data.ts

Live

npm run deploy:prod

Staging

npm run deploy:staging (also automatically deploys to staging on git commit)

android

Release build (update version in package.json, when prompted for pw Chris has, if fail due to warning continue steps from npm run android:zip and npm run android:openfolder) npm run android:release

Test production version on android npm run run:android (need to check whether also want to set NODE_ENV="production", e.g. set NODE_ENV="production"&& ionic cordova run android --prod )

General

Adding Resources

Hard coded resources in the assets/resources folder (include cover image png with same file name .png) Hard coded meta data in providers/storage.data.ts, make sure to include viewableBy if not everybody Also upload to firebase storage for web link and populate /Resources firestore entry

Database Backups

Create subfolder for date firestore-backup-restore --accountCredentials backups/firebase-service-key.json --backupPath backups/{date} Additional flags: --plainJSONBackup (-L) (no type info)

Merge database files

Create gulp file to hanle merge, e.g.

var gulp = require("gulp");
var jsonConcat = require("gulp-json-concat");
var jsonTransform = require("gulp-json-transform");

gulp.task("merge", function() {
  return gulp
    .src("2018-10-22-plain/forms/farmerVisit/submissions/**/*.json")
    .pipe(
      jsonConcat("merged.json", function(data) {
        return new Buffer(JSON.stringify(data));
      })
    )
    .pipe(
      jsonTransform(function(data, file) {
        var arr = [];
        for (let key in data) {
          data[key]._key = key;
          arr.push(data[key]);
        }
        return arr;
      })
    )
    .pipe(gulp.dest("./"));
});

./backups/mergeFormsGulp.js

Run the file gulp merge --gulpfile backups/mergeFormsGulp.js

Troubleshooting:

make sure all cli=s up to date $npm install -g cordova ionic@latest

clean node-modules folder and run (with elevated command prompt) $npm install

firebase promise issue: $npm install promise-polyfill --save-exact

(issue - cordova plugin file, if cannot install may need to:) remove platforms and cordova-plugin-file then re-add? $ionic cordova plugin remove --save cordova-plugin-file cordova-plugin-file-transfer $npm uninstall --save cordova-plugin-file cordova-plugin-file-transfer $npm install --save cordova-plugin-file cordova-plugin-file-transfer @ionic-native/file $ionic cordova plugin add --save cordova-plugin-file cordova-plugin-file-transfer

video player

At time of writing cordova 8 had deprecated --nofetch flag and videoplayer plugin not available properly via npm resulting in unable to fetch. manually copied to plugins folder from git repo instead.

ionic import sources

Current typescript/vscode has issue trying to import from ionic-angular search for ionic-angular and replace with ionic-angular (https://github.com/Microsoft/TypeScript/issues/25204)

build fails for android - Multiple dex files

possibly due to conflicts within file opener and fileopener2

$ionic cordova platform remove android $ionic cordova platform add android try again

if still, make sure cordova plugin android-support-gradle-release installed $cordova plugin add cordova-android-support-gradle-release

or try with a higher android api version installed

C3 and leaflet types

Currently bugged and removed https://github.com/DefinitelyTyped/DefinitelyTyped/issues/21794 should recheck in future

SurveyJS integration

Using survey-angular which has issue with typings. Need to install @types/knockout seperately and change tsconfig.json to specify "typeRoots": ["./node_modules/@types/"]"

ios build notes