agent-package-manager 0.4.2 → 0.4.3
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/dist/cli/index.js +45 -6
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4851,11 +4851,6 @@ async function runUpdate(input, projectDir) {
|
|
|
4851
4851
|
hasBreakingChanges: hasBreaking
|
|
4852
4852
|
});
|
|
4853
4853
|
}
|
|
4854
|
-
if (updates.length === 0) {
|
|
4855
|
-
log.info("All packages are up to date");
|
|
4856
|
-
console.log(JSON.stringify({ updates: [], dryRun: input.dryRun }, null, 2));
|
|
4857
|
-
return;
|
|
4858
|
-
}
|
|
4859
4854
|
for (const u of updates) {
|
|
4860
4855
|
const breaking = u.hasBreakingChanges ? " (BREAKING)" : "";
|
|
4861
4856
|
log.info(`${u.package}: ${u.fromVersion} \u2192 ${u.toVersion}${breaking}`);
|
|
@@ -4906,6 +4901,49 @@ async function runUpdate(input, projectDir) {
|
|
|
4906
4901
|
installedDeps.push(...deps);
|
|
4907
4902
|
}
|
|
4908
4903
|
}
|
|
4904
|
+
const upToDatePackages = targetPackages.filter(
|
|
4905
|
+
(name) => !updates.some((u) => u.package === name)
|
|
4906
|
+
);
|
|
4907
|
+
for (const name of upToDatePackages) {
|
|
4908
|
+
const pkg = config.packages[name];
|
|
4909
|
+
const registryName = pkg.registry || "default";
|
|
4910
|
+
const registry = config.registries[registryName];
|
|
4911
|
+
if (!registry) continue;
|
|
4912
|
+
const installDir = join8(projectDir, config.install.modulesDir, name);
|
|
4913
|
+
if (!existsSync6(installDir)) continue;
|
|
4914
|
+
const pkgManifest = await readPackageManifest(installDir);
|
|
4915
|
+
if (!pkgManifest?.dependencies) continue;
|
|
4916
|
+
const missingDeps = Object.entries(pkgManifest.dependencies).filter(
|
|
4917
|
+
([depId, range]) => {
|
|
4918
|
+
const existing = config.packages[depId];
|
|
4919
|
+
if (!existing) return true;
|
|
4920
|
+
const depDir = join8(projectDir, config.install.modulesDir, depId);
|
|
4921
|
+
if (!existsSync6(depDir)) return true;
|
|
4922
|
+
return !semver3.satisfies(existing.version, range);
|
|
4923
|
+
}
|
|
4924
|
+
);
|
|
4925
|
+
if (missingDeps.length === 0) continue;
|
|
4926
|
+
log.info(`${name}@${pkg.version} \u2014 resolving missing dependencies`);
|
|
4927
|
+
const repoDir = await ensureCloned(registry.owner, registry.repo);
|
|
4928
|
+
const manifest = await readManifestFromRepo(repoDir);
|
|
4929
|
+
const deps = await installDependencies2(
|
|
4930
|
+
projectDir,
|
|
4931
|
+
config,
|
|
4932
|
+
lock,
|
|
4933
|
+
registry,
|
|
4934
|
+
registryName,
|
|
4935
|
+
repoDir,
|
|
4936
|
+
manifest,
|
|
4937
|
+
Object.fromEntries(missingDeps),
|
|
4938
|
+
/* @__PURE__ */ new Set([name])
|
|
4939
|
+
);
|
|
4940
|
+
installedDeps.push(...deps);
|
|
4941
|
+
}
|
|
4942
|
+
if (updates.length === 0 && installedDeps.length === 0) {
|
|
4943
|
+
log.info("All packages are up to date");
|
|
4944
|
+
console.log(JSON.stringify({ updates: [], installedDeps: [], dryRun: false }, null, 2));
|
|
4945
|
+
return;
|
|
4946
|
+
}
|
|
4909
4947
|
lock.generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4910
4948
|
await writeProjectConfig(projectDir, config);
|
|
4911
4949
|
await writeLockFile(projectDir, lock);
|
|
@@ -4919,7 +4957,8 @@ async function installDependencies2(projectDir, config, lock, registry, registry
|
|
|
4919
4957
|
throw new Error(`Circular dependency detected: ${chain}`);
|
|
4920
4958
|
}
|
|
4921
4959
|
const existing = config.packages[depId];
|
|
4922
|
-
|
|
4960
|
+
const depDir = join8(projectDir, config.install.modulesDir, depId);
|
|
4961
|
+
if (existing && existsSync6(depDir) && semver3.satisfies(existing.version, range)) {
|
|
4923
4962
|
log.debug(`Dependency ${depId}@${existing.version} already satisfies ${range}`);
|
|
4924
4963
|
continue;
|
|
4925
4964
|
}
|