mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Add flow to api/server/server.js Add flow check to src/api: index, accountinfo, balances, orderbook.. orders, settings, transaction, transactions Add flow typecheck to api/ledger/pathfind Use eslint plugin flowtype to allow flow type annotations Babel-eslint emits errors when using the type keyword. This plugin works around the issue by stripping flow annotations before linting. Source: https://www.npmjs.com/package/eslint-plugin-flowtype Add flow to ledger/parse/account-order, trustline, orderbook-order
53 lines
998 B
Bash
Executable File
53 lines
998 B
Bash
Executable File
#!/bin/bash -ex
|
|
|
|
NODE_INDEX="$1"
|
|
TOTAL_NODES="$2"
|
|
|
|
typecheck() {
|
|
npm install -g flow-bin
|
|
npm run typecheck
|
|
}
|
|
|
|
lint() {
|
|
REPO_URL="https://raw.githubusercontent.com/ripple/javascript-style-guide"
|
|
curl "$REPO_URL/es6/eslintrc" > ./eslintrc
|
|
echo "plugins: [flowtype]" >> ./eslintrc
|
|
node_modules/.bin/eslint --reset -c ./eslintrc $(git --no-pager diff --name-only -M100% --diff-filter=AM --relative $(git merge-base FETCH_HEAD origin/HEAD) FETCH_HEAD | grep "\.js$")
|
|
}
|
|
|
|
unittest() {
|
|
npm test --coverage
|
|
npm run coveralls
|
|
}
|
|
|
|
oneNode() {
|
|
lint
|
|
typecheck
|
|
unittest
|
|
}
|
|
|
|
twoNodes() {
|
|
case "$NODE_INDEX" in
|
|
0) lint && unittest;;
|
|
1) typecheck;;
|
|
*) echo "ERROR: invalid usage"; exit 2;;
|
|
esac
|
|
}
|
|
|
|
threeNodes() {
|
|
case "$NODE_INDEX" in
|
|
0) lint;;
|
|
1) typecheck;;
|
|
2) unittest;;
|
|
*) echo "ERROR: invalid usage"; exit 2;;
|
|
esac
|
|
}
|
|
|
|
case "$TOTAL_NODES" in
|
|
"") oneNode;;
|
|
1) oneNode;;
|
|
2) twoNodes;;
|
|
3) threeNodes;;
|
|
*) echo "ERROR: invalid usage"; exit 2;;
|
|
esac
|