ic-mops 1.1.0-pre.0 → 1.1.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/CHANGELOG.md +13 -0
- package/bin/moc-wrapper.sh +1 -1
- package/bundle/cli.tgz +0 -0
- package/check-requirements.ts +1 -1
- package/cli.ts +18 -0
- package/commands/bench.ts +1 -1
- package/commands/install/install-all.ts +2 -2
- package/commands/replica.ts +33 -3
- package/commands/sources.ts +1 -1
- package/commands/sync.ts +4 -19
- package/commands/test/mmf1.ts +4 -0
- package/commands/test/reporters/silent-reporter.ts +22 -4
- package/commands/test/test.ts +74 -10
- package/commands/watch/deployer.ts +155 -0
- package/commands/watch/error-checker.ts +87 -0
- package/commands/watch/generator.ts +99 -0
- package/commands/watch/globMoFiles.ts +16 -0
- package/commands/watch/parseDfxJson.ts +64 -0
- package/commands/watch/tester.ts +81 -0
- package/commands/watch/warning-checker.ts +133 -0
- package/commands/watch/watch.ts +90 -0
- package/declarations/main/main.did +16 -10
- package/declarations/main/main.did.d.ts +19 -10
- package/declarations/main/main.did.js +25 -11
- package/dist/bin/moc-wrapper.sh +1 -1
- package/dist/check-requirements.js +1 -1
- package/dist/cli.js +16 -0
- package/dist/commands/bench.js +1 -1
- package/dist/commands/install/install-all.js +2 -2
- package/dist/commands/replica.d.ts +2 -2
- package/dist/commands/replica.js +26 -3
- package/dist/commands/sources.d.ts +1 -1
- package/dist/commands/sources.js +1 -1
- package/dist/commands/sync.js +3 -18
- package/dist/commands/test/mmf1.d.ts +1 -0
- package/dist/commands/test/mmf1.js +3 -0
- package/dist/commands/test/reporters/silent-reporter.d.ts +6 -1
- package/dist/commands/test/reporters/silent-reporter.js +18 -5
- package/dist/commands/test/test.d.ts +1 -1
- package/dist/commands/test/test.js +62 -10
- package/dist/commands/watch/deployer.d.ts +24 -0
- package/dist/commands/watch/deployer.js +125 -0
- package/dist/commands/watch/error-checker.d.ts +13 -0
- package/dist/commands/watch/error-checker.js +76 -0
- package/dist/commands/watch/generator.d.ts +21 -0
- package/dist/commands/watch/generator.js +79 -0
- package/dist/commands/watch/globMoFiles.d.ts +1 -0
- package/dist/commands/watch/globMoFiles.js +14 -0
- package/dist/commands/watch/parseDfxJson.d.ts +2 -0
- package/dist/commands/watch/parseDfxJson.js +22 -0
- package/dist/commands/watch/tester.d.ts +19 -0
- package/dist/commands/watch/tester.js +63 -0
- package/dist/commands/watch/warning-checker.d.ts +20 -0
- package/dist/commands/watch/warning-checker.js +111 -0
- package/dist/commands/watch/watch.d.ts +7 -0
- package/dist/commands/watch/watch.js +79 -0
- package/dist/declarations/main/main.did +16 -10
- package/dist/declarations/main/main.did.d.ts +19 -10
- package/dist/declarations/main/main.did.js +25 -11
- package/dist/helpers/get-moc-path.d.ts +1 -1
- package/dist/helpers/get-moc-path.js +17 -3
- package/dist/helpers/get-moc-version.d.ts +1 -1
- package/dist/helpers/get-moc-version.js +17 -5
- package/dist/integrity.js +3 -2
- package/dist/package.json +3 -2
- package/dist/parallel.d.ts +1 -1
- package/dist/templates/mops-test.yml +4 -2
- package/helpers/get-moc-path.ts +19 -3
- package/helpers/get-moc-version.ts +17 -5
- package/integrity.ts +3 -2
- package/package.json +3 -2
- package/parallel.ts +2 -2
- package/templates/mops-test.yml +4 -2
- package/test +0 -4
|
@@ -14,9 +14,11 @@ jobs:
|
|
|
14
14
|
steps:
|
|
15
15
|
- uses: actions/checkout@v4
|
|
16
16
|
- uses: ZenVoich/setup-mops@v1
|
|
17
|
+
with:
|
|
18
|
+
mops-version: 1
|
|
17
19
|
|
|
18
|
-
- name:
|
|
19
|
-
run: mops
|
|
20
|
+
- name: install mops packages
|
|
21
|
+
run: mops install
|
|
20
22
|
|
|
21
23
|
- name: run tests
|
|
22
24
|
run: mops test
|
package/helpers/get-moc-path.ts
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
|
-
import {
|
|
2
|
+
import {execFileSync} from 'node:child_process';
|
|
3
3
|
|
|
4
|
-
export function getMocPath() : string {
|
|
4
|
+
export function getMocPath(throwIfNotFound = false) : string {
|
|
5
5
|
let mocPath = process.env.DFX_MOC_PATH;
|
|
6
6
|
if (!mocPath) {
|
|
7
|
-
|
|
7
|
+
try {
|
|
8
|
+
mocPath = execFileSync('dfx', ['cache', 'show']).toString().trim() + '/moc';
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
mocPath = '';
|
|
12
|
+
}
|
|
8
13
|
}
|
|
9
14
|
if (!mocPath) {
|
|
10
15
|
mocPath = 'moc';
|
|
11
16
|
}
|
|
17
|
+
|
|
18
|
+
if (throwIfNotFound) {
|
|
19
|
+
try {
|
|
20
|
+
execFileSync(mocPath, ['--version']);
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
console.error(e);
|
|
24
|
+
throw new Error('moc not found');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
12
28
|
return mocPath;
|
|
13
29
|
}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {execFileSync} from 'node:child_process';
|
|
2
2
|
import {getMocPath} from './get-moc-path.js';
|
|
3
3
|
|
|
4
|
-
export function getMocVersion() : string {
|
|
5
|
-
let mocPath = getMocPath();
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export function getMocVersion(throwOnError = false) : string {
|
|
5
|
+
let mocPath = getMocPath(false);
|
|
6
|
+
if (!mocPath) {
|
|
7
|
+
return '';
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
let match = execFileSync(mocPath, ['--version']).toString().trim().match(/Motoko compiler ([^\s]+) .*/);
|
|
11
|
+
return match?.[1] || '';
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
if (throwOnError) {
|
|
15
|
+
console.error(e);
|
|
16
|
+
throw new Error('moc not found');
|
|
17
|
+
}
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
8
20
|
}
|
package/integrity.ts
CHANGED
|
@@ -167,6 +167,7 @@ export async function updateLockFile() {
|
|
|
167
167
|
|
|
168
168
|
// compare hashes of local files with hashes from the lock file
|
|
169
169
|
export async function checkLockFile(force = false) {
|
|
170
|
+
let supportedVersions = [1, 2, 3];
|
|
170
171
|
let rootDir = getRootDir();
|
|
171
172
|
let lockFile = path.join(rootDir, 'mops.lock');
|
|
172
173
|
|
|
@@ -183,9 +184,9 @@ export async function checkLockFile(force = false) {
|
|
|
183
184
|
let packageIds = await getResolvedMopsPackageIds();
|
|
184
185
|
|
|
185
186
|
// check lock file version
|
|
186
|
-
if (
|
|
187
|
+
if (!supportedVersions.includes(lockFileJsonGeneric.version)) {
|
|
187
188
|
console.error('Integrity check failed');
|
|
188
|
-
console.error(`Invalid lock file version: ${lockFileJsonGeneric.version}. Supported versions:
|
|
189
|
+
console.error(`Invalid lock file version: ${lockFileJsonGeneric.version}. Supported versions: ${supportedVersions.join(', ')}`);
|
|
189
190
|
process.exit(1);
|
|
190
191
|
}
|
|
191
192
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "dist/bin/mops.js",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"octokit": "3.1.2",
|
|
81
81
|
"pem-file": "1.0.1",
|
|
82
82
|
"pic-ic": "0.5.3",
|
|
83
|
+
"promisify-child-process": "4.1.2",
|
|
83
84
|
"prompts": "2.4.2",
|
|
84
85
|
"semver": "7.6.3",
|
|
85
86
|
"stream-to-promise": "3.0.0",
|
|
@@ -93,7 +94,7 @@
|
|
|
93
94
|
"@types/fs-extra": "11.0.4",
|
|
94
95
|
"@types/glob": "8.1.0",
|
|
95
96
|
"@types/ncp": "2.0.8",
|
|
96
|
-
"@types/node": "22.
|
|
97
|
+
"@types/node": "22.7.4",
|
|
97
98
|
"@types/prompts": "2.4.9",
|
|
98
99
|
"@types/semver": "7.5.8",
|
|
99
100
|
"@types/stream-to-promise": "2.2.4",
|
package/parallel.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export async function parallel(threads : number, items :
|
|
1
|
+
export async function parallel<T>(threads : number, items : T[], fn : (item : T) => Promise<void>) {
|
|
2
2
|
return new Promise<void>((resolve) => {
|
|
3
3
|
let busyThreads = 0;
|
|
4
4
|
items = items.slice();
|
|
@@ -14,7 +14,7 @@ export async function parallel(threads : number, items : any[], fn : CallableFun
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
busyThreads++;
|
|
17
|
-
fn(items.shift()).then(() => {
|
|
17
|
+
fn(items.shift() as T).then(() => {
|
|
18
18
|
busyThreads--;
|
|
19
19
|
loop();
|
|
20
20
|
});
|
package/templates/mops-test.yml
CHANGED
|
@@ -14,9 +14,11 @@ jobs:
|
|
|
14
14
|
steps:
|
|
15
15
|
- uses: actions/checkout@v4
|
|
16
16
|
- uses: ZenVoich/setup-mops@v1
|
|
17
|
+
with:
|
|
18
|
+
mops-version: 1
|
|
17
19
|
|
|
18
|
-
- name:
|
|
19
|
-
run: mops
|
|
20
|
+
- name: install mops packages
|
|
21
|
+
run: mops install
|
|
20
22
|
|
|
21
23
|
- name: run tests
|
|
22
24
|
run: mops test
|
package/test
DELETED