ic-mops 0.40.0 → 0.41.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.
- package/.DS_Store +0 -0
- package/.npmrc +2 -1
- package/CHANGELOG.md +8 -0
- package/DEVELOPMENT.md +25 -0
- package/bundle/bench/bench-canister.mo +87 -0
- package/bundle/bench/user-bench.mo +14 -0
- package/bundle/bin/moc-wrapper.sh +3 -0
- package/bundle/bin/mops.js +3 -0
- package/bundle/cli.js +88 -0
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +26 -0
- package/bundle/declarations/bench/bench.did.d.ts +29 -0
- package/bundle/declarations/bench/bench.did.js +26 -0
- package/bundle/declarations/bench/index.d.ts +50 -0
- package/bundle/declarations/bench/index.js +40 -0
- package/bundle/declarations/main/index.d.ts +50 -0
- package/bundle/declarations/main/index.js +40 -0
- package/bundle/declarations/main/main.did +433 -0
- package/bundle/declarations/main/main.did.d.ts +355 -0
- package/bundle/declarations/main/main.did.js +407 -0
- package/bundle/declarations/storage/index.d.ts +50 -0
- package/bundle/declarations/storage/index.js +30 -0
- package/bundle/declarations/storage/storage.did +46 -0
- package/bundle/declarations/storage/storage.did.d.ts +37 -0
- package/bundle/declarations/storage/storage.did.js +38 -0
- package/bundle/package.json +31 -0
- package/bundle/templates/README.md +13 -0
- package/bundle/templates/licenses/Apache-2.0 +202 -0
- package/bundle/templates/licenses/Apache-2.0-NOTICE +13 -0
- package/bundle/templates/licenses/MIT +21 -0
- package/bundle/templates/mops-publish.yml +17 -0
- package/bundle/templates/mops-test.yml +22 -0
- package/bundle/templates/src/lib.mo +15 -0
- package/bundle/templates/test/lib.test.mo +4 -0
- package/bundle-package-json.ts +17 -0
- package/check-requirements.ts +50 -0
- package/cli.ts +22 -19
- package/commands/add.ts +4 -0
- package/commands/install-all.ts +2 -0
- package/commands/publish.ts +18 -30
- package/commands/self.ts +75 -0
- package/commands/template.ts +9 -10
- package/commands/toolchain/index.ts +7 -0
- package/declarations/bench/bench.did.d.ts +1 -1
- package/declarations/bench/index.js +1 -2
- package/declarations/main/index.js +1 -2
- package/declarations/main/main.did +15 -8
- package/declarations/main/main.did.d.ts +12 -9
- package/declarations/main/main.did.js +11 -8
- package/dist/api/actors.d.ts +0 -0
- package/dist/api/actors.js +0 -0
- package/dist/api/downloadPackageFiles.d.ts +0 -0
- package/dist/api/downloadPackageFiles.js +0 -0
- package/dist/api/getHighestVersion.d.ts +0 -0
- package/dist/api/getHighestVersion.js +0 -0
- package/dist/api/index.d.ts +0 -0
- package/dist/api/index.js +0 -0
- package/dist/api/network.d.ts +0 -0
- package/dist/api/network.js +0 -0
- package/dist/api/resolveVersion.d.ts +0 -0
- package/dist/api/resolveVersion.js +0 -0
- package/dist/bin/mops.d.ts +1 -1
- package/dist/bin/mops.js +2 -1
- package/dist/bundle-package-json.d.ts +0 -0
- package/dist/bundle-package-json.js +2 -0
- package/dist/cache.d.ts +0 -0
- package/dist/cache.js +0 -0
- package/dist/check-requirements.d.ts +3 -0
- package/dist/check-requirements.js +44 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +18 -18
- package/dist/commands/add.d.ts +0 -0
- package/dist/commands/add.js +2 -0
- package/dist/commands/available-updates.d.ts +0 -0
- package/dist/commands/available-updates.js +0 -0
- package/dist/commands/bench-replica.d.ts +0 -0
- package/dist/commands/bench-replica.js +0 -0
- package/dist/commands/bench.d.ts +0 -0
- package/dist/commands/bench.js +0 -0
- package/dist/commands/bump.d.ts +0 -0
- package/dist/commands/bump.js +0 -0
- package/dist/commands/docs.d.ts +0 -0
- package/dist/commands/docs.js +0 -0
- package/dist/commands/import-identity.d.ts +0 -0
- package/dist/commands/import-identity.js +0 -0
- package/dist/commands/init.d.ts +0 -0
- package/dist/commands/init.js +0 -0
- package/dist/commands/install-all.d.ts +0 -0
- package/dist/commands/install-all.js +2 -0
- package/dist/commands/install-local.d.ts +0 -0
- package/dist/commands/install-local.js +0 -0
- package/dist/commands/install.d.ts +0 -0
- package/dist/commands/install.js +0 -0
- package/dist/commands/outdated.d.ts +0 -0
- package/dist/commands/outdated.js +0 -0
- package/dist/commands/publish.d.ts +0 -0
- package/dist/commands/publish.js +14 -25
- package/dist/commands/remove.d.ts +0 -0
- package/dist/commands/remove.js +0 -0
- package/dist/commands/search.d.ts +0 -0
- package/dist/commands/search.js +0 -0
- package/dist/commands/self.js +1 -1
- package/dist/commands/sources.d.ts +0 -0
- package/dist/commands/sources.js +0 -0
- package/dist/commands/sync.d.ts +0 -0
- package/dist/commands/sync.js +0 -0
- package/dist/commands/template.d.ts +0 -0
- package/dist/commands/template.js +9 -10
- package/dist/commands/test/mmf1.d.ts +0 -0
- package/dist/commands/test/mmf1.js +0 -0
- package/dist/commands/test/reporters/compact-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/compact-reporter.js +0 -0
- package/dist/commands/test/reporters/files-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/files-reporter.js +0 -0
- package/dist/commands/test/reporters/reporter.d.ts +0 -0
- package/dist/commands/test/reporters/reporter.js +0 -0
- package/dist/commands/test/reporters/silent-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/silent-reporter.js +0 -0
- package/dist/commands/test/reporters/verbose-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/verbose-reporter.js +0 -0
- package/dist/commands/test/test.d.ts +0 -0
- package/dist/commands/test/test.js +0 -0
- package/dist/commands/test/utils.d.ts +0 -0
- package/dist/commands/test/utils.js +0 -0
- package/dist/commands/toolchain/index.d.ts +0 -0
- package/dist/commands/toolchain/index.js +5 -0
- package/dist/commands/toolchain/moc.d.ts +0 -0
- package/dist/commands/toolchain/moc.js +0 -0
- package/dist/commands/toolchain/pocket-ic.d.ts +0 -0
- package/dist/commands/toolchain/pocket-ic.js +0 -0
- package/dist/commands/toolchain/toolchain-utils.d.ts +0 -0
- package/dist/commands/toolchain/toolchain-utils.js +0 -0
- package/dist/commands/toolchain/wasmtime.d.ts +0 -0
- package/dist/commands/toolchain/wasmtime.js +0 -0
- package/dist/commands/transfer-ownership.d.ts +0 -0
- package/dist/commands/transfer-ownership.js +0 -0
- package/dist/commands/update.d.ts +0 -0
- package/dist/commands/update.js +0 -0
- package/dist/commands/user.d.ts +0 -0
- package/dist/commands/user.js +0 -0
- package/dist/commands/whoami.d.ts +0 -0
- package/dist/commands/whoami.js +0 -0
- package/dist/declarations/bench/bench.did +0 -0
- package/dist/declarations/bench/bench.did.d.ts +1 -1
- package/dist/declarations/bench/bench.did.js +0 -0
- package/dist/declarations/bench/index.d.ts +0 -0
- package/dist/declarations/bench/index.js +1 -2
- package/dist/declarations/main/index.d.ts +0 -0
- package/dist/declarations/main/index.js +1 -2
- package/dist/declarations/main/main.did +15 -8
- package/dist/declarations/main/main.did.d.ts +12 -9
- package/dist/declarations/main/main.did.js +11 -8
- package/dist/helpers/find-changelog-entry.d.ts +0 -0
- package/dist/helpers/find-changelog-entry.js +0 -0
- package/dist/helpers/get-dfx-version.d.ts +0 -0
- package/dist/helpers/get-dfx-version.js +0 -0
- package/dist/helpers/get-moc-path.d.ts +0 -0
- package/dist/helpers/get-moc-path.js +0 -0
- package/dist/helpers/get-moc-version.d.ts +0 -0
- package/dist/helpers/get-moc-version.js +0 -0
- package/dist/integrity.d.ts +0 -0
- package/dist/integrity.js +0 -0
- package/dist/mops.d.ts +1 -0
- package/dist/mops.js +12 -1
- package/dist/notify-installs.d.ts +0 -0
- package/dist/notify-installs.js +0 -0
- package/dist/package.json +18 -24
- package/dist/parallel.d.ts +0 -0
- package/dist/parallel.js +0 -0
- package/dist/pem.d.ts +0 -0
- package/dist/pem.js +0 -0
- package/dist/release-cli.d.ts +0 -0
- package/dist/release-cli.js +13 -7
- package/dist/resolve-packages.d.ts +0 -0
- package/dist/resolve-packages.js +0 -0
- package/dist/templates.d.ts +1 -0
- package/dist/templates.js +4 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js +0 -0
- package/dist/vessel.d.ts +0 -0
- package/dist/vessel.js +0 -0
- package/helpers/find-changelog-entry.ts +27 -0
- package/mops.ts +15 -1
- package/package.json +26 -17
- package/release-cli.ts +67 -0
- package/remove-scripts.ts +6 -0
- package/templates.ts +5 -0
- package/tsconfig.json +1 -1
- package/types.ts +7 -2
- package/commands/self-update.ts +0 -6
- package/dist/commands/self-update.d.ts +0 -3
- package/dist/commands/self-update.js +0 -5
- /package/bin/{mops.ts → mops.js} +0 -0
package/.DS_Store
ADDED
|
Binary file
|
package/.npmrc
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
save-exact = true
|
|
1
|
+
save-exact = true
|
|
2
|
+
# omit = optional
|
package/CHANGELOG.md
ADDED
package/DEVELOPMENT.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Mops CLI
|
|
2
|
+
|
|
3
|
+
1. Update the version in `package.json` using `npm version` command.
|
|
4
|
+
|
|
5
|
+
2. Update changelog in `CHANGELOG.md` file.
|
|
6
|
+
|
|
7
|
+
3. Publish.
|
|
8
|
+
|
|
9
|
+
## Publish to npm
|
|
10
|
+
```
|
|
11
|
+
npm publish
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Publish on chain
|
|
15
|
+
|
|
16
|
+
1. Prepeare release
|
|
17
|
+
```
|
|
18
|
+
npm run release
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Deploy canister
|
|
22
|
+
(from root of the project)
|
|
23
|
+
```
|
|
24
|
+
dfx deploy --network ic --no-wallet cli
|
|
25
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import Nat64 "mo:base/Nat64";
|
|
2
|
+
import Nat "mo:base/Nat";
|
|
3
|
+
import Debug "mo:base/Debug";
|
|
4
|
+
import ExperimentalInternetComputer "mo:base/ExperimentalInternetComputer";
|
|
5
|
+
import Prim "mo:prim";
|
|
6
|
+
import Bench "mo:bench";
|
|
7
|
+
|
|
8
|
+
import UserBench "./user-bench"; // file path will be replaced with the *.bench.mo file path
|
|
9
|
+
|
|
10
|
+
actor class() {
|
|
11
|
+
var benchOpt : ?Bench.Bench = null;
|
|
12
|
+
|
|
13
|
+
public func init() : async Bench.BenchSchema {
|
|
14
|
+
let bench = UserBench.init();
|
|
15
|
+
benchOpt := ?bench;
|
|
16
|
+
bench.getSchema();
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
public query func getSchema() : async Bench.BenchSchema {
|
|
20
|
+
let ?bench = benchOpt else Debug.trap("bench not initialized");
|
|
21
|
+
bench.getSchema();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
func _getStats() : Bench.BenchResult {
|
|
25
|
+
{
|
|
26
|
+
instructions = 0;
|
|
27
|
+
rts_heap_size = Prim.rts_heap_size();
|
|
28
|
+
rts_memory_size = Prim.rts_memory_size();
|
|
29
|
+
rts_total_allocation = Prim.rts_total_allocation();
|
|
30
|
+
rts_mutator_instructions = Prim.rts_mutator_instructions();
|
|
31
|
+
rts_collector_instructions = Prim.rts_collector_instructions();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
func _diffStats(before : Bench.BenchResult, after : Bench.BenchResult) : Bench.BenchResult {
|
|
36
|
+
{
|
|
37
|
+
instructions = after.instructions - before.instructions;
|
|
38
|
+
rts_heap_size = after.rts_heap_size - before.rts_heap_size;
|
|
39
|
+
rts_memory_size = after.rts_memory_size - before.rts_memory_size;
|
|
40
|
+
rts_total_allocation = after.rts_total_allocation - before.rts_total_allocation;
|
|
41
|
+
rts_mutator_instructions = after.rts_mutator_instructions - before.rts_mutator_instructions;
|
|
42
|
+
rts_collector_instructions = after.rts_collector_instructions - before.rts_collector_instructions;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
func _runCell(rowIndex : Nat, colIndex : Nat) : Bench.BenchResult {
|
|
47
|
+
let ?bench = benchOpt else Debug.trap("bench not initialized");
|
|
48
|
+
let statsBefore = _getStats();
|
|
49
|
+
|
|
50
|
+
let instructions = Nat64.toNat(ExperimentalInternetComputer.countInstructions(func() {
|
|
51
|
+
bench.runCell(rowIndex, colIndex);
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
let statsAfter = _getStats();
|
|
55
|
+
_diffStats(statsBefore, { statsAfter with instructions });
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
func _runCellAwait(rowIndex : Nat, colIndex : Nat) : async Bench.BenchResult {
|
|
59
|
+
let ?bench = benchOpt else Debug.trap("bench not initialized");
|
|
60
|
+
let statsBefore = _getStats();
|
|
61
|
+
|
|
62
|
+
let instructions = Nat64.toNat(ExperimentalInternetComputer.countInstructions(func() {
|
|
63
|
+
bench.runCell(rowIndex, colIndex);
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
await (func() : async () {})();
|
|
67
|
+
|
|
68
|
+
let statsAfter = _getStats();
|
|
69
|
+
_diffStats(statsBefore, { statsAfter with instructions });
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
public query func getStats() : async Bench.BenchResult {
|
|
73
|
+
_getStats();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
public query func runCellQuery(rowIndex : Nat, colIndex : Nat) : async Bench.BenchResult {
|
|
77
|
+
_runCell(rowIndex, colIndex);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
public func runCellUpdate(rowIndex : Nat, colIndex : Nat) : async Bench.BenchResult {
|
|
81
|
+
_runCell(rowIndex, colIndex);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
public func runCellUpdateAwait(rowIndex : Nat, colIndex : Nat) : async Bench.BenchResult {
|
|
85
|
+
await _runCellAwait(rowIndex, colIndex);
|
|
86
|
+
};
|
|
87
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Nat "mo:base/Nat";
|
|
2
|
+
import Iter "mo:base/Iter";
|
|
3
|
+
import Buffer "mo:base/Buffer";
|
|
4
|
+
import Vector "mo:vector/Class";
|
|
5
|
+
import Bench "mo:bench";
|
|
6
|
+
|
|
7
|
+
// placeholder file that will be replaced with the *.bench.mo file
|
|
8
|
+
module {
|
|
9
|
+
public func init() : Bench.Bench {
|
|
10
|
+
let bench = Bench.Bench();
|
|
11
|
+
// benchmark code goes here...
|
|
12
|
+
bench;
|
|
13
|
+
};
|
|
14
|
+
};
|