ic-mops 0.32.0 → 0.32.1

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
- fs.cpSync(new URL('./bench/bench-canister.mo', import.meta.url), path.join(tempDir, 'canister.mo'));
186
- fs.cpSync(file, path.join(tempDir, 'user-bench.mo'));
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();
@@ -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;
@@ -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.cpSync(new URL('./bench/bench-canister.mo', import.meta.url), path.join(tempDir, 'canister.mo'));
151
- fs.cpSync(file, path.join(tempDir, 'user-bench.mo'));
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"