From 3be812d55f819765b355c044a4a6f4023a9a6af8 Mon Sep 17 00:00:00 2001 From: Przemyslaw Rzad Date: Thu, 13 Jun 2019 16:17:24 +0200 Subject: [PATCH] Monorepo initialization (#101) * Update postinstall script * Add initialize script, simplify readme * Unsafe perm * Added initialize-root job * Initialize-root only on master --- .circleci/config.yml | 10 ++++++++++ README.md | 24 ++++++++---------------- package.json | 3 ++- ui/package.json | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fc640144..fbd932b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,6 +35,12 @@ jobs: key: initialize-{{ .Environment.CIRCLE_SHA1 }} paths: - ~/project + initialize-root: + docker: + - image: circleci/node:10.15 + steps: + - checkout + - run: sudo su - -c 'export CI=true && cd /home/circleci/project && yarn initialize && yarn test' build: docker: - image: circleci/node:10.15 @@ -111,6 +117,10 @@ workflows: tokenbridge: jobs: - initialize + - initialize-root: + filters: + branches: + only: master - build: requires: - initialize diff --git a/README.md b/README.md index a06f7265..397abfa5 100644 --- a/README.md +++ b/README.md @@ -47,26 +47,14 @@ The POA TokenBridge provides three operational modes: ## Initializing the monorepository -Clone the repository with submodules: +Clone the repository: ```bash -git clone --recursive https://github.com/poanetwork/tokenbridge - -# or initialize submodules if already cloned without --recursive option: -git submodule update --init +git clone https://github.com/poanetwork/tokenbridge ``` -Install dependencies: - +Initialize submodules, install dependencies, compile the Smart Contracts: ``` -yarn install && yarn install:deploy -``` - -_**Note**: The installation should be performed with an unprivileged Linux account or with the following flag: `yarn install --unsafe-perm`. [More information](https://docs.npmjs.com/misc/scripts#user)_ - -Compile the Smart Contracts - -``` -yarn compile:contracts +yarn initialize ``` ## Linting @@ -97,6 +85,10 @@ Additionaly there are end-to-end tests for [Oracle](oracle-e2e/README.md) and [U For details on building, running and developing please refer to respective READMEs in sub-repositories. +## Building, running and deploying + +Please refer to the instructions in sub-directories. + ## Contributing See the [CONTRIBUTING](CONTRIBUTING.md) document for contribution, testing and pull request protocol. diff --git a/package.json b/package.json index f01d502e..ffccef29 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "contracts" ], "scripts": { + "initialize": "yarn clean && git submodule update --init && yarn install --unsafe-perm --frozen-lockfile && yarn install:deploy && yarn compile:contracts", "build": "yarn workspace ui run build", "lint": "yarn wsrun --exclude oracle-e2e --exclude ui-e2e --exclude poa-parity-bridge-contracts lint", "test": "yarn wsrun --exclude monitor --exclude oracle-e2e --exclude ui-e2e test", @@ -39,7 +40,7 @@ "ui-e2e": "./ui-e2e/run-tests.sh", "clean": "rm -rf ./node_modules ./**/node_modules ./**/**/node_modules ./**/build", "compile:contracts": "yarn workspace poa-parity-bridge-contracts run compile", - "install:deploy": "cd contracts/deploy && npm install --silent", + "install:deploy": "cd contracts/deploy && npm install --unsafe-perm --silent", "postinstall": "ln -sf $(pwd)/node_modules/openzeppelin-solidity/ contracts/node_modules/openzeppelin-solidity" } } diff --git a/ui/package.json b/ui/package.json index d6eef51d..ced9ad7f 100644 --- a/ui/package.json +++ b/ui/package.json @@ -39,7 +39,7 @@ "coverage": "react-app-rewired test --env=jsdom --coverage", "coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls", "eject": "react-app-rewired eject", - "postinstall": "(cp lib/web3-eth/index.js ../node_modules/web3-eth/src && cp lib/web3-eth/index.js ./node_modules/web3-eth/src)" + "postinstall": "(cp lib/web3-eth/index.js ../node_modules/web3-eth/src; cp lib/web3-eth/index.js ./node_modules/web3-eth/src) || :" }, "devDependencies": { "babel-eslint": "^10.0.1",