pubm 0.2.4 → 0.2.6
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/bin/cli.js +109 -26
- package/dist/index.cjs +119 -36
- package/dist/index.js +111 -28
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -5466,7 +5466,7 @@ import process14 from "node:process";
|
|
|
5466
5466
|
import npmCli3 from "@npmcli/promise-spawn";
|
|
5467
5467
|
import SemVer from "semver";
|
|
5468
5468
|
import { isCI as isCI2 } from "std-env";
|
|
5469
|
-
import { exec as
|
|
5469
|
+
import { exec as exec9 } from "tinyexec";
|
|
5470
5470
|
|
|
5471
5471
|
// src/utils/cli.ts
|
|
5472
5472
|
var warningBadge = color.bgYellow(" Warning ");
|
|
@@ -5478,6 +5478,7 @@ function link2(text, url) {
|
|
|
5478
5478
|
import { readFile, stat as stat2, writeFile } from "node:fs/promises";
|
|
5479
5479
|
import path8 from "node:path";
|
|
5480
5480
|
import { parse, stringify } from "smol-toml";
|
|
5481
|
+
import { exec as exec4 } from "tinyexec";
|
|
5481
5482
|
|
|
5482
5483
|
// src/ecosystem/ecosystem.ts
|
|
5483
5484
|
var Ecosystem = class {
|
|
@@ -5520,6 +5521,53 @@ var RustEcosystem = class extends Ecosystem {
|
|
|
5520
5521
|
pkg.version = newVersion;
|
|
5521
5522
|
await writeFile(filePath, stringify(cargo));
|
|
5522
5523
|
}
|
|
5524
|
+
/**
|
|
5525
|
+
* Update the `version` field of dependencies that match sibling crate names.
|
|
5526
|
+
* This ensures `cargo publish` works when crates depend on each other via path.
|
|
5527
|
+
*/
|
|
5528
|
+
async updateSiblingDependencyVersions(siblingVersions) {
|
|
5529
|
+
const filePath = path8.join(this.packagePath, "Cargo.toml");
|
|
5530
|
+
const raw = await readFile(filePath, "utf-8");
|
|
5531
|
+
const cargo = parse(raw);
|
|
5532
|
+
let modified = false;
|
|
5533
|
+
for (const section of ["dependencies", "build-dependencies"]) {
|
|
5534
|
+
const sectionData = cargo[section];
|
|
5535
|
+
if (!sectionData) continue;
|
|
5536
|
+
for (const [depName, depValue] of Object.entries(sectionData)) {
|
|
5537
|
+
if (typeof depValue === "object" && depValue !== null && "path" in depValue && siblingVersions.has(depName)) {
|
|
5538
|
+
const dep = depValue;
|
|
5539
|
+
dep.version = siblingVersions.get(depName);
|
|
5540
|
+
modified = true;
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
}
|
|
5544
|
+
if (modified) {
|
|
5545
|
+
await writeFile(filePath, stringify(cargo));
|
|
5546
|
+
}
|
|
5547
|
+
return modified;
|
|
5548
|
+
}
|
|
5549
|
+
async syncLockfile() {
|
|
5550
|
+
const lockfilePath = await this.findLockfile();
|
|
5551
|
+
if (!lockfilePath) return void 0;
|
|
5552
|
+
const name = await this.packageName();
|
|
5553
|
+
await exec4("cargo", ["update", "--package", name], {
|
|
5554
|
+
nodeOptions: { cwd: path8.dirname(lockfilePath) }
|
|
5555
|
+
});
|
|
5556
|
+
return lockfilePath;
|
|
5557
|
+
}
|
|
5558
|
+
async findLockfile() {
|
|
5559
|
+
let dir = this.packagePath;
|
|
5560
|
+
const { root } = path8.parse(dir);
|
|
5561
|
+
while (dir !== root) {
|
|
5562
|
+
const candidate = path8.join(dir, "Cargo.lock");
|
|
5563
|
+
try {
|
|
5564
|
+
if ((await stat2(candidate)).isFile()) return candidate;
|
|
5565
|
+
} catch {
|
|
5566
|
+
}
|
|
5567
|
+
dir = path8.dirname(dir);
|
|
5568
|
+
}
|
|
5569
|
+
return void 0;
|
|
5570
|
+
}
|
|
5523
5571
|
async dependencies() {
|
|
5524
5572
|
const cargo = await this.readCargoToml();
|
|
5525
5573
|
const deps = [];
|
|
@@ -5816,8 +5864,15 @@ async function replaceVersion(version2, packages) {
|
|
|
5816
5864
|
);
|
|
5817
5865
|
}
|
|
5818
5866
|
return "jsr.json";
|
|
5819
|
-
})()
|
|
5820
|
-
|
|
5867
|
+
})()
|
|
5868
|
+
]);
|
|
5869
|
+
const cratePackages = (packages ?? []).filter(
|
|
5870
|
+
(pkg) => pkg.registries.includes("crates")
|
|
5871
|
+
);
|
|
5872
|
+
const crateFiles = [];
|
|
5873
|
+
if (cratePackages.length > 0) {
|
|
5874
|
+
const ecosystems = [];
|
|
5875
|
+
for (const pkg of cratePackages) {
|
|
5821
5876
|
const eco = new RustEcosystem(path9.resolve(pkg.path));
|
|
5822
5877
|
try {
|
|
5823
5878
|
await eco.writeVersion(version2);
|
|
@@ -5827,10 +5882,38 @@ async function replaceVersion(version2, packages) {
|
|
|
5827
5882
|
{ cause: error }
|
|
5828
5883
|
);
|
|
5829
5884
|
}
|
|
5830
|
-
|
|
5831
|
-
}
|
|
5832
|
-
|
|
5833
|
-
|
|
5885
|
+
ecosystems.push({ eco, pkg });
|
|
5886
|
+
}
|
|
5887
|
+
if (ecosystems.length > 1) {
|
|
5888
|
+
const siblingVersions = /* @__PURE__ */ new Map();
|
|
5889
|
+
for (const { eco } of ecosystems) {
|
|
5890
|
+
siblingVersions.set(await eco.packageName(), version2);
|
|
5891
|
+
}
|
|
5892
|
+
await Promise.all(
|
|
5893
|
+
ecosystems.map(
|
|
5894
|
+
({ eco }) => eco.updateSiblingDependencyVersions(siblingVersions)
|
|
5895
|
+
)
|
|
5896
|
+
);
|
|
5897
|
+
}
|
|
5898
|
+
for (const { eco, pkg } of ecosystems) {
|
|
5899
|
+
crateFiles.push(path9.join(pkg.path, "Cargo.toml"));
|
|
5900
|
+
try {
|
|
5901
|
+
const lockfilePath = await eco.syncLockfile();
|
|
5902
|
+
if (lockfilePath) crateFiles.push(lockfilePath);
|
|
5903
|
+
} catch (error) {
|
|
5904
|
+
throw new AbstractError(
|
|
5905
|
+
`Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
|
|
5906
|
+
{ cause: error }
|
|
5907
|
+
);
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
}
|
|
5911
|
+
const allFiles = [];
|
|
5912
|
+
for (const r of results) {
|
|
5913
|
+
if (r) allFiles.push(r);
|
|
5914
|
+
}
|
|
5915
|
+
allFiles.push(...crateFiles);
|
|
5916
|
+
return [...new Set(allFiles)];
|
|
5834
5917
|
}
|
|
5835
5918
|
|
|
5836
5919
|
// src/utils/package-manager.ts
|
|
@@ -5869,7 +5952,7 @@ function collectRegistries(ctx) {
|
|
|
5869
5952
|
|
|
5870
5953
|
// src/registry/crates.ts
|
|
5871
5954
|
import path10 from "node:path";
|
|
5872
|
-
import { exec as
|
|
5955
|
+
import { exec as exec5, NonZeroExitError } from "tinyexec";
|
|
5873
5956
|
|
|
5874
5957
|
// src/registry/registry.ts
|
|
5875
5958
|
var Registry = class {
|
|
@@ -5909,7 +5992,7 @@ var CratesRegistry = class extends Registry {
|
|
|
5909
5992
|
}
|
|
5910
5993
|
async isInstalled() {
|
|
5911
5994
|
try {
|
|
5912
|
-
await
|
|
5995
|
+
await exec5("cargo", ["--version"]);
|
|
5913
5996
|
return true;
|
|
5914
5997
|
} catch {
|
|
5915
5998
|
return false;
|
|
@@ -5950,7 +6033,7 @@ var CratesRegistry = class extends Registry {
|
|
|
5950
6033
|
if (manifestDir) {
|
|
5951
6034
|
args.push("--manifest-path", path10.join(manifestDir, "Cargo.toml"));
|
|
5952
6035
|
}
|
|
5953
|
-
await
|
|
6036
|
+
await exec5("cargo", args, { throwOnError: true });
|
|
5954
6037
|
return true;
|
|
5955
6038
|
} catch (error) {
|
|
5956
6039
|
const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
|
|
@@ -5965,7 +6048,7 @@ ${stderr}` : "Failed to run `cargo publish`";
|
|
|
5965
6048
|
if (manifestDir) {
|
|
5966
6049
|
args.push("--manifest-path", path10.join(manifestDir, "Cargo.toml"));
|
|
5967
6050
|
}
|
|
5968
|
-
await
|
|
6051
|
+
await exec5("cargo", args, { throwOnError: true });
|
|
5969
6052
|
} catch (error) {
|
|
5970
6053
|
const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
|
|
5971
6054
|
const message = stderr ? `Failed to run \`cargo publish --dry-run\`:
|
|
@@ -6063,7 +6146,7 @@ var cratesPublishTasks = createCratesPublishTask();
|
|
|
6063
6146
|
import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter2 } from "@listr2/prompt-adapter-enquirer";
|
|
6064
6147
|
|
|
6065
6148
|
// src/registry/jsr.ts
|
|
6066
|
-
import { exec as
|
|
6149
|
+
import { exec as exec6, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
|
|
6067
6150
|
|
|
6068
6151
|
// src/utils/package-name.ts
|
|
6069
6152
|
import { builtinModules } from "node:module";
|
|
@@ -6130,7 +6213,7 @@ var JsrRegisry = class extends Registry {
|
|
|
6130
6213
|
this.client = new JsrClient(getApiEndpoint(this.registry));
|
|
6131
6214
|
}
|
|
6132
6215
|
async jsr(args) {
|
|
6133
|
-
const { stdout } = await
|
|
6216
|
+
const { stdout } = await exec6("jsr", args, { throwOnError: true });
|
|
6134
6217
|
return stdout;
|
|
6135
6218
|
}
|
|
6136
6219
|
async isInstalled() {
|
|
@@ -6146,7 +6229,7 @@ var JsrRegisry = class extends Registry {
|
|
|
6146
6229
|
}
|
|
6147
6230
|
async ping() {
|
|
6148
6231
|
try {
|
|
6149
|
-
const { stdout } = await
|
|
6232
|
+
const { stdout } = await exec6(
|
|
6150
6233
|
"ping",
|
|
6151
6234
|
[new URL(this.registry).hostname, "-c", "1"],
|
|
6152
6235
|
{ throwOnError: true }
|
|
@@ -6161,7 +6244,7 @@ var JsrRegisry = class extends Registry {
|
|
|
6161
6244
|
}
|
|
6162
6245
|
async publish() {
|
|
6163
6246
|
try {
|
|
6164
|
-
await
|
|
6247
|
+
await exec6(
|
|
6165
6248
|
"jsr",
|
|
6166
6249
|
["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
|
|
6167
6250
|
{
|
|
@@ -6192,7 +6275,7 @@ ${stderr}` : ""}`,
|
|
|
6192
6275
|
}
|
|
6193
6276
|
async dryRunPublish() {
|
|
6194
6277
|
try {
|
|
6195
|
-
await
|
|
6278
|
+
await exec6(
|
|
6196
6279
|
"jsr",
|
|
6197
6280
|
[
|
|
6198
6281
|
"publish",
|
|
@@ -6452,7 +6535,7 @@ async function jsrRegistry() {
|
|
|
6452
6535
|
// src/registry/npm.ts
|
|
6453
6536
|
import { tmpdir } from "node:os";
|
|
6454
6537
|
import { join } from "node:path";
|
|
6455
|
-
import { exec as
|
|
6538
|
+
import { exec as exec7, NonZeroExitError as NonZeroExitError3 } from "tinyexec";
|
|
6456
6539
|
var NpmError = class extends AbstractError {
|
|
6457
6540
|
constructor() {
|
|
6458
6541
|
super(...arguments);
|
|
@@ -6465,7 +6548,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6465
6548
|
__publicField(this, "registry", "https://registry.npmjs.org");
|
|
6466
6549
|
}
|
|
6467
6550
|
async npm(args) {
|
|
6468
|
-
const { stdout } = await
|
|
6551
|
+
const { stdout } = await exec7("npm", args, { throwOnError: true });
|
|
6469
6552
|
return stdout;
|
|
6470
6553
|
}
|
|
6471
6554
|
async isInstalled() {
|
|
@@ -6576,7 +6659,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6576
6659
|
}
|
|
6577
6660
|
async ping() {
|
|
6578
6661
|
try {
|
|
6579
|
-
await
|
|
6662
|
+
await exec7("npm", ["ping"], { throwOnError: true });
|
|
6580
6663
|
return true;
|
|
6581
6664
|
} catch (error) {
|
|
6582
6665
|
throw new NpmError("Failed to run `npm ping`", { cause: error });
|
|
@@ -6607,7 +6690,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6607
6690
|
}
|
|
6608
6691
|
async dryRunPublish() {
|
|
6609
6692
|
try {
|
|
6610
|
-
await
|
|
6693
|
+
await exec7("npm", ["publish", "--dry-run"], {
|
|
6611
6694
|
throwOnError: true,
|
|
6612
6695
|
nodeOptions: {
|
|
6613
6696
|
env: {
|
|
@@ -7245,10 +7328,10 @@ var prerequisitesCheckTask = (options) => {
|
|
|
7245
7328
|
import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter6 } from "@listr2/prompt-adapter-enquirer";
|
|
7246
7329
|
|
|
7247
7330
|
// src/registry/custom-registry.ts
|
|
7248
|
-
import { exec as
|
|
7331
|
+
import { exec as exec8 } from "tinyexec";
|
|
7249
7332
|
var CustomRegistry = class extends NpmRegistry {
|
|
7250
7333
|
async npm(args) {
|
|
7251
|
-
const { stdout } = await
|
|
7334
|
+
const { stdout } = await exec8(
|
|
7252
7335
|
"npm",
|
|
7253
7336
|
args.concat("--registry", this.registry),
|
|
7254
7337
|
{ throwOnError: true }
|
|
@@ -7564,7 +7647,7 @@ async function run(options) {
|
|
|
7564
7647
|
task: async (ctx2) => {
|
|
7565
7648
|
const packageManager = await getPackageManager();
|
|
7566
7649
|
try {
|
|
7567
|
-
await
|
|
7650
|
+
await exec9(packageManager, ["run", ctx2.testScript], {
|
|
7568
7651
|
throwOnError: true
|
|
7569
7652
|
});
|
|
7570
7653
|
} catch (error) {
|
|
@@ -7581,7 +7664,7 @@ async function run(options) {
|
|
|
7581
7664
|
task: async (ctx2) => {
|
|
7582
7665
|
const packageManager = await getPackageManager();
|
|
7583
7666
|
try {
|
|
7584
|
-
await
|
|
7667
|
+
await exec9(packageManager, ["run", ctx2.buildScript], {
|
|
7585
7668
|
throwOnError: true
|
|
7586
7669
|
});
|
|
7587
7670
|
} catch (error) {
|
|
@@ -7641,7 +7724,7 @@ async function run(options) {
|
|
|
7641
7724
|
}
|
|
7642
7725
|
},
|
|
7643
7726
|
{
|
|
7644
|
-
skip: (ctx2) => options.skipPublish || !!ctx2.preview || options.preflight,
|
|
7727
|
+
skip: (ctx2) => !!options.skipPublish || !!ctx2.preview || !!options.preflight,
|
|
7645
7728
|
title: "Publishing",
|
|
7646
7729
|
task: async (ctx2, parentTask) => parentTask.newListr(await collectPublishTasks(ctx2), {
|
|
7647
7730
|
concurrent: true
|
|
@@ -7667,7 +7750,7 @@ async function run(options) {
|
|
|
7667
7750
|
}
|
|
7668
7751
|
},
|
|
7669
7752
|
{
|
|
7670
|
-
skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
|
|
7753
|
+
skip: (ctx2) => !!options.skipReleaseDraft || !!ctx2.preview,
|
|
7671
7754
|
title: "Creating release draft on GitHub",
|
|
7672
7755
|
task: async (ctx2, task) => {
|
|
7673
7756
|
const git = new Git();
|
package/dist/index.cjs
CHANGED
|
@@ -4486,7 +4486,7 @@ var Listr = (_a23 = class {
|
|
|
4486
4486
|
// src/tasks/runner.ts
|
|
4487
4487
|
var import_semver3 = __toESM(require("semver"), 1);
|
|
4488
4488
|
var import_std_env = require("std-env");
|
|
4489
|
-
var
|
|
4489
|
+
var import_tinyexec8 = require("tinyexec");
|
|
4490
4490
|
|
|
4491
4491
|
// src/error.ts
|
|
4492
4492
|
var AbstractError = class extends Error {
|
|
@@ -4818,6 +4818,7 @@ function link2(text, url) {
|
|
|
4818
4818
|
var import_promises2 = require("fs/promises");
|
|
4819
4819
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
4820
4820
|
var import_smol_toml = require("smol-toml");
|
|
4821
|
+
var import_tinyexec2 = require("tinyexec");
|
|
4821
4822
|
|
|
4822
4823
|
// src/ecosystem/ecosystem.ts
|
|
4823
4824
|
var Ecosystem = class {
|
|
@@ -4860,6 +4861,53 @@ var RustEcosystem = class extends Ecosystem {
|
|
|
4860
4861
|
pkg.version = newVersion;
|
|
4861
4862
|
await (0, import_promises2.writeFile)(filePath, (0, import_smol_toml.stringify)(cargo));
|
|
4862
4863
|
}
|
|
4864
|
+
/**
|
|
4865
|
+
* Update the `version` field of dependencies that match sibling crate names.
|
|
4866
|
+
* This ensures `cargo publish` works when crates depend on each other via path.
|
|
4867
|
+
*/
|
|
4868
|
+
async updateSiblingDependencyVersions(siblingVersions) {
|
|
4869
|
+
const filePath = import_node_path2.default.join(this.packagePath, "Cargo.toml");
|
|
4870
|
+
const raw = await (0, import_promises2.readFile)(filePath, "utf-8");
|
|
4871
|
+
const cargo = (0, import_smol_toml.parse)(raw);
|
|
4872
|
+
let modified = false;
|
|
4873
|
+
for (const section of ["dependencies", "build-dependencies"]) {
|
|
4874
|
+
const sectionData = cargo[section];
|
|
4875
|
+
if (!sectionData) continue;
|
|
4876
|
+
for (const [depName, depValue] of Object.entries(sectionData)) {
|
|
4877
|
+
if (typeof depValue === "object" && depValue !== null && "path" in depValue && siblingVersions.has(depName)) {
|
|
4878
|
+
const dep = depValue;
|
|
4879
|
+
dep.version = siblingVersions.get(depName);
|
|
4880
|
+
modified = true;
|
|
4881
|
+
}
|
|
4882
|
+
}
|
|
4883
|
+
}
|
|
4884
|
+
if (modified) {
|
|
4885
|
+
await (0, import_promises2.writeFile)(filePath, (0, import_smol_toml.stringify)(cargo));
|
|
4886
|
+
}
|
|
4887
|
+
return modified;
|
|
4888
|
+
}
|
|
4889
|
+
async syncLockfile() {
|
|
4890
|
+
const lockfilePath = await this.findLockfile();
|
|
4891
|
+
if (!lockfilePath) return void 0;
|
|
4892
|
+
const name = await this.packageName();
|
|
4893
|
+
await (0, import_tinyexec2.exec)("cargo", ["update", "--package", name], {
|
|
4894
|
+
nodeOptions: { cwd: import_node_path2.default.dirname(lockfilePath) }
|
|
4895
|
+
});
|
|
4896
|
+
return lockfilePath;
|
|
4897
|
+
}
|
|
4898
|
+
async findLockfile() {
|
|
4899
|
+
let dir = this.packagePath;
|
|
4900
|
+
const { root } = import_node_path2.default.parse(dir);
|
|
4901
|
+
while (dir !== root) {
|
|
4902
|
+
const candidate = import_node_path2.default.join(dir, "Cargo.lock");
|
|
4903
|
+
try {
|
|
4904
|
+
if ((await (0, import_promises2.stat)(candidate)).isFile()) return candidate;
|
|
4905
|
+
} catch {
|
|
4906
|
+
}
|
|
4907
|
+
dir = import_node_path2.default.dirname(dir);
|
|
4908
|
+
}
|
|
4909
|
+
return void 0;
|
|
4910
|
+
}
|
|
4863
4911
|
async dependencies() {
|
|
4864
4912
|
const cargo = await this.readCargoToml();
|
|
4865
4913
|
const deps = [];
|
|
@@ -5156,8 +5204,15 @@ async function replaceVersion(version2, packages) {
|
|
|
5156
5204
|
);
|
|
5157
5205
|
}
|
|
5158
5206
|
return "jsr.json";
|
|
5159
|
-
})()
|
|
5160
|
-
|
|
5207
|
+
})()
|
|
5208
|
+
]);
|
|
5209
|
+
const cratePackages = (packages ?? []).filter(
|
|
5210
|
+
(pkg) => pkg.registries.includes("crates")
|
|
5211
|
+
);
|
|
5212
|
+
const crateFiles = [];
|
|
5213
|
+
if (cratePackages.length > 0) {
|
|
5214
|
+
const ecosystems = [];
|
|
5215
|
+
for (const pkg of cratePackages) {
|
|
5161
5216
|
const eco = new RustEcosystem(import_node_path3.default.resolve(pkg.path));
|
|
5162
5217
|
try {
|
|
5163
5218
|
await eco.writeVersion(version2);
|
|
@@ -5167,10 +5222,38 @@ async function replaceVersion(version2, packages) {
|
|
|
5167
5222
|
{ cause: error }
|
|
5168
5223
|
);
|
|
5169
5224
|
}
|
|
5170
|
-
|
|
5171
|
-
}
|
|
5172
|
-
|
|
5173
|
-
|
|
5225
|
+
ecosystems.push({ eco, pkg });
|
|
5226
|
+
}
|
|
5227
|
+
if (ecosystems.length > 1) {
|
|
5228
|
+
const siblingVersions = /* @__PURE__ */ new Map();
|
|
5229
|
+
for (const { eco } of ecosystems) {
|
|
5230
|
+
siblingVersions.set(await eco.packageName(), version2);
|
|
5231
|
+
}
|
|
5232
|
+
await Promise.all(
|
|
5233
|
+
ecosystems.map(
|
|
5234
|
+
({ eco }) => eco.updateSiblingDependencyVersions(siblingVersions)
|
|
5235
|
+
)
|
|
5236
|
+
);
|
|
5237
|
+
}
|
|
5238
|
+
for (const { eco, pkg } of ecosystems) {
|
|
5239
|
+
crateFiles.push(import_node_path3.default.join(pkg.path, "Cargo.toml"));
|
|
5240
|
+
try {
|
|
5241
|
+
const lockfilePath = await eco.syncLockfile();
|
|
5242
|
+
if (lockfilePath) crateFiles.push(lockfilePath);
|
|
5243
|
+
} catch (error) {
|
|
5244
|
+
throw new AbstractError(
|
|
5245
|
+
`Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
|
|
5246
|
+
{ cause: error }
|
|
5247
|
+
);
|
|
5248
|
+
}
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
const allFiles = [];
|
|
5252
|
+
for (const r of results) {
|
|
5253
|
+
if (r) allFiles.push(r);
|
|
5254
|
+
}
|
|
5255
|
+
allFiles.push(...crateFiles);
|
|
5256
|
+
return [...new Set(allFiles)];
|
|
5174
5257
|
}
|
|
5175
5258
|
|
|
5176
5259
|
// src/utils/package-manager.ts
|
|
@@ -5332,7 +5415,7 @@ function injectTokensToEnv(tokens) {
|
|
|
5332
5415
|
|
|
5333
5416
|
// src/registry/crates.ts
|
|
5334
5417
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
5335
|
-
var
|
|
5418
|
+
var import_tinyexec3 = require("tinyexec");
|
|
5336
5419
|
|
|
5337
5420
|
// src/registry/registry.ts
|
|
5338
5421
|
var Registry = class {
|
|
@@ -5372,7 +5455,7 @@ var CratesRegistry = class extends Registry {
|
|
|
5372
5455
|
}
|
|
5373
5456
|
async isInstalled() {
|
|
5374
5457
|
try {
|
|
5375
|
-
await (0,
|
|
5458
|
+
await (0, import_tinyexec3.exec)("cargo", ["--version"]);
|
|
5376
5459
|
return true;
|
|
5377
5460
|
} catch {
|
|
5378
5461
|
return false;
|
|
@@ -5413,10 +5496,10 @@ var CratesRegistry = class extends Registry {
|
|
|
5413
5496
|
if (manifestDir) {
|
|
5414
5497
|
args.push("--manifest-path", import_node_path5.default.join(manifestDir, "Cargo.toml"));
|
|
5415
5498
|
}
|
|
5416
|
-
await (0,
|
|
5499
|
+
await (0, import_tinyexec3.exec)("cargo", args, { throwOnError: true });
|
|
5417
5500
|
return true;
|
|
5418
5501
|
} catch (error) {
|
|
5419
|
-
const stderr = error instanceof
|
|
5502
|
+
const stderr = error instanceof import_tinyexec3.NonZeroExitError ? error.output?.stderr : void 0;
|
|
5420
5503
|
const message = stderr ? `Failed to run \`cargo publish\`:
|
|
5421
5504
|
${stderr}` : "Failed to run `cargo publish`";
|
|
5422
5505
|
throw new CratesError(message, { cause: error });
|
|
@@ -5428,9 +5511,9 @@ ${stderr}` : "Failed to run `cargo publish`";
|
|
|
5428
5511
|
if (manifestDir) {
|
|
5429
5512
|
args.push("--manifest-path", import_node_path5.default.join(manifestDir, "Cargo.toml"));
|
|
5430
5513
|
}
|
|
5431
|
-
await (0,
|
|
5514
|
+
await (0, import_tinyexec3.exec)("cargo", args, { throwOnError: true });
|
|
5432
5515
|
} catch (error) {
|
|
5433
|
-
const stderr = error instanceof
|
|
5516
|
+
const stderr = error instanceof import_tinyexec3.NonZeroExitError ? error.output?.stderr : void 0;
|
|
5434
5517
|
const message = stderr ? `Failed to run \`cargo publish --dry-run\`:
|
|
5435
5518
|
${stderr}` : "Failed to run `cargo publish --dry-run`";
|
|
5436
5519
|
throw new CratesError(message, { cause: error });
|
|
@@ -5526,7 +5609,7 @@ var cratesPublishTasks = createCratesPublishTask();
|
|
|
5526
5609
|
var import_prompt_adapter_enquirer = require("@listr2/prompt-adapter-enquirer");
|
|
5527
5610
|
|
|
5528
5611
|
// src/registry/jsr.ts
|
|
5529
|
-
var
|
|
5612
|
+
var import_tinyexec4 = require("tinyexec");
|
|
5530
5613
|
|
|
5531
5614
|
// src/utils/package-name.ts
|
|
5532
5615
|
var import_node_module = require("module");
|
|
@@ -5594,7 +5677,7 @@ var JsrRegisry = class extends Registry {
|
|
|
5594
5677
|
this.client = new JsrClient(getApiEndpoint(this.registry));
|
|
5595
5678
|
}
|
|
5596
5679
|
async jsr(args) {
|
|
5597
|
-
const { stdout } = await (0,
|
|
5680
|
+
const { stdout } = await (0, import_tinyexec4.exec)("jsr", args, { throwOnError: true });
|
|
5598
5681
|
return stdout;
|
|
5599
5682
|
}
|
|
5600
5683
|
async isInstalled() {
|
|
@@ -5610,7 +5693,7 @@ var JsrRegisry = class extends Registry {
|
|
|
5610
5693
|
}
|
|
5611
5694
|
async ping() {
|
|
5612
5695
|
try {
|
|
5613
|
-
const { stdout } = await (0,
|
|
5696
|
+
const { stdout } = await (0, import_tinyexec4.exec)(
|
|
5614
5697
|
"ping",
|
|
5615
5698
|
[new URL(this.registry).hostname, "-c", "1"],
|
|
5616
5699
|
{ throwOnError: true }
|
|
@@ -5625,7 +5708,7 @@ var JsrRegisry = class extends Registry {
|
|
|
5625
5708
|
}
|
|
5626
5709
|
async publish() {
|
|
5627
5710
|
try {
|
|
5628
|
-
await (0,
|
|
5711
|
+
await (0, import_tinyexec4.exec)(
|
|
5629
5712
|
"jsr",
|
|
5630
5713
|
["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
|
|
5631
5714
|
{
|
|
@@ -5635,7 +5718,7 @@ var JsrRegisry = class extends Registry {
|
|
|
5635
5718
|
this.packageCreationUrls = void 0;
|
|
5636
5719
|
return true;
|
|
5637
5720
|
} catch (error) {
|
|
5638
|
-
const stderr = error instanceof
|
|
5721
|
+
const stderr = error instanceof import_tinyexec4.NonZeroExitError ? error.output?.stderr : void 0;
|
|
5639
5722
|
if (stderr?.includes("don't exist")) {
|
|
5640
5723
|
const urls = [...stderr.matchAll(/https:\/\/jsr\.io\/new\S+/g)].map(
|
|
5641
5724
|
(m) => m[0]
|
|
@@ -5656,7 +5739,7 @@ ${stderr}` : ""}`,
|
|
|
5656
5739
|
}
|
|
5657
5740
|
async dryRunPublish() {
|
|
5658
5741
|
try {
|
|
5659
|
-
await (0,
|
|
5742
|
+
await (0, import_tinyexec4.exec)(
|
|
5660
5743
|
"jsr",
|
|
5661
5744
|
[
|
|
5662
5745
|
"publish",
|
|
@@ -5916,7 +5999,7 @@ async function jsrRegistry() {
|
|
|
5916
5999
|
// src/registry/npm.ts
|
|
5917
6000
|
var import_node_os = require("os");
|
|
5918
6001
|
var import_node_path6 = require("path");
|
|
5919
|
-
var
|
|
6002
|
+
var import_tinyexec5 = require("tinyexec");
|
|
5920
6003
|
var NpmError = class extends AbstractError {
|
|
5921
6004
|
constructor() {
|
|
5922
6005
|
super(...arguments);
|
|
@@ -5929,7 +6012,7 @@ var NpmRegistry = class extends Registry {
|
|
|
5929
6012
|
__publicField(this, "registry", "https://registry.npmjs.org");
|
|
5930
6013
|
}
|
|
5931
6014
|
async npm(args) {
|
|
5932
|
-
const { stdout } = await (0,
|
|
6015
|
+
const { stdout } = await (0, import_tinyexec5.exec)("npm", args, { throwOnError: true });
|
|
5933
6016
|
return stdout;
|
|
5934
6017
|
}
|
|
5935
6018
|
async isInstalled() {
|
|
@@ -5973,7 +6056,7 @@ var NpmRegistry = class extends Registry {
|
|
|
5973
6056
|
await this.npm(["whoami"]);
|
|
5974
6057
|
return true;
|
|
5975
6058
|
} catch (error) {
|
|
5976
|
-
if (error instanceof
|
|
6059
|
+
if (error instanceof import_tinyexec5.NonZeroExitError) {
|
|
5977
6060
|
return false;
|
|
5978
6061
|
}
|
|
5979
6062
|
throw new NpmError("Failed to run `npm whoami`", { cause: error });
|
|
@@ -6040,7 +6123,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6040
6123
|
}
|
|
6041
6124
|
async ping() {
|
|
6042
6125
|
try {
|
|
6043
|
-
await (0,
|
|
6126
|
+
await (0, import_tinyexec5.exec)("npm", ["ping"], { throwOnError: true });
|
|
6044
6127
|
return true;
|
|
6045
6128
|
} catch (error) {
|
|
6046
6129
|
throw new NpmError("Failed to run `npm ping`", { cause: error });
|
|
@@ -6051,7 +6134,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6051
6134
|
await this.npm(["publish", "--provenance", "--access", "public"]);
|
|
6052
6135
|
return true;
|
|
6053
6136
|
} catch (error) {
|
|
6054
|
-
if (error instanceof
|
|
6137
|
+
if (error instanceof import_tinyexec5.NonZeroExitError && error.output?.stderr.includes("EOTP")) {
|
|
6055
6138
|
return false;
|
|
6056
6139
|
}
|
|
6057
6140
|
throw this.classifyPublishError(error);
|
|
@@ -6063,7 +6146,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6063
6146
|
await this.npm(args);
|
|
6064
6147
|
return true;
|
|
6065
6148
|
} catch (error) {
|
|
6066
|
-
if (error instanceof
|
|
6149
|
+
if (error instanceof import_tinyexec5.NonZeroExitError && error.output?.stderr.includes("EOTP")) {
|
|
6067
6150
|
return false;
|
|
6068
6151
|
}
|
|
6069
6152
|
throw this.classifyPublishError(error);
|
|
@@ -6071,7 +6154,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6071
6154
|
}
|
|
6072
6155
|
async dryRunPublish() {
|
|
6073
6156
|
try {
|
|
6074
|
-
await (0,
|
|
6157
|
+
await (0, import_tinyexec5.exec)("npm", ["publish", "--dry-run"], {
|
|
6075
6158
|
throwOnError: true,
|
|
6076
6159
|
nodeOptions: {
|
|
6077
6160
|
env: {
|
|
@@ -6081,7 +6164,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6081
6164
|
}
|
|
6082
6165
|
});
|
|
6083
6166
|
} catch (error) {
|
|
6084
|
-
const stderr = error instanceof
|
|
6167
|
+
const stderr = error instanceof import_tinyexec5.NonZeroExitError ? error.output?.stderr : void 0;
|
|
6085
6168
|
throw new NpmError(
|
|
6086
6169
|
`Failed to run \`npm publish --dry-run\`${stderr ? `
|
|
6087
6170
|
${stderr}` : ""}`,
|
|
@@ -6108,7 +6191,7 @@ ${stderr}` : ""}`,
|
|
|
6108
6191
|
};
|
|
6109
6192
|
}
|
|
6110
6193
|
classifyPublishError(error) {
|
|
6111
|
-
if (error instanceof
|
|
6194
|
+
if (error instanceof import_tinyexec5.NonZeroExitError) {
|
|
6112
6195
|
const stderr = error.output?.stderr ?? "";
|
|
6113
6196
|
if (stderr.includes("EOTP")) {
|
|
6114
6197
|
return new NpmError("OTP required for publishing", { cause: error });
|
|
@@ -6562,7 +6645,7 @@ var npmPublishTasks = {
|
|
|
6562
6645
|
// src/tasks/preflight.ts
|
|
6563
6646
|
var import_node_crypto2 = require("crypto");
|
|
6564
6647
|
var import_prompt_adapter_enquirer4 = require("@listr2/prompt-adapter-enquirer");
|
|
6565
|
-
var
|
|
6648
|
+
var import_tinyexec6 = require("tinyexec");
|
|
6566
6649
|
var PreflightError = class extends AbstractError {
|
|
6567
6650
|
constructor() {
|
|
6568
6651
|
super(...arguments);
|
|
@@ -6589,7 +6672,7 @@ async function syncGhSecrets(tokens) {
|
|
|
6589
6672
|
for (const [registry, token] of Object.entries(tokens)) {
|
|
6590
6673
|
const config = TOKEN_CONFIG[registry];
|
|
6591
6674
|
if (!config) continue;
|
|
6592
|
-
const result = (0,
|
|
6675
|
+
const result = (0, import_tinyexec6.exec)("gh", ["secret", "set", config.ghSecretName], {
|
|
6593
6676
|
throwOnError: true
|
|
6594
6677
|
});
|
|
6595
6678
|
const proc = result.process;
|
|
@@ -6783,10 +6866,10 @@ var prerequisitesCheckTask = (options) => {
|
|
|
6783
6866
|
var import_prompt_adapter_enquirer6 = require("@listr2/prompt-adapter-enquirer");
|
|
6784
6867
|
|
|
6785
6868
|
// src/registry/custom-registry.ts
|
|
6786
|
-
var
|
|
6869
|
+
var import_tinyexec7 = require("tinyexec");
|
|
6787
6870
|
var CustomRegistry = class extends NpmRegistry {
|
|
6788
6871
|
async npm(args) {
|
|
6789
|
-
const { stdout } = await (0,
|
|
6872
|
+
const { stdout } = await (0, import_tinyexec7.exec)(
|
|
6790
6873
|
"npm",
|
|
6791
6874
|
args.concat("--registry", this.registry),
|
|
6792
6875
|
{ throwOnError: true }
|
|
@@ -7103,7 +7186,7 @@ async function run(options) {
|
|
|
7103
7186
|
task: async (ctx2) => {
|
|
7104
7187
|
const packageManager = await getPackageManager();
|
|
7105
7188
|
try {
|
|
7106
|
-
await (0,
|
|
7189
|
+
await (0, import_tinyexec8.exec)(packageManager, ["run", ctx2.testScript], {
|
|
7107
7190
|
throwOnError: true
|
|
7108
7191
|
});
|
|
7109
7192
|
} catch (error) {
|
|
@@ -7120,7 +7203,7 @@ async function run(options) {
|
|
|
7120
7203
|
task: async (ctx2) => {
|
|
7121
7204
|
const packageManager = await getPackageManager();
|
|
7122
7205
|
try {
|
|
7123
|
-
await (0,
|
|
7206
|
+
await (0, import_tinyexec8.exec)(packageManager, ["run", ctx2.buildScript], {
|
|
7124
7207
|
throwOnError: true
|
|
7125
7208
|
});
|
|
7126
7209
|
} catch (error) {
|
|
@@ -7180,7 +7263,7 @@ async function run(options) {
|
|
|
7180
7263
|
}
|
|
7181
7264
|
},
|
|
7182
7265
|
{
|
|
7183
|
-
skip: (ctx2) => options.skipPublish || !!ctx2.preview || options.preflight,
|
|
7266
|
+
skip: (ctx2) => !!options.skipPublish || !!ctx2.preview || !!options.preflight,
|
|
7184
7267
|
title: "Publishing",
|
|
7185
7268
|
task: async (ctx2, parentTask) => parentTask.newListr(await collectPublishTasks(ctx2), {
|
|
7186
7269
|
concurrent: true
|
|
@@ -7206,7 +7289,7 @@ async function run(options) {
|
|
|
7206
7289
|
}
|
|
7207
7290
|
},
|
|
7208
7291
|
{
|
|
7209
|
-
skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
|
|
7292
|
+
skip: (ctx2) => !!options.skipReleaseDraft || !!ctx2.preview,
|
|
7210
7293
|
title: "Creating release draft on GitHub",
|
|
7211
7294
|
task: async (ctx2, task) => {
|
|
7212
7295
|
const git = new Git();
|
package/dist/index.js
CHANGED
|
@@ -4453,7 +4453,7 @@ var Listr = (_a23 = class {
|
|
|
4453
4453
|
// src/tasks/runner.ts
|
|
4454
4454
|
import SemVer from "semver";
|
|
4455
4455
|
import { isCI as isCI2 } from "std-env";
|
|
4456
|
-
import { exec as
|
|
4456
|
+
import { exec as exec9 } from "tinyexec";
|
|
4457
4457
|
|
|
4458
4458
|
// src/error.ts
|
|
4459
4459
|
var AbstractError = class extends Error {
|
|
@@ -4785,6 +4785,7 @@ function link2(text, url) {
|
|
|
4785
4785
|
import { readFile, stat as stat2, writeFile } from "node:fs/promises";
|
|
4786
4786
|
import path2 from "node:path";
|
|
4787
4787
|
import { parse, stringify } from "smol-toml";
|
|
4788
|
+
import { exec as exec3 } from "tinyexec";
|
|
4788
4789
|
|
|
4789
4790
|
// src/ecosystem/ecosystem.ts
|
|
4790
4791
|
var Ecosystem = class {
|
|
@@ -4827,6 +4828,53 @@ var RustEcosystem = class extends Ecosystem {
|
|
|
4827
4828
|
pkg.version = newVersion;
|
|
4828
4829
|
await writeFile(filePath, stringify(cargo));
|
|
4829
4830
|
}
|
|
4831
|
+
/**
|
|
4832
|
+
* Update the `version` field of dependencies that match sibling crate names.
|
|
4833
|
+
* This ensures `cargo publish` works when crates depend on each other via path.
|
|
4834
|
+
*/
|
|
4835
|
+
async updateSiblingDependencyVersions(siblingVersions) {
|
|
4836
|
+
const filePath = path2.join(this.packagePath, "Cargo.toml");
|
|
4837
|
+
const raw = await readFile(filePath, "utf-8");
|
|
4838
|
+
const cargo = parse(raw);
|
|
4839
|
+
let modified = false;
|
|
4840
|
+
for (const section of ["dependencies", "build-dependencies"]) {
|
|
4841
|
+
const sectionData = cargo[section];
|
|
4842
|
+
if (!sectionData) continue;
|
|
4843
|
+
for (const [depName, depValue] of Object.entries(sectionData)) {
|
|
4844
|
+
if (typeof depValue === "object" && depValue !== null && "path" in depValue && siblingVersions.has(depName)) {
|
|
4845
|
+
const dep = depValue;
|
|
4846
|
+
dep.version = siblingVersions.get(depName);
|
|
4847
|
+
modified = true;
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4851
|
+
if (modified) {
|
|
4852
|
+
await writeFile(filePath, stringify(cargo));
|
|
4853
|
+
}
|
|
4854
|
+
return modified;
|
|
4855
|
+
}
|
|
4856
|
+
async syncLockfile() {
|
|
4857
|
+
const lockfilePath = await this.findLockfile();
|
|
4858
|
+
if (!lockfilePath) return void 0;
|
|
4859
|
+
const name = await this.packageName();
|
|
4860
|
+
await exec3("cargo", ["update", "--package", name], {
|
|
4861
|
+
nodeOptions: { cwd: path2.dirname(lockfilePath) }
|
|
4862
|
+
});
|
|
4863
|
+
return lockfilePath;
|
|
4864
|
+
}
|
|
4865
|
+
async findLockfile() {
|
|
4866
|
+
let dir = this.packagePath;
|
|
4867
|
+
const { root } = path2.parse(dir);
|
|
4868
|
+
while (dir !== root) {
|
|
4869
|
+
const candidate = path2.join(dir, "Cargo.lock");
|
|
4870
|
+
try {
|
|
4871
|
+
if ((await stat2(candidate)).isFile()) return candidate;
|
|
4872
|
+
} catch {
|
|
4873
|
+
}
|
|
4874
|
+
dir = path2.dirname(dir);
|
|
4875
|
+
}
|
|
4876
|
+
return void 0;
|
|
4877
|
+
}
|
|
4830
4878
|
async dependencies() {
|
|
4831
4879
|
const cargo = await this.readCargoToml();
|
|
4832
4880
|
const deps = [];
|
|
@@ -5123,8 +5171,15 @@ async function replaceVersion(version2, packages) {
|
|
|
5123
5171
|
);
|
|
5124
5172
|
}
|
|
5125
5173
|
return "jsr.json";
|
|
5126
|
-
})()
|
|
5127
|
-
|
|
5174
|
+
})()
|
|
5175
|
+
]);
|
|
5176
|
+
const cratePackages = (packages ?? []).filter(
|
|
5177
|
+
(pkg) => pkg.registries.includes("crates")
|
|
5178
|
+
);
|
|
5179
|
+
const crateFiles = [];
|
|
5180
|
+
if (cratePackages.length > 0) {
|
|
5181
|
+
const ecosystems = [];
|
|
5182
|
+
for (const pkg of cratePackages) {
|
|
5128
5183
|
const eco = new RustEcosystem(path3.resolve(pkg.path));
|
|
5129
5184
|
try {
|
|
5130
5185
|
await eco.writeVersion(version2);
|
|
@@ -5134,10 +5189,38 @@ async function replaceVersion(version2, packages) {
|
|
|
5134
5189
|
{ cause: error }
|
|
5135
5190
|
);
|
|
5136
5191
|
}
|
|
5137
|
-
|
|
5138
|
-
}
|
|
5139
|
-
|
|
5140
|
-
|
|
5192
|
+
ecosystems.push({ eco, pkg });
|
|
5193
|
+
}
|
|
5194
|
+
if (ecosystems.length > 1) {
|
|
5195
|
+
const siblingVersions = /* @__PURE__ */ new Map();
|
|
5196
|
+
for (const { eco } of ecosystems) {
|
|
5197
|
+
siblingVersions.set(await eco.packageName(), version2);
|
|
5198
|
+
}
|
|
5199
|
+
await Promise.all(
|
|
5200
|
+
ecosystems.map(
|
|
5201
|
+
({ eco }) => eco.updateSiblingDependencyVersions(siblingVersions)
|
|
5202
|
+
)
|
|
5203
|
+
);
|
|
5204
|
+
}
|
|
5205
|
+
for (const { eco, pkg } of ecosystems) {
|
|
5206
|
+
crateFiles.push(path3.join(pkg.path, "Cargo.toml"));
|
|
5207
|
+
try {
|
|
5208
|
+
const lockfilePath = await eco.syncLockfile();
|
|
5209
|
+
if (lockfilePath) crateFiles.push(lockfilePath);
|
|
5210
|
+
} catch (error) {
|
|
5211
|
+
throw new AbstractError(
|
|
5212
|
+
`Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
|
|
5213
|
+
{ cause: error }
|
|
5214
|
+
);
|
|
5215
|
+
}
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5218
|
+
const allFiles = [];
|
|
5219
|
+
for (const r of results) {
|
|
5220
|
+
if (r) allFiles.push(r);
|
|
5221
|
+
}
|
|
5222
|
+
allFiles.push(...crateFiles);
|
|
5223
|
+
return [...new Set(allFiles)];
|
|
5141
5224
|
}
|
|
5142
5225
|
|
|
5143
5226
|
// src/utils/package-manager.ts
|
|
@@ -5298,7 +5381,7 @@ function injectTokensToEnv(tokens) {
|
|
|
5298
5381
|
|
|
5299
5382
|
// src/registry/crates.ts
|
|
5300
5383
|
import path5 from "node:path";
|
|
5301
|
-
import { exec as
|
|
5384
|
+
import { exec as exec4, NonZeroExitError } from "tinyexec";
|
|
5302
5385
|
|
|
5303
5386
|
// src/registry/registry.ts
|
|
5304
5387
|
var Registry = class {
|
|
@@ -5338,7 +5421,7 @@ var CratesRegistry = class extends Registry {
|
|
|
5338
5421
|
}
|
|
5339
5422
|
async isInstalled() {
|
|
5340
5423
|
try {
|
|
5341
|
-
await
|
|
5424
|
+
await exec4("cargo", ["--version"]);
|
|
5342
5425
|
return true;
|
|
5343
5426
|
} catch {
|
|
5344
5427
|
return false;
|
|
@@ -5379,7 +5462,7 @@ var CratesRegistry = class extends Registry {
|
|
|
5379
5462
|
if (manifestDir) {
|
|
5380
5463
|
args.push("--manifest-path", path5.join(manifestDir, "Cargo.toml"));
|
|
5381
5464
|
}
|
|
5382
|
-
await
|
|
5465
|
+
await exec4("cargo", args, { throwOnError: true });
|
|
5383
5466
|
return true;
|
|
5384
5467
|
} catch (error) {
|
|
5385
5468
|
const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
|
|
@@ -5394,7 +5477,7 @@ ${stderr}` : "Failed to run `cargo publish`";
|
|
|
5394
5477
|
if (manifestDir) {
|
|
5395
5478
|
args.push("--manifest-path", path5.join(manifestDir, "Cargo.toml"));
|
|
5396
5479
|
}
|
|
5397
|
-
await
|
|
5480
|
+
await exec4("cargo", args, { throwOnError: true });
|
|
5398
5481
|
} catch (error) {
|
|
5399
5482
|
const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
|
|
5400
5483
|
const message = stderr ? `Failed to run \`cargo publish --dry-run\`:
|
|
@@ -5492,7 +5575,7 @@ var cratesPublishTasks = createCratesPublishTask();
|
|
|
5492
5575
|
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
5493
5576
|
|
|
5494
5577
|
// src/registry/jsr.ts
|
|
5495
|
-
import { exec as
|
|
5578
|
+
import { exec as exec5, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
|
|
5496
5579
|
|
|
5497
5580
|
// src/utils/package-name.ts
|
|
5498
5581
|
import { builtinModules } from "node:module";
|
|
@@ -5559,7 +5642,7 @@ var JsrRegisry = class extends Registry {
|
|
|
5559
5642
|
this.client = new JsrClient(getApiEndpoint(this.registry));
|
|
5560
5643
|
}
|
|
5561
5644
|
async jsr(args) {
|
|
5562
|
-
const { stdout } = await
|
|
5645
|
+
const { stdout } = await exec5("jsr", args, { throwOnError: true });
|
|
5563
5646
|
return stdout;
|
|
5564
5647
|
}
|
|
5565
5648
|
async isInstalled() {
|
|
@@ -5575,7 +5658,7 @@ var JsrRegisry = class extends Registry {
|
|
|
5575
5658
|
}
|
|
5576
5659
|
async ping() {
|
|
5577
5660
|
try {
|
|
5578
|
-
const { stdout } = await
|
|
5661
|
+
const { stdout } = await exec5(
|
|
5579
5662
|
"ping",
|
|
5580
5663
|
[new URL(this.registry).hostname, "-c", "1"],
|
|
5581
5664
|
{ throwOnError: true }
|
|
@@ -5590,7 +5673,7 @@ var JsrRegisry = class extends Registry {
|
|
|
5590
5673
|
}
|
|
5591
5674
|
async publish() {
|
|
5592
5675
|
try {
|
|
5593
|
-
await
|
|
5676
|
+
await exec5(
|
|
5594
5677
|
"jsr",
|
|
5595
5678
|
["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
|
|
5596
5679
|
{
|
|
@@ -5621,7 +5704,7 @@ ${stderr}` : ""}`,
|
|
|
5621
5704
|
}
|
|
5622
5705
|
async dryRunPublish() {
|
|
5623
5706
|
try {
|
|
5624
|
-
await
|
|
5707
|
+
await exec5(
|
|
5625
5708
|
"jsr",
|
|
5626
5709
|
[
|
|
5627
5710
|
"publish",
|
|
@@ -5881,7 +5964,7 @@ async function jsrRegistry() {
|
|
|
5881
5964
|
// src/registry/npm.ts
|
|
5882
5965
|
import { tmpdir } from "node:os";
|
|
5883
5966
|
import { join } from "node:path";
|
|
5884
|
-
import { exec as
|
|
5967
|
+
import { exec as exec6, NonZeroExitError as NonZeroExitError3 } from "tinyexec";
|
|
5885
5968
|
var NpmError = class extends AbstractError {
|
|
5886
5969
|
constructor() {
|
|
5887
5970
|
super(...arguments);
|
|
@@ -5894,7 +5977,7 @@ var NpmRegistry = class extends Registry {
|
|
|
5894
5977
|
__publicField(this, "registry", "https://registry.npmjs.org");
|
|
5895
5978
|
}
|
|
5896
5979
|
async npm(args) {
|
|
5897
|
-
const { stdout } = await
|
|
5980
|
+
const { stdout } = await exec6("npm", args, { throwOnError: true });
|
|
5898
5981
|
return stdout;
|
|
5899
5982
|
}
|
|
5900
5983
|
async isInstalled() {
|
|
@@ -6005,7 +6088,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6005
6088
|
}
|
|
6006
6089
|
async ping() {
|
|
6007
6090
|
try {
|
|
6008
|
-
await
|
|
6091
|
+
await exec6("npm", ["ping"], { throwOnError: true });
|
|
6009
6092
|
return true;
|
|
6010
6093
|
} catch (error) {
|
|
6011
6094
|
throw new NpmError("Failed to run `npm ping`", { cause: error });
|
|
@@ -6036,7 +6119,7 @@ var NpmRegistry = class extends Registry {
|
|
|
6036
6119
|
}
|
|
6037
6120
|
async dryRunPublish() {
|
|
6038
6121
|
try {
|
|
6039
|
-
await
|
|
6122
|
+
await exec6("npm", ["publish", "--dry-run"], {
|
|
6040
6123
|
throwOnError: true,
|
|
6041
6124
|
nodeOptions: {
|
|
6042
6125
|
env: {
|
|
@@ -6527,7 +6610,7 @@ var npmPublishTasks = {
|
|
|
6527
6610
|
// src/tasks/preflight.ts
|
|
6528
6611
|
import { createHash as createHash2 } from "node:crypto";
|
|
6529
6612
|
import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter4 } from "@listr2/prompt-adapter-enquirer";
|
|
6530
|
-
import { exec as
|
|
6613
|
+
import { exec as exec7 } from "tinyexec";
|
|
6531
6614
|
var PreflightError = class extends AbstractError {
|
|
6532
6615
|
constructor() {
|
|
6533
6616
|
super(...arguments);
|
|
@@ -6554,7 +6637,7 @@ async function syncGhSecrets(tokens) {
|
|
|
6554
6637
|
for (const [registry, token] of Object.entries(tokens)) {
|
|
6555
6638
|
const config = TOKEN_CONFIG[registry];
|
|
6556
6639
|
if (!config) continue;
|
|
6557
|
-
const result =
|
|
6640
|
+
const result = exec7("gh", ["secret", "set", config.ghSecretName], {
|
|
6558
6641
|
throwOnError: true
|
|
6559
6642
|
});
|
|
6560
6643
|
const proc = result.process;
|
|
@@ -6748,10 +6831,10 @@ var prerequisitesCheckTask = (options) => {
|
|
|
6748
6831
|
import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter6 } from "@listr2/prompt-adapter-enquirer";
|
|
6749
6832
|
|
|
6750
6833
|
// src/registry/custom-registry.ts
|
|
6751
|
-
import { exec as
|
|
6834
|
+
import { exec as exec8 } from "tinyexec";
|
|
6752
6835
|
var CustomRegistry = class extends NpmRegistry {
|
|
6753
6836
|
async npm(args) {
|
|
6754
|
-
const { stdout } = await
|
|
6837
|
+
const { stdout } = await exec8(
|
|
6755
6838
|
"npm",
|
|
6756
6839
|
args.concat("--registry", this.registry),
|
|
6757
6840
|
{ throwOnError: true }
|
|
@@ -7067,7 +7150,7 @@ async function run(options) {
|
|
|
7067
7150
|
task: async (ctx2) => {
|
|
7068
7151
|
const packageManager = await getPackageManager();
|
|
7069
7152
|
try {
|
|
7070
|
-
await
|
|
7153
|
+
await exec9(packageManager, ["run", ctx2.testScript], {
|
|
7071
7154
|
throwOnError: true
|
|
7072
7155
|
});
|
|
7073
7156
|
} catch (error) {
|
|
@@ -7084,7 +7167,7 @@ async function run(options) {
|
|
|
7084
7167
|
task: async (ctx2) => {
|
|
7085
7168
|
const packageManager = await getPackageManager();
|
|
7086
7169
|
try {
|
|
7087
|
-
await
|
|
7170
|
+
await exec9(packageManager, ["run", ctx2.buildScript], {
|
|
7088
7171
|
throwOnError: true
|
|
7089
7172
|
});
|
|
7090
7173
|
} catch (error) {
|
|
@@ -7144,7 +7227,7 @@ async function run(options) {
|
|
|
7144
7227
|
}
|
|
7145
7228
|
},
|
|
7146
7229
|
{
|
|
7147
|
-
skip: (ctx2) => options.skipPublish || !!ctx2.preview || options.preflight,
|
|
7230
|
+
skip: (ctx2) => !!options.skipPublish || !!ctx2.preview || !!options.preflight,
|
|
7148
7231
|
title: "Publishing",
|
|
7149
7232
|
task: async (ctx2, parentTask) => parentTask.newListr(await collectPublishTasks(ctx2), {
|
|
7150
7233
|
concurrent: true
|
|
@@ -7170,7 +7253,7 @@ async function run(options) {
|
|
|
7170
7253
|
}
|
|
7171
7254
|
},
|
|
7172
7255
|
{
|
|
7173
|
-
skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
|
|
7256
|
+
skip: (ctx2) => !!options.skipReleaseDraft || !!ctx2.preview,
|
|
7174
7257
|
title: "Creating release draft on GitHub",
|
|
7175
7258
|
task: async (ctx2, task) => {
|
|
7176
7259
|
const git = new Git();
|