-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracts logic from apm commands (#871)
* Enabling verbose in AVA tests * Review: Extracts logic from apm commands: info command (#898) * Extracts logic from apm commands: extract-functions command (#870) * Extracts logic from apm commands: versions command (#891) * Extracts logic from apm commands: packages command (#892) * Extracts logic from apm commands: grant command (#902) * Fix test import
- Loading branch information
1 parent
4215e1b
commit 5a3dc58
Showing
21 changed files
with
1,275 additions
and
189 deletions.
There are no files selected for viewing
58 changes: 0 additions & 58 deletions
58
packages/aragon-cli/src/commands/apm_cmds/extract-functions.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,57 @@ | ||
const APM = require('@aragon/apm') | ||
const chalk = require('chalk') | ||
const TaskList = require('listr') | ||
const defaultAPMName = require('@aragon/cli-utils/src/helpers/default-apm') | ||
const { ensureWeb3 } = require('../../helpers/web3-fallback') | ||
const getRepoTask = require('../dao_cmds/utils/getRepoTask') | ||
const getApmRepo = require('../../lib/apm/getApmRepo') | ||
|
||
exports.command = 'info <apmRepo> [apmRepoVersion]' | ||
|
||
exports.describe = 'Get information about a package' | ||
|
||
exports.builder = getRepoTask.args | ||
exports.builder = yargs => { | ||
return yargs | ||
.option('apmRepo', { | ||
describe: 'Name of the aragonPM repo', | ||
}) | ||
.option('apmRepoVersion', { | ||
describe: 'Version of the package upgrading to', | ||
default: 'latest', | ||
}) | ||
} | ||
|
||
exports.handler = async function({ | ||
apmRepo, | ||
apm: apmOptions, | ||
apmRepoVersion, | ||
apm: apmOptions, | ||
network, | ||
}) { | ||
const web3 = await ensureWeb3(network) | ||
apmRepo = defaultAPMName(apmRepo) | ||
apmOptions.ensRegistryAddress = apmOptions['ens-registry'] | ||
const apm = await APM(web3, apmOptions) | ||
|
||
const tasks = new TaskList([ | ||
{ | ||
title: `Fetching ${chalk.bold(apmRepo)}@${apmRepoVersion}`, | ||
task: getRepoTask.task({ | ||
apm, | ||
apmRepo, | ||
apmRepoVersion, | ||
artifactRequired: false, | ||
}), | ||
}, | ||
]) | ||
|
||
return tasks.run().then(ctx => { | ||
delete ctx.repo.abi | ||
delete ctx.repo.environments | ||
|
||
console.log(JSON.stringify(ctx.repo, null, 2)) | ||
process.exit() | ||
}) | ||
|
||
const apmRepoName = defaultAPMName(apmRepo) | ||
|
||
const progressHandler = step => { | ||
switch (step) { | ||
case 1: | ||
console.log(`Initialize aragonPM`) | ||
break | ||
case 2: | ||
// TODO: Use reporter instead of chalk? Should reporter have a 'title' function? | ||
console.log(`Fetching ${chalk.bold(apmRepo)}@${apmRepoVersion}`) | ||
break | ||
} | ||
} | ||
|
||
const apmRepoObject = await getApmRepo( | ||
web3, | ||
apmRepoName, | ||
apmRepoVersion, | ||
apmOptions, | ||
progressHandler | ||
) | ||
// TODO: Improve parsing of abi and env to display useful information | ||
delete apmRepoObject.abi | ||
delete apmRepoObject.environments | ||
|
||
const apmRepoJSON = JSON.stringify(apmRepoObject, null, 2) | ||
console.log(apmRepoJSON) | ||
process.exit() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.