ic-mops 0.38.2 → 0.39.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.
@@ -6,6 +6,7 @@ import {install} from './install.js';
6
6
  import {installFromGithub} from '../vessel.js';
7
7
  import {notifyInstalls} from '../notify-installs.js';
8
8
  import {checkIntegrity} from '../integrity.js';
9
+ import {installLocal} from './install-local.js';
9
10
 
10
11
  type InstallAllOptions = {
11
12
  verbose?: boolean;
@@ -28,8 +29,8 @@ export async function installAll({verbose = false, silent = false, lock}: Instal
28
29
  if (repo) {
29
30
  await installFromGithub(name, repo, {verbose, silent});
30
31
  }
31
- else if (!path) {
32
- let res = await install(name, version, {verbose, silent});
32
+ else {
33
+ let res = await (path ? installLocal(name, path, {silent, verbose}) : install(name, version, {silent, verbose}));
33
34
  if (res === false) {
34
35
  return;
35
36
  }
@@ -38,7 +39,6 @@ export async function installAll({verbose = false, silent = false, lock}: Instal
38
39
  }
39
40
 
40
41
  let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
41
- // let logUpdate = l;
42
42
 
43
43
  if (!silent && lock !== 'ignore') {
44
44
  logUpdate('Checking integrity...');
@@ -0,0 +1,51 @@
1
+ import path from 'node:path';
2
+ import {createLogUpdate} from 'log-update';
3
+ import {checkConfigFile, getRootDir, readConfig} from '../mops.js';
4
+ import {installFromGithub} from '../vessel.js';
5
+ import {install} from './install.js';
6
+
7
+ // skip install and just find non-local dependencies to install
8
+ // pkgPath should be relative to the current root dir or absolute
9
+ export async function installLocal(pkg: string, pkgPath = '', {verbose = false, silent = false} = {}): Promise<Record<string, string> | false> {
10
+ if (!checkConfigFile()) {
11
+ return false;
12
+ }
13
+
14
+ let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
15
+
16
+ logUpdate(`Local dependency ${pkg} = "${pkgPath}"`);
17
+
18
+ if (verbose) {
19
+ silent || logUpdate.done();
20
+ }
21
+ else {
22
+ logUpdate.clear();
23
+ }
24
+
25
+ // install dependencies
26
+ let ok = true;
27
+ let rootDir = getRootDir();
28
+ let dir = path.resolve(rootDir, pkgPath);
29
+ let config = readConfig(path.join(dir, 'mops.toml'));
30
+ let deps = Object.values(config.dependencies || {});
31
+ let installedDeps = {};
32
+ for (const {name, repo, version, path: depPath} of deps) {
33
+ if (repo) {
34
+ await installFromGithub(name, repo, {silent, verbose});
35
+ }
36
+ else {
37
+ let res = await (depPath ? installLocal(name, path.resolve(pkgPath, depPath), {silent, verbose}) : install(name, version, {silent, verbose}));
38
+ if (res) {
39
+ installedDeps = {...installedDeps, ...res};
40
+ }
41
+ else {
42
+ ok = false;
43
+ }
44
+ }
45
+ }
46
+
47
+ if (!ok) {
48
+ return false;
49
+ }
50
+ return installedDeps;
51
+ }
@@ -9,6 +9,7 @@ import {parallel} from '../parallel.js';
9
9
  import {installFromGithub} from '../vessel.js';
10
10
  import {addCache, copyCache, isCached} from '../cache.js';
11
11
  import {downloadFile, getPackageFilesInfo} from '../api/downloadPackageFiles.js';
12
+ import {installLocal} from './install-local.js';
12
13
 
13
14
  export async function install(pkg: string, version = '', {verbose = false, silent = false, dep = false} = {}): Promise<Record<string, string> | false> {
14
15
  if (!checkConfigFile()) {
@@ -99,12 +100,12 @@ export async function install(pkg: string, version = '', {verbose = false, silen
99
100
  let config = readConfig(path.join(dir, 'mops.toml'));
100
101
  let deps = Object.values(config.dependencies || {});
101
102
  let installedDeps = {};
102
- for (const {name, repo, version} of deps) {
103
+ for (const {name, repo, version, path: depPath} of deps) {
103
104
  if (repo) {
104
105
  await installFromGithub(name, repo, {silent, verbose});
105
106
  }
106
107
  else {
107
- let res = await install(name, version, {silent, verbose});
108
+ let res = await (depPath ? installLocal(name, depPath, {silent, verbose}) : install(name, version, {silent, verbose}));
108
109
  if (res) {
109
110
  installedDeps = {...installedDeps, ...res};
110
111
  }
@@ -40,7 +40,7 @@ export async function sources({verbose = false, cwd = process.cwd()} = {}) {
40
40
  }
41
41
 
42
42
  // use pkgDir if baseDir doesn't exist for local packages
43
- if (depType === 'local' && !fs.existsSync(pkgBaseDir)) {
43
+ if (depType === 'local' && !fs.existsSync(path.resolve(cwd, pkgBaseDir))) {
44
44
  pkgBaseDir = pkgDir;
45
45
  }
46
46
 
@@ -24,11 +24,6 @@ type User =
24
24
  twitter: text;
25
25
  twitterVerified: bool;
26
26
  };
27
- type TransformArg =
28
- record {
29
- context: vec nat8;
30
- response: HttpResponse;
31
- };
32
27
  type Time = int;
33
28
  type Text = text;
34
29
  type TestsChanges =
@@ -344,14 +339,19 @@ type Main =
344
339
  startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
345
340
  startPublish: (PackageConfigV2) -> (Result_2);
346
341
  transferOwnership: (PackageName, principal) -> (Result_1);
347
- transformRequest: (TransformArg) -> (HttpResponse) query;
342
+ transformRequest: (HttpTransformArg) -> (HttpResponse) query;
348
343
  uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
349
344
  uploadNotes: (PublishingId, text) -> (Result);
350
345
  uploadTestStats: (PublishingId, TestStats) -> (Result);
351
346
  };
347
+ type HttpTransformArg =
348
+ record {
349
+ context: blob;
350
+ response: HttpResponse;
351
+ };
352
352
  type HttpResponse =
353
353
  record {
354
- body: vec nat8;
354
+ body: blob;
355
355
  headers: vec HttpHeader;
356
356
  status: nat;
357
357
  };
@@ -33,6 +33,10 @@ export interface HttpResponse {
33
33
  'body' : Uint8Array | number[],
34
34
  'headers' : Array<HttpHeader>,
35
35
  }
36
+ export interface HttpTransformArg {
37
+ 'context' : Uint8Array | number[],
38
+ 'response' : HttpResponse,
39
+ }
36
40
  export interface Main {
37
41
  'backup' : ActorMethod<[], undefined>,
38
42
  'computeHashesForExistingFiles' : ActorMethod<[], undefined>,
@@ -96,7 +100,7 @@ export interface Main {
96
100
  >,
97
101
  'startPublish' : ActorMethod<[PackageConfigV2], Result_2>,
98
102
  'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
99
- 'transformRequest' : ActorMethod<[TransformArg], HttpResponse>,
103
+ 'transformRequest' : ActorMethod<[HttpTransformArg], HttpResponse>,
100
104
  'uploadFileChunk' : ActorMethod<
101
105
  [PublishingId, FileId, bigint, Uint8Array | number[]],
102
106
  Result
@@ -296,10 +300,6 @@ export interface TestsChanges {
296
300
  }
297
301
  export type Text = string;
298
302
  export type Time = bigint;
299
- export interface TransformArg {
300
- 'context' : Uint8Array | number[],
301
- 'response' : HttpResponse,
302
- }
303
303
  export interface User {
304
304
  'id' : Principal,
305
305
  'emailVerified' : boolean,
@@ -251,7 +251,7 @@ export const idlFactory = ({ IDL }) => {
251
251
  'body' : IDL.Vec(IDL.Nat8),
252
252
  'headers' : IDL.Vec(HttpHeader),
253
253
  });
254
- const TransformArg = IDL.Record({
254
+ const HttpTransformArg = IDL.Record({
255
255
  'context' : IDL.Vec(IDL.Nat8),
256
256
  'response' : HttpResponse,
257
257
  });
@@ -360,7 +360,11 @@ export const idlFactory = ({ IDL }) => {
360
360
  [Result_1],
361
361
  [],
362
362
  ),
363
- 'transformRequest' : IDL.Func([TransformArg], [HttpResponse], ['query']),
363
+ 'transformRequest' : IDL.Func(
364
+ [HttpTransformArg],
365
+ [HttpResponse],
366
+ ['query'],
367
+ ),
364
368
  'uploadFileChunk' : IDL.Func(
365
369
  [PublishingId, FileId, IDL.Nat, IDL.Vec(IDL.Nat8)],
366
370
  [Result],
@@ -6,6 +6,7 @@ import { install } from './install.js';
6
6
  import { installFromGithub } from '../vessel.js';
7
7
  import { notifyInstalls } from '../notify-installs.js';
8
8
  import { checkIntegrity } from '../integrity.js';
9
+ import { installLocal } from './install-local.js';
9
10
  export async function installAll({ verbose = false, silent = false, lock } = {}) {
10
11
  if (!checkConfigFile()) {
11
12
  return;
@@ -19,8 +20,8 @@ export async function installAll({ verbose = false, silent = false, lock } = {})
19
20
  if (repo) {
20
21
  await installFromGithub(name, repo, { verbose, silent });
21
22
  }
22
- else if (!path) {
23
- let res = await install(name, version, { verbose, silent });
23
+ else {
24
+ let res = await (path ? installLocal(name, path, { silent, verbose }) : install(name, version, { silent, verbose }));
24
25
  if (res === false) {
25
26
  return;
26
27
  }
@@ -28,7 +29,6 @@ export async function installAll({ verbose = false, silent = false, lock } = {})
28
29
  }
29
30
  }
30
31
  let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
31
- // let logUpdate = l;
32
32
  if (!silent && lock !== 'ignore') {
33
33
  logUpdate('Checking integrity...');
34
34
  }
@@ -0,0 +1,4 @@
1
+ export declare function installLocal(pkg: string, pkgPath?: string, { verbose, silent }?: {
2
+ verbose?: boolean | undefined;
3
+ silent?: boolean | undefined;
4
+ }): Promise<Record<string, string> | false>;
@@ -0,0 +1,45 @@
1
+ import path from 'node:path';
2
+ import { createLogUpdate } from 'log-update';
3
+ import { checkConfigFile, getRootDir, readConfig } from '../mops.js';
4
+ import { installFromGithub } from '../vessel.js';
5
+ import { install } from './install.js';
6
+ // skip install and just find non-local dependencies to install
7
+ // pkgPath should be relative to the current root dir or absolute
8
+ export async function installLocal(pkg, pkgPath = '', { verbose = false, silent = false } = {}) {
9
+ if (!checkConfigFile()) {
10
+ return false;
11
+ }
12
+ let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
13
+ logUpdate(`Local dependency ${pkg} = "${pkgPath}"`);
14
+ if (verbose) {
15
+ silent || logUpdate.done();
16
+ }
17
+ else {
18
+ logUpdate.clear();
19
+ }
20
+ // install dependencies
21
+ let ok = true;
22
+ let rootDir = getRootDir();
23
+ let dir = path.resolve(rootDir, pkgPath);
24
+ let config = readConfig(path.join(dir, 'mops.toml'));
25
+ let deps = Object.values(config.dependencies || {});
26
+ let installedDeps = {};
27
+ for (const { name, repo, version, path: depPath } of deps) {
28
+ if (repo) {
29
+ await installFromGithub(name, repo, { silent, verbose });
30
+ }
31
+ else {
32
+ let res = await (depPath ? installLocal(name, path.resolve(pkgPath, depPath), { silent, verbose }) : install(name, version, { silent, verbose }));
33
+ if (res) {
34
+ installedDeps = { ...installedDeps, ...res };
35
+ }
36
+ else {
37
+ ok = false;
38
+ }
39
+ }
40
+ }
41
+ if (!ok) {
42
+ return false;
43
+ }
44
+ return installedDeps;
45
+ }
@@ -9,6 +9,7 @@ import { parallel } from '../parallel.js';
9
9
  import { installFromGithub } from '../vessel.js';
10
10
  import { addCache, copyCache, isCached } from '../cache.js';
11
11
  import { downloadFile, getPackageFilesInfo } from '../api/downloadPackageFiles.js';
12
+ import { installLocal } from './install-local.js';
12
13
  export async function install(pkg, version = '', { verbose = false, silent = false, dep = false } = {}) {
13
14
  if (!checkConfigFile()) {
14
15
  return false;
@@ -84,12 +85,12 @@ export async function install(pkg, version = '', { verbose = false, silent = fal
84
85
  let config = readConfig(path.join(dir, 'mops.toml'));
85
86
  let deps = Object.values(config.dependencies || {});
86
87
  let installedDeps = {};
87
- for (const { name, repo, version } of deps) {
88
+ for (const { name, repo, version, path: depPath } of deps) {
88
89
  if (repo) {
89
90
  await installFromGithub(name, repo, { silent, verbose });
90
91
  }
91
92
  else {
92
- let res = await install(name, version, { silent, verbose });
93
+ let res = await (depPath ? installLocal(name, depPath, { silent, verbose }) : install(name, version, { silent, verbose }));
93
94
  if (res) {
94
95
  installedDeps = { ...installedDeps, ...res };
95
96
  }
@@ -34,7 +34,7 @@ export async function sources({ verbose = false, cwd = process.cwd() } = {}) {
34
34
  pkgBaseDir = path.join(pkgDir, 'src');
35
35
  }
36
36
  // use pkgDir if baseDir doesn't exist for local packages
37
- if (depType === 'local' && !fs.existsSync(pkgBaseDir)) {
37
+ if (depType === 'local' && !fs.existsSync(path.resolve(cwd, pkgBaseDir))) {
38
38
  pkgBaseDir = pkgDir;
39
39
  }
40
40
  return `--package ${name} ${pkgBaseDir}`;
@@ -24,11 +24,6 @@ type User =
24
24
  twitter: text;
25
25
  twitterVerified: bool;
26
26
  };
27
- type TransformArg =
28
- record {
29
- context: vec nat8;
30
- response: HttpResponse;
31
- };
32
27
  type Time = int;
33
28
  type Text = text;
34
29
  type TestsChanges =
@@ -344,14 +339,19 @@ type Main =
344
339
  startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
345
340
  startPublish: (PackageConfigV2) -> (Result_2);
346
341
  transferOwnership: (PackageName, principal) -> (Result_1);
347
- transformRequest: (TransformArg) -> (HttpResponse) query;
342
+ transformRequest: (HttpTransformArg) -> (HttpResponse) query;
348
343
  uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
349
344
  uploadNotes: (PublishingId, text) -> (Result);
350
345
  uploadTestStats: (PublishingId, TestStats) -> (Result);
351
346
  };
347
+ type HttpTransformArg =
348
+ record {
349
+ context: blob;
350
+ response: HttpResponse;
351
+ };
352
352
  type HttpResponse =
353
353
  record {
354
- body: vec nat8;
354
+ body: blob;
355
355
  headers: vec HttpHeader;
356
356
  status: nat;
357
357
  };
@@ -33,6 +33,10 @@ export interface HttpResponse {
33
33
  'body' : Uint8Array | number[],
34
34
  'headers' : Array<HttpHeader>,
35
35
  }
36
+ export interface HttpTransformArg {
37
+ 'context' : Uint8Array | number[],
38
+ 'response' : HttpResponse,
39
+ }
36
40
  export interface Main {
37
41
  'backup' : ActorMethod<[], undefined>,
38
42
  'computeHashesForExistingFiles' : ActorMethod<[], undefined>,
@@ -96,7 +100,7 @@ export interface Main {
96
100
  >,
97
101
  'startPublish' : ActorMethod<[PackageConfigV2], Result_2>,
98
102
  'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
99
- 'transformRequest' : ActorMethod<[TransformArg], HttpResponse>,
103
+ 'transformRequest' : ActorMethod<[HttpTransformArg], HttpResponse>,
100
104
  'uploadFileChunk' : ActorMethod<
101
105
  [PublishingId, FileId, bigint, Uint8Array | number[]],
102
106
  Result
@@ -296,10 +300,6 @@ export interface TestsChanges {
296
300
  }
297
301
  export type Text = string;
298
302
  export type Time = bigint;
299
- export interface TransformArg {
300
- 'context' : Uint8Array | number[],
301
- 'response' : HttpResponse,
302
- }
303
303
  export interface User {
304
304
  'id' : Principal,
305
305
  'emailVerified' : boolean,
@@ -251,7 +251,7 @@ export const idlFactory = ({ IDL }) => {
251
251
  'body' : IDL.Vec(IDL.Nat8),
252
252
  'headers' : IDL.Vec(HttpHeader),
253
253
  });
254
- const TransformArg = IDL.Record({
254
+ const HttpTransformArg = IDL.Record({
255
255
  'context' : IDL.Vec(IDL.Nat8),
256
256
  'response' : HttpResponse,
257
257
  });
@@ -360,7 +360,11 @@ export const idlFactory = ({ IDL }) => {
360
360
  [Result_1],
361
361
  [],
362
362
  ),
363
- 'transformRequest' : IDL.Func([TransformArg], [HttpResponse], ['query']),
363
+ 'transformRequest' : IDL.Func(
364
+ [HttpTransformArg],
365
+ [HttpResponse],
366
+ ['query'],
367
+ ),
364
368
  'uploadFileChunk' : IDL.Func(
365
369
  [PublishingId, FileId, IDL.Nat, IDL.Vec(IDL.Nat8)],
366
370
  [Result],
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.38.2",
3
+ "version": "0.39.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",
@@ -6,6 +6,7 @@ export async function resolvePackages({ verbose = false } = {}) {
6
6
  if (!checkConfigFile()) {
7
7
  return {};
8
8
  }
9
+ let rootDir = getRootDir();
9
10
  let packages = {};
10
11
  let versions = {};
11
12
  let compareVersions = (a = '0.0.0', b = '0.0.0') => {
@@ -36,7 +37,7 @@ export async function resolvePackages({ verbose = false } = {}) {
36
37
  return 1;
37
38
  }
38
39
  };
39
- let collectDeps = async (config, isRoot = false) => {
40
+ let collectDeps = async (config, configDir, isRoot = false) => {
40
41
  let allDeps = [...Object.values(config.dependencies || {})];
41
42
  if (isRoot) {
42
43
  allDeps = [...allDeps, ...Object.values(config['dev-dependencies'] || {})];
@@ -49,22 +50,34 @@ export async function resolvePackages({ verbose = false } = {}) {
49
50
  || !packages[name]?.isRoot
50
51
  && (repo && packages[name]?.repo && compareGitVersions(packages[name]?.repo || '', repo) === -1
51
52
  || compareVersions(packages[name]?.version, version) === -1)) {
52
- packages[name] = {
53
+ let temp = {
53
54
  ...pkgDetails,
54
55
  isRoot,
55
56
  };
57
+ packages[name] = temp;
58
+ // normalize path relative to the root config dir
59
+ if (pkgDetails.path) {
60
+ temp.path = path.relative(rootDir, path.resolve(configDir, pkgDetails.path));
61
+ }
56
62
  }
57
63
  let nestedConfig;
64
+ let nestedDir = '';
65
+ // read nested config
58
66
  if (repo) {
59
- const dir = formatGithubDir(name, repo);
60
- nestedConfig = await readVesselConfig(dir, { silent: true }) || {};
67
+ nestedDir = formatGithubDir(name, repo);
68
+ nestedConfig = await readVesselConfig(nestedDir, { silent: true }) || {};
69
+ }
70
+ else if (pkgDetails.path) {
71
+ nestedDir = path.resolve(configDir, pkgDetails.path);
72
+ nestedConfig = readConfig(nestedDir + '/mops.toml');
61
73
  }
62
- else if (!pkgDetails.path && version) {
63
- const file = formatDir(name, version) + '/mops.toml';
64
- nestedConfig = readConfig(file);
74
+ else if (version) {
75
+ nestedDir = formatDir(name, version);
76
+ nestedConfig = readConfig(nestedDir + '/mops.toml');
65
77
  }
66
- if (nestedConfig && !pkgDetails.path) {
67
- await collectDeps(nestedConfig);
78
+ // collect nested deps
79
+ if (nestedConfig) {
80
+ await collectDeps(nestedConfig, nestedDir);
68
81
  }
69
82
  if (!versions[name]) {
70
83
  versions[name] = [];
@@ -79,7 +92,7 @@ export async function resolvePackages({ verbose = false } = {}) {
79
92
  }
80
93
  };
81
94
  let config = readConfig();
82
- await collectDeps(config, true);
95
+ await collectDeps(config, rootDir, true);
83
96
  // show conflicts
84
97
  if (verbose) {
85
98
  for (let [dep, vers] of Object.entries(versions)) {
@@ -88,7 +101,6 @@ export async function resolvePackages({ verbose = false } = {}) {
88
101
  }
89
102
  }
90
103
  }
91
- let rootDir = getRootDir();
92
104
  return Object.fromEntries(Object.entries(packages).map(([name, pkg]) => {
93
105
  let version;
94
106
  if (pkg.path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.38.2",
3
+ "version": "0.39.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",
@@ -9,6 +9,7 @@ export async function resolvePackages({verbose = false} = {}): Promise<Record<st
9
9
  return {};
10
10
  }
11
11
 
12
+ let rootDir = getRootDir();
12
13
  let packages: Record<string, Dependency & {isRoot: boolean;}> = {};
13
14
  let versions: Record<string, string[]> = {};
14
15
 
@@ -44,7 +45,7 @@ export async function resolvePackages({verbose = false} = {}): Promise<Record<st
44
45
  }
45
46
  };
46
47
 
47
- let collectDeps = async (config: Config | VesselConfig, isRoot = false) => {
48
+ let collectDeps = async (config: Config | VesselConfig, configDir: string, isRoot = false) => {
48
49
  let allDeps = [...Object.values(config.dependencies || {})];
49
50
  if (isRoot) {
50
51
  allDeps = [...allDeps, ...Object.values(config['dev-dependencies'] || {})];
@@ -61,25 +62,38 @@ export async function resolvePackages({verbose = false} = {}): Promise<Record<st
61
62
  repo && packages[name]?.repo && compareGitVersions(packages[name]?.repo || '', repo) === -1
62
63
  || compareVersions(packages[name]?.version, version) === -1)
63
64
  ) {
64
- packages[name] = {
65
+ let temp = {
65
66
  ...pkgDetails,
66
67
  isRoot,
67
68
  };
69
+ packages[name] = temp;
70
+
71
+ // normalize path relative to the root config dir
72
+ if (pkgDetails.path) {
73
+ temp.path = path.relative(rootDir, path.resolve(configDir, pkgDetails.path));
74
+ }
68
75
  }
69
76
 
70
77
  let nestedConfig;
78
+ let nestedDir = '';
71
79
 
80
+ // read nested config
72
81
  if (repo) {
73
- const dir = formatGithubDir(name, repo);
74
- nestedConfig = await readVesselConfig(dir, {silent: true}) || {};
82
+ nestedDir = formatGithubDir(name, repo);
83
+ nestedConfig = await readVesselConfig(nestedDir, {silent: true}) || {};
84
+ }
85
+ else if (pkgDetails.path) {
86
+ nestedDir = path.resolve(configDir, pkgDetails.path);
87
+ nestedConfig = readConfig(nestedDir + '/mops.toml');
75
88
  }
76
- else if (!pkgDetails.path && version) {
77
- const file = formatDir(name, version) + '/mops.toml';
78
- nestedConfig = readConfig(file);
89
+ else if (version) {
90
+ nestedDir = formatDir(name, version);
91
+ nestedConfig = readConfig(nestedDir + '/mops.toml');
79
92
  }
80
93
 
81
- if (nestedConfig && !pkgDetails.path) {
82
- await collectDeps(nestedConfig);
94
+ // collect nested deps
95
+ if (nestedConfig) {
96
+ await collectDeps(nestedConfig, nestedDir);
83
97
  }
84
98
 
85
99
  if (!versions[name]) {
@@ -97,7 +111,7 @@ export async function resolvePackages({verbose = false} = {}): Promise<Record<st
97
111
  };
98
112
 
99
113
  let config = readConfig();
100
- await collectDeps(config, true);
114
+ await collectDeps(config, rootDir, true);
101
115
 
102
116
  // show conflicts
103
117
  if (verbose) {
@@ -108,8 +122,6 @@ export async function resolvePackages({verbose = false} = {}): Promise<Record<st
108
122
  }
109
123
  }
110
124
 
111
- let rootDir = getRootDir();
112
-
113
125
  return Object.fromEntries(
114
126
  Object.entries(packages).map(([name, pkg]) => {
115
127
  let version: string;