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 13, 2018
1 parent 2eaea12 commit 18cf20e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ exports.builder = function (yargs) {
}).option('client-port', {
description: 'Port being used by Aragon client',
default: DEFAULT_CLIENT_PORT
}).option('client-path', {
description: 'A path pointing to an existing Aragon client installation',
default: null
})
}

Expand Down Expand Up @@ -131,7 +134,8 @@ exports.handler = function ({
appInit,
appInitArgs,
clientVersion,
clientPort
clientPort,
clientPath
}) {

apmOptions.ensRegistryAddress = apmOptions['ens-registry']
Expand Down Expand Up @@ -244,6 +248,7 @@ exports.handler = function ({
task: (ctx, task) => new TaskList([
{
title: 'Download wrapper',
skip: () => !!clientPath,
task: (ctx, task) => {
clientVersion = clientVersion || DEFAULT_CLIENT_VERSION
const CLIENT_PATH = `${os.homedir()}/.aragon/wrapper-${clientVersion}`
Expand All @@ -268,7 +273,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 @@ -279,12 +284,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 18cf20e

Please sign in to comment.