Wallet/Gruntfile.js

401 lines
13 KiB
JavaScript
Raw Normal View History

'use strict';
2014-04-07 15:31:13 -03:00
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
2014-04-07 15:31:13 -03:00
// Project Configuration
grunt.initConfig({
2016-10-18 15:27:09 -03:00
pkg: grunt.file.readJSON('package.json'),
2014-12-30 15:19:16 +00:00
exec: {
appConfig: {
command: 'node ./util/buildAppConfig.js'
},
android_studio: {
command: ' open -a open -a /Applications/Android\\ Studio.app platforms/android',
},
build_android_debug: {
command: 'cordova prepare android && cordova build android --debug',
},
build_android_release: {
command: 'cordova prepare android && cordova build android --release',
},
build_ios_debug: {
command: 'cordova prepare ios && cordova build ios --debug',
options: {
maxBuffer: 3200 * 1024
}
},
build_ios_release: {
command: 'cordova prepare ios && cordova build ios --release',
options: {
maxBuffer: 1600 * 1024
}
},
chrome: {
command: 'make -C chrome-app '
Feat/coinbase integration (#4012) * Oauth2 and first view * Connect with Coinbase using mobile * Buy and Sell through Coinbase * Fix buy * Receive and send bitcoin to Coinbase account * Receive bitcoin from Coinbase to Copay * Complete user and account information. Connection errors * Improves error handler * Removes console.log * Coinbase background color. Send to Coinbase form validation * Fix send from different wallet * Send and receive using Coinbase * Pagination activity * Fix Buy and Sell * One option in the sidebar to Buy and Sell * Native balance on Coinbase homepage * Rename receive and send * Auto-close window after authenticate * Reorder * Get payment methods * Fix when token expired * Fix token expired * Integration: sell and send to Coinbase * Store pending transaction before sell * Sell flow completed * Removing files * Fix sell * Fix sell * Fix sell * Sell completed * Buy bitcoin through coinbase * Buy auto * Currency set to USD * Select payment methods. Limits * Removes payment methods from preferences * Fix signs. Tx ordered by updated. Minor fixes * Removes console.log * Improving ux-language things * Fix selectedpaymentmethod if not verified * Set error if tx not found * Price sensitivity. Minor fixes * Adds coinbase api key to gitignore * Coinbase production ready * Fix sell in usd * Bug fixes * New Sensitivity step * Refresh token with a simple click * Refresh token * Refactor * Fix auto reconnect if token expired Signed-off-by: Gustavo Maximiliano Cortez <cmgustavo83@gmail.com> * Fix calls if token expired
2016-04-13 14:08:03 -03:00
},
2016-08-10 17:35:40 -03:00
clean: {
2015-03-06 12:00:10 -03:00
command: 'rm -Rf bower_components node_modules'
},
2016-08-10 17:35:40 -03:00
cordovaclean: {
command: 'make -C cordova clean'
},
2016-06-15 13:53:09 -03:00
coveralls: {
command: 'cat coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
2016-08-10 17:35:40 -03:00
},
create_dmg_dist: {
command: 'sh webkitbuilds/create-dmg-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
2018-09-04 16:45:52 +09:00
},
create_others_dist: {
command: 'sh webkitbuilds/create-others-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
},
create_pkg_dist: {
command: 'sh webkitbuilds/create-pkg-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
2016-08-10 17:35:40 -03:00
},
externalServices: {
command: 'node ./util/buildExternalServices.js'
},
get_nwjs_for_pkg: {
command: 'if [ ! -d ./cache/0.19.5-pkg/osx64/nwjs.app ]; then cd ./cache; curl https://dl.nwjs.io/v0.19.5-mas-beta/nwjs-mas-v0.19.5-osx-x64.zip --output nwjs.zip; unzip nwjs.zip; mkdir -p ./0.19.5-pkg/osx64; cp -R ./nwjs-mas-v0.19.5-osx-x64/nwjs.app ./0.19.5-pkg/osx64/; fi'
2016-08-10 17:35:40 -03:00
},
log_android: {
command: 'adb logcat | grep chromium',
2016-08-10 17:35:40 -03:00
},
2018-09-04 16:45:52 +09:00
run_android: {
command: 'cordova run android --device',
2016-08-10 17:35:40 -03:00
},
2018-09-10 20:26:33 +12:00
run_android_emulator: {
command: 'cordova run android --emulator',
},
2018-09-04 16:45:52 +09:00
sign_android: {
2018-08-22 18:17:33 +12:00
// When the build log outputs "Built the following apk(s):", it seems to need the filename to start with "android-release".
2018-09-05 10:03:00 +12:00
// It looks like it simply lists all apk files starting with "android-release"
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',
2016-08-10 17:35:40 -03:00
stdin: true,
},
sign_desktop_dist: {
command: 'sh webkitbuilds/sign-desktop-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>"'
},
wpinit: {
command: 'make -C cordova wp-init',
},
wpcopy: {
command: 'make -C cordova wp-copy',
},
xcode: {
command: 'open platforms/ios/*.xcodeproj',
}
2014-04-07 15:31:13 -03:00
},
watch: {
options: {
dateFormat: function(time) {
grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
grunt.log.writeln('Waiting for more changes...');
},
},
2016-06-22 15:53:55 -03:00
sass: {
files: ['src/sass/**/**/*.scss'],
2016-12-27 15:38:57 -03:00
tasks: ['sass']
2016-06-22 15:53:55 -03:00
},
2014-08-21 16:49:04 -03:00
main: {
files: [
2015-03-06 12:00:10 -03:00
'src/js/init.js',
'src/js/app.js',
'src/js/directives/*.js',
'src/js/filters/*.js',
'src/js/routes.js',
'src/js/services/*.js',
'src/js/models/*.js',
2016-05-27 15:06:41 -03:00
'src/js/controllers/**/*.js'
2014-08-21 16:49:04 -03:00
],
2015-03-06 12:00:10 -03:00
tasks: ['concat:js']
2017-06-15 23:50:49 +02:00
},
gettext: {
files: [
'i18n/po/*.po',
'i18n/po/*.pot'
],
tasks: ['nggettext_compile','concat']
},
2014-04-07 15:31:13 -03:00
},
sass: {
dist: {
options: {
style: 'compact',
sourcemap: 'none'
},
files: [{
expand: true,
2016-12-27 15:38:57 -03:00
flatten: true,
src: ['src/sass/main.scss'],
2016-12-27 15:38:57 -03:00
dest: 'www/css/',
ext: '.css'
}]
}
},
concat: {
2015-03-06 12:00:10 -03:00
options: {
sourceMap: false,
sourceMapStyle: 'link' // embed, link, inline
},
angular: {
src: [
'src/shim/shim.js',
2015-03-06 12:00:10 -03:00
'bower_components/qrcode-generator/js/qrcode.js',
2016-12-29 11:22:50 -03:00
'bower_components/qrcode-generator/js/qrcode_UTF8.js',
2015-03-06 12:00:10 -03:00
'bower_components/moment/min/moment-with-locales.js',
'bower_components/angular-moment/angular-moment.js',
'bower_components/ng-lodash/build/ng-lodash.js',
'bower_components/angular-qrcode/angular-qrcode.js',
2015-03-06 12:00:10 -03:00
'bower_components/angular-gettext/dist/angular-gettext.js',
2016-02-16 12:33:39 -05:00
'bower_components/ng-csv/build/ng-csv.js',
'bower_components/ionic-toast/dist/ionic-toast.bundle.min.js',
'bower_components/angular-clipboard/angular-clipboard.js',
2016-09-13 17:39:01 -03:00
'bower_components/angular-md5/angular-md5.js',
2016-05-26 16:28:37 -03:00
'bower_components/angular-mocks/angular-mocks.js',
2016-10-07 20:03:51 -04:00
'bower_components/ngtouch/src/ngTouch.js',
2016-10-06 19:23:39 -03:00
'angular-bitauth/angular-bitauth.js',
2018-01-15 13:33:33 +09:00
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
],
2016-12-27 15:38:57 -03:00
dest: 'www/lib/angular-components.js'
},
2018-01-15 13:33:33 +09:00
bitcoinCashJs: {
src: [
'bitcoin-cash-js/bitcoin-cash-js.js'
],
dest: 'www/lib/bitcoin-cash-js.js'
},
2018-07-10 16:39:30 +09:00
bitanalytics: {
src: [
2018-07-25 16:17:42 +09:00
'bitanalytics/bitanalytics.js'
2018-07-10 16:39:30 +09:00
],
dest: 'www/lib/bitanalytics.js'
},
2015-03-06 12:00:10 -03:00
js: {
src: [
2015-03-06 12:00:10 -03:00
'src/js/app.js',
'src/js/routes.js',
'src/js/decorators/*.js',
2018-06-06 19:53:57 +12:00
2015-03-06 12:00:10 -03:00
'src/js/directives/*.js',
2018-06-06 19:53:57 +12:00
'!src/js/directives/*.spec.js',
2015-03-06 12:00:10 -03:00
'src/js/filters/*.js',
2018-06-06 19:53:57 +12:00
'!src/js/filters/*.spec.js',
2015-03-06 12:00:10 -03:00
'src/js/models/*.js',
2018-06-06 19:53:57 +12:00
'!src/js/models/*.spec.js',
2015-03-06 12:00:10 -03:00
'src/js/services/*.js',
2018-06-06 19:53:57 +12:00
'!src/js/services/*.spec.js',
2016-05-20 11:37:13 -03:00
'src/js/controllers/**/*.js',
2018-06-06 19:53:57 +12:00
'!src/js/controllers/**/*.spec.js',
2015-03-06 12:00:10 -03:00
'src/js/translations.js',
2016-08-10 17:35:40 -03:00
'src/js/appConfig.js',
2016-09-01 16:51:29 -03:00
'src/js/externalServices.js',
'src/js/init.js',
'src/js/trezor-url.js',
2017-03-29 20:49:32 +02:00
'bower_components/trezor-connect/connect.js',
2016-10-07 20:03:51 -04:00
'node_modules/bezier-easing/dist/bezier-easing.min.js',
'node_modules/cordova-plugin-qrscanner/dist/cordova-plugin-qrscanner-lib.min.js'
],
2016-12-27 15:38:57 -03:00
dest: 'www/js/app.js'
}
},
uglify: {
options: {
mangle: false
},
prod: {
files: {
2016-12-27 15:38:57 -03:00
'www/js/app.js': ['www/js/app.js'],
2018-01-16 10:55:45 +09:00
'www/lib/angular-components.js': ['www/lib/angular-components.js'],
2018-07-10 16:39:30 +09:00
'www/lib/bitcoin-cash-js.js': ['www/lib/bitcoin-cash-js.js'],
'www/lib/bitanalytics.js': ['www/lib/bitanalytics.js']
}
}
},
nggettext_extract: {
pot: {
files: {
'i18n/po/template.pot': [
'www/index.html',
'www/views/**/*.html',
'src/js/routes.js',
'src/js/services/*.js',
2016-05-27 15:06:41 -03:00
'src/js/controllers/**/*.js'
]
}
},
},
nggettext_compile: {
all: {
options: {
module: 'copayApp'
},
files: {
'src/js/translations.js': ['i18n/po/**/*.po']
}
},
2014-09-08 15:42:55 -03:00
},
copy: {
2016-05-13 10:49:36 -03:00
ionic_fonts: {
expand: true,
flatten: true,
2016-08-31 12:17:30 -03:00
src: 'bower_components/ionic/release/fonts/ionicons.*',
dest: 'www/fonts/'
2016-05-13 10:49:36 -03:00
},
ionic_js: {
expand: true,
flatten: true,
src: 'bower_components/ionic/release/js/ionic.bundle.min.js',
dest: 'www/lib/'
},
2015-06-02 16:44:59 -03:00
linux: {
files: [{
expand: true,
cwd: 'webkitbuilds/',
src: ['.desktop', '../www/img/app/favicon.ico', '../resources/<%= pkg.name %>/linux/512x512.png'],
dest: 'webkitbuilds/others/<%= pkg.title %>/linux64/',
flatten: true,
filter: 'isFile'
2015-12-11 15:06:43 -03:00
}],
2015-03-06 12:00:10 -03:00
}
},
2016-07-28 09:07:29 -03:00
nwjs: {
others: {
options: {
appName: '<%= pkg.nameCaseNoSpace %>',
platforms: ['win64', 'linux64'],
buildDir: './webkitbuilds/others',
version: '0.19.5',
exeIco: './www/img/app/logo.ico'
},
src: ['./package.json', './www/**/*']
},
dmg: {
options: {
appName: '<%= pkg.nameCaseNoSpace %>',
platforms: ['osx64'],
buildDir: './webkitbuilds/dmg',
version: '0.19.5',
macIcns: './resources/<%= pkg.name %>/mac/app.icns',
exeIco: './www/img/app/logo.ico',
macPlist: {
'CFBundleDisplayName': '<%= pkg.title %>',
'CFBundleShortVersionString': '<%= pkg.version %>',
'CFBundleVersion': '<%= pkg.androidVersion %>',
'LSApplicationCategoryType': 'public.app-category.finance',
'CFBundleURLTypes': [
{
'CFBundleURLName': 'URI Handler',
'CFBundleURLSchemes': ['bitcoin', '<%= pkg.name %>']
}
]
}
},
src: ['./package.json', './www/**/*']
},
pkg: {
options: {
2018-08-28 10:50:53 +09:00
appName: '<%= pkg.title %>',
platforms: ['osx64'],
buildDir: './webkitbuilds/pkg',
2018-08-28 10:50:53 +09:00
version: '0.19.4',
macIcns: './resources/<%= pkg.name %>/mac/pkg/app.icns',
exeIco: './www/img/app/logo.ico',
macPlist: {
'CFBundleIdentifier': 'com.bitcoin.mwallet.mac',
'CFBundleDisplayName': '<%= pkg.title %>',
'CFBundleShortVersionString': '<%= pkg.version %>',
'CFBundleVersion': '<%= pkg.androidVersion %>',
'LSApplicationCategoryType': 'public.app-category.finance',
'CFBundleURLTypes': [
{
'CFBundleURLName': 'URI Handler',
'CFBundleURLSchemes': ['bitcoin', '<%= pkg.name %>']
}
]
}
},
src: ['./package.json', './www/**/*']
2015-05-28 10:52:33 -03:00
},
2015-06-02 16:44:59 -03:00
},
compress: {
2015-12-11 15:06:43 -03:00
linux: {
2015-06-02 16:44:59 -03:00
options: {
archive: './webkitbuilds/others/<%= pkg.title %>-linux.zip'
2015-06-02 16:44:59 -03:00
},
expand: true,
cwd: './webkitbuilds/others/<%= pkg.title %>/linux64/',
2015-06-02 16:44:59 -03:00
src: ['**/*'],
2016-10-18 15:27:09 -03:00
dest: '<%= pkg.title %>-linux/'
2015-06-02 16:44:59 -03:00
}
},
browserify: {
dist: {
files: {
2016-08-10 16:08:11 -03:00
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
'angular-bitauth/angular-bitauth.js': ['angular-bitauth/index.js'],
'bitcoin-cash-js/bitcoin-cash-js.js': ['bitcoin-cash-js/index.js']
},
}
2014-04-07 15:31:13 -03:00
}
});
2016-09-01 16:51:29 -03:00
grunt.registerTask('default', ['nggettext_compile', 'exec:appConfig', 'exec:externalServices', 'browserify', 'sass', 'concat', 'copy:ionic_fonts', 'copy:ionic_js']);
2015-07-20 15:21:14 -03:00
grunt.registerTask('prod', ['default', 'uglify']);
grunt.registerTask('translate', ['nggettext_extract']);
2017-10-06 10:13:49 -03:00
grunt.registerTask('chrome', ['default','exec:chrome']);
2016-08-10 17:35:40 -03:00
grunt.registerTask('wp', ['prod', 'exec:wp']);
2016-09-06 17:47:21 -03:00
grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']);
grunt.registerTask('wp-init', ['default', 'exec:wpinit']);
2016-08-10 17:35:40 -03:00
grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
// Build all
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-app-release', ['build-mobile-release', 'build-desktop-release']);
/**
* Mobile app
*/
// Build mobile app
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-mobile-release', ['build-ios-release', 'build-android-release']);
// Build ios
grunt.registerTask('start-ios', ['exec:build_ios_debug', 'exec:xcode']);
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-ios-debug', ['exec:build_ios_debug']);
grunt.registerTask('build-ios-release', ['prod', 'exec:build_ios_release']);
// Build android
grunt.registerTask('start-android', ['build-android-debug', 'exec:run_android']);
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-android-debug', ['exec:build_android_debug']);
2018-09-10 20:26:33 +12:00
grunt.registerTask('start-android-emulator', ['build-android-debug', 'exec:run_android_emulator']);
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-android-release', ['prod', 'exec:build_android_release', 'sign-android']);
grunt.registerTask('sign-android', ['exec:sign_android']);
/**
* Desktop app
*/
// Build desktop
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-desktop', ['build-desktop-others', 'build-desktop-osx-dmg', 'build-desktop-osx-pkg']);
// Build desktop win64 & linux64
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-desktop-others', ['prod', 'nwjs:others', 'copy:linux', 'exec:create_others_dist']);
// Build desktop osx pkg
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-desktop-osx-pkg', ['prod', 'exec:get_nwjs_for_pkg', 'nwjs:pkg', 'exec:create_pkg_dist']);
// Build desktop osx dmg
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-desktop-osx-dmg', ['prod', 'nwjs:dmg', 'exec:create_dmg_dist']);
// Sign desktop
2018-09-04 16:45:52 +09:00
grunt.registerTask('sign-desktop', ['exec:sign_desktop_dist']);
2016-08-10 17:35:40 -03:00
// Release desktop
2018-09-04 16:45:52 +09:00
grunt.registerTask('build-desktop-release', ['build-desktop', 'sign-desktop']);
2014-04-07 15:31:13 -03:00
};