Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 5113384

Browse files
committed
silo off all legacy code in wfc
1 parent 0d15b57 commit 5113384

File tree

1 file changed

+25
-4
lines changed
  • packages/workflow-compile/legacy

1 file changed

+25
-4
lines changed

packages/workflow-compile/legacy/index.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,37 @@ const fse = require("fs-extra");
33
const externalCompile = require("@truffle/external-compile");
44
const solcCompile = require("@truffle/compile-solidity");
55
const vyperCompile = require("@truffle/compile-vyper");
6-
const { prepareConfig } = require("../utils");
76
const { Shims } = require("@truffle/compile-common");
7+
const expect = require("@truffle/expect");
8+
const Config = require("@truffle/config");
9+
const Artifactor = require("@truffle/artifactor");
10+
const Resolver = require("@truffle/resolver");
811

912
const SUPPORTED_COMPILERS = {
1013
solc: solcCompile,
1114
vyper: vyperCompile,
1215
external: externalCompile
1316
};
1417

18+
function prepareConfig(options) {
19+
expect.options(options, ["contracts_build_directory"]);
20+
21+
expect.one(options, ["contracts_directory", "files"]);
22+
23+
// Use a config object to ensure we get the default sources.
24+
const config = Config.default().merge(options);
25+
26+
config.compilersInfo = {};
27+
28+
if (!config.resolver) config.resolver = new Resolver(config);
29+
30+
if (!config.artifactor) {
31+
config.artifactor = new Artifactor(config.contracts_build_directory);
32+
}
33+
34+
return config;
35+
}
36+
1537
const WorkflowCompile = {
1638
collectCompilations: async compilations => {
1739
let result = { outputs: {}, contracts: {} };
@@ -103,9 +125,8 @@ const WorkflowCompile = {
103125
const { contracts, output } = compilations.reduce(
104126
(a, compilation) => {
105127
for (const contract of compilation.contracts) {
106-
a.contracts[
107-
contract.contractName
108-
] = Shims.NewToLegacy.forContract(contract);
128+
a.contracts[contract.contractName] =
129+
Shims.NewToLegacy.forContract(contract);
109130
}
110131
a.output = a.output.concat(compilation.sourceIndexes);
111132
return a;

0 commit comments

Comments
 (0)