@0xweb/hardhat 0.1.7 → 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 +24 -8
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -101,10 +101,10 @@ var $path;
|
|
|
101
101
|
return pathUtil.join(process.cwd(), path);
|
|
102
102
|
}
|
|
103
103
|
$path.resolve = resolve;
|
|
104
|
-
function
|
|
104
|
+
function join(...paths) {
|
|
105
105
|
return pathUtil.join(...paths);
|
|
106
106
|
}
|
|
107
|
-
$path.
|
|
107
|
+
$path.join = join;
|
|
108
108
|
})($path = exports.$path || (exports.$path = {}));
|
|
109
109
|
//# sourceMappingURL=$path.js.map
|
|
110
110
|
//# sourceMappingURL=$path.ts.map;
|
|
@@ -142,20 +142,36 @@ const taskArgsStore = { compileAll: false };
|
|
|
142
142
|
(0, config_1.task)(task_names_1.TASK_COMPILE, 'Compiles the entire project, building all artifacts')
|
|
143
143
|
.addOptionalParam('sources', 'Override the sources directory')
|
|
144
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')
|
|
145
146
|
.addOptionalParam('watch', 'Re-runs compilation task on changes')
|
|
146
147
|
.setAction(async (compilationArgs, { run, config, artifacts }, runSuper) => {
|
|
147
|
-
|
|
148
|
-
|
|
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');
|
|
159
|
+
}
|
|
160
|
+
if (sourcesDir) {
|
|
161
|
+
sourcesDir = _path_1.$path.resolve(sourcesDir);
|
|
162
|
+
config.paths.sources = sourcesDir;
|
|
149
163
|
}
|
|
150
|
-
if (
|
|
151
|
-
|
|
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
|
|
152
170
|
const artifactsInstance = artifacts;
|
|
153
|
-
config.paths.artifacts = artifactsDir;
|
|
154
171
|
if (artifactsInstance._artifactsPath == null) {
|
|
155
172
|
console.error(`Articats Internal interface was changed. Trying to set private _artifactsPath, but it doesn't exist.`);
|
|
156
173
|
}
|
|
157
174
|
artifactsInstance._artifactsPath = artifactsDir;
|
|
158
|
-
config.paths.cache = _path_1.$path.combine(artifactsDir, '../cache/');
|
|
159
175
|
}
|
|
160
176
|
if (compilationArgs.watch != null) {
|
|
161
177
|
const directory = `file://${config.paths.sources}/`;
|