From ea8567034d24c0dcafae1b459b15f64528c735da Mon Sep 17 00:00:00 2001 From: kongliangzhong Date: Thu, 9 Nov 2017 15:28:20 +0800 Subject: [PATCH] Solve the global npm module dependency problem --- README.md | 5 +---- package.json | 16 ++++++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 28707d70..4a9b651f 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,6 @@ npm install --global --production windows-build-tools Then run the following commands from project's root directory: ``` -npm install -g truffle@4.0.1 -npm install -g ethereumjs-testrpc@6.0.1 -npm install -g typescript@2.4.2 npm install npm run compile ``` @@ -21,7 +18,7 @@ npm run compile ## Run Unit Tests * run `npm run testrpc` from project's root directory in terminal. * run `npm run test` from project's root directory in another terminal window. - +* run single test: `npm run test -- transpiled/test/xxx.js` ## Run Unit Tests inside Docker diff --git a/package.json b/package.json index 7b22a63f..f60d44cb 100644 --- a/package.json +++ b/package.json @@ -7,15 +7,15 @@ "test": "test" }, "scripts": { - "transpile": "rm -rf ./transpiled; copyfiles ./build/**/* ./transpiled; tsc", - "pretest": "solium --dir contracts", - "test": "npm run transpile; truffle test", + "transpile": "rm -rf ./transpiled; copyfiles ./build/**/* ./transpiled; ./node_modules/.bin/tsc", + "pretest": "./node_modules/.bin/solium --dir contracts", + "test": "npm run transpile; ./node_modules/.bin/truffle test", "docker": "docker-compose up --build --abort-on-container-exit; docker-compose logs -f test", - "testdocker": "npm run transpile; truffle test --network docker", - "compile": "rm -rf build/contracts; truffle compile", - "migrate": "npm run transpile; truffle migrate", + "testdocker": "npm run transpile; ./node_modules/.bin/truffle test --network docker", + "compile": "rm -rf build/contracts; ./node_modules/.bin/truffle compile", + "migrate": "npm run transpile; ./node_modules/.bin/truffle migrate", "deploy": "npm run migrate --network kovan", - "testrpc": "./testrpc.sh" + "testrpc": "./node_modules/.bin/testrpc" }, "license": "ISC", "devDependencies": { @@ -27,9 +27,9 @@ "copyfiles": "^1.2.0", "dirty-chai": "^2.0.0", "ethereumjs-testrpc": "6.0.1", + "truffle": "4.0.1", "solc": "0.4.18", "solium": "^1.0.3", - "truffle": "^4.0.1", "typescript": "2.4.2", "web3-typescript-typings": "0.0.3", "zeppelin-solidity": "^1.2.0"