@coana-tech/cli 14.1.3 → 14.2.0
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/cli.js +34 -27
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -40380,20 +40380,18 @@ var init_npm_ecosystem_fixing_manager = __esm({
|
|
|
40380
40380
|
signalFixApplied?.(fixId, this.subprojectPath, workspacePath, vulnerabilityFixes);
|
|
40381
40381
|
});
|
|
40382
40382
|
});
|
|
40383
|
+
await this.finalizeFixes();
|
|
40383
40384
|
}
|
|
40384
40385
|
async applySecurityFixesForWorkspace(workspacePath, fixes, dependencyTree, directDependencyToPackageType, packageManagerInfo) {
|
|
40385
40386
|
const that = this;
|
|
40386
|
-
const directDependenciesToBump =
|
|
40387
|
-
await this.applySecurityFixesSpecificPackageManager(
|
|
40387
|
+
const directDependenciesToBump = await this.getDirectDependenciesToBump(workspacePath, dependencyTree, fixes);
|
|
40388
|
+
await this.applySecurityFixesSpecificPackageManager(fixes);
|
|
40388
40389
|
if (directDependenciesToBump.length === 0) return;
|
|
40389
|
-
await
|
|
40390
|
-
|
|
40391
|
-
|
|
40392
|
-
|
|
40393
|
-
|
|
40394
|
-
await that.installSpecificPackages(workspacePath2, type === "dev", packagesOfType, packageManagerInfo);
|
|
40395
|
-
});
|
|
40396
|
-
}
|
|
40390
|
+
await applySeries(["prod", "dev"], async (type) => {
|
|
40391
|
+
const packagesOfType = directDependenciesToBump.filter((f5) => directDependencyToPackageType[f5.dependencyName] === type).map((f5) => `${f5.dependencyName}@${f5.fixedVersion}`);
|
|
40392
|
+
if (packagesOfType.length === 0) return;
|
|
40393
|
+
await that.installSpecificPackages(workspacePath, type === "dev", packagesOfType, packageManagerInfo);
|
|
40394
|
+
});
|
|
40397
40395
|
}
|
|
40398
40396
|
async getDirectDependenciesToBump(_workspacePath, dependencyTree, fix) {
|
|
40399
40397
|
return fix.filter((f5) => dependencyTree.dependencies?.includes(f5.dependencyIdentifier));
|
|
@@ -40415,12 +40413,15 @@ var init_npm_fixing_manager = __esm({
|
|
|
40415
40413
|
init_npm_ecosystem_fixing_manager();
|
|
40416
40414
|
NpmFixingManager = class extends NpmEcosystemFixingManager {
|
|
40417
40415
|
async installSpecificPackages(workspacePath, isDev, packagesToInstall) {
|
|
40418
|
-
|
|
40416
|
+
const result = await actuallyRunInstall(
|
|
40419
40417
|
cmdt`${isDev && "-D"} ${packagesToInstall}`,
|
|
40420
40418
|
(0, import_path.resolve)(this.rootDir, this.subprojectPath, workspacePath)
|
|
40421
40419
|
);
|
|
40420
|
+
if (!result) {
|
|
40421
|
+
throw new Error(`Failed to install packages`);
|
|
40422
|
+
}
|
|
40422
40423
|
}
|
|
40423
|
-
async applySecurityFixesSpecificPackageManager(
|
|
40424
|
+
async applySecurityFixesSpecificPackageManager(fixes) {
|
|
40424
40425
|
const pkgLockLocation = (0, import_path.resolve)(this.rootDir, this.subprojectPath, "package-lock.json");
|
|
40425
40426
|
const packageLockContent = await (0, import_promises2.readFile)(pkgLockLocation, "utf-8");
|
|
40426
40427
|
const getPackageName = (pkgPath) => {
|
|
@@ -40444,6 +40445,8 @@ var init_npm_fixing_manager = __esm({
|
|
|
40444
40445
|
throw new Error(`Failed to update package-lock.json ${e.stack}`);
|
|
40445
40446
|
}
|
|
40446
40447
|
}
|
|
40448
|
+
async finalizeFixes() {
|
|
40449
|
+
}
|
|
40447
40450
|
};
|
|
40448
40451
|
}
|
|
40449
40452
|
});
|
|
@@ -67445,15 +67448,15 @@ var init_pnpm_fixing_manager = __esm({
|
|
|
67445
67448
|
throw new Error(`fixing data for package manager 'PNPM' required, got ${packageManagerInfo.packageManager}`);
|
|
67446
67449
|
}
|
|
67447
67450
|
const isInstallingInRootOfWorkspace = workspacePath === "." && packageManagerInfo.workspacePaths.length > 1;
|
|
67448
|
-
|
|
67451
|
+
await this.actuallyRunInstall(
|
|
67449
67452
|
cmdt`${isDev && "-D"} ${isInstallingInRootOfWorkspace && "-w"} ${packagesToInstall}`,
|
|
67450
67453
|
workspacePath
|
|
67451
67454
|
);
|
|
67452
67455
|
}
|
|
67453
67456
|
async actuallyRunInstall(specificPackagesCmd = [], workspacePath = ".") {
|
|
67454
|
-
const installationCommand = cmdt`
|
|
67457
|
+
const installationCommand = cmdt`pnpm install --ignore-scripts ${specificPackagesCmd}`;
|
|
67455
67458
|
logger.info(`running installation command: ${installationCommand}`);
|
|
67456
|
-
|
|
67459
|
+
await exec(installationCommand, (0, import_path2.resolve)(this.rootDir, this.subprojectPath, workspacePath));
|
|
67457
67460
|
}
|
|
67458
67461
|
async getLockFileYaml() {
|
|
67459
67462
|
const lockFile = await (0, import_lockfile_file.readWantedLockfile)((0, import_path2.resolve)(this.rootDir, this.subprojectPath), { ignoreIncompatible: true });
|
|
@@ -67471,7 +67474,7 @@ var init_pnpm_fixing_manager = __esm({
|
|
|
67471
67474
|
});
|
|
67472
67475
|
return directDepsToBump;
|
|
67473
67476
|
}
|
|
67474
|
-
async applySecurityFixesSpecificPackageManager(
|
|
67477
|
+
async applySecurityFixesSpecificPackageManager(fixes) {
|
|
67475
67478
|
const lockFileYaml = await this.getLockFileYaml();
|
|
67476
67479
|
try {
|
|
67477
67480
|
if (lockFileYaml.packages) {
|
|
@@ -67539,15 +67542,15 @@ var init_pnpm_fixing_manager = __esm({
|
|
|
67539
67542
|
await writeYamlFile(yamlAST, pnpmWorkspaceYamlFile);
|
|
67540
67543
|
}
|
|
67541
67544
|
await (0, import_lockfile_file.writeWantedLockfile)((0, import_path2.resolve)(this.rootDir, this.subprojectPath), lockFileYaml);
|
|
67542
|
-
await this.fixLockFile(workspacePath);
|
|
67543
67545
|
} catch (e) {
|
|
67544
67546
|
if (e.message) throw e;
|
|
67545
67547
|
throw new Error("Failed to update pnpm-lock.yaml");
|
|
67546
67548
|
}
|
|
67547
67549
|
}
|
|
67548
|
-
async
|
|
67549
|
-
const cmd = cmdt`
|
|
67550
|
-
|
|
67550
|
+
async finalizeFixes() {
|
|
67551
|
+
const cmd = cmdt`pnpm install --ignore-scripts --fix-lockfile`;
|
|
67552
|
+
logger.info(`Adjusting lock file changes by running '${cmd}'`);
|
|
67553
|
+
await exec(cmd, (0, import_path2.resolve)(this.rootDir, this.subprojectPath));
|
|
67551
67554
|
}
|
|
67552
67555
|
};
|
|
67553
67556
|
}
|
|
@@ -84607,13 +84610,13 @@ var init_yarn_fixing_manager = __esm({
|
|
|
84607
84610
|
return pkgJson?.packageManager;
|
|
84608
84611
|
}
|
|
84609
84612
|
async installPackages() {
|
|
84610
|
-
|
|
84613
|
+
await this.actuallyRunInstall();
|
|
84611
84614
|
}
|
|
84612
84615
|
async installSpecificPackages(workspacePath, isDev, packagesToInstall) {
|
|
84613
84616
|
const installArgs = cmdt`${isDev && "-D"} ${// otherwise yarn will fail with an error when trying to install/update packages
|
|
84614
84617
|
// in the root of a workspace project.
|
|
84615
84618
|
this.yarnType === "classic" && "--ignore-workspace-root-check"} ${packagesToInstall}`;
|
|
84616
|
-
|
|
84619
|
+
await this.actuallyRunInstall(installArgs, workspacePath);
|
|
84617
84620
|
}
|
|
84618
84621
|
async actuallyRunInstall(specificPackagesArgs, workspacePath) {
|
|
84619
84622
|
const yarnInstruction = specificPackagesArgs?.length ? "add" : "install";
|
|
@@ -84628,8 +84631,9 @@ var init_yarn_fixing_manager = __esm({
|
|
|
84628
84631
|
logger.info(`Running installation command: ${installationCommand}`);
|
|
84629
84632
|
const installDir = (0, import_path4.resolve)(this.rootDir, this.subprojectPath, workspacePath ?? ".");
|
|
84630
84633
|
const installResult = await this.runYarnCommand(installationCommand, installDir, { env });
|
|
84631
|
-
if (installResult.error)
|
|
84632
|
-
|
|
84634
|
+
if (installResult.error) {
|
|
84635
|
+
throw new Error(`Failed to install packages: ${installResult.error.message}`);
|
|
84636
|
+
}
|
|
84633
84637
|
}
|
|
84634
84638
|
async getYarnLockObj(filePath) {
|
|
84635
84639
|
const fileString = await (0, import_promises4.readFile)(filePath, "utf8");
|
|
@@ -84709,9 +84713,8 @@ var init_yarn_fixing_manager = __esm({
|
|
|
84709
84713
|
delete pkgObj.checksum;
|
|
84710
84714
|
});
|
|
84711
84715
|
await this.writeYarnObj(yarnLock, yarnLockLocation);
|
|
84712
|
-
await this.installPackages();
|
|
84713
84716
|
}
|
|
84714
|
-
async applySecurityFixesSpecificPackageManager(
|
|
84717
|
+
async applySecurityFixesSpecificPackageManager(fixes) {
|
|
84715
84718
|
const yarnLockLocation = (0, import_path4.resolve)(this.rootDir, this.subprojectPath, "yarn.lock");
|
|
84716
84719
|
const yarnType = this.yarnType;
|
|
84717
84720
|
try {
|
|
@@ -84724,6 +84727,10 @@ var init_yarn_fixing_manager = __esm({
|
|
|
84724
84727
|
throw new Error(`Failed to update yarn.lock ${e.stack}`);
|
|
84725
84728
|
}
|
|
84726
84729
|
}
|
|
84730
|
+
async finalizeFixes() {
|
|
84731
|
+
logger.info(`Adjusting lock file changes by running a yarn dependency install command`);
|
|
84732
|
+
await this.installPackages();
|
|
84733
|
+
}
|
|
84727
84734
|
};
|
|
84728
84735
|
}
|
|
84729
84736
|
});
|
|
@@ -194028,7 +194035,7 @@ var require_version = __commonJS({
|
|
|
194028
194035
|
"use strict";
|
|
194029
194036
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
194030
194037
|
exports2.version = void 0;
|
|
194031
|
-
exports2.version = "14.
|
|
194038
|
+
exports2.version = "14.2.0";
|
|
194032
194039
|
}
|
|
194033
194040
|
});
|
|
194034
194041
|
|