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

Convert scripts to node to support windows #32

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"prepublishOnly": "npm run start",
"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-kits",
"start-ganache": "scripts/start-ganache",
"start-ganache-bg": "scripts/start-ganache-bg",
"gen": "sh scripts/deploy-base && sh scripts/publish-apps && sh scripts/publish-kits",
"start-ganache": "node scripts/start-ganache",
"start-ganache-bg": "node scripts/start-ganache-bg",
"get-repos": "scripts/get-repos",
"link-repos": "scripts/link-repos",
"link-repos": "node scripts/link-repos",
"deploy-base": "scripts/deploy-base",
"deploy-beta": "scripts/deploy-beta"
},
Expand All @@ -41,10 +41,12 @@
"chalk": "^2.1.0",
"figures": "^2.0.0",
"ganache-core": "^2.2.1",
"kill-port-process": "0.0.6",
"listr": "^0.13.0",
"ncp": "^2.0.0",
"mkdirp": "^0.5.1",
"rimraf": "^2.6.2",
"shelljs": "^0.8.3",
"web3": "^1.0.0-beta.34",
"yargs": "^12.0.2"
},
Expand Down
28 changes: 0 additions & 28 deletions scripts/deploy-base

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/deploy-base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const { echo, exec, cd, exit, rm } = require('shelljs')
require('./set-env')

echo('Make sure you are on an empty chain running with the default mnemonic')
// sleep 2; # let the people read

echo('Deploying ENS instance')
cd('repos/aragonOS')
// exec('npx truffle compile')
const DEPLOYED_ENS = exec('npx truffle exec --network rpc scripts/deploy-test-ens.js') //| tail -n 1
console.log(DEPLOYED_ENS.stdout)

if(process.env.ENS === DEPLOYED_ENS) {
echo('ENS deployed $DEPLOYED_ENS')
} else {
// echo >&2 "ENS address missmatch. Please restart ganache by running:";
echo('ENS address missmatch. Please restart ganache by running:')
echo('npm run start-ganache')
rm('-rf', 'aragon-ganache')
exit(1)
}

echo('Deploying APM registry to aragonpm.eth')
exec('npx truffle exec --network rpc scripts/deploy-apm.js')

cd('../aragon-id')
echo('Deploying aragonID registry to aragonpm.eth')
exec('npx truffle compile')
exec('npx truffle exec --network rpc scripts/deploy-beta-aragonid.js')
14 changes: 0 additions & 14 deletions scripts/link-repos

This file was deleted.

14 changes: 14 additions & 0 deletions scripts/link-repos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { mkdir, echo, rm, cd, ln } = require('shelljs')

// TODO set -e;
echo('Cleaning and creating "repos" dir')
rm('-rf', 'repos')
mkdir('repos')

cd('repos')

echo('Linking to local repos')
ln('-s', '../../aragonOS', 'aragonOS')
ln('-s', '../../aragon-apps', 'aragon-apps')
ln('-s', '../../aragon-id', 'aragon-id')
ln('-s', '../../dao-kits', 'dao-kits')
4 changes: 0 additions & 4 deletions scripts/set-env

This file was deleted.

2 changes: 2 additions & 0 deletions scripts/set-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
process.env.OWNER = "0xb4124ceb3451635dacedd11767f004d8a28c6ee7"
process.env.ENS = "0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1"
10 changes: 0 additions & 10 deletions scripts/start-ganache

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/start-ganache-bg

This file was deleted.

20 changes: 20 additions & 0 deletions scripts/start-ganache-bg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { echo, exec } = require('shelljs')
const kill = require('kill-port-process')

async function execute () {
echo('Checking if the port 8545 is busy')
try {
await kill(8545)
} catch (e) {
echo('Nothing was running on port 8545')
}

echo('Starting ganache in the background')

// TODO nohup npm run start-ganache &
exec('npm run start-ganache', {
detached: true // is it working?
})
}

execute()
13 changes: 13 additions & 0 deletions scripts/start-ganache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { echo, mkdir, pwd, rm, exec } = require('shelljs')

const BASEPATH = pwd().toString()

// TODO cd $(dirname $0) /..

const mnemonic = require(require('path').join(BASEPATH, 'src/helpers/ganache-vars')).MNEMONIC
echo(mnemonic)

rm('-rf','aragon-ganache')
mkdir('aragon-ganache')
// TODO # set - e;
exec(`npx ganache-cli -m "${mnemonic}" -i 15 -l 100000000 --db aragon-ganache`)