Etape 1 : Mise à jour et installation
Lancer le terminal de commande en mode Administrateur.
Mettre à jour les logiciels à l'aide des commandes suivantes :
npm install npm
npm install -g cordova
npm install @angular/cli -g
Etape 2 : Créer le projet
Créer le projet avec cordova.
cordova create begin com.sciencesappliquees.begin "Le nom de l'app"
Aller dans le répertoire du projet.
Renommer le fichier platform.json en platform2.json dans celui-ci.
Ajouter angular au projet
ng new begin --style=scss
Etape 3 : Modifier package.json
Copier le contenu du fichier package2.json de cordova dans package.json de angular de la manière suivante :
{
"name": "begin2",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"cordova-android": "^7.1.4",
"cordova-plugin-whitelist": "^1.3.3",
"core-js": "^2.5.4",
"npm": "^6.5.0",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.12.0",
"@angular/cli": "~7.2.1",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
} ,
"cordova": {
"name": "com.sc.begin",
"displayName": "begin",
"version": "1.0.0",
"description": "A sample Apache Cordova application that responds to the deviceready event.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Apache Cordova Team",
"license": "Apache-2.0",
"plugins": {
"cordova-plugin-whitelist": {}
},
"platforms": [
"android"
]
}
}