Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scripts & dependencies #60

Merged
merged 12 commits into from
Jul 28, 2019
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Dependencies
node_modules
repos
aragon-ganache

nohup.out
ipfs-cache
package-lock.json

# build
repos
build
flattened_contracts

# snapshot
aragon-ganache
ipfs-cache
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ notifications:
node_js:
- '8'
install:
- npm install
- travis_wait 60 npm run get-repos
- npm run start-ganache-bg && npm run gen
- travis_wait 60 npm install
- npm run start
before_script:
- npm prune
before_deploy: echo 'Starting publish to NPM'
Expand Down
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@
"aragen": "./src/cli.js"
},
"scripts": {
"start": "npm run start-ganache-bg && npm run get-repos && npm run gen",
"start:local": "npm run start-ganache-bg && npm run link-repos && npm run gen",
"gen": "scripts/deploy-base && scripts/publish-apps && scripts/publish-templates",
"postinstall": "npm run gen",
"start": "npm run start-ganache-bg && npm run deploy",
"start:local": "npm run start-ganache-bg && npm run link-repos && npm run deploy",
"deploy": "npm run deploy-base && npm run publish-apps && npm run publish-templates && npm run publish-client",
"start-ganache": "scripts/start-ganache",
"start-ganache-bg": "scripts/start-ganache-bg",
"get-repos": "scripts/get-repos",
"gen": "scripts/get-repos",
"link-repos": "scripts/link-repos",
"deploy-base": "scripts/deploy-base"
"deploy-base": "scripts/deploy-base",
"publish-apps": "scripts/publish-apps",
"publish-templates": "scripts/publish-templates",
"publish-client": "scripts/publish-client"
},
"files": [
"index.js",
Expand All @@ -36,34 +40,31 @@
},
"homepage": "https://github.com/aragon/aragen#readme",
"dependencies": {
"@babel/polyfill": "^7.0.0",
"chalk": "^2.1.0",
"core-js": "^3.1.4",
"figures": "^3.0.0",
"ganache-core": "2.5.3",
"ganache-core": "^2.5.7",
"listr": "^0.14.3",
"ncp": "^2.0.0",
"rimraf": "^2.6.2",
"web3": "1.0.0-beta.35",
"yargs": "^12.0.0"
"web3": "1.0.0-beta.37",
"yargs": "^13.2.4"
},
"devDependencies": {
"@aragon/cli": "^5.0.0",
"@aragon/cli": "^6.0.0",
"@aragon/id": "^2.0.0",
"@aragon/os": "^4.2.0",
"eth-ens-namehash": "^2.0.8",
"ganache-cli": "~6.2.0",
"ganache-cli": "^6.4.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xGabi It looks like this is actually breaking some assumptions we hold with ETH nodes :(.

The newer versions of ganache-cli do not seem to react properly to an eth_estimateGas, making transaction pathing in the client fail (it currently always says you can directly do every action).

"truffle": "4.1.14"
},
"publishConfig": {
"access": "public"
},
"greenkeeper": {
"ignore": [
"ganache-core",
"ganache-cli",
"truffle",
"web3",
"yargs"
"web3"
]
}
}
6 changes: 3 additions & 3 deletions scripts/deploy-base
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sleep 2; # let the people read

echo "Deploying ENS instance"
npx truffle compile;
DEPLOYED_ENS=$(npx truffle exec --network rpc scripts/deploy-test-ens.js | tail -n 1)
DEPLOYED_ENS=$(npx truffle exec --network rpc scripts/deploy/test-ens.js | tail -n 1)
if [ "${ENS}" = "${DEPLOYED_ENS}" ]; then
echo "ENS deployed $DEPLOYED_ENS"
else
Expand All @@ -19,7 +19,7 @@ else
fi

echo "Deploying APM registry to aragonpm.eth and open.aragonpm.eth"
npx truffle exec --network rpc scripts/deploy-apm-open.js
npx truffle exec --network rpc scripts/deploy/apm-open.js

echo "Deploying aragonID registry to aragonpm.eth"
npx truffle exec --network rpc scripts/deploy-beta-aragonid.js;
npx truffle exec --network rpc scripts/deploy/beta-aragonid.js;
2 changes: 1 addition & 1 deletion scripts/deploy-apm-open.js → scripts/deploy/apm-open.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const namehash = require('eth-ens-namehash').hash
const keccak256 = require('js-sha3').keccak_256

const deployAPM = require('./deploy-apm')
const deployAPM = require('./apm')

const globalArtifacts = this.artifacts // Not injected unless called directly via truffle
const globalWeb3 = this.web3 // Not injected unless called directly via truffle
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy-apm.js → scripts/deploy/apm.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const namehash = require('eth-ens-namehash').hash
const keccak256 = require('js-sha3').keccak_256

const deployENS = require('./deploy-test-ens')
const deployDaoFactory = require('./deploy-daofactory')
const deployENS = require('./test-ens')
const deployDaoFactory = require('./daofactory')
const logDeploy = require('@aragon/os/scripts/helpers/deploy-logger')
const getAccounts = require('./helpers/get-accounts')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const defaultOwner = process.env.OWNER
const defaultENSAddress = process.env.ENS

const tld = namehash('eth')
const label = '0x'+keccak256('aragonid')
const label = '0x' + keccak256('aragonid')
const node = namehash('aragonid.eth')

module.exports = async (
Expand All @@ -19,11 +19,13 @@ module.exports = async (
web3 = globalWeb3,
ensAddress = defaultENSAddress,
owner = defaultOwner,
verbose = true
verbose = true,
} = {}
) => {
const log = (...args) => {
if (verbose) { console.log(...args) }
if (verbose) {
console.log(...args)
}
}

const accounts = await getAccounts(web3)
Expand All @@ -32,14 +34,20 @@ module.exports = async (
const FIFSResolvingRegistrar = artifacts.require('FIFSResolvingRegistrar')
const ENS = artifacts.require('AbstractENS')

const publicResolver = await ENS.at(ensAddress).resolver(namehash('resolver.eth'))
const aragonID = await FIFSResolvingRegistrar.new(ensAddress, publicResolver, node)
const publicResolver = await ENS.at(ensAddress).resolver(
namehash('resolver.eth')
)
const aragonID = await FIFSResolvingRegistrar.new(
ensAddress,
publicResolver,
node
)
await logDeploy(aragonID, { verbose })

log('assigning ENS name to AragonID')
const ens = ENS.at(ensAddress)

if (await ens.owner(node) === accounts[0]) {
if ((await ens.owner(node)) === accounts[0]) {
log('Transferring name ownership from deployer to AragonID')
await ens.setOwner(node, aragonID.address)
} else {
Expand All @@ -57,7 +65,7 @@ module.exports = async (

if (owner) {
log('assigning owner name')
await aragonID.register('0x'+keccak256('owner'), owner)
await aragonID.register('0x' + keccak256('owner'), owner)
}

log('===========')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions scripts/get-repos
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ echo "Fetching dao-kits and installing dependencies (this may also take a while
git clone https://github.com/aragon/dao-kits.git -b master;
cd dao-kits;
npm i;
cd ..;

echo "Fetching aragon client and installing dependencies"
git clone https://github.com/aragon/aragon.git -b master;
cd aragon;
npm i;
1 change: 1 addition & 0 deletions scripts/link-repos
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ cd repos
echo "Linking to local repos"
ln -s ../../aragon-apps aragon-apps
ln -s ../../dao-kits dao-kits
ln -s ../../aragon aragon
4 changes: 2 additions & 2 deletions scripts/publish-apps
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ cd repos/aragon-apps;
LERNA_EXEC_APPS="npx lerna exec --scope=@aragon/apps-finance --scope=@aragon/apps-voting --scope=@aragon/apps-token-manager --scope=@aragon/apps-survey --concurrency=1 --stream"
LERNA_EXEC_APPS_WITHOUT_UI="npx lerna exec --scope=@aragon/apps-vault --scope=@aragon/apps-agent --concurrency=1 --stream"

$LERNA_EXEC_APPS -- "aragon apm publish 1.0.0 --files app/build --publish-dir $IPFS_CACHE/\$LERNA_PACKAGE_NAME"
$LERNA_EXEC_APPS_WITHOUT_UI -- "aragon apm publish 1.0.0 --files public --publish-dir $IPFS_CACHE/\$LERNA_PACKAGE_NAME"
$LERNA_EXEC_APPS -- "aragon apm publish 1.0.0 --files app/build --publish-dir $IPFS_CACHE/\$LERNA_PACKAGE_NAME --skip-confirmation --no-propagate-content"
$LERNA_EXEC_APPS_WITHOUT_UI -- "aragon apm publish 1.0.0 --files public --publish-dir $IPFS_CACHE/\$LERNA_PACKAGE_NAME --skip-confirmation --no-propagate-content"
9 changes: 9 additions & 0 deletions scripts/publish-client
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

DIR=$(pwd)
IPFS_CACHE=$DIR/ipfs-cache

set -e;
cd repos/aragon;

npm run publish:major -- --publish-dir $IPFS_CACHE/@aragon/aragon --skip-confirmation --no-propagate-content --no-build;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll want to use the build:local command instead

4 changes: 2 additions & 2 deletions scripts/publish-templates
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ source scripts/set-env;
set -e;
cd repos/dao-kits;

LERNA_EXEC="npx lerna exec --scope=@aragon/kits-bare --scope=@aragon/kits-democracy --scope=@aragon/kits-multisig --scope=@aragon/kits-survey --concurrency=1 --stream"
LERNA_EXEC="npx lerna exec --scope=@aragon/templates-bare --scope=@aragon/templates-democracy --scope=@aragon/templates-multisig --scope=@aragon/templates-trust --concurrency=1 --stream"

$LERNA_EXEC -- "npm run publish:rpc -- --files manifest.json --publish-dir $IPFS_CACHE/\$LERNA_PACKAGE_NAME"
$LERNA_EXEC -- "aragon apm publish 1.0.0 $(npm run deploy:rpc | tail -n 1) --files manifest.json --publish-dir $IPFS_CACHE/\$LERNA_PACKAGE_NAME --skip-confirmation --no-propagate-content"
16 changes: 11 additions & 5 deletions scripts/start-ganache-bg
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#!/bin/bash

set +e;
kill -9 $(lsof -t -i:8545);
set -e;
ganache_port=8545
ganache_running() {
nc -z localhost "$ganache_port" &> /dev/null
}

echo "Starting ganache in the background";
if ganache_running; then
echo "Killing ganache instance at port $ganache_port"
kill -9 $(lsof -t -i:$ganache_port);
fi

nohup npm run start-ganache &
printf "Starting ganache in the background\n\n";

nohup npm run start-ganache &
10 changes: 8 additions & 2 deletions src/cli.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#!/usr/bin/env node
require('@babel/polyfill')
import 'core-js/stable'
import 'regenerator-runtime/runtime'
const ConsoleReporter = require('./reporters/ConsoleReporter')

// Set up commands
const cmd = require('yargs').commandDir('./commands')
const cmd = require('yargs')
.strict()
.parserConfiguration({
'parse-numbers': false,
})
.commandDir('./commands')

cmd.alias('h', 'help')
cmd.alias('v', 'version')
Expand Down