Skip to content

Adds a --clean-build flag to the build command #896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions publish/src/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ const build = async ({
showWarnings,
showContractSize,
useOvm,
cleanBuild,
} = {}) => {
console.log(gray(`Starting build${useOvm ? ' using OVM' : ''}...`));

if (cleanBuild && fs.existsSync(buildPath)) {
fs.rmdirSync(buildPath, { recursive: true });
}

if (!fs.existsSync(buildPath)) {
fs.mkdirSync(buildPath);
}

// Flatten all the contracts.
// Start with the libraries, then copy our own contracts on top to ensure
// if there's a naming clash our code wins.
Expand Down Expand Up @@ -216,6 +222,7 @@ module.exports = {
.command('build')
.description('Build (flatten and compile) solidity files')
.option('-b, --build-path <value>', 'Build path for built files', DEFAULTS.buildPath)
.option('-c, --clean-build', 'Delete previously existing files', false)
.option(
'-k, --skip-unchanged',
'Skip any contracts that seem as though they have not changed (infers from flattened file and does not strictly check bytecode. ⚠⚠⚠ DO NOT USE FOR PRODUCTION BUILDS.'
Expand Down