@0xweb/hardhat 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +33 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -101,6 +101,10 @@ var $path;
|
|
|
101
101
|
return pathUtil.join(process.cwd(), path);
|
|
102
102
|
}
|
|
103
103
|
$path.resolve = resolve;
|
|
104
|
+
function join(...paths) {
|
|
105
|
+
return pathUtil.join(...paths);
|
|
106
|
+
}
|
|
107
|
+
$path.join = join;
|
|
104
108
|
})($path = exports.$path || (exports.$path = {}));
|
|
105
109
|
//# sourceMappingURL=$path.js.map
|
|
106
110
|
//# sourceMappingURL=$path.ts.map;
|
|
@@ -138,13 +142,36 @@ const taskArgsStore = { compileAll: false };
|
|
|
138
142
|
(0, config_1.task)(task_names_1.TASK_COMPILE, 'Compiles the entire project, building all artifacts')
|
|
139
143
|
.addOptionalParam('sources', 'Override the sources directory')
|
|
140
144
|
.addOptionalParam('artifacts', 'Override the artifacts output directory')
|
|
145
|
+
.addOptionalParam('root', 'Overrides root directory. If sources is also overriden must be the sub-folder of the sources dir')
|
|
141
146
|
.addOptionalParam('watch', 'Re-runs compilation task on changes')
|
|
142
|
-
.setAction(async (compilationArgs, { run, config }, runSuper) => {
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
.setAction(async (compilationArgs, { run, config, artifacts }, runSuper) => {
|
|
148
|
+
let { sources: sourcesDir, artifacts: artifactsDir, root: rootDir } = compilationArgs;
|
|
149
|
+
if (rootDir != null) {
|
|
150
|
+
rootDir = _path_1.$path.resolve(rootDir);
|
|
151
|
+
if (sourcesDir == null) {
|
|
152
|
+
sourcesDir = _path_1.$path.join(rootDir, 'contracts');
|
|
153
|
+
}
|
|
154
|
+
if (artifactsDir == null) {
|
|
155
|
+
artifactsDir = _path_1.$path.join(rootDir, 'artifacts');
|
|
156
|
+
}
|
|
157
|
+
config.paths.root = rootDir;
|
|
158
|
+
config.paths.cache = _path_1.$path.join(rootDir, 'cache');
|
|
145
159
|
}
|
|
146
|
-
if (
|
|
147
|
-
|
|
160
|
+
if (sourcesDir) {
|
|
161
|
+
sourcesDir = _path_1.$path.resolve(sourcesDir);
|
|
162
|
+
config.paths.sources = sourcesDir;
|
|
163
|
+
}
|
|
164
|
+
if (artifactsDir) {
|
|
165
|
+
artifactsDir = _path_1.$path.resolve(artifactsDir);
|
|
166
|
+
config.paths.artifacts = _path_1.$path.join(artifactsDir, './artifacts/');
|
|
167
|
+
config.paths.cache = _path_1.$path.join(artifactsDir, './cache/');
|
|
168
|
+
// Re-set Artifacts Path manually, as Hardhat initializes the Artifacts Instance before this task runs.
|
|
169
|
+
// Other paths (sources, cache) will be resolved later by hardhat from config
|
|
170
|
+
const artifactsInstance = artifacts;
|
|
171
|
+
if (artifactsInstance._artifactsPath == null) {
|
|
172
|
+
console.error(`Articats Internal interface was changed. Trying to set private _artifactsPath, but it doesn't exist.`);
|
|
173
|
+
}
|
|
174
|
+
artifactsInstance._artifactsPath = artifactsDir;
|
|
148
175
|
}
|
|
149
176
|
if (compilationArgs.watch != null) {
|
|
150
177
|
const directory = `file://${config.paths.sources}/`;
|
|
@@ -158,7 +185,7 @@ const taskArgsStore = { compileAll: false };
|
|
|
158
185
|
}
|
|
159
186
|
await runSuper();
|
|
160
187
|
});
|
|
161
|
-
(0, config_1.subtask)(task_names_1.TASK_COMPILE_SOLIDITY_COMPILE_JOBS, 'Compiles the entire project, building all artifacts')
|
|
188
|
+
(0, config_1.subtask)(task_names_1.TASK_COMPILE_SOLIDITY_COMPILE_JOBS, 'Compiles the entire project, building all artifacts and generating 0xweb TS classes')
|
|
162
189
|
.setAction(async (taskArgs, { run }, runSuper) => {
|
|
163
190
|
const compileSolOutput = await runSuper(taskArgs);
|
|
164
191
|
await run(constants_1.TASK_0xWEB_GENERATE, { compileSolOutput });
|