From 3f63d044e5a8bd6d00e62fc94d7f2f3ba115a8d2 Mon Sep 17 00:00:00 2001 From: Mariano Cortesi Date: Fri, 9 Aug 2019 21:15:42 -0300 Subject: [PATCH] cleanup: npm scripts, circleci, docker (#397) - Use build, lint and install as standard scripts for every package - rename lint-checks to lint - remove old dockerfile - rename dockerfiles to use `Dockerfile` name - Simplify circleci build - add tslint to utils - normalize script names - rename compile-typescript to build:ts - create build:gen for generated files - don't compile typescript on lint. (build will do that) - Fix linting problems * Revisit celotool docker file - Build projects - fix missing dependencies - improve docker caching & size * circleci: lint & prettify:diff as 2 steps --- .circleci/config.yml | 113 ++++++------------ .dockerignore | 20 +++- .mergify.yml | 2 +- .prettierignore | 39 ++++-- cloudbuild.yaml | 18 +-- dockerfiles/celotool/Dockerfile | 36 ++++++ dockerfiles/cli/.dockerignore | 3 - .../cli/{Dockerfile.cli => Dockerfile} | 0 dockerfiles/monorepo/.dockerignore | 4 - dockerfiles/monorepo/Dockerfile | 17 --- dockerfiles/monorepo/Dockerfile.celotool | 29 ----- .../Dockerfile} | 0 package.json | 5 +- packages/blockchain-api/package.json | 3 +- packages/celotool/package.json | 4 +- packages/celotool/tsconfig.json | 1 + packages/cli/package.json | 2 - packages/contractkit/bin/build-sdk.js | 2 +- packages/contractkit/package.json | 9 +- packages/dappkit/package.json | 2 +- packages/faucet/package.json | 6 +- packages/mobile/package.json | 7 +- packages/notification-service/package.json | 1 - packages/protocol/package.json | 13 +- .../protocol/scripts/bash/get_balances.sh | 3 +- packages/protocol/scripts/bash/govern.sh | 3 +- packages/protocol/scripts/bash/invite.sh | 3 +- packages/protocol/scripts/bash/migrate.sh | 3 +- .../protocol/scripts/bash/network_check.sh | 3 +- packages/protocol/scripts/bash/revoke.sh | 2 +- .../scripts/bash/set_exchange_rate.sh | 3 +- packages/protocol/scripts/bash/transfer.sh | 3 +- packages/protocol/scripts/bash/upgrade.sh | 3 +- packages/react-components/package.json | 1 - .../transaction-metrics-exporter/package.json | 2 +- packages/utils/package.json | 8 +- packages/utils/src/commentEncryption.ts | 6 +- packages/utils/src/countries.ts | 50 ++++---- packages/utils/src/dappkit.ts | 2 +- packages/utils/src/parsing.ts | 2 +- packages/utils/test/async-helpers.test.ts | 2 +- packages/utils/test/commentEncryption.test.ts | 16 +-- packages/utils/tsconfig.json | 5 + packages/utils/tslint.json | 7 ++ packages/verification-pool-api/README.md | 2 +- packages/verification-pool-api/build.sh | 2 +- .../deployment/deployment-utils.ts | 2 +- packages/verification-pool-api/package.json | 5 +- packages/verifier/package.json | 3 +- packages/web/package.json | 1 - packages/web/tsconfig.json | 3 +- yarn.lock | 44 ------- 52 files changed, 227 insertions(+), 298 deletions(-) create mode 100644 dockerfiles/celotool/Dockerfile delete mode 100644 dockerfiles/cli/.dockerignore rename dockerfiles/cli/{Dockerfile.cli => Dockerfile} (100%) delete mode 100644 dockerfiles/monorepo/.dockerignore delete mode 100644 dockerfiles/monorepo/Dockerfile delete mode 100644 dockerfiles/monorepo/Dockerfile.celotool rename dockerfiles/{monorepo/Dockerfile.transaction-metrics-exporter => transaction-metrics-exporter/Dockerfile} (100%) create mode 100644 packages/utils/tslint.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 38f9d5588c6..ccd838454d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,9 @@ defaults: &defaults working_directory: ~/app docker: - image: celohq/node8:gcloud-deps + environment: + # To avoid ENOMEM problem when running node + NODE_OPTIONS: "--max-old-space-size=4096" android-defaults: &android-defaults <<: *defaults @@ -52,19 +55,22 @@ jobs: at: ~/app - restore_cache: - key: yarn-v2-{{ checksum "yarn.lock" }}-{{ arch }} + keys: + - yarn-v2-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-v2-{{ arch }}-{{ .Branch }}- + - yarn-v2-{{ arch }}- + - yarn-v2- - run: name: Delete @celo dir from node_modules (if its there) command: rm -rf ~/app/node_modules/@celo - run: - name: yarn + name: Install dependencies command: | # Deals with yarn install flakiness which can come due to yarnpkg.com being # unreliable. For example, https://circleci.com/gh/celo-org/celo-monorepo/82685 yarn install || yarn install - - run: name: Fail if someone forgot to commit "yarn.lock" command: | @@ -72,76 +78,36 @@ jobs: echo "There are git differences after running yarn install" exit 1 fi - - run: npm rebuild scrypt - save_cache: - key: yarn-v2-{{ checksum "yarn.lock" }}-{{ arch }} + key: yarn-v2-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - node_modules - packages/*/node_modules + + - run: + name: Build packages + command: | + # separate build to avoid ENOMEN in CI :( + yarn build --scope @celo/protocol + yarn build --scope docs + yarn build --scope @celo/contractkit + yarn build --ignore @celo/protocol --ignore docs --ignore @celo/contractkit + - persist_to_workspace: root: . - paths: . + paths: + - . lint-checks: <<: *defaults steps: - attach_workspace: at: ~/app - - - run: yarn run ci-lint - - build-all-packages: - <<: *defaults - steps: - - attach_workspace: - at: ~/app - - - run: - name: Build SDK - command: | - set -e - yarn --cwd=packages/contractkit build alfajores - - - run: - name: Build CLI - command: | - yarn --cwd=packages/cli build-sdk alfajores - yarn --cwd=packages/cli build - yarn --cwd=packages/cli docs - - - run: - name: Fail if someone forgot to commit CLI docs - command: | - if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then - git --no-pager diff packages/docs/command-line-interface - echo "There are git differences after generating CLI docs" - exit 1 - fi - - - run: - name: Build mobile - command: yarn --cwd=packages/mobile build - - - run: - name: Build Verification Pool - command: yarn --cwd=packages/verification-pool-api compile-typescript - - - run: - name: Build Verifier - command: yarn --cwd=packages/verifier build:typescript - - - run: - name: Build Web - command: | - set -e - yarn --cwd=packages/web build - - - run: - name: Build Docs - command: yarn --cwd=packages/docs build + - run: yarn run prettify:diff + - run: yarn run lint general-test: <<: *defaults @@ -269,6 +235,15 @@ jobs: command: | set -euo pipefail yarn --cwd=packages/cli test + - run: + name: Fail if someone forgot to commit CLI docs + command: | + yarn --cwd=packages/cli docs + if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then + git --no-pager diff packages/docs/command-line-interface + echo "There are git differences after generating CLI docs" + exit 1 + fi end-to-end-geth-transfer-test: <<: *defaults @@ -456,54 +431,44 @@ workflows: - lint-checks: requires: - install_dependencies - - build-all-packages: - requires: - - install_dependencies - - lint-checks - general-test: requires: - install_dependencies - - lint-checks - contractkit-test: requires: - install_dependencies - - lint-checks - cli-test: requires: - install_dependencies - - lint-checks - mobile-test: requires: - - install_dependencies - lint-checks - mobile-test-build-app: requires: - - install_dependencies - - lint-checks + - mobile-test - verification-pool-api: requires: - - install_dependencies - lint-checks - protocol-test: requires: - - install_dependencies - lint-checks + - contractkit-test - end-to-end-geth-transfer-test: requires: - - install_dependencies - lint-checks + - contractkit-test - end-to-end-geth-governance-test: requires: - - install_dependencies - lint-checks + - contractkit-test - end-to-end-geth-sync-test: requires: - - install_dependencies - lint-checks + - contractkit-test - end-to-end-geth-integration-sync-test: requires: - - install_dependencies - lint-checks + - contractkit-test nightly: triggers: - schedule: diff --git a/.dockerignore b/.dockerignore index 6fa84791dec..d87868e8d46 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,20 @@ -packages/mobile node_modules **/node_modules -*node_modules \ No newline at end of file +*node_modules + +# root folders +.github +dockerfiles +.vscode + +# not docker packages +packages/analytics +packages/blockchain-api +packages/docs +packages/faucet +packages/helm-charts +packages/mobile +packages/notification-service +# packages/verification-pool-api +packages/verifier +packages/web diff --git a/.mergify.yml b/.mergify.yml index bfcb3165ce5..95c4f286dc9 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -11,9 +11,9 @@ pull_request_rules: # Only enable this when the pull request is being merged into master - "base=master" # List of all the tests that should pass. - - "status-success=ci/circleci: general-test" - "status-success=ci/circleci: install_dependencies" - "status-success=ci/circleci: lint-checks" + - "status-success=ci/circleci: general-test" - "status-success=ci/circleci: mobile-test" - "status-success=ci/circleci: protocol-test" - "status-success=ci/circleci: verification-pool-api" diff --git a/.prettierignore b/.prettierignore index 264ea8e386e..8f741255718 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,21 +1,38 @@ package.json **/.next **/coverage -packages/functions/lib -packages/protocol/types/typechain +**/node_modules +**/privacy/* +.git/ + +packages/blockchain-api/dist + +packages/cli/lib + +packages/contractkit/lib/ +packages/contractkit/.artifacts/ +packages/contractkit/contracts/ +packages/contractkit/types/ +packages/dappkit/lib/ +packages/docs/_book +packages/faucet/dist/ +packages/mobile/src/geth/*.json +packages/notification-service/dist/ + +packages/protocol/build/ +packages/protocol/types/ packages/protocol/lib/**/*.js packages/protocol/scripts/**/*.js packages/protocol/migrations/**/*.js packages/protocol/tests/**/*.js -packages/protocol/types/**/*.js -**/privacy/* -packages/mobile/src/geth/*.json + packages/transaction-metrics-exporter/src/contracts/*.ts -packages/verification-pool-api/lib/**/*.js +packages/dappkit/lib/ +packages/utils/lib/ + +packages/verification-pool-api/lib/ packages/verification-pool-api/contracts/*.ts -packages/contractkit/.artifacts/ -packages/contractkit/contracts/ -packages/contractkit/lib/ -packages/contractkit/types/ + packages/web/dist -.git/ +packages/web/.next + diff --git a/cloudbuild.yaml b/cloudbuild.yaml index b5563bdd4f1..fdd720ccc54 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -3,33 +3,33 @@ steps: -- name: gcr.io/kaniko-project/executor:latest +- id: "docker:celotool" + name: gcr.io/kaniko-project/executor:latest args: [ - "--dockerfile=dockerfiles/monorepo/Dockerfile.celotool", + "--dockerfile=dockerfiles/celotool/Dockerfile", "--cache=true", "--destination=gcr.io/$PROJECT_ID/celo-monorepo:celotool-$COMMIT_SHA" ] - id: Build celotool docker image waitFor: ['-'] -- name: gcr.io/kaniko-project/executor:latest +- id: "docker:transaction-metrics-exporter" + name: gcr.io/kaniko-project/executor:latest args: [ - "--dockerfile=dockerfiles/monorepo/Dockerfile.transaction-metrics-exporter", + "--dockerfile=dockerfiles/transaction-metrics-exporter/Dockerfile", "--cache=true", "--destination=gcr.io/$PROJECT_ID/celo-monorepo:transaction-metrics-exporter-$COMMIT_SHA" ] - id: Build transaction metrics exporter docker image waitFor: ['-'] -- name: gcr.io/kaniko-project/executor:latest +- id: "docker:cli" + name: gcr.io/kaniko-project/executor:latest args: [ - "--dockerfile=dockerfiles/cli/Dockerfile.cli", + "--dockerfile=dockerfiles/cli/Dockerfile", "--cache=true", "--destination=gcr.io/$PROJECT_ID/celocli:$COMMIT_SHA", "--build-arg", "celo_env=alfajores" ] - id: Build CLI docker image waitFor: ['-'] timeout: 3000s diff --git a/dockerfiles/celotool/Dockerfile b/dockerfiles/celotool/Dockerfile new file mode 100644 index 00000000000..a2d417245fb --- /dev/null +++ b/dockerfiles/celotool/Dockerfile @@ -0,0 +1,36 @@ +FROM node:8 +WORKDIR /celo-monorepo + +# Needed for gsutil +RUN apt-get update && \ + apt-get install -y lsb-release && \ + export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \ + echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ + apt-get update -y && \ + apt-get install -y google-cloud-sdk && \ + rm -rf /var/lib/apt/lists/* + + +# ensure yarn.lock is evaluated by kaniko cache diff +COPY lerna.json package.json yarn.lock ./ +COPY scripts/ scripts/ +COPY packages/utils/package.json packages/utils/ +COPY packages/typescript/package.json packages/typescript/ +COPY packages/contractkit/package.json packages/contractkit/ +COPY packages/verification-pool-api/package.json packages/verification-pool-api/ +COPY packages/celotool/package.json packages/celotool/ + +RUN yarn install --frozen-lockfile && yarn cache clean + +COPY packages/utils packages/utils/ +COPY packages/typescript packages/typescript/ +COPY packages/contractkit packages/contractkit/ +COPY packages/verification-pool-api packages/verification-pool-api/ +COPY packages/celotool packages/celotool/ + +# RUN yarn build + +ENV PATH="/celo-monorepo/packages/celotool/bin:${PATH}" + +CMD ["celotooljs.sh"] diff --git a/dockerfiles/cli/.dockerignore b/dockerfiles/cli/.dockerignore deleted file mode 100644 index bac7aa57360..00000000000 --- a/dockerfiles/cli/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -packages/mobile -node_modules/ -*/*/node_modules/ \ No newline at end of file diff --git a/dockerfiles/cli/Dockerfile.cli b/dockerfiles/cli/Dockerfile similarity index 100% rename from dockerfiles/cli/Dockerfile.cli rename to dockerfiles/cli/Dockerfile diff --git a/dockerfiles/monorepo/.dockerignore b/dockerfiles/monorepo/.dockerignore deleted file mode 100644 index 6fa84791dec..00000000000 --- a/dockerfiles/monorepo/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -packages/mobile -node_modules -**/node_modules -*node_modules \ No newline at end of file diff --git a/dockerfiles/monorepo/Dockerfile b/dockerfiles/monorepo/Dockerfile deleted file mode 100644 index 827a17e7e08..00000000000 --- a/dockerfiles/monorepo/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:8 - -RUN apt-get update -RUN apt-get install lsb-release -y - -# Needed for gsutil -RUN export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \ - echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ - apt-get update -y && apt-get install google-cloud-sdk -y - -# ensure yarn.lock is evaluated by kaniko cache diff -COPY . /celo-monorepo -WORKDIR /celo-monorepo -RUN yarn install - -CMD ["/bin/sh"] diff --git a/dockerfiles/monorepo/Dockerfile.celotool b/dockerfiles/monorepo/Dockerfile.celotool deleted file mode 100644 index 0f1ed668996..00000000000 --- a/dockerfiles/monorepo/Dockerfile.celotool +++ /dev/null @@ -1,29 +0,0 @@ -FROM node:8 - -RUN apt-get update -RUN apt-get install lsb-release -y - -# Needed for gsutil -RUN export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \ - echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ - apt-get update -y && apt-get install google-cloud-sdk -y - -# ensure yarn.lock is evaluated by kaniko cache diff - -COPY lerna.json /celo-monorepo/lerna.json -COPY scripts /celo-monorepo/scripts -COPY package.json /celo-monorepo/package.json -COPY yarn.lock /celo-monorepo/yarn.lock -COPY .prettierrc.js /celo-monorepo/.prettierrc.js -COPY packages/utils /celo-monorepo/packages/utils -COPY packages/typescript /celo-monorepo/packages/typescript -COPY packages/contractkit /celo-monorepo/packages/contractkit -COPY packages/celotool /celo-monorepo/packages/celotool - -WORKDIR /celo-monorepo -RUN yarn install - -ENV PATH="/celo-monorepo/packages/celotool/bin:${PATH}" - -CMD ["celotooljs.sh"] diff --git a/dockerfiles/monorepo/Dockerfile.transaction-metrics-exporter b/dockerfiles/transaction-metrics-exporter/Dockerfile similarity index 100% rename from dockerfiles/monorepo/Dockerfile.transaction-metrics-exporter rename to dockerfiles/transaction-metrics-exporter/Dockerfile diff --git a/package.json b/package.json index 2fb6089dd44..35c48f3c081 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,7 @@ "private": true, "scripts": { "install-pkg": "yarn install --link-duplicates", - "precommit": "pretty-quick --staged", - "ci-lint": "yarn run prettify:diff && yarn run lint-checks", - "lint-checks": "yarn run lerna run lint-checks", + "lint": "yarn lerna run lint", "prettify": "yarn run prettier --config .prettierrc.js --write '**/*.+(ts|tsx|js|jsx)'", "prettify:diff": "yarn run prettier --config .prettierrc.js --list-different '**/*.+(ts|tsx|js|jsx)'", "reset": "yarn reset-modules && yarn reset-cache", @@ -17,6 +15,7 @@ "reset-rn": "watchman watch-del-all; rm -rf $TMPDIR/metro-cache-*; rm -rf $TMPDIR/haste-map-*; rm -rf $TMPDIR/metro-symbolicate*", "reset-yarn": "yarn cache clean", "test": "yarn run lerna run test", + "build": "yarn run lerna run build", "report-coverage": "yarn run lerna run test-coverage", "test:watch": "node node_modules/jest/bin/jest.js --watch", "postinstall": "yarn run lerna --concurrency 1 run postinstall && patch-package && sh scripts/custom_patch_packages.sh && yarn keys:decrypt", diff --git a/packages/blockchain-api/package.json b/packages/blockchain-api/package.json index 96a4a0772ca..a954913ca3e 100644 --- a/packages/blockchain-api/package.json +++ b/packages/blockchain-api/package.json @@ -12,10 +12,9 @@ "test": "jest --ci --silent --coverage --runInBand", "test:verbose": "jest --ci --verbose --runInBand", "lint": "tslint -c tslint.json --project tsconfig.json", - "lint-checks": "yarn run lint && tsc --project tsconfig.json --noEmit", "start": "node ./dist/index.js", "start:dev": "tsc-watch --onSuccess \"node ./dist/index.js\" ", - "build": "tsc", + "build": "tsc -p .", "gcp-build": "npm run build", "deploy": "gcloud app deploy" }, diff --git a/packages/celotool/package.json b/packages/celotool/package.json index a8fd437a480..44fd32087b9 100644 --- a/packages/celotool/package.json +++ b/packages/celotool/package.json @@ -12,6 +12,7 @@ "@google-cloud/storage": "^2.4.3", "@types/bip32": "^1.0.1", "@types/bip39": "^2.4.2", + "bignumber.js": "^7.2.0", "bip32": "^1.0.2", "bip39": "^2.5.0", "buffer-reverse": "^1.0.1", @@ -32,6 +33,7 @@ "devDependencies": { "@types/dotenv": "^4.0.3", "@types/jest": "^24.0.13", + "@types/node-fetch": "^2.1.2", "@types/prompts": "^1.1.1", "@types/web3": "^1.0.18", "@types/yargs": "^12.0.1", @@ -43,7 +45,7 @@ "cli": "TS_NODE_FILES=true ts-node -r tsconfig-paths/register src/cli.ts", "test": "jest", "lint": "tslint -c tslint.json --project tsconfig.json", - "lint-checks": "yarn run lint && tsc --project tsconfig.json --noEmit" + "build": "tsc -p tsconfig.json " }, "private": true } diff --git a/packages/celotool/tsconfig.json b/packages/celotool/tsconfig.json index 631e788fa86..3a272b62d7e 100644 --- a/packages/celotool/tsconfig.json +++ b/packages/celotool/tsconfig.json @@ -15,6 +15,7 @@ "noUnusedParameters": true, "resolveJsonModule": true, "strict": true, + "noEmit": true, "target": "es6", "esModuleInterop": true, "allowSyntheticDefaultImports": true, diff --git a/packages/cli/package.json b/packages/cli/package.json index 63fd11e6065..eb6ffb82ca9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -21,11 +21,9 @@ "node": ">=8.0.0" }, "scripts": { - "build:sdk": "yarn --cwd=packages/contractkit build-sdk", "build": "rm -rf lib && tsc -b", "docs": "yarn oclif-dev readme --multi --dir=../docs/command-line-interface && yarn prettier ../docs/command-line-interface/*.md --write", "lint": "tslint -c tslint.json --project tsconfig.json", - "lint-checks": "yarn run lint", "test": "export TZ=UTC && jest --ci --silent" }, "dependencies": { diff --git a/packages/contractkit/bin/build-sdk.js b/packages/contractkit/bin/build-sdk.js index 1c0acfdf992..35eb564b178 100755 --- a/packages/contractkit/bin/build-sdk.js +++ b/packages/contractkit/bin/build-sdk.js @@ -135,7 +135,7 @@ function buildSdk() { writeNetworkNameToFile(network, contractsPath) console.debug('Recompiling typescript') - execCmd(`yarn run --cwd="${__dirname}/.." compile-typescript`) + execCmd(`yarn run --cwd="${__dirname}/.." build:ts`) console.debug('build-sdk done') } catch (error) { console.error('Error building SDK', error) diff --git a/packages/contractkit/package.json b/packages/contractkit/package.json index 0e8e235c582..0a30cc68e90 100644 --- a/packages/contractkit/package.json +++ b/packages/contractkit/package.json @@ -7,13 +7,12 @@ "author": "Celo", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && bin/build-sdk.js", - "compile-typescript": "tsc", + "build:for-env": "bin/build-sdk.js", + "build:ts": "tsc -p .", "clean": "rm -rf lib .artifacts contracts types lib", "lint": "tslint -c tslint.json --project tsconfig.json", - "lint-checks": "yarn run lint && yarn run build alfajores", - "postinstall": "yarn run build alfajores", - "prettify": "yarn run prettier --config ../../.prettierrc.js --write '{contracts,types}/**/*.+(ts|tsx|js|jsx)'", + "prebuild": "yarn clean", + "build": "yarn run build:for-env alfajores", "test": "export TZ=UTC && jest --ci --silent --coverage --runInBand test/attestations.test.ts test/erc20-utils.test.ts test/google-storage-utils.test.ts test/start_geth.sh test/transaction-utils.test.ts", "test:verbose": "export TZ=UTC && jest --ci --verbose --runInBand test/attestations.test.ts test/erc20-utils.test.ts test/google-storage-utils.test.ts test/start_geth.sh test/transaction-utils.test.ts", "test-licenses": "yarn licenses list --prod | grep '\\(─ GPL\\|─ (GPL-[1-9]\\.[0-9]\\+ OR GPL-[1-9]\\.[0-9]\\+)\\)' && echo 'Found GPL license(s). Use 'yarn licenses list --prod' to look up the offending package' || echo 'No GPL licenses found'" diff --git a/packages/dappkit/package.json b/packages/dappkit/package.json index 0842a6c43fe..4137faff64b 100644 --- a/packages/dappkit/package.json +++ b/packages/dappkit/package.json @@ -5,7 +5,7 @@ "build": "tsc" }, "dependencies": { - "@celo/contractkit": "0.0.3", + "@celo/contractkit": "0.0.4", "@celo/utils": "0.0.5", "expo": "^34.0.1" }, diff --git a/packages/faucet/package.json b/packages/faucet/package.json index 3d5dd6c0586..46ab2f8748c 100644 --- a/packages/faucet/package.json +++ b/packages/faucet/package.json @@ -13,12 +13,8 @@ "serve": "cross-env NODE_ENV=production fi rebase serve", "deploy": "firebase deploy", "clean": "tsc -b . --clean", - "build:contracts": "yarn run --cwd=../celotool cli copy-contract-artifacts --output-path=../faucet/src/generated --celo-env=integration --contracts=StableToken", "build": "tsc -b .", - "lint:types-functions": "tsc -p . --noEmit", - "lint:functions": "tslint --project .", - "lint": "yarn lint:functions && yarn lint:types-functions", - "lint-checks": "yarn lint", + "lint": "tslint --project .", "transfer-funds": "ts-node scripts/transfer-funds.ts", "cli": "ts-node scripts/cli.ts" }, diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 3d30708346a..c06c2f9444b 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -9,11 +9,10 @@ "start:bg": "react-native start &", "start:android": "react-native run-android", "start:ios": "react-native run-ios", - "lint-checks": "yarn run lint && yarn run build:typescript", "lint": "tslint -c tslint.json --project tsconfig.json", - "build": "yarn run build:typescript && yarn run build:metro", - "build:sdk": "build-sdk", - "build:typescript": "tsc --noEmit", + "build": "yarn run build:ts && yarn run build:metro", + "build:sdk": "yarn --cwd ../contractkit build:for-env", + "build:ts": "tsc --noEmit", "build:metro": "echo 'NOT WORKING RIGHT NOW'", "build:gen-graphql-types": "gql-gen --schema http://localhost:8080/graphql --template graphql-codegen-typescript-template --out ./typings/ 'src/**/*.tsx'", "dev": "react-native run-android --appIdSuffix \"debug\"", diff --git a/packages/notification-service/package.json b/packages/notification-service/package.json index 1de360c525b..4b97225fd86 100644 --- a/packages/notification-service/package.json +++ b/packages/notification-service/package.json @@ -14,7 +14,6 @@ "test": "export TZ=UTC && jest", "test:watch": "yarn test --watch", "lint": "tslint -c tslint.json --project tsconfig.json", - "lint-checks": "yarn run lint && yarn build --noEmit", "start": "node ./dist/index.js", "start:local": "npm run build; cp config/config.local.env .env; node --inspect ./dist/index.js", "deploy": "./deploy.sh" diff --git a/packages/protocol/package.json b/packages/protocol/package.json index e968b9855c8..759888601b0 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -8,16 +8,17 @@ "scripts": { "lint:ts": "tslint -c tslint.json --project tsconfig.json", "lint:sol": "solhint './contracts/**/*.sol'", - "lint-checks": "yarn run lint:ts && yarn run lint:sol", - "compile-typescript": "rm -f migrations/*.js* && tsc -b", - "clean": "rm -rf ../types/typechain && rm -rf build/* && rm -rf migrations/*.js* && rm -rf test/**/*.js* && rm -f lib/*.js*", - "pretest": "yarn run contract-types && yarn run compile-typescript", + "lint": "yarn run lint:ts && yarn run lint:sol", + "clean": "rm -rf ./types/typechain && rm -rf build/* && rm -rf migrations/*.js* && rm -rf test/**/*.js* && rm -f lib/*.js*", + "pretest": "yarn run build", "test": "node runTests.js", "test:local": "yarn run test --local", "gas": "yarn run test:local --gas", "truffle-compile": "./scripts/bash/compile.sh", - "contract-types": "rm -rf build/tmp/contracts && yarn run truffle-compile -n tmp && yarn run typechain --target=truffle --outDir types/typechain \"./build/tmp/contracts/*.json\" ", - "postinstall": "yarn run contract-types && rm -f node_modules/web3/index.d.ts", + "build:ts": "rm -f migrations/*.js* && tsc -b", + "build:gen": "yarn run typechain --target=truffle --outDir \"./types/typechain\" \"./build/tmp/contracts/*.json\" ", + "build": "yarn run truffle-compile -n tmp && yarn run build:gen && yarn build:ts", + "postinstall": "rm -f node_modules/web3/index.d.ts", "test-coverage": "yarn run pretest && node runCoverage.js", "migrate": "./scripts/bash/migrate.sh", "download-artifacts": "./scripts/bash/download_artifacts.sh", diff --git a/packages/protocol/scripts/bash/get_balances.sh b/packages/protocol/scripts/bash/get_balances.sh index 4672e9d6332..baa8e6f9852 100755 --- a/packages/protocol/scripts/bash/get_balances.sh +++ b/packages/protocol/scripts/bash/get_balances.sh @@ -26,7 +26,6 @@ if ! nc -z 127.0.0.1 8545 ; then exit 1 fi -yarn run contract-types && \ -yarn run compile-typescript && \ +yarn run build && \ yarn run truffle exec ./scripts/truffle/get_balances.js \ --network $NETWORK --build_directory $PWD/build/$NETWORK --account $ACCOUNT diff --git a/packages/protocol/scripts/bash/govern.sh b/packages/protocol/scripts/bash/govern.sh index 3bc67d1745f..f257f085b02 100755 --- a/packages/protocol/scripts/bash/govern.sh +++ b/packages/protocol/scripts/bash/govern.sh @@ -25,7 +25,6 @@ if ! nc -z 127.0.0.1 8545 ; then exit 1 fi -yarn run contract-types && \ -yarn run compile-typescript && \ +yarn run build && \ yarn run truffle exec ./scripts/truffle/govern.js \ --network $NETWORK --build_directory $PWD/build/$NETWORK --command "$CMD" diff --git a/packages/protocol/scripts/bash/invite.sh b/packages/protocol/scripts/bash/invite.sh index 415b66e9aeb..9bfe5cbe41f 100755 --- a/packages/protocol/scripts/bash/invite.sh +++ b/packages/protocol/scripts/bash/invite.sh @@ -26,8 +26,7 @@ if ! nc -z 127.0.0.1 8545 ; then exit 1 fi -yarn run contract-types && \ -yarn run compile-typescript && \ +yarn run build && \ gcloud config set project celo-testnet gcloud kms decrypt --ciphertext-file=twilio-config.enc --plaintext-file=twilio-config.js \ --key=github-key --keyring=celo-keyring --location=global && \ diff --git a/packages/protocol/scripts/bash/migrate.sh b/packages/protocol/scripts/bash/migrate.sh index 39bf3072c83..ba8992cfc8c 100755 --- a/packages/protocol/scripts/bash/migrate.sh +++ b/packages/protocol/scripts/bash/migrate.sh @@ -35,8 +35,7 @@ if ! nc -z 127.0.0.1 8545 ; then exit 1 fi -yarn run contract-types && \ -yarn run compile-typescript && \ +yarn run build && \ echo "Migrating contracts up to migration number ${TO}" && \ yarn run truffle migrate --compile-all --network $NETWORK --build_directory $PWD/build/$NETWORK $RESET \ --to ${TO} \ diff --git a/packages/protocol/scripts/bash/network_check.sh b/packages/protocol/scripts/bash/network_check.sh index 3ef9192b787..bcc43ea1e1b 100755 --- a/packages/protocol/scripts/bash/network_check.sh +++ b/packages/protocol/scripts/bash/network_check.sh @@ -22,8 +22,7 @@ done [ -z "$NETWORK" ] && echo "Need to set the NETWORK via the -n flag" && exit 1; -yarn run contract-types && \ -yarn run compile-typescript && \ +yarn run build && \ yarn run truffle exec ./scripts/truffle/network_check.js \ --network $NETWORK --build_directory $PWD/build/$NETWORK \ --truffle_override "$TRUFFLE_OVERRIDE" \ diff --git a/packages/protocol/scripts/bash/revoke.sh b/packages/protocol/scripts/bash/revoke.sh index d8103feed04..b4309077d13 100755 --- a/packages/protocol/scripts/bash/revoke.sh +++ b/packages/protocol/scripts/bash/revoke.sh @@ -28,7 +28,7 @@ if ! nc -z 127.0.0.1 8545 ; then exit 1 fi -yarn run contract-types && yarn run compile-typescript && \ +yarn run build && \ yarn run truffle exec ./scripts/truffle/revoke.js \ --network $NETWORK --phone $PHONE \ --build_directory $PWD/build/$NETWORK diff --git a/packages/protocol/scripts/bash/set_exchange_rate.sh b/packages/protocol/scripts/bash/set_exchange_rate.sh index 32e47dacb73..eb97a853d73 100755 --- a/packages/protocol/scripts/bash/set_exchange_rate.sh +++ b/packages/protocol/scripts/bash/set_exchange_rate.sh @@ -32,8 +32,7 @@ done [ -z "$NETWORK" ] && echo "Need to set the NETWORK via the -n flag" && exit 1; yarn run download-artifacts -n $NETWORK && \ -yarn run contract-types && \ -yarn run compile-typescript && \ +yarn run build && \ yarn run truffle exec ./scripts/truffle/set_exchange_rate.js \ --network $NETWORK --stableValue $STABLE_VALUE --goldValue $GOLD_VALUE \ --build_directory $PWD/build/$NETWORK --csv $FILE \ diff --git a/packages/protocol/scripts/bash/transfer.sh b/packages/protocol/scripts/bash/transfer.sh index 0edded5ff72..9c8dfdbe378 100755 --- a/packages/protocol/scripts/bash/transfer.sh +++ b/packages/protocol/scripts/bash/transfer.sh @@ -30,8 +30,7 @@ if ! nc -z 127.0.0.1 8545 ; then exit 1 fi -yarn run contract-types && \ -yarn run compile-typescript && \ +yarn run build && \ yarn run truffle exec ./scripts/truffle/transfer.js \ --network $NETWORK --stableValue $DOLLARS --goldValue $GOLD \ --build_directory $PWD/build/$NETWORK --to $ACCOUNT diff --git a/packages/protocol/scripts/bash/upgrade.sh b/packages/protocol/scripts/bash/upgrade.sh index 149b80a4829..43d1f5358bd 100755 --- a/packages/protocol/scripts/bash/upgrade.sh +++ b/packages/protocol/scripts/bash/upgrade.sh @@ -23,8 +23,7 @@ if ! nc -z 127.0.0.1 8545 ; then exit 1 fi -yarn run contract-types && \ -yarn run compile-typescript && \ +yarn run build && \ yarn run truffle-compile -n $NETWORK && \ yarn run truffle exec ./scripts/truffle/upgrade.js \ --network $NETWORK --build_directory $PWD/build/$NETWORK \ diff --git a/packages/react-components/package.json b/packages/react-components/package.json index edb036672b5..de560a14115 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -8,7 +8,6 @@ "private": true, "scripts": { "build": "tsc", - "lint-checks": "yarn run lint && yarn run build --noEmit", "lint": "tslint -c tslint.json --project tsconfig.json", "test": "export TZ=UTC && jest --ci --silent --coverage --maxWorkers=2", "test:verbose": "export TZ=UTC && jest --ci --verbose --runInBand", diff --git a/packages/transaction-metrics-exporter/package.json b/packages/transaction-metrics-exporter/package.json index a9edeca8b2e..389dd0eb4fd 100644 --- a/packages/transaction-metrics-exporter/package.json +++ b/packages/transaction-metrics-exporter/package.json @@ -21,7 +21,7 @@ }, "scripts": { "start": "ts-node -r tsconfig-paths/register src/index.ts", - "lint-checks": "tsc -p tsconfig.json --outDir /tmp", + "lint": "tsc -p tsconfig.json --outDir /tmp", "setup-sdk-environment": "build-sdk" } } diff --git a/packages/utils/package.json b/packages/utils/package.json index 16543ad011b..676e85b8a4a 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -7,12 +7,10 @@ "main": "./lib/index.js", "types": "./lib/index.d.ts", "scripts": { - "pretest": "tsc", - "postinstall": "yarn run build || exit 1 && yarn run prettify || true", - "prettify": "yarn run prettier --config ../../.prettierrc.js --write '{contracts,types,lib}/**/*.+(ts|tsx|js|jsx)'", "build": "tsc", - "test": "npm run pretest && jest --ci --silent --coverage --runInBand", - "test:verbose": "npm run pretest && jest --ci --verbose --runInBand" + "lint": "tslint --project .", + "test": "yarn build && jest --ci --silent --coverage --runInBand", + "test:verbose": "yarn build && jest --ci --verbose --runInBand" }, "dependencies": { "@umpirsky/country-list": "git://github.com/umpirsky/country-list#05fda51", diff --git a/packages/utils/src/commentEncryption.ts b/packages/utils/src/commentEncryption.ts index 38eb325b379..0130cf78cc5 100644 --- a/packages/utils/src/commentEncryption.ts +++ b/packages/utils/src/commentEncryption.ts @@ -13,7 +13,7 @@ const ec = new EC('secp256k1') const ECIES_SESSION_KEY_LEN = 129 const TAG = 'CommentEncryption' -export interface encryptionStatus { +export interface EncryptionStatus { encrypted: boolean comment: string } @@ -72,7 +72,7 @@ export function encryptComment( comment: string, pubKeyRecipient: Buffer, pubKeySelf: Buffer -): encryptionStatus { +): EncryptionStatus { try { // Uncompress public keys & strip out the leading 0x04 const pubRecip = decompressPublicKey(pubKeyRecipient) @@ -99,7 +99,7 @@ export function encryptComment( */ export const decryptComment = memoize( - (comment: string, key: Buffer, sender: boolean): encryptionStatus => { + (comment: string, key: Buffer, sender: boolean): EncryptionStatus => { try { const buf = Buffer.from(comment, 'base64') const data = decryptData(buf, key, sender).toString('ucs2') diff --git a/packages/utils/src/countries.ts b/packages/utils/src/countries.ts index ae434e0a921..c287132622b 100644 --- a/packages/utils/src/countries.ts +++ b/packages/utils/src/countries.ts @@ -37,31 +37,6 @@ export class Countries { this.assignCountries() } - private assignCountries() { - // add other languages to country data - this.localizedCountries = countryData.callingCountries.all.map( - (country: countryData.Country) => { - // this is assuming these two are the only cases, in i18n.ts seems like there - // are fallback languages 'es-US' and 'es-LA' that are not covered - const names: CountryNames = { - 'en-us': country.name, - 'es-ar': esData[country.alpha2], - } - - const localizedCountry = { - names, - displayName: names[this.language], - ...country, - } - - // use ISO 3166-1 alpha2 code as country id - this.countryMap.set(country.alpha2.toUpperCase(), localizedCountry) - - return localizedCountry - } - ) - } - getCountry(countryName?: string | null): LocalizedCountry { if (!countryName) { return EMPTY_COUNTRY @@ -129,4 +104,29 @@ export class Countries { ) .map((c: LocalizedCountry) => c.alpha2) } + + private assignCountries() { + // add other languages to country data + this.localizedCountries = countryData.callingCountries.all.map( + (country: countryData.Country) => { + // this is assuming these two are the only cases, in i18n.ts seems like there + // are fallback languages 'es-US' and 'es-LA' that are not covered + const names: CountryNames = { + 'en-us': country.name, + 'es-ar': esData[country.alpha2], + } + + const localizedCountry = { + names, + displayName: names[this.language], + ...country, + } + + // use ISO 3166-1 alpha2 code as country id + this.countryMap.set(country.alpha2.toUpperCase(), localizedCountry) + + return localizedCountry + } + ) + } } diff --git a/packages/utils/src/dappkit.ts b/packages/utils/src/dappkit.ts index b401e1fcfac..ce497a4375d 100644 --- a/packages/utils/src/dappkit.ts +++ b/packages/utils/src/dappkit.ts @@ -69,7 +69,7 @@ export type SignTxResponse = SignTxResponseSuccess | SignTxResponseFailure export type DappKitResponse = AccountAuthResponse | SignTxResponse export function produceResponseDeeplink(request: DappKitRequest, response: DappKitResponse) { - let params: any = { type: response.type, status: response.status, requestId: request.requestId } + const params: any = { type: response.type, status: response.status, requestId: request.requestId } switch (response.type) { case DappKitRequestTypes.ACCOUNT_ADDRESS: if (response.status === DappKitResponseStatus.SUCCESS) { diff --git a/packages/utils/src/parsing.ts b/packages/utils/src/parsing.ts index 31970613ba2..effa63fb343 100644 --- a/packages/utils/src/parsing.ts +++ b/packages/utils/src/parsing.ts @@ -8,7 +8,7 @@ export const stringToBoolean = (inputString: string): boolean => { } else if (lowercasedInput === 'false') { return false } - throw 'Parsing error' + throw new Error('Parsing error') } export const parseInputAmount = (inputString: string): BigNumber => { diff --git a/packages/utils/test/async-helpers.test.ts b/packages/utils/test/async-helpers.test.ts index 52010ab5e2e..7e32eac83c1 100644 --- a/packages/utils/test/async-helpers.test.ts +++ b/packages/utils/test/async-helpers.test.ts @@ -9,7 +9,7 @@ describe('utils->async-helpers', () => { it('retries n times', async () => { const mockFunction = jest.fn(() => { - throw 'error' + throw new Error('error') }) try { diff --git a/packages/utils/test/commentEncryption.test.ts b/packages/utils/test/commentEncryption.test.ts index 7d4bd8133c5..f4e712ab761 100644 --- a/packages/utils/test/commentEncryption.test.ts +++ b/packages/utils/test/commentEncryption.test.ts @@ -82,7 +82,7 @@ describe('Comment Encryption', () => { }) }) describe('regression test', () => { - const recipPriv = Buffer.from( + const newRecipPriv = Buffer.from( 'd2a515a64d37407f0e0e4a6a6a69a95eeb5ef8c2524ef01a6ffc6e3b39e0661b', 'hex' ) @@ -93,7 +93,7 @@ describe('Comment Encryption', () => { const encrypted = 'BGacSsVDzOXrVdXBkM2yBC4F1KD94rjfClQGi7r2TPkFu+hLQIRJ73H3z5wgWVgq8vcziPR5ugWPI/6pFduezNVMAJGB9pSLfA00wvb8twy5/uBIzaAQqkfKUJ4/n10N5+F313PDq0BU1LXsPN1Oq+5SWPQc4Z4MWKs+7zkcNz//BNNZkm8lgJ4frVHExBrED62rsth87vwxpsfyxxk36zdvAHN7xfYss3bqgYVA2+E45mRZOaJxnyRHfUYKU5tA5neTertXlzpZO93l4e9SrDTUVbI/dr8QuSc2Pot7C83cCQHjeIl9eB2W5DTfTwlThg/CeWW0afaElTjuEw1XXy9eC3H9nxTXOj44SM2WUB3uDH2K2wmPJsd+RW66CDI6fD2VHMst2CA2B01hX2h+6Ml84Ria53bI6iedOpb1ejsw98a1/z2QKAlh/KfMHmseY/dQMh9kBhIuOQwavf3t4PvyMJ2QbRGwi1cuItkkyg/8eiCa8Zdjn3OozoWSQnfR' - const comment = 'regression test on encryption method 👍' + const newComment = 'regression test on encryption method 👍' // How comment was encrypted. // Uses elliptic package // console.info( @@ -109,16 +109,16 @@ describe('Comment Encryption', () => { senderPriv, true ) - assert.equal(decrypted, comment) + assert.equal(decrypted, newComment) assert(didDecrypt) }) it('should not regress for recipeient', () => { const { comment: decrypted, encrypted: didDecrypt } = decryptComment( encrypted, - recipPriv, + newRecipPriv, false ) - assert.equal(decrypted, comment) + assert.equal(decrypted, newComment) assert(didDecrypt) }) }) @@ -128,7 +128,7 @@ describe('deriveCEK', () => { it('should produce 32 bytes', () => { const input = randomBytes(32) const derived = deriveCEK(input.toString('hex')) - assert(derived.length == 32) + assert(derived.length === 32) }) it('should not regress', () => { // Expected verified on a different HDKF implementation for input 0xdeadbeef @@ -149,13 +149,13 @@ describe('decompressPublicKey', () => { const publicKeyCompressed = Buffer.from(privateKey.getPublic(true, 'hex'), 'hex') const decompressed = decompressPublicKey(publicKeyCompressed) assert(Buffer.concat([Buffer.from('04', 'hex'), decompressed]).equals(publicKeyFull)) - assert(decompressed.length == 64) + assert(decompressed.length === 64) }) it('should work with long form input', () => { const privateKey = ec.keyFromPrivate(randomBytes(32)) const publicKeyFull = Buffer.from(privateKey.getPublic(false, 'hex'), 'hex') const decompressed = decompressPublicKey(publicKeyFull) assert(Buffer.concat([Buffer.from('04', 'hex'), decompressed]).equals(publicKeyFull)) - assert(decompressed.length == 64) + assert(decompressed.length === 64) }) }) diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index 3e9b029f336..faf4f1e9fab 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -1,6 +1,11 @@ { "compileOnSave": false, "compilerOptions": { + "plugins": [ + { + "name": "typescript-tslint-plugin" + } + ], "allowSyntheticDefaultImports": true, "baseUrl": ".", "composite": true, diff --git a/packages/utils/tslint.json b/packages/utils/tslint.json new file mode 100644 index 00000000000..dfc1be41d87 --- /dev/null +++ b/packages/utils/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": ["@celo/typescript/tslint.json"], + "rules": { + "no-global-arrow-functions": false, + "no-console": false + } +} diff --git a/packages/verification-pool-api/README.md b/packages/verification-pool-api/README.md index 3d064bc5cdf..ff5e381e110 100644 --- a/packages/verification-pool-api/README.md +++ b/packages/verification-pool-api/README.md @@ -20,7 +20,7 @@ To run unit tests: `yarn test` or `yarn test:verbose` For lint checks: -`yarn lint-checks` +`yarn lint` ## Deploy to Firebase Cloud Functions diff --git a/packages/verification-pool-api/build.sh b/packages/verification-pool-api/build.sh index 71e0f0f296b..02e866bf3c2 100755 --- a/packages/verification-pool-api/build.sh +++ b/packages/verification-pool-api/build.sh @@ -12,5 +12,5 @@ set -euo pipefail done yarn run --cwd=../celotool cli copy-contract-artifacts --output-path=../verification-pool-api/contracts/ --celo-env=$ENVIRONMENT --contracts=Attestations,GoldToken,StableToken && \ - yarn run tsc && \ + yarn run build && \ yarn run firebase-bolt schema.bolt diff --git a/packages/verification-pool-api/deployment/deployment-utils.ts b/packages/verification-pool-api/deployment/deployment-utils.ts index 736446bf3cb..869a13269db 100644 --- a/packages/verification-pool-api/deployment/deployment-utils.ts +++ b/packages/verification-pool-api/deployment/deployment-utils.ts @@ -16,7 +16,7 @@ export function setEnv(CELO_ENV: string) { } export async function deploy(CELO_ENV: string) { - await exec('yarn', ['run', 'build', CELO_ENV]) + await exec('yarn', ['run', 'build:for-env', CELO_ENV]) await exec('yarn', [ 'run', 'firebase', diff --git a/packages/verification-pool-api/package.json b/packages/verification-pool-api/package.json index f78128132a0..919a0ed0c7a 100644 --- a/packages/verification-pool-api/package.json +++ b/packages/verification-pool-api/package.json @@ -7,7 +7,7 @@ "license": "Apache-2.0", "main": "lib/src/index.js", "scripts": { - "build": "./build.sh -e", + "build:for-env": "./build.sh -e", "get-config": "firebase functions:config:get", "set-config": "ts-node ./deployment/set-config.ts --celo-env", "set-env": "ts-node ./deployment/set-env.ts --celo-env", @@ -16,9 +16,8 @@ "shell": "firebase functions:shell", "start": "yarn run shell", "logs": "firebase functions:log", - "lint-checks": "yarn run lint && yarn run compile-typescript", "lint": "tslint -c tslint.json --project tsconfig.json", - "compile-typescript": "tsc", + "build": "tsc -p .", "test": "jest --ci --coverage --runInBand --detectOpenHandles", "test:verbose": "jest --ci --verbose --runInBand --detectOpenHandles" }, diff --git a/packages/verifier/package.json b/packages/verifier/package.json index 559bd06fef6..353a4dbc0ce 100644 --- a/packages/verifier/package.json +++ b/packages/verifier/package.json @@ -9,9 +9,8 @@ "dev:show-menu": "adb devices | grep '\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} adb -s {} shell input keyevent 82", "dev:reload": "adb shell input text \"RR\"", "dev:remote": "remotedev --hostname=localhost --port=8000", - "lint-checks": "yarn run lint && yarn run build:typescript", "lint": "tslint -c tslint.json --project tsconfig.json", - "build:typescript": "tsc", + "build": "tsc -p . --noEmit", "start": "react-native start", "start:android": "react-native run-android", "start:ios": "react-native run-ios", diff --git a/packages/web/package.json b/packages/web/package.json index 646a5295775..4bbfb47fb0a 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -13,7 +13,6 @@ "deploy:dev": "gcloud config set project celo-testnet; NODE_ENV=production DEPLOY_ENV=development MANIFEST=development.yaml yarn run deploy", "deploy:staging": "gcloud config set project celo-testnet; NODE_ENV=production DEPLOY_ENV=staging MANIFEST=staging.yaml yarn run deploy", "deploy:prod": "gcloud config set project celo-testnet-production; NODE_ENV=production DEPLOY_ENV=production MANIFEST=production.yaml yarn run deploy", - "lint-checks": "yarn run lint && yarn run tsc --noEmit", "lint": "tslint -c tslint.json --project tsconfig.json", "kill-dev": "kill -9 $(lsof -ti :3000)", "test": "jest --runInBand", diff --git a/packages/web/tsconfig.json b/packages/web/tsconfig.json index a46ae06c36c..78661f2e322 100644 --- a/packages/web/tsconfig.json +++ b/packages/web/tsconfig.json @@ -18,5 +18,6 @@ "paths": { "next-i18next": ["src/next-i18next-aug.d.ts"] } - } + }, + "exclude": ["dist"] } diff --git a/yarn.lock b/yarn.lock index dc90fe3145f..bb47167fae8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2020,30 +2020,6 @@ resolved "https://registry.yarnpkg.com/@celo/client/-/client-0.0.28.tgz#2de197b0e75222ee64720f26fb3e57c19cf273eb" integrity sha512-u0VPhyi7YLUdCqZCDSVqUQm+MU/EZJ6JiKAq/MikJyCJdQZu7QU3nU4nV1HPXAsLmLon2z38a46nAjO4318D+Q== -"@celo/contractkit@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@celo/contractkit/-/contractkit-0.0.3.tgz#8091d10ddc13230676d53a07082962d7db7fe947" - integrity sha512-kie2o1gStISH5VeNdw5MBOIjDZRP+dUvZhukHx0uXzjwdmTVQfVw7wytEBrsZBOB1YTz7yOjR1gRgJMgaMPoIA== - dependencies: - "@0x/subproviders" "^4.1.0" - "@celo/utils" "0.0.1-delta" - "@google-cloud/storage" "^2.3.3" - "@types/jest" "^24.0.13" - babel-jest "^24.8.0" - bignumber.js "^7.2.0" - chalk "^2.4.2" - cross-fetch "^3.0.2" - eth-lib "^0.2.8" - jest "^24.8.0" - lodash "^4.17.14" - prettier "1.13.5" - sleep-promise "^8.0.1" - ts-jest "^24.0.0" - typechain "git+https://github.com/celo-org/TypeChain.git#ce6a33b" - typescript "^3.3.3" - web3 "1.0.0-beta.37" - web3-utils "1.0.0-beta.37" - "@celo/dev-cli@^2.0.3": version "2.0.3" resolved "https://registry.yarnpkg.com/@celo/dev-cli/-/dev-cli-2.0.3.tgz#67f61dfee373ad8b412925e386cf122aabada5f5" @@ -2074,22 +2050,6 @@ version "1.0.3" resolved "git+https://github.com/celo-org/react-native-sms-retriever#d3a2fdb148e3427c9a8c1c87acb61e79e2afcfee" -"@celo/utils@0.0.1-delta": - version "0.0.1-delta" - resolved "https://registry.yarnpkg.com/@celo/utils/-/utils-0.0.1-delta.tgz#8e90b5c7a34d721e7f446ac7e63c951db43f788a" - integrity sha512-QK5jyX3jHss2ETO8TF9ADRI/2Fz2925VczKgqOUR1inraI4jiltNFm4djnfkcq4LpbIprUHpnPKbkPCoQjsNyA== - dependencies: - "@umpirsky/country-list" "https://github.com/umpirsky/country-list#05fda51" - bignumber.js "^7.2.0" - bn.js "4.11.8" - country-data "^0.0.31" - elliptic "^6.4.1" - ethereumjs-util "^5.2.0" - futoin-hkdf "^1.0.3" - google-libphonenumber "^3.2.1" - lodash "^4.17.14" - web3-utils "1.0.0-beta.37" - "@cnakazawa/watch@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" @@ -4990,10 +4950,6 @@ version "1.0.0" resolved "git://github.com/umpirsky/country-list#05fda51cd97b3294e8175ffed06104c44b3c71d7" -"@umpirsky/country-list@https://github.com/umpirsky/country-list#05fda51": - version "1.0.0" - resolved "https://github.com/umpirsky/country-list#05fda51cd97b3294e8175ffed06104c44b3c71d7" - "@ungap/url-search-params@^0.1.2": version "0.1.2" resolved "https://registry.yarnpkg.com/@ungap/url-search-params/-/url-search-params-0.1.2.tgz#8ba8c0527543fe675d1c29ae0a2daca842e8ee4f"