Skip to content

Commit

Permalink
Fix contracts-gen so make sure all dirs are created
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioberger committed Nov 11, 2019
1 parent 5db1820 commit bc1dca3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/contracts-gen/src/contracts-gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ const COPY = 'copy';
const srcArtifactsDir = convertToTopLevelDir('testArtifactsDir', testArtifactsDir);
const testWrappersDir = DEFAULT_WRAPPERS_DIR;
const srcWrappersDir = convertToTopLevelDir('testWrappersDir', testWrappersDir);

// Make sure all dirs exist, if not, create them
mkdirp.sync(testArtifactsDir);
mkdirp.sync(srcArtifactsDir);
mkdirp.sync(testWrappersDir);
mkdirp.sync(srcWrappersDir);

if (command === GENERATE) {
await regenerateContractPackageAsync(
testContracts,
Expand Down Expand Up @@ -197,7 +204,6 @@ function generateArtifactsTs(
export const artifacts = {${artifacts.join('\n')}};
`;
const formattedArtifactsTs = prettier.format(artifactsTs, { ...prettierConfig, filepath: artifactsTsFilePath });
mkdirp.sync(artifactsTsFilePath);
fs.writeFileSync(artifactsTsFilePath, formattedArtifactsTs);
}

Expand All @@ -219,7 +225,6 @@ function generateWrappersTs(
${sortedImports.join('\n')}
`;
const formattedArtifactsTs = prettier.format(wrappersTs, { ...prettierConfig, filepath: wrappersTsFilePath });
mkdirp.sync(wrappersTsFilePath);
fs.writeFileSync(wrappersTsFilePath, formattedArtifactsTs);
}

Expand Down

0 comments on commit bc1dca3

Please sign in to comment.