Skip to content

Commit

Permalink
feat(commands/run): introduce --client-path option
Browse files Browse the repository at this point in the history
This commit enables users to pass a `--client-path` to the `run` command.
The path specifies the location to an already existing installation of the
Aragon client on the local machine, allowing developers to test custom versions
of the app.

Closes #199
  • Loading branch information
0x-r4bbit committed Sep 12, 2018
1 parent 561ab2d commit 8f81623
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ exports.builder = function (yargs) {
description: 'Arguments for calling the app init function',
array: true,
default: [],
}).option('client-path', {
description: 'A path pointing to an existing Aragon client installation',
default: null
})
}

Expand Down Expand Up @@ -123,6 +126,7 @@ exports.handler = function ({
httpServedFrom,
appInit,
appInitArgs,
clientPath
}) {
apmOptions.ensRegistryAddress = apmOptions['ens-registry']
const showAccounts = accounts
Expand Down Expand Up @@ -230,6 +234,7 @@ exports.handler = function ({
task: (ctx, task) => new TaskList([
{
title: 'Download wrapper',
skip: () => !!clientPath,
task: (ctx, task) => {
const WRAPPER_PATH = `${os.homedir()}/.aragon/wrapper-${WRAPPER_COMMIT}`
ctx.wrapperPath = WRAPPER_PATH
Expand All @@ -255,7 +260,7 @@ exports.handler = function ({
{
title: 'Install wrapper dependencies',
task: async (ctx, task) => (await installDeps(ctx.wrapperPath, task)),
enabled: (ctx) => !ctx.wrapperAvailable
enabled: (ctx) => !ctx.wrapperAvailable && !clientPath
},
{
title: 'Start Aragon client',
Expand All @@ -266,12 +271,13 @@ exports.handler = function ({
}
const bin = getNodePackageManager()
const startArguments = {
cwd: ctx.wrapperPath,
cwd: clientPath || ctx.wrapperPath,
env: {
REACT_APP_ENS_REGISTRY_ADDRESS: ctx.ens,
BROWSER: 'none',
}
}

execa(bin, ['run', 'start:local'], startArguments).catch((err) => { throw new Error(err) })
}
},
Expand Down

0 comments on commit 8f81623

Please sign in to comment.