Organize the package.json and grunt file. Some optimizations and renaming.

This commit is contained in:
Jean-Baptiste Dominguez 2018-09-04 15:54:24 +09:00
commit d934a9241a
2 changed files with 60 additions and 31 deletions

View file

@ -51,7 +51,7 @@ module.exports = function(grunt) {
command: 'npm run build:ios', command: 'npm run build:ios',
}, },
ios: { ios: {
command: 'npm run build:ios-release', command: 'cordova prepare ios && cordova build ios --release',
}, },
xcode: { xcode: {
command: 'npm run open:ios', command: 'npm run open:ios',
@ -60,7 +60,7 @@ module.exports = function(grunt) {
command: 'npm run build:android', command: 'npm run build:android',
}, },
android: { android: {
command: 'npm run build:android-release', command: 'cordova prepare android && cordova build android --release',
}, },
androidrun: { androidrun: {
command: 'npm run run:android && npm run log:android', command: 'npm run run:android && npm run log:android',
@ -72,7 +72,7 @@ module.exports = function(grunt) {
// When the build log outputs "Built the following apk(s):", it seems to need the filename to start with "android-release". // When the build log outputs "Built the following apk(s):", it seems to need the filename to start with "android-release".
// It looks like it simply lists all apk files starting with "android-release" so I have added that prefix to the final apk // It looks like it simply lists all apk files starting with "android-release" so I have added that prefix to the final apk
// so that its filename shows up in the log output. // so that its filename shows up in the log output.
command: 'rm -f platforms/android/build/outputs/apk/android-release-signed-*.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../bitcoin-com-release-key.jks -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk bitcoin-com && zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-signed-aligned-bitcoin-com-wallet-<%= pkg.fullVersion %>-android.apk', command: 'rm -f platforms/android/build/outputs/apk/android-release-signed-*.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../bitcoin-com-release-key.jks -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk bitcoin-com && zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/bitcoin-com-wallet-<%= pkg.fullVersion %>-android-signed-aligned.apk',
stdin: true, stdin: true,
}, },
desktopsign: { desktopsign: {
@ -357,9 +357,28 @@ module.exports = function(grunt) {
grunt.registerTask('cordovaclean', ['exec:cordovaclean']); grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
grunt.registerTask('android-debug', ['exec:androiddebug', 'exec:androidrun']); grunt.registerTask('android-debug', ['exec:androiddebug', 'exec:androidrun']);
grunt.registerTask('android', ['exec:android']); grunt.registerTask('android', ['exec:android']);
grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']);
grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']); grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);
// Build all
grunt.registerTask('app-release', ['mobile-release', 'desktop-release']);
/**
* Mobile app
*/
// Build mobile app
grunt.registerTask('mobile-release', ['ios-release', 'android-release']);
// Build ios
grunt.registerTask('ios-release', ['prod', 'exec:ios']);
// Build android
grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']);
/**
* Desktop app
*/
// Build desktop // Build desktop
grunt.registerTask('desktop-build', ['desktop-others', 'desktop-osx-dmg', 'desktop-osx-pkg']); grunt.registerTask('desktop-build', ['desktop-others', 'desktop-osx-dmg', 'desktop-osx-pkg']);

View file

@ -88,45 +88,55 @@
}, },
"scripts": { "scripts": {
"postinstall": "bower install", "postinstall": "bower install",
"watch": "grunt watch",
"log:android": "adb logcat | grep chromium",
"test": "karma start test/karma.conf.js --single-run",
"clean": "trash platforms && trash plugins && cordova prepare",
"unstage-package": "git reset package.json",
"clean-all": "git clean -dfx",
"apply:copay": "npm i fs-extra && cd app-template && node apply.js copay && npm i && cordova prepare",
"apply:bitpay": "npm i fs-extra && cd app-template && node apply.js bitpay && npm i && cordova prepare",
"apply:bitcoincom": "npm i fs-extra && cd app-template && node apply.js bitcoincom && npm i && cordova prepare && cd ../ && ./fix-asn1.sh",
"start": "npm run build:www && ionic serve --nolivereload --nogulp -s --address 0.0.0.0", "start": "npm run build:www && ionic serve --nolivereload --nogulp -s --address 0.0.0.0",
"start:chrome": "npm run build:www && ionic serve --nolivereload --nogulp -s --address 0.0.0.0 --browser \"google chrome\"", "start:chrome": "npm run build:www && ionic serve --nolivereload --nogulp -s --address 0.0.0.0 --browser \"google chrome\"",
"start:ios": "npm run build:www && npm run build:ios && npm run open:ios", "start:ios": "npm run build:www && npm run build:ios",
"start:android": "npm run build:www && npm run build:android && npm run run:android", "start:android": "npm run build:www && npm run build:android",
"start:windows": "npm run build:www && npm run build:windows", "start:windows": "npm run build:www && npm run build:windows",
"start:desktop": "npm start", "start:desktop": "npm start",
"watch": "grunt watch",
"open:ios": "open platforms/ios/*.xcodeproj",
"open:android": "open -a open -a /Applications/Android\\ Studio.app platforms/android",
"run:android": "cordova run android --device",
"run:android-release": "cordova run android --device --release",
"build:www": "grunt", "build:www": "grunt",
"build:www-release": "grunt prod", "build:www-release": "grunt prod",
"build:ios": "cordova prepare ios && cordova build ios --debug", "build:ios": "cordova prepare ios && cordova build ios --debug",
"build:android": "cordova prepare android && cordova build android --debug", "build:android": "cordova prepare android && cordova build android --debug",
"build:windows": "cordova prepare windows && cordova build windows -- --arch=\"ARM\"", "build:windows": "cordova prepare windows && cordova build windows -- --arch=\"ARM\"",
"build:ios-release": "cordova prepare ios && cordova build ios --release",
"build:android-release": "cordova prepare android && cordova build android --release",
"build:windows-release": "cordova prepare windows && cordova build windows --release --arch=\"ARM\"", "build:windows-release": "cordova prepare windows && cordova build windows --release --arch=\"ARM\"",
"build:desktop-release": "grunt desktop-release",
"build:ios-release": "grunt ios-release",
"build:android-release": "grunt android-release",
"build:desktop-release": "grunt desktop-release",
"build:desktop": "grunt desktop-build", "build:desktop": "grunt desktop-build",
"build:osx-pkg": "grunt desktop-osx-pkg", "build:osx-pkg": "grunt desktop-osx-pkg",
"build:osx-dmg": "grunt desktop-osx-dmg", "build:osx-dmg": "grunt desktop-osx-dmg",
"build:others": "grunt desktop-others", "build:others": "grunt desktop-others",
"sign:desktop": "grunt desktop-sign",
"open:ios": "open platforms/ios/*.xcodeproj", "sign:desktop": "grunt desktop-sign",
"open:android": "open -a open -a /Applications/Android\\ Studio.app platforms/android", "sign:android": "grunt exec:androidsign",
"final:www": "npm run build:www-release", "final:www": "npm run build:www-release",
"final:ios": "npm run final:www && npm run build:ios-release && npm run open:ios", "final:ios": "npm run build:ios-release",
"final:android": "npm run final:www && npm run build:android-release && npm run sign:android && npm run run:android-release", "final:android": "npm run build:android-release",
"final:windows": "npm run final:www && npm run build:windows-release", "final:windows": "npm run build:windows-release",
"final:desktop": "npm run final:www && npm run build:desktop-release", "final:desktop": "npm run build:desktop-release",
"run:android": "cordova run android --device", "final:mobile": "npm run build:mobile-release",
"run:android-release": "cordova run android --device --release", "final:app": "npm run build:app-release"
"log:android": "adb logcat | grep chromium",
"sign:android": "grunt android-release",
"apply:copay": "npm i fs-extra && cd app-template && node apply.js copay && npm i && cordova prepare",
"apply:bitpay": "npm i fs-extra && cd app-template && node apply.js bitpay && npm i && cordova prepare",
"apply:bitcoincom": "npm i fs-extra && cd app-template && node apply.js bitcoincom && npm i && cordova prepare && cd ../ && ./fix-asn1.sh",
"test": "karma start test/karma.conf.js --single-run",
"clean": "trash platforms && trash plugins && cordova prepare",
"unstage-package": "git reset package.json",
"clean-all": "git clean -dfx"
}, },
"devDependencies": { "devDependencies": {
"cordova": "^6.3.1", "cordova": "^6.3.1",