ic-mops 0.32.0 → 0.32.2
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.
|
@@ -5,7 +5,7 @@ import ExperimentalInternetComputer "mo:base/ExperimentalInternetComputer";
|
|
|
5
5
|
import Prim "mo:prim";
|
|
6
6
|
import Bench "mo:bench";
|
|
7
7
|
|
|
8
|
-
import UserBench "./user-bench";
|
|
8
|
+
import UserBench "./user-bench"; // file path will be replaced with the *.bench.mo file path
|
|
9
9
|
|
|
10
10
|
actor class() {
|
|
11
11
|
var benchOpt : ?Bench.Bench = null;
|
package/commands/bench.ts
CHANGED
|
@@ -182,8 +182,10 @@ async function deployBenchFile(file: string, options: BenchOptions = {}): Promis
|
|
|
182
182
|
// prepare temp files
|
|
183
183
|
fs.mkdirSync(tempDir, {recursive: true});
|
|
184
184
|
fs.writeFileSync(path.join(tempDir, 'dfx.json'), JSON.stringify(dfxJson(canisterName, options), null, 2));
|
|
185
|
-
|
|
186
|
-
fs.
|
|
185
|
+
|
|
186
|
+
let benchCanisterData = fs.readFileSync(new URL('./bench/bench-canister.mo', import.meta.url), 'utf8');
|
|
187
|
+
benchCanisterData = benchCanisterData.replace('./user-bench', path.relative(tempDir, file).replace(/.mo$/g, ''));
|
|
188
|
+
fs.writeFileSync(path.join(tempDir, 'canister.mo'), benchCanisterData);
|
|
187
189
|
|
|
188
190
|
// build canister
|
|
189
191
|
let mocPath = getMocPath();
|
package/commands/publish.ts
CHANGED
|
@@ -5,7 +5,7 @@ import ExperimentalInternetComputer "mo:base/ExperimentalInternetComputer";
|
|
|
5
5
|
import Prim "mo:prim";
|
|
6
6
|
import Bench "mo:bench";
|
|
7
7
|
|
|
8
|
-
import UserBench "./user-bench";
|
|
8
|
+
import UserBench "./user-bench"; // file path will be replaced with the *.bench.mo file path
|
|
9
9
|
|
|
10
10
|
actor class() {
|
|
11
11
|
var benchOpt : ?Bench.Bench = null;
|
package/dist/commands/bench.js
CHANGED
|
@@ -147,8 +147,9 @@ async function deployBenchFile(file, options = {}) {
|
|
|
147
147
|
// prepare temp files
|
|
148
148
|
fs.mkdirSync(tempDir, { recursive: true });
|
|
149
149
|
fs.writeFileSync(path.join(tempDir, 'dfx.json'), JSON.stringify(dfxJson(canisterName, options), null, 2));
|
|
150
|
-
fs.
|
|
151
|
-
|
|
150
|
+
let benchCanisterData = fs.readFileSync(new URL('./bench/bench-canister.mo', import.meta.url), 'utf8');
|
|
151
|
+
benchCanisterData = benchCanisterData.replace('./user-bench', path.relative(tempDir, file).replace(/.mo$/g, ''));
|
|
152
|
+
fs.writeFileSync(path.join(tempDir, 'canister.mo'), benchCanisterData);
|
|
152
153
|
// build canister
|
|
153
154
|
let mocPath = getMocPath();
|
|
154
155
|
let mocArgs = getMocArgs(options);
|
package/dist/commands/publish.js
CHANGED
package/dist/package.json
CHANGED