Skip to content

Commit

Permalink
Removed grunt, now using npm run tasks and make
Browse files Browse the repository at this point in the history
Moved homepage-related files to separate repository
  • Loading branch information
chill117 committed Dec 24, 2018
1 parent 95a0c6d commit d5d2022
Show file tree
Hide file tree
Showing 45 changed files with 4,604 additions and 6,980 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.gradle/
build/
node_modules/
public/
hooks/
platforms/
plugins/
Expand Down
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ node_js:
- "8"

before_install:
- npm install -g grunt-cli
- npm install -g mocha
- npm install -g eslint

env:
- TRAVIS_CI=1

install: npm install
install:
- npm install

before_script:
- npm run build
196 changes: 196 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
#

## Variables
BIN=node_modules/.bin
BUILD=build
BUILD_DEPS=$(BUILD)/deps
BUILD_DEPS_JS=$(BUILD)/dependencies.min.js
BUILD_ALL_JS=$(BUILD)/all.min.js
BUILD_ALL_CSS=$(BUILD)/all.min.css
BUILD_WORKER_BITCOIN_JS=$(BUILD)/workers/bitcoin.min.js
CSS=css
IMAGES=images
JS=js
PUBLIC=www
PUBLIC_ALL_CSS=$(PUBLIC)/css/all.min.css
PUBLIC_ALL_JS=$(PUBLIC)/js/all.min.js
PUBLIC_WORKER_BITCOIN_JS=$(PUBLIC)/js/workers/bitcoin.min.js
SCRIPTS=scripts

# Targets
#
# The format goes:
#
# target: list of dependencies
# commands to build target
#
# If something isn't re-compiling double-check the changed file is in the
# target's dependencies list.

# Phony targets - these are for when the target-side of a definition
# (such as "all" below) isn't a file but instead a just label. Declaring
# it as phony ensures that it always run, even if a file by the same name
# exists.
.PHONY: all clean fonts images sounds

all: config.xml $(PUBLIC)/index.html $(PUBLIC_ALL_CSS) $(PUBLIC_ALL_JS) $(PUBLIC_WORKER_BITCOIN_JS) fonts images sounds

clean:
# Delete build and output files:
rm -rf $(BUILD) $(PUBLIC)

fonts:
mkdir -p $(PUBLIC)/fonts/OpenSans
cp -r node_modules/open-sans-fontface/fonts/**/* $(PUBLIC)/fonts/OpenSans/

images:
mkdir -p $(PUBLIC)/images/
cp -r $(IMAGES)/* $(PUBLIC)/images/
cp -r $(IMAGES)/favicon/* $(PUBLIC)/images/favicon/
cp -r $(IMAGES)/favicon/favicon.ico $(PUBLIC)/favicon.ico

sounds:
mkdir -p $(PUBLIC)/sounds
cp -r sounds/* $(PUBLIC)/sounds/

config.xml: config-template.xml
node $(SCRIPTS)/copy-config-xml.js

$(PUBLIC)/index.html: index.html
mkdir -p $(PUBLIC)/
node $(SCRIPTS)/copy-index-html.js

$(BUILD)/css/*.min.css: $(CSS)/*.css
mkdir -p $(BUILD)/css
$(BIN)/postcss $^ --ext .min.css --dir $(BUILD)/css

$(BUILD)/css/views/*.min.css: $(CSS)/views/*.css
mkdir -p $(BUILD)/css/views
$(BIN)/postcss $^ --ext .min.css --dir $(BUILD)/css/views

APP_CSS_FILES=$(CSS)/fonts.css $(CSS)/reset.css $(CSS)/base.css $(CSS)/buttons.css $(CSS)/forms.css $(CSS)/header.css $(CSS)/menu.css $(CSS)/page.css $(CSS)/payment-method.css $(CSS)/amount.css $(CSS)/secondary-controls.css $(CSS)/number-pad.css $(CSS)/slider.css $(CSS)/result-indicator.css $(CSS)/views/*.css $(CSS)/responsive.css
APP_CSS_MIN_FILES=$(addprefix $(BUILD)/, $(patsubst %.css, %.min.css, $(APP_CSS_FILES)))
$(BUILD_ALL_CSS): $(BUILD)/css/*.min.css $(BUILD)/css/views/*.min.css
for file in $(APP_CSS_MIN_FILES); do \
cat $$file >> $(BUILD_ALL_CSS); \
echo "" >> $(BUILD_ALL_CSS); \
done

$(PUBLIC_ALL_CSS): $(BUILD_ALL_CSS)
mkdir -p $(PUBLIC)/css/
cp $(BUILD_ALL_CSS) $(PUBLIC_ALL_CSS)

$(BUILD_DEPS)/js/bitcoin.js: node_modules/bitcoinjs-lib/src/index.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify \
--entry node_modules/bitcoinjs-lib/src/index.js \
--standalone bitcoin \
--transform [ babelify --presets [ @babel/preset-env ] ] \
--outfile $(BUILD_DEPS)/js/bitcoin.js

$(BUILD_DEPS)/js/bitcoin.min.js: $(BUILD_DEPS)/js/bitcoin.js
$(BIN)/uglifyjs $(BUILD_DEPS)/js/bitcoin.js --mangle reserved=['BigInteger','ECPair','Point'] -o $(BUILD)/js/bitcoin.min.js

$(BUILD_DEPS)/js/basex.js: node_modules/base-x/index.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify --entry $^ --standalone $$(basename $@ .js) --outfile $@

$(BUILD_DEPS)/js/bech32.js: node_modules/bech32/index.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify --entry $^ --standalone $$(basename $@ .js) --outfile $@

$(BUILD_DEPS)/js/BigInteger.js: node_modules/bigi/lib/index.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify --entry $^ --standalone $$(basename $@ .js) --outfile $@

$(BUILD_DEPS)/js/bs58.js: node_modules/bs58/index.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify --entry $^ --standalone $$(basename $@ .js) --outfile $@

$(BUILD_DEPS)/js/Buffer.js: exports/buffer.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify --entry $^ --standalone $$(basename $@ .js) --outfile $@

$(BUILD_DEPS)/js/ecurve.js: node_modules/ecurve/lib/index.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify --entry $^ --standalone $$(basename $@ .js) --outfile $@

$(BUILD_DEPS)/js/QRCode.js: node_modules/qrcode/lib/browser.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify --entry $^ --standalone $$(basename $@ .js) --outfile $@

$(BUILD_DEPS)/js/querystring.js: exports/querystring.js
mkdir -p $(BUILD_DEPS)/js
$(BIN)/browserify --entry $^ --standalone $$(basename $@ .js) --outfile $@

$(BUILD_DEPS)/js/basex.min.js: $(BUILD_DEPS)/js/basex.js
$(BIN)/uglifyjs $^ -o $@

$(BUILD_DEPS)/js/bech32.min.js: $(BUILD_DEPS)/js/bech32.js
$(BIN)/uglifyjs $^ -o $@

$(BUILD_DEPS)/js/BigInteger.min.js: $(BUILD_DEPS)/js/BigInteger.js
$(BIN)/uglifyjs $^ -o $@

$(BUILD_DEPS)/js/bs58.min.js: $(BUILD_DEPS)/js/bs58.js
$(BIN)/uglifyjs $^ -o $@

$(BUILD_DEPS)/js/Buffer.min.js: $(BUILD_DEPS)/js/Buffer.js
$(BIN)/uglifyjs $^ -o $@

$(BUILD_DEPS)/js/ecurve.min.js: $(BUILD_DEPS)/js/ecurve.js
$(BIN)/uglifyjs $^ -o $@

$(BUILD_DEPS)/js/QRCode.min.js: $(BUILD_DEPS)/js/QRCode.js
$(BIN)/uglifyjs $^ -o $@

$(BUILD_DEPS)/js/querystring.min.js: $(BUILD_DEPS)/js/querystring.js
$(BIN)/uglifyjs $^ -o $@

DEPS_JS_FILES=node_modules/core-js/client/shim.min.js node_modules/async/dist/async.min.js node_modules/bignumber.js/bignumber.min.js node_modules/jquery/dist/jquery.min.js node_modules/underscore/underscore-min.js node_modules/backbone/backbone-min.js node_modules/backbone.localstorage/build/backbone.localStorage.min.js node_modules/handlebars/dist/handlebars.min.js node_modules/js-sha3/build/sha3.min.js $(BUILD_DEPS)/js/basex.min.js $(BUILD_DEPS)/js/bech32.min.js $(BUILD_DEPS)/js/BigInteger.min.js $(BUILD_DEPS)/js/bs58.min.js $(BUILD_DEPS)/js/Buffer.min.js $(BUILD_DEPS)/js/ecurve.min.js $(BUILD_DEPS)/js/QRCode.min.js $(BUILD_DEPS)/js/querystring.min.js third-party/sjcl/sjcl.min.js third-party/monero/crypto.js node_modules/moment/min/moment-with-locales.min.js
$(BUILD_DEPS_JS): $(DEPS_JS_FILES)
for file in $(DEPS_JS_FILES); do \
cat $$file >> $(BUILD_DEPS_JS); \
echo "" >> $(BUILD_DEPS_JS); \
done

$(BUILD)/js/**/*.min.js: $(JS)/*.js $(JS)/**/*.js $(JS)/**/**/*.js
for input in $^; do \
dir=$$(dirname $(BUILD)/$$input); \
output="$$dir/$$(basename $$input .js).min.js"; \
mkdir -p $$dir; \
$(BIN)/uglifyjs -o $$output $$input; \
done

APP_JS_FILES=$(JS)/jquery.extend/*.js $(JS)/backbone.extend/*.js $(JS)/handlebars.extend/*.js $(JS)/app.js $(JS)/queues.js $(JS)/util.js $(JS)/device.js $(JS)/screen-saver.js $(JS)/nfc.js $(JS)/sqlite.js $(JS)/lang/*.js $(JS)/abstracts/*.js $(JS)/services/*.js $(JS)/models/*.js $(JS)/collections/*.js $(JS)/views/utility/*.js $(JS)/views/*.js $(JS)/payment-methods/bitcoin.js $(JS)/payment-methods/bitcoin-testnet.js $(JS)/payment-methods/bitcoin-lightning.js $(JS)/payment-methods/litecoin.js $(JS)/payment-methods/monero.js $(JS)/config.js $(JS)/cache.js $(JS)/settings.js $(JS)/sound.js $(JS)/i18n.js $(JS)/router.js $(JS)/init.js
APP_JS_MIN_FILES=$(addprefix $(BUILD)/, $(patsubst %.js, %.min.js, $(APP_JS_FILES)))
JS_FILES=$(BUILD_DEPS_JS) $(APP_JS_MIN_FILES)
$(BUILD_ALL_JS): $(BUILD_DEPS_JS) $(BUILD)/js/**/*.min.js
for file in $(JS_FILES); do \
cat $$file >> $(BUILD_ALL_JS); \
echo "" >> $(BUILD_ALL_JS); \
done

$(PUBLIC_ALL_JS): $(BUILD_ALL_JS)
mkdir -p $(PUBLIC)/js/
cp $(BUILD_ALL_JS) $(PUBLIC_ALL_JS)

WORKER_BITCOIN_JS_FILES=node_modules/async/dist/async.min.js node_modules/bignumber.js/bignumber.min.js node_modules/underscore/underscore-min.js node_modules/js-sha3/build/sha3.min.js $(BUILD_DEPS)/js/bech32.min.js $(BUILD_DEPS)/js/BigInteger.min.js $(BUILD_DEPS)/js/bs58.min.js $(BUILD_DEPS)/js/Buffer.min.js $(BUILD_DEPS)/js/ecurve.min.js third-party/sjcl/sjcl.min.js $(BUILD)/js/workers/bitcoin.min.js
$(BUILD_WORKER_BITCOIN_JS): $(WORKER_BITCOIN_JS_FILES)
mkdir -p $(BUILD)/workers
for file in $(WORKER_BITCOIN_JS_FILES); do \
cat $$file >> $(BUILD_WORKER_BITCOIN_JS); \
echo "" >> $(BUILD_WORKER_BITCOIN_JS); \
done

$(PUBLIC_WORKER_BITCOIN_JS): $(BUILD_WORKER_BITCOIN_JS)
mkdir -p $(PUBLIC)/js/workers/
cp $(BUILD_WORKER_BITCOIN_JS) $(PUBLIC_WORKER_BITCOIN_JS)
39 changes: 2 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ If you would like to contribute to the project, the following should help get yo
* [Monero](#monero)
* [Android Development](#android-development)
* [Create Signed APK](#create-signed-apk)
* [Homepage](#homepage) - [cryptoterminal.eu](https://cryptoterminal.eu)


## Requirements

The following is a list of requirements needed to contribute to this project.

* [nodejs](https://nodejs.org/) - For Linux and Mac install node via [nvm](https://github.com/creationix/nvm). For Windows, use an [installer](https://nodejs.org/en/download/) from the nodejs website.
* [grunt-cli](https://gruntjs.com/getting-started) - `npm install -g grunt-cli`
* For Android development:
* [cordova](https://cordova.apache.org/#getstarted) - `npm install -g cordova`
* [Java Development Kit (JDK)](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html) version 8 or higher. Use your system's native package manager to install the JDK (if available).
Expand All @@ -54,34 +52,11 @@ Don't forget to replace `YOUR_USERNAME` with your GitHub username.
```bash
cd crypto-terminal
npm install
grunt
```

Open your browser and navigate to [localhost:3000](http://localhost:3000). You should see the settings screen the first time you open the app.


## Technical Overview

The technology stack includes:
* Standard web technologies (HTML, CSS, JavaScript).
* [Backbone.js](http://backbonejs.org/) - A JavaScript library for developing complex web applications.
* [cordova](https://cordova.apache.org/) - To wrap the web application and create builds for Android, iOS, and other mobile platforms.
* [nodejs](https://nodejs.org/) - As a build tool.

Directory structure explained:
* `build/` - Temporary files used during the build process by Grunt.
* `css/` - CSS source files.
* `exports/` - Files that are processed by browserify, which processes node.js modules so that they can be run in a browser.
* `grunt/` - Grunt task configuration files go here.
* `html/` - Source HTML files go here (templates for example).
* `js/` - JavaScript source files.
* `scripts/` - Miscellaneous script files go here.
* `tasks/` - Custom Grunt tasks live here.
* `third-party/` - Custom builds of third-party libraries.
* `test/` - Automated tests are defined here. This project uses [mocha]().
* `www/` - Final output from the build process. Minified and uglified, this is served in the app once you run it.


## Developing with Cryptocurrencies

This project is focused on working with cryptocurrencies as a payment method. As such, you will need to know some basics about how cryptocurrencies work and how to develop applications that use them.
Expand Down Expand Up @@ -162,16 +137,6 @@ If successful, it should have created a new `.apk` file at the following path:
```


## Homepage

The homepage is hosted via [GitHub pages](https://pages.github.com/) at [cryptoterminal.eu](https://cryptoterminal.eu/). It is intended as a non-technical entry-point for merchants to find and learn about the app.

The source files for the homepage are located in this project in the `homepage/` directory.

To build and serve the homepage locally:
```bash
grunt homepage
```
Then open your browser to [localhost:3003](http://localhost:3003).
## License

To update the production build, copy the homepage build files from `build/homepage/www` to the `gh-pages` git branch in this project.
This project is licensed under the [GNU Affero General Public License v3 (AGPL-3.0)](https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)).
46 changes: 0 additions & 46 deletions grunt/aliases.json

This file was deleted.

Loading

0 comments on commit d5d2022

Please sign in to comment.