ic-mops 0.25.2 → 0.25.4

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/README.md CHANGED
@@ -17,7 +17,20 @@ npm i -g ic-mops
17
17
 
18
18
  ## Install Packages
19
19
 
20
- ### 1. Initialize
20
+ ### 1. Configure dfx.json
21
+ Add `mops` as a packtool to your `dfx.json`
22
+
23
+ ```json
24
+ {
25
+ "defaults": {
26
+ "build": {
27
+ "packtool": "mops sources"
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ### 2. Initialize
21
34
  Run this command in the root directory of your project (where is `dfx.json` placed)
22
35
 
23
36
  If there are Vessel config files, mops will migrate packages from `vessel.dhall` to `mops.toml`
@@ -26,7 +39,7 @@ If there are Vessel config files, mops will migrate packages from `vessel.dhall`
26
39
  mops init
27
40
  ```
28
41
 
29
- ### 2. Install Motoko Packages
42
+ ### 3. Install Motoko Packages
30
43
  Use `mops add <package_name>` to install a specific package and save it to `mops.toml`
31
44
 
32
45
  ```
@@ -53,7 +66,7 @@ Use `mops install` to install all packages specified in `mops.toml`
53
66
  mops install
54
67
  ```
55
68
 
56
- ### 3. Import Package
69
+ ### 4. Import Package
57
70
  Now you can import installed packages in your Motoko code
58
71
 
59
72
  ```motoko
@@ -0,0 +1,13 @@
1
+ import { MMF1 } from '../mmf1.js';
2
+ import { Reporter } from './reporter.js';
3
+ export declare class SilentReporter implements Reporter {
4
+ passed: number;
5
+ failed: number;
6
+ skipped: number;
7
+ passedFiles: number;
8
+ failedFiles: number;
9
+ passedNamesFlat: string[];
10
+ addFiles(_files: string[]): void;
11
+ addRun(file: string, mmf: MMF1, state: Promise<void>, _wasiMode: boolean): void;
12
+ done(): boolean;
13
+ }
@@ -0,0 +1,35 @@
1
+ import chalk from 'chalk';
2
+ import { absToRel } from '../utils.js';
3
+ export class SilentReporter {
4
+ constructor() {
5
+ this.passed = 0;
6
+ this.failed = 0;
7
+ this.skipped = 0;
8
+ this.passedFiles = 0;
9
+ this.failedFiles = 0;
10
+ this.passedNamesFlat = [];
11
+ }
12
+ addFiles(_files) { }
13
+ addRun(file, mmf, state, _wasiMode) {
14
+ state.then(() => {
15
+ this.passed += mmf.passed;
16
+ this.failed += mmf.failed;
17
+ this.skipped += mmf.skipped;
18
+ this.passedNamesFlat = [...this.passedNamesFlat, ...mmf.passedNamesFlat];
19
+ if (mmf.passed === 0 && mmf.failed === 0) {
20
+ this.passed++;
21
+ this.passedNamesFlat.push(absToRel(file));
22
+ }
23
+ this.passedFiles += Number(mmf.failed === 0);
24
+ this.failedFiles += Number(mmf.failed !== 0);
25
+ if (mmf.failed) {
26
+ console.log(chalk.red('✖'), absToRel(file));
27
+ mmf.flush('fail');
28
+ console.log('-'.repeat(50));
29
+ }
30
+ });
31
+ }
32
+ done() {
33
+ return this.failed === 0;
34
+ }
35
+ }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.25.2",
3
+ "version": "0.25.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"
@@ -7,7 +7,7 @@ module {
7
7
  /// Example:
8
8
  /// ```motoko
9
9
  /// assert add(1, 2) == 3;
10
- /// assert add(-5, 5) == 0;
10
+ /// assert add(7, 3) == 10;
11
11
  /// ```
12
12
  public func add(x : Nat, y : Nat) : Nat {
13
13
  return x + y;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.25.2",
3
+ "version": "0.25.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"
@@ -7,7 +7,7 @@ module {
7
7
  /// Example:
8
8
  /// ```motoko
9
9
  /// assert add(1, 2) == 3;
10
- /// assert add(-5, 5) == 0;
10
+ /// assert add(7, 3) == 10;
11
11
  /// ```
12
12
  public func add(x : Nat, y : Nat) : Nat {
13
13
  return x + y;