Skip to content

Commit

Permalink
[cli] install nested local deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenVoich committed Jan 20, 2024
1 parent febdab4 commit 9a7848b
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 32 deletions.
8 changes: 5 additions & 3 deletions cli/commands/install-local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import {installFromGithub} from '../vessel.js';
import {install} from './install.js';

// skip install and just find non-local dependencies to install
// pkgPath should be relative to the current root dir
// pkgPath should be relative to the current root dir or absolute
export async function installLocal(pkg: string, pkgPath = '', {verbose = false, silent = false} = {}): Promise<Record<string, string> | false> {
if (!checkConfigFile()) {
return false;
}
console.log(pkg, pkgPath)

Check failure on line 13 in cli/commands/install-local.ts

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

let logUpdate = createLogUpdate(process.stdout, {showCursor: true});

Expand All @@ -24,7 +25,8 @@ export async function installLocal(pkg: string, pkgPath = '', {verbose = false,

// install dependencies
let ok = true;
let dir = path.resolve(getRootDir(), pkgPath);
let rootDir = getRootDir();
let dir = path.resolve(rootDir, pkgPath);
let config = readConfig(path.join(dir, 'mops.toml'));
let deps = Object.values(config.dependencies || {});
let installedDeps = {};
Expand All @@ -33,7 +35,7 @@ export async function installLocal(pkg: string, pkgPath = '', {verbose = false,
await installFromGithub(name, repo, {silent, verbose});
}
else {
let res = await (depPath ? installLocal(name, depPath, {silent, verbose}) : install(name, version, {silent, verbose}));
let res = await (depPath ? installLocal(name, path.resolve(pkgPath, depPath), {silent, verbose}) : install(name, version, {silent, verbose}));
if (res) {
installedDeps = {...installedDeps, ...res};
}
Expand Down
14 changes: 7 additions & 7 deletions cli/declarations/main/main.did
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ type User =
twitter: text;
twitterVerified: bool;
};
type TransformArg =
record {
context: vec nat8;
response: HttpResponse;
};
type Time = int;
type Text = text;
type TestsChanges =
Expand Down Expand Up @@ -344,14 +339,19 @@ type Main =
startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
startPublish: (PackageConfigV2) -> (Result_2);
transferOwnership: (PackageName, principal) -> (Result_1);
transformRequest: (TransformArg) -> (HttpResponse) query;
transformRequest: (HttpTransformArg) -> (HttpResponse) query;
uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
uploadNotes: (PublishingId, text) -> (Result);
uploadTestStats: (PublishingId, TestStats) -> (Result);
};
type HttpTransformArg =
record {
context: blob;
response: HttpResponse;
};
type HttpResponse =
record {
body: vec nat8;
body: blob;
headers: vec HttpHeader;
status: nat;
};
Expand Down
10 changes: 5 additions & 5 deletions cli/declarations/main/main.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export interface HttpResponse {
'body' : Uint8Array | number[],
'headers' : Array<HttpHeader>,
}
export interface HttpTransformArg {
'context' : Uint8Array | number[],
'response' : HttpResponse,
}
export interface Main {
'backup' : ActorMethod<[], undefined>,
'computeHashesForExistingFiles' : ActorMethod<[], undefined>,
Expand Down Expand Up @@ -96,7 +100,7 @@ export interface Main {
>,
'startPublish' : ActorMethod<[PackageConfigV2], Result_2>,
'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
'transformRequest' : ActorMethod<[TransformArg], HttpResponse>,
'transformRequest' : ActorMethod<[HttpTransformArg], HttpResponse>,
'uploadFileChunk' : ActorMethod<
[PublishingId, FileId, bigint, Uint8Array | number[]],
Result
Expand Down Expand Up @@ -296,10 +300,6 @@ export interface TestsChanges {
}
export type Text = string;
export type Time = bigint;
export interface TransformArg {
'context' : Uint8Array | number[],
'response' : HttpResponse,
}
export interface User {
'id' : Principal,
'emailVerified' : boolean,
Expand Down
8 changes: 6 additions & 2 deletions cli/declarations/main/main.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export const idlFactory = ({ IDL }) => {
'body' : IDL.Vec(IDL.Nat8),
'headers' : IDL.Vec(HttpHeader),
});
const TransformArg = IDL.Record({
const HttpTransformArg = IDL.Record({
'context' : IDL.Vec(IDL.Nat8),
'response' : HttpResponse,
});
Expand Down Expand Up @@ -360,7 +360,11 @@ export const idlFactory = ({ IDL }) => {
[Result_1],
[],
),
'transformRequest' : IDL.Func([TransformArg], [HttpResponse], ['query']),
'transformRequest' : IDL.Func(
[HttpTransformArg],
[HttpResponse],
['query'],
),
'uploadFileChunk' : IDL.Func(
[PublishingId, FileId, IDL.Nat, IDL.Vec(IDL.Nat8)],
[Result],
Expand Down
14 changes: 7 additions & 7 deletions frontend/declarations/main/main.did
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ type User =
twitter: text;
twitterVerified: bool;
};
type TransformArg =
record {
context: vec nat8;
response: HttpResponse;
};
type Time = int;
type Text = text;
type TestsChanges =
Expand Down Expand Up @@ -344,14 +339,19 @@ type Main =
startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
startPublish: (PackageConfigV2) -> (Result_2);
transferOwnership: (PackageName, principal) -> (Result_1);
transformRequest: (TransformArg) -> (HttpResponse) query;
transformRequest: (HttpTransformArg) -> (HttpResponse) query;
uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
uploadNotes: (PublishingId, text) -> (Result);
uploadTestStats: (PublishingId, TestStats) -> (Result);
};
type HttpTransformArg =
record {
context: blob;
response: HttpResponse;
};
type HttpResponse =
record {
body: vec nat8;
body: blob;
headers: vec HttpHeader;
status: nat;
};
Expand Down
10 changes: 5 additions & 5 deletions frontend/declarations/main/main.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export interface HttpResponse {
'body' : Uint8Array | number[],
'headers' : Array<HttpHeader>,
}
export interface HttpTransformArg {
'context' : Uint8Array | number[],
'response' : HttpResponse,
}
export interface Main {
'backup' : ActorMethod<[], undefined>,
'computeHashesForExistingFiles' : ActorMethod<[], undefined>,
Expand Down Expand Up @@ -96,7 +100,7 @@ export interface Main {
>,
'startPublish' : ActorMethod<[PackageConfigV2], Result_2>,
'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
'transformRequest' : ActorMethod<[TransformArg], HttpResponse>,
'transformRequest' : ActorMethod<[HttpTransformArg], HttpResponse>,
'uploadFileChunk' : ActorMethod<
[PublishingId, FileId, bigint, Uint8Array | number[]],
Result
Expand Down Expand Up @@ -296,10 +300,6 @@ export interface TestsChanges {
}
export type Text = string;
export type Time = bigint;
export interface TransformArg {
'context' : Uint8Array | number[],
'response' : HttpResponse,
}
export interface User {
'id' : Principal,
'emailVerified' : boolean,
Expand Down
8 changes: 6 additions & 2 deletions frontend/declarations/main/main.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export const idlFactory = ({ IDL }) => {
'body' : IDL.Vec(IDL.Nat8),
'headers' : IDL.Vec(HttpHeader),
});
const TransformArg = IDL.Record({
const HttpTransformArg = IDL.Record({
'context' : IDL.Vec(IDL.Nat8),
'response' : HttpResponse,
});
Expand Down Expand Up @@ -360,7 +360,11 @@ export const idlFactory = ({ IDL }) => {
[Result_1],
[],
),
'transformRequest' : IDL.Func([TransformArg], [HttpResponse], ['query']),
'transformRequest' : IDL.Func(
[HttpTransformArg],
[HttpResponse],
['query'],
),
'uploadFileChunk' : IDL.Func(
[PublishingId, FileId, IDL.Nat, IDL.Vec(IDL.Nat8)],
[Result],
Expand Down
1 change: 0 additions & 1 deletion test/.flat/aaa/mops.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
name = "aaa"
version = "0.1.0"
description = "asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd "
repository = "repo aaa"
keywords = [ "test", "cli", "data" ]
files = [ "test.mo" ]

0 comments on commit 9a7848b

Please sign in to comment.