ic-mops 0.1.9 → 0.1.12
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 +2 -2
- package/cli.js +7 -1
- package/commands/install.js +23 -4
- package/commands/publish.js +5 -1
- package/commands/sources.js +8 -2
- package/declarations/main/main.did +24 -5
- package/declarations/main/main.did.d.ts +15 -5
- package/declarations/main/main.did.js +13 -10
- package/package.json +1 -1
package/README.md
CHANGED
package/cli.js
CHANGED
|
@@ -64,7 +64,13 @@ program
|
|
|
64
64
|
installAll(options);
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
|
-
let
|
|
67
|
+
let versionRes = await getHighestVersion(pkg);
|
|
68
|
+
if (versionRes.err) {
|
|
69
|
+
console.log(chalk.red('Error: ') + versionRes.err);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
let version = versionRes.ok;
|
|
73
|
+
|
|
68
74
|
await install(pkg, version, {verbose: options.verbose});
|
|
69
75
|
|
|
70
76
|
config.dependencies[pkg] = version;
|
package/commands/install.js
CHANGED
|
@@ -11,7 +11,12 @@ export async function install(pkg, version = '', {verbose, silent, dep} = {}) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
if (!version) {
|
|
14
|
-
|
|
14
|
+
let versionRes = await getHighestVersion(pkg);
|
|
15
|
+
if (versionRes.err) {
|
|
16
|
+
console.log(chalk.red('Error: ') + versionRes.err);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
version = versionRes.ok;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
let dir = path.join(process.cwd(), '.mops', `${pkg}@${version}`);
|
|
@@ -28,8 +33,21 @@ export async function install(pkg, version = '', {verbose, silent, dep} = {}) {
|
|
|
28
33
|
if (!dep) {
|
|
29
34
|
actor.notifyInstall(pkg, version);
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
let
|
|
36
|
+
|
|
37
|
+
let packageDetailsRes = await actor.getPackageDetails(pkg, version);
|
|
38
|
+
if (packageDetailsRes.err) {
|
|
39
|
+
console.log(chalk.red('Error: ') + packageDetailsRes.err);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let packageDetails = packageDetailsRes.ok;
|
|
43
|
+
|
|
44
|
+
let filesIdsRes = await actor.getFileIds(pkg, version);
|
|
45
|
+
if (filesIdsRes.err) {
|
|
46
|
+
console.log(chalk.red('Error: ') + filesIdsRes.err);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
let filesIds = filesIdsRes.ok;
|
|
50
|
+
|
|
33
51
|
let storage = await storageActor(packageDetails.publication.storage);
|
|
34
52
|
|
|
35
53
|
// progress
|
|
@@ -57,7 +75,8 @@ export async function install(pkg, version = '', {verbose, silent, dep} = {}) {
|
|
|
57
75
|
console.log(chalk.red('ERR: ') + chunkRes.err);
|
|
58
76
|
return;
|
|
59
77
|
}
|
|
60
|
-
|
|
78
|
+
let chunk = chunkRes.ok;
|
|
79
|
+
buffer = Buffer.concat([buffer, Buffer.from(chunk)]);
|
|
61
80
|
}
|
|
62
81
|
|
|
63
82
|
fs.mkdirSync(path.join(dir, path.dirname(fileMeta.path)), {recursive: true});
|
package/commands/publish.js
CHANGED
|
@@ -57,6 +57,7 @@ export async function publish() {
|
|
|
57
57
|
'repository',
|
|
58
58
|
'documentation',
|
|
59
59
|
'homepage',
|
|
60
|
+
'baseDir',
|
|
60
61
|
'readme',
|
|
61
62
|
'license',
|
|
62
63
|
'files',
|
|
@@ -86,6 +87,7 @@ export async function publish() {
|
|
|
86
87
|
dfx: 10,
|
|
87
88
|
moc: 10,
|
|
88
89
|
donation: 64,
|
|
90
|
+
root: 50,
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
for (let [key, max] of Object.entries(keysMax)) {
|
|
@@ -127,6 +129,7 @@ export async function publish() {
|
|
|
127
129
|
repository: config.package.repository || '',
|
|
128
130
|
homepage: config.package.homepage || '',
|
|
129
131
|
documentation: config.package.documentation || '',
|
|
132
|
+
baseDir: 'src',
|
|
130
133
|
readme: 'README.md',
|
|
131
134
|
license: config.package.license || '',
|
|
132
135
|
owner: getIdentity()?.getPrincipal() || Principal.anonymous(),
|
|
@@ -136,6 +139,7 @@ export async function publish() {
|
|
|
136
139
|
dependencies: (Object.entries(config.dependencies || {})).map(([name, version]) => {
|
|
137
140
|
return {name, version};
|
|
138
141
|
}),
|
|
142
|
+
devDependencies: [],
|
|
139
143
|
scripts: [],
|
|
140
144
|
};
|
|
141
145
|
|
|
@@ -161,7 +165,7 @@ export async function publish() {
|
|
|
161
165
|
|
|
162
166
|
// check allowed exts
|
|
163
167
|
for (let file of files) {
|
|
164
|
-
if (!minimatch(file, '**/*.{mo,did,md,toml}')) {
|
|
168
|
+
if (!minimatch(file, '**/*.{mo,did,md,toml}') && !file.toLowerCase().endsWith('license')) {
|
|
165
169
|
console.log(chalk.red('Error: ') + `file ${file} has unsupported extension. Allowed: .mo, .did, .md, .toml`);
|
|
166
170
|
return;
|
|
167
171
|
}
|
package/commands/sources.js
CHANGED
|
@@ -73,7 +73,13 @@ export async function sources({verbose} = {}) {
|
|
|
73
73
|
packages['base-unofficial'] = downloadedPackages['base-unofficial'];
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
|
-
let
|
|
76
|
+
let versionRes = await getHighestVersion('base-unofficial');
|
|
77
|
+
if (versionRes.err) {
|
|
78
|
+
console.log(chalk.red('Error: ') + versionRes.err);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
let version = versionRes.ok;
|
|
82
|
+
|
|
77
83
|
await install('base-unofficial', version, {silent: true, dep: true});
|
|
78
84
|
packages['base-unofficial'] = version;
|
|
79
85
|
}
|
|
@@ -90,7 +96,7 @@ export async function sources({verbose} = {}) {
|
|
|
90
96
|
|
|
91
97
|
// sources
|
|
92
98
|
for (let [name, ver] of Object.entries(packages)) {
|
|
93
|
-
let pkgDir = path.relative(process.cwd(), path.join(root, `.mops/${name}@${ver}`));
|
|
99
|
+
let pkgDir = path.relative(process.cwd(), path.join(root, `.mops/${name}@${ver}/src`));
|
|
94
100
|
console.log(`--package ${name} ${pkgDir}`);
|
|
95
101
|
|
|
96
102
|
// fallback base to base-unofficial
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type Ver = text;
|
|
2
2
|
type Time = int;
|
|
3
3
|
type Text = text;
|
|
4
4
|
type StorageStats =
|
|
@@ -13,6 +13,21 @@ type Script =
|
|
|
13
13
|
name: text;
|
|
14
14
|
value: text;
|
|
15
15
|
};
|
|
16
|
+
type Result_5 =
|
|
17
|
+
variant {
|
|
18
|
+
err: Err;
|
|
19
|
+
ok: vec FileId;
|
|
20
|
+
};
|
|
21
|
+
type Result_4 =
|
|
22
|
+
variant {
|
|
23
|
+
err: Err;
|
|
24
|
+
ok: Ver;
|
|
25
|
+
};
|
|
26
|
+
type Result_3 =
|
|
27
|
+
variant {
|
|
28
|
+
err: Err;
|
|
29
|
+
ok: PackageDetails;
|
|
30
|
+
};
|
|
16
31
|
type Result_2 =
|
|
17
32
|
variant {
|
|
18
33
|
err: Err;
|
|
@@ -48,8 +63,10 @@ type PackageDetails =
|
|
|
48
63
|
};
|
|
49
64
|
type PackageConfig__1 =
|
|
50
65
|
record {
|
|
66
|
+
baseDir: text;
|
|
51
67
|
dependencies: vec Dependency;
|
|
52
68
|
description: text;
|
|
69
|
+
devDependencies: vec Dependency;
|
|
53
70
|
dfx: text;
|
|
54
71
|
documentation: text;
|
|
55
72
|
donation: text;
|
|
@@ -65,8 +82,10 @@ type PackageConfig__1 =
|
|
|
65
82
|
};
|
|
66
83
|
type PackageConfig =
|
|
67
84
|
record {
|
|
85
|
+
baseDir: text;
|
|
68
86
|
dependencies: vec Dependency;
|
|
69
87
|
description: text;
|
|
88
|
+
devDependencies: vec Dependency;
|
|
70
89
|
dfx: text;
|
|
71
90
|
documentation: text;
|
|
72
91
|
donation: text;
|
|
@@ -90,15 +109,15 @@ type Dependency =
|
|
|
90
109
|
service : {
|
|
91
110
|
finishPublish: (PublishingId) -> (Result);
|
|
92
111
|
getApiVersion: () -> (Text) query;
|
|
93
|
-
getFileIds: (PackageName__1,
|
|
94
|
-
getHighestVersion: (PackageName__1) -> (
|
|
95
|
-
getPackageDetails: (PackageName__1,
|
|
112
|
+
getFileIds: (PackageName__1, Ver) -> (Result_5) query;
|
|
113
|
+
getHighestVersion: (PackageName__1) -> (Result_4) query;
|
|
114
|
+
getPackageDetails: (PackageName__1, Ver) -> (Result_3) query;
|
|
96
115
|
getRecentlyUpdatedPackages: () -> (vec PackageDetails) query;
|
|
97
116
|
getStoragesStats: () -> (vec record {
|
|
98
117
|
StorageId;
|
|
99
118
|
StorageStats;
|
|
100
119
|
}) query;
|
|
101
|
-
notifyInstall: (PackageName__1,
|
|
120
|
+
notifyInstall: (PackageName__1, Ver) -> () oneway;
|
|
102
121
|
search: (Text) -> (vec PackageDetails) query;
|
|
103
122
|
startFileUpload: (PublishingId, Text, nat, blob) -> (Result_2);
|
|
104
123
|
startPublish: (PackageConfig) -> (Result_1);
|
|
@@ -8,6 +8,7 @@ export interface PackageConfig {
|
|
|
8
8
|
'dfx' : string,
|
|
9
9
|
'moc' : string,
|
|
10
10
|
'scripts' : Array<Script>,
|
|
11
|
+
'baseDir' : string,
|
|
11
12
|
'documentation' : string,
|
|
12
13
|
'name' : PackageName,
|
|
13
14
|
'homepage' : string,
|
|
@@ -15,6 +16,7 @@ export interface PackageConfig {
|
|
|
15
16
|
'version' : string,
|
|
16
17
|
'keywords' : Array<string>,
|
|
17
18
|
'donation' : string,
|
|
19
|
+
'devDependencies' : Array<Dependency>,
|
|
18
20
|
'repository' : string,
|
|
19
21
|
'dependencies' : Array<Dependency>,
|
|
20
22
|
'license' : string,
|
|
@@ -24,6 +26,7 @@ export interface PackageConfig__1 {
|
|
|
24
26
|
'dfx' : string,
|
|
25
27
|
'moc' : string,
|
|
26
28
|
'scripts' : Array<Script>,
|
|
29
|
+
'baseDir' : string,
|
|
27
30
|
'documentation' : string,
|
|
28
31
|
'name' : PackageName,
|
|
29
32
|
'homepage' : string,
|
|
@@ -31,6 +34,7 @@ export interface PackageConfig__1 {
|
|
|
31
34
|
'version' : string,
|
|
32
35
|
'keywords' : Array<string>,
|
|
33
36
|
'donation' : string,
|
|
37
|
+
'devDependencies' : Array<Dependency>,
|
|
34
38
|
'repository' : string,
|
|
35
39
|
'dependencies' : Array<Dependency>,
|
|
36
40
|
'license' : string,
|
|
@@ -58,6 +62,12 @@ export type Result_1 = { 'ok' : PublishingId } |
|
|
|
58
62
|
{ 'err' : PublishingErr };
|
|
59
63
|
export type Result_2 = { 'ok' : FileId } |
|
|
60
64
|
{ 'err' : Err };
|
|
65
|
+
export type Result_3 = { 'ok' : PackageDetails } |
|
|
66
|
+
{ 'err' : Err };
|
|
67
|
+
export type Result_4 = { 'ok' : Ver } |
|
|
68
|
+
{ 'err' : Err };
|
|
69
|
+
export type Result_5 = { 'ok' : Array<FileId> } |
|
|
70
|
+
{ 'err' : Err };
|
|
61
71
|
export interface Script { 'value' : string, 'name' : string }
|
|
62
72
|
export type StorageId = Principal;
|
|
63
73
|
export interface StorageStats {
|
|
@@ -67,16 +77,16 @@ export interface StorageStats {
|
|
|
67
77
|
}
|
|
68
78
|
export type Text = string;
|
|
69
79
|
export type Time = bigint;
|
|
70
|
-
export type
|
|
80
|
+
export type Ver = string;
|
|
71
81
|
export interface _SERVICE {
|
|
72
82
|
'finishPublish' : ActorMethod<[PublishingId], Result>,
|
|
73
83
|
'getApiVersion' : ActorMethod<[], Text>,
|
|
74
|
-
'getFileIds' : ActorMethod<[PackageName__1,
|
|
75
|
-
'getHighestVersion' : ActorMethod<[PackageName__1],
|
|
76
|
-
'getPackageDetails' : ActorMethod<[PackageName__1,
|
|
84
|
+
'getFileIds' : ActorMethod<[PackageName__1, Ver], Result_5>,
|
|
85
|
+
'getHighestVersion' : ActorMethod<[PackageName__1], Result_4>,
|
|
86
|
+
'getPackageDetails' : ActorMethod<[PackageName__1, Ver], Result_3>,
|
|
77
87
|
'getRecentlyUpdatedPackages' : ActorMethod<[], Array<PackageDetails>>,
|
|
78
88
|
'getStoragesStats' : ActorMethod<[], Array<[StorageId, StorageStats]>>,
|
|
79
|
-
'notifyInstall' : ActorMethod<[PackageName__1,
|
|
89
|
+
'notifyInstall' : ActorMethod<[PackageName__1, Ver], undefined>,
|
|
80
90
|
'search' : ActorMethod<[Text], Array<PackageDetails>>,
|
|
81
91
|
'startFileUpload' : ActorMethod<
|
|
82
92
|
[PublishingId, Text, bigint, Array<number>],
|
|
@@ -4,8 +4,10 @@ export const idlFactory = ({ IDL }) => {
|
|
|
4
4
|
const Result = IDL.Variant({ 'ok' : IDL.Null, 'err' : Err });
|
|
5
5
|
const Text = IDL.Text;
|
|
6
6
|
const PackageName__1 = IDL.Text;
|
|
7
|
-
const
|
|
7
|
+
const Ver = IDL.Text;
|
|
8
8
|
const FileId = IDL.Text;
|
|
9
|
+
const Result_5 = IDL.Variant({ 'ok' : IDL.Vec(FileId), 'err' : Err });
|
|
10
|
+
const Result_4 = IDL.Variant({ 'ok' : Ver, 'err' : Err });
|
|
9
11
|
const Script = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
|
|
10
12
|
const PackageName = IDL.Text;
|
|
11
13
|
const Dependency = IDL.Record({ 'name' : PackageName, 'version' : IDL.Text });
|
|
@@ -13,6 +15,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
13
15
|
'dfx' : IDL.Text,
|
|
14
16
|
'moc' : IDL.Text,
|
|
15
17
|
'scripts' : IDL.Vec(Script),
|
|
18
|
+
'baseDir' : IDL.Text,
|
|
16
19
|
'documentation' : IDL.Text,
|
|
17
20
|
'name' : PackageName,
|
|
18
21
|
'homepage' : IDL.Text,
|
|
@@ -20,6 +23,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
20
23
|
'version' : IDL.Text,
|
|
21
24
|
'keywords' : IDL.Vec(IDL.Text),
|
|
22
25
|
'donation' : IDL.Text,
|
|
26
|
+
'devDependencies' : IDL.Vec(Dependency),
|
|
23
27
|
'repository' : IDL.Text,
|
|
24
28
|
'dependencies' : IDL.Vec(Dependency),
|
|
25
29
|
'license' : IDL.Text,
|
|
@@ -38,6 +42,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
38
42
|
'config' : PackageConfig__1,
|
|
39
43
|
'publication' : PackagePublication,
|
|
40
44
|
});
|
|
45
|
+
const Result_3 = IDL.Variant({ 'ok' : PackageDetails, 'err' : Err });
|
|
41
46
|
const StorageId = IDL.Principal;
|
|
42
47
|
const StorageStats = IDL.Record({
|
|
43
48
|
'fileCount' : IDL.Nat,
|
|
@@ -49,6 +54,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
49
54
|
'dfx' : IDL.Text,
|
|
50
55
|
'moc' : IDL.Text,
|
|
51
56
|
'scripts' : IDL.Vec(Script),
|
|
57
|
+
'baseDir' : IDL.Text,
|
|
52
58
|
'documentation' : IDL.Text,
|
|
53
59
|
'name' : PackageName,
|
|
54
60
|
'homepage' : IDL.Text,
|
|
@@ -56,6 +62,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
56
62
|
'version' : IDL.Text,
|
|
57
63
|
'keywords' : IDL.Vec(IDL.Text),
|
|
58
64
|
'donation' : IDL.Text,
|
|
65
|
+
'devDependencies' : IDL.Vec(Dependency),
|
|
59
66
|
'repository' : IDL.Text,
|
|
60
67
|
'dependencies' : IDL.Vec(Dependency),
|
|
61
68
|
'license' : IDL.Text,
|
|
@@ -66,15 +73,11 @@ export const idlFactory = ({ IDL }) => {
|
|
|
66
73
|
return IDL.Service({
|
|
67
74
|
'finishPublish' : IDL.Func([PublishingId], [Result], []),
|
|
68
75
|
'getApiVersion' : IDL.Func([], [Text], ['query']),
|
|
69
|
-
'getFileIds' : IDL.Func(
|
|
70
|
-
|
|
71
|
-
[IDL.Vec(FileId)],
|
|
72
|
-
['query'],
|
|
73
|
-
),
|
|
74
|
-
'getHighestVersion' : IDL.Func([PackageName__1], [Version], ['query']),
|
|
76
|
+
'getFileIds' : IDL.Func([PackageName__1, Ver], [Result_5], ['query']),
|
|
77
|
+
'getHighestVersion' : IDL.Func([PackageName__1], [Result_4], ['query']),
|
|
75
78
|
'getPackageDetails' : IDL.Func(
|
|
76
|
-
[PackageName__1,
|
|
77
|
-
[
|
|
79
|
+
[PackageName__1, Ver],
|
|
80
|
+
[Result_3],
|
|
78
81
|
['query'],
|
|
79
82
|
),
|
|
80
83
|
'getRecentlyUpdatedPackages' : IDL.Func(
|
|
@@ -87,7 +90,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
87
90
|
[IDL.Vec(IDL.Tuple(StorageId, StorageStats))],
|
|
88
91
|
['query'],
|
|
89
92
|
),
|
|
90
|
-
'notifyInstall' : IDL.Func([PackageName__1,
|
|
93
|
+
'notifyInstall' : IDL.Func([PackageName__1, Ver], [], ['oneway']),
|
|
91
94
|
'search' : IDL.Func([Text], [IDL.Vec(PackageDetails)], ['query']),
|
|
92
95
|
'startFileUpload' : IDL.Func(
|
|
93
96
|
[PublishingId, Text, IDL.Nat, IDL.Vec(IDL.Nat8)],
|