From ae8991174f57ce6518bafa86d0621142a5df412e Mon Sep 17 00:00:00 2001 From: Sam Goldman Date: Tue, 22 Nov 2022 15:49:30 -0500 Subject: [PATCH] fix(pg): add user logs for commit subtask --- .changeset/many-games-train.md | 5 ++++ packages/plugins/src/hardhat/deployments.ts | 11 +------- packages/plugins/src/hardhat/tasks.ts | 31 +++++++++++++-------- 3 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 .changeset/many-games-train.md diff --git a/.changeset/many-games-train.md b/.changeset/many-games-train.md new file mode 100644 index 000000000..4c0b14dea --- /dev/null +++ b/.changeset/many-games-train.md @@ -0,0 +1,5 @@ +--- +'@chugsplash/plugins': patch +--- + +Add user logs for the commit subtask diff --git a/packages/plugins/src/hardhat/deployments.ts b/packages/plugins/src/hardhat/deployments.ts index 969fa90ff..4a2a9b21c 100644 --- a/packages/plugins/src/hardhat/deployments.ts +++ b/packages/plugins/src/hardhat/deployments.ts @@ -121,12 +121,6 @@ export const deployChugSplashConfig = async ( ) } - // The spinner interferes with Hardhat's compilation logs, so we only display this message if - // compilation is being skipped. - if (noCompile) { - spinner.start('Getting the deployment info...') - } - // Get the bundle ID without publishing anything to IPFS. const { bundleId, bundle, configUri, canonicalConfig } = await chugsplashCommitSubtask( @@ -135,14 +129,11 @@ export const deployChugSplashConfig = async ( ipfsUrl, commitToIpfs: false, noCompile, + spinner, }, hre ) - if (noCompile) { - spinner.succeed('Loaded the deployment info.') - } - spinner.start('Checking status of the deployment...') const ChugSplashManager = getChugSplashManager( diff --git a/packages/plugins/src/hardhat/tasks.ts b/packages/plugins/src/hardhat/tasks.ts index d3b2605e8..d12cdf262 100644 --- a/packages/plugins/src/hardhat/tasks.ts +++ b/packages/plugins/src/hardhat/tasks.ts @@ -282,7 +282,6 @@ export const chugsplashProposeTask = async ( await deployChugSplashPredeploys(provider, provider.getSigner()) const parsedConfig = loadParsedChugSplashConfig(configPath) - const projectName = parsedConfig.options.projectName if ( (await isProjectRegistered(signer, parsedConfig.options.projectName)) === @@ -302,12 +301,6 @@ export const chugsplashProposeTask = async ( spinner.succeed('ChugSplash is ready to go.') - // The spinner interferes with Hardhat's compilation logs, so we only display this message if - // compilation is being skipped. - if (noCompile) { - spinner.start(`Committing ${projectName}... on ${hre.network.name}.`) - } - // Get the bundle info by calling the commit subtask locally (i.e. without publishing the // bundle to IPFS). This allows us to ensure that the bundle state is empty before we submit // it to IPFS. @@ -317,14 +310,11 @@ export const chugsplashProposeTask = async ( ipfsUrl, commitToIpfs: false, noCompile, + spinner, }, hre ) - if (noCompile) { - spinner.succeed(`Committed ${projectName} on ${hre.network.name}.`) - } - spinner.start('Proposing the project...') const bundleState: ChugSplashBundleState = await ChugSplashManager.bundles( @@ -535,6 +525,7 @@ export const chugsplashCommitSubtask = async ( ipfsUrl: string commitToIpfs: boolean noCompile: boolean + spinner?: ora.Ora }, hre ): Promise<{ @@ -543,12 +534,20 @@ export const chugsplashCommitSubtask = async ( bundleId: string canonicalConfig: CanonicalChugSplashConfig }> => { - const { parsedConfig, ipfsUrl, commitToIpfs, noCompile } = args + const { parsedConfig, ipfsUrl, commitToIpfs, noCompile, spinner } = args if (!noCompile) { await cleanThenCompile(hre) } + if (spinner) { + commitToIpfs + ? spinner.start( + `Committing ${parsedConfig.options.projectName} on ${hre.network.name}.` + ) + : spinner.start('Loading the deployment info...') + } + let configSourceNames = Object.values(parsedConfig.contracts) .map((contractConfig) => contractConfig.contract) .map((name) => getContractArtifact(name).sourceName) @@ -644,6 +643,14 @@ IPFS_API_KEY_SECRET: ... configUri ) + if (spinner) { + commitToIpfs + ? spinner.succeed( + `Committed ${parsedConfig.options.projectName} on ${hre.network.name}.` + ) + : spinner.succeed('Loaded the deployment info.') + } + return { bundle, configUri, bundleId, canonicalConfig } }