Commit fa53b21a authored by Benoit Lavenier's avatar Benoit Lavenier

Initial commit

parents
Pipeline #4583 failed with stages
in 24 seconds
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore
*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
.vscode/
npm-debug.log*
.idea/
.sourcemaps/
.sass-cache/
.tmp/
.versions/
coverage/
dist/
node_modules/
tmp/
temp/
hooks/
platforms/
plugins/
plugins/android.json
plugins/ios.json
www/
$RECYCLE.BIN/
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate
yarn.lock
.directory
package-lock.json
package-lock.json
\ No newline at end of file
This diff is collapsed.
# Cesium 2
## Compile from source
1. Install Node.js v8+
```
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
nvm use 8
```
2. Install global dependencies:
```
npm install -g ionic@^4.0.0-beta.11 cordova@^8.0.0 @angular/cli@^6.1.2
```
3. Clone the repo: `git clone ...`
4. Install project dependencies
```
cd cesium2
npm install
```
5. Start a Duniter node with GraphQL API (GVA). See https://git.duniter.org/nodes/typescript/modules/gva-api/
A GraphQL editor should be accessible at [localhost:8080](http://localhost:8080/graphql)
6. Start app
```
cd cesium2
npm start
```
ou
```
ng serve --port [port]
```
The application should be accessible at [localhost:4200](http://localhost:4200)
7. Check environment configuration
Edit the file `src/environment/environment.ts`
8. Build a release
```
npm run build --prod --release
```
## Developer guide :
- Ionic 4 colors: https://www.joshmorony.com/a-primer-on-css-4-variables-for-ionic-4/
- Migration to Ionic 4 tips: https://www.joshmorony.com/my-method-for-upgrading-from-ionic-3-to-ionic-4/
## Useful additional tools
```
sudo apt-get install chromium-browser docker.io
```
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"cesium2": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/cesium2",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/svg",
{
"glob": "**/*.svg",
"input": "node_modules/@ionic/angular/dist/ionic/svg",
"output": "./svg"
},
{
"glob": "**/*.*",
"input": "node_modules/@ionic/core/node_modules/ionicons/dist/fonts",
"output": "./assets/fonts"
},
{
"glob": "**/*.*",
"input": "node_modules/roboto-fontface/fonts/roboto",
"output": "./"
},
{
"glob": "**/*.*",
"input": "node_modules/material-design-icons/iconfont",
"output": "./"
},
{
"glob": "sitemap.xml",
"input": "src/assets",
"output": "/"
}
],
"styles": [{
"input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
},
"src/global.scss"
],
"scripts": [],
"stylePreprocessorOptions": {
"includePaths": [
"node_modules/@ionic/angular/dist/themes",
"node_modules/@ionic/core/node_modules/ionicons/dist/scss",
"node_modules/ionicons/dist/scss",
"src/theme"
]
}
},
"configurations": {
"production": {
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "cesium2:build"
},
"configurations": {
"production": {
"browserTarget": "cesium2:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "cesium2:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/global.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"cesium2-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "cesium2:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "cesium2"
}
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.duniter.cesium" version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>cesium2</name>
<description>Cesium v2</description>
<author email="contact@e-is.pro" href="http://www.e-is.pro">E-IS Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<platform name="android">
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform>
<plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
<plugin name="cordova-plugin-whitelist" spec="1.3.1" />
<plugin name="cordova-plugin-device" spec="1.1.4" />
<plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.1.11" />
<plugin name="cordova-sqlite-storage" spec="^2.3.2" />
<engine name="android" spec="7.1.0" />
</widget>
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
\ No newline at end of file
import { AppPage } from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to app!');
});
});
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
\ No newline at end of file
#!/bin/bash
### Control that the script is run on `dev` branch
branch=`git rev-parse --abbrev-ref HEAD`
if [[ ! "$branch" = "master" ]];
then
echo ">> This script must be run under \`master\` branch"
exit 1
fi
### Get version to release
current=`grep -P "version\": \"\d+.\d+.\d+(\w*)" package.json | grep -oP "\d+.\d+.\d+(\w*)"`
echo "Current version: $current"
### Get repo URL
REMOTE_URL=`git remote -v | grep -P "push" | grep -oP "(https:\/\/github.com\/|git@github.com:)[^ ]+"`
REPO=`echo $REMOTE_URL | sed "s/https:\/\/github.com\///g" | sed "s/git@github.com://g" | sed "s/.git$//"`
REPO='duniter/cesium2'
REPO_URL=https://api.github.com/repos/$REPO
### get auth token
GITHUB_TOKEN=`cat ~/.config/cesium/.github`
if [[ "_$GITHUB_TOKEN" != "_" ]]; then
GITHUT_AUTH="Authorization: token $GITHUB_TOKEN"
else
echo "Unable to find github authentication token file: "
echo " - You can create such a token at https://github.com/settings/tokens > 'Generate a new token'."
echo " - Then copy the token and paste it in the file '~/.config/cesium/.github' using a valid token."
exit 1
fi
case "$1" in
del)
result=`curl -i "$REPO_URL/releases/tags/v$current"`
release_url=`echo "$result" | grep -P "\"url\": \"[^\"]+" | grep -oP "$REPO_URL/releases/\d+"`
if [[ $release_url != "" ]]; then
echo "Deleting existing release..."
curl -H 'Authorization: token $GITHUB_TOKEN' -XDELETE $release_url
fi
;;
pre|rel)
if [[ "_$2" != "_" ]]; then
if [[ $1 = "pre" ]]; then
prerelease="true"
else
prerelease="false"
fi
description=`echo $2`
result=`curl -s -H ''"$GITHUT_AUTH"'' "$REPO_URL/releases/tags/v$current"`
release_url=`echo "$result" | grep -P "\"url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+/releases/\d+"`
if [[ "_$release_url" != "_" ]]; then
echo "Deleting existing release... $release_url"
result=`curl -H ''"$GITHUT_AUTH"'' -s -XDELETE $release_url`
if [[ "_$result" != "_" ]]; then
error_message=`echo "$result" | grep -P "\"message\": \"[^\"]+" | grep -oP ": \"[^\"]+\""`
echo "Delete existing release failed with error$error_message"
exit 1
fi
else
echo "Release not exists yet on github."
fi
echo "Creating new release..."
echo " - tag: v$current"
echo " - description: $description"
result=`curl -H ''"$GITHUT_AUTH"'' -s $REPO_URL/releases -d '{"tag_name": "v'"$current"'","target_commitish": "master","name": "'"$current"'","body": "'"$description"'","draft": false,"prerelease": '"$prerelease"'}'`
upload_url=`echo "$result" | grep -P "\"upload_url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+"`
if [[ "_$upload_url" = "_" ]]; then
echo "Failed to create new release for repo $REPO."
echo "Server response:"
echo "$result"
exit 1
fi
### Sending files
echo "Uploading files to $upload_url"
dirname=`pwd`
echo "Sending web build..."
curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: application/zip' -T $dirname/dist/cesium2.zip $upload_url?name=cesium2-v$current-web.zip
echo "-----"
echo "Successfully uploading files !"
echo " -> Release url: https://github.com/$REPO/releases/tag/v$current"
else
echo "Wrong arguments"
echo "Usage:"
echo " > ./github.sh pre|rel <release_description>"
echo "With:"
echo " - pre: use for pre-release"
echo " - rel: for full release"
exit 1
fi
;;
*)
echo "No task given"
;;
esac
#!/bin/bash
{ # this ensures the entire script is downloaded #
is_installed() {
type "$1" > /dev/null 2>&1
}
if [ "_$1" != "_" ]; then
INSTALL_DIR="$1"
fi
if [ "_$INSTALL_DIR" == "_" ]; then
DIRNAME=`pwd`
INSTALL_DIR="$DIRNAME/cesium2"
fi
latest_version() {
echo "v2.0.0" #lastest
}
api_release_url() {
echo "https://api.github.com/repos/duniter/cesium2/releases/tags/$(latest_version)"
}
download() {
if is_installed "curl"; then
curl -qkL $*
elif is_installed "wget"; then
# Emulate curl with wget
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
-e 's/-L //' \
-e 's/-I /--server-response /' \
-e 's/-s /-q /' \
-e 's/-o /-O /' \
-e 's/-C - /-c /')
wget $ARGS
fi
}
install_from_github() {
local RELEASE=`curl -XGET -i $(api_release_url)`
local ARCHIVE_URL=`echo "$RELEASE" | grep -P "\"browser_download_url\": \"[^\"]+" | grep -oP "https://[a-zA-Z0-9/.-]+-web.zip"`
local TMP_DIR=/tmp/cesium2-install
local ARCHIVE_FILE=$TMP_DIR/cesium2-$(latest_version)-web.zip
if [ -d "$INSTALL_DIR" ]; then
if [ -f "$ARCHIVE_FILE" ]; then
echo "WARNING: Deleting existing archive [$ARCHIVE_FILE]"
rm $ARCHIVE_FILE
fi
else
mkdir -p "$INSTALL_DIR"
fi
if [ -d "$TMP_DIR" ]; then
echo "WARNING: Deleting existing temp directory [$TMP_DIR]"
rm -rf $TMP_DIR
fi
mkdir -p "$TMP_DIR"
echo "Downloading [$ARCHIVE_URL]"
download "$ARCHIVE_URL" -o "$ARCHIVE_FILE" || {
echo >&2 "Failed to download '$ARCHIVE_URL'"
return 4
}
echo "Unarchive to $INSTALL_DIR"
unzip -o $ARCHIVE_FILE -d $TMP_DIR
cp -rf $TMP_DIR/cesium2/* $INSTALL_DIR
rm -rf $TMP_DIR
echo
echo "Successfully installed at $INSTALL_DIR"
}
do_install() {
if ! is_installed "curl"; then
echo "=> curl is not available. You will likely need to install 'curl' package."
exit 1
fi
if ! is_installed "unzip"; then
echo "=> unzip is not available. You will likely need to install 'unzip' package."
exit 1
fi
install_from_github
}
#
# Unsets the various functions defined
# during the execution of the install script
#
reset() {
unset -f reset is_installed latest_version \
download install_from_github do_install
}
[[ "_$CESIUM2_ENV" = "_testing" ]] || do_install $1
} # this ensures the entire script is downloaded #
{
"name": "cesium2",
"app_id": "",
"type": "ionic-angular",
"integrations": {
"cordova": {}
}
}