Skip to content

Commit

Permalink
fix(apm/publish): check whether artifact.json already exist
Browse files Browse the repository at this point in the history
And throw if it doesn't. CLI users will have to generate the artifact.json
explicitly using `apm publish --only-artifacts`.

Closes aragon#159
  • Loading branch information
0x-r4bbit committed Sep 6, 2018
1 parent 0ebdace commit 5ec911c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/commands/apm_cmds/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const startIPFS = require('../ipfs')
const getRepoTask = require('../dao_cmds/utils/getRepoTask')

const MANIFEST_FILE = 'manifest.json'
const ARTIFACT_FILE = 'artifact.json'

exports.command = 'publish [contract]'

Expand Down Expand Up @@ -362,8 +363,11 @@ exports.task = function ({
skip: () => onlyContent && !module.path, // TODO: If onlyContent has been set, get previous version's artifact
task: async (ctx, task) => {
const dir = onlyArtifacts ? cwd : ctx.pathToPublish
const artifact = await generateApplicationArtifact(web3, cwd, dir, module, contract, reporter)

if (onlyContent && !pathExistsSync(`${dir}/${ARTIFACT_FILE}`)) {
throw new Error('Couldn\'t find artifact.json. Please generate it first with apm publish --only-artifacts')
}
const artifact = await generateApplicationArtifact(web3, cwd, dir, module, contract, reporter)
return `Saved artifact in ${dir}/artifact.json`
}
},
Expand Down

0 comments on commit 5ec911c

Please sign in to comment.