pubm 0.1.5 → 0.1.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 +221 -170
- package/dist/index.cjs +241 -190
- package/dist/index.js +238 -187
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -5289,9 +5289,71 @@ function createListr(...args) {
|
|
|
5289
5289
|
}
|
|
5290
5290
|
|
|
5291
5291
|
// src/utils/package.ts
|
|
5292
|
+
import { readFile as readFile2, stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
|
|
5293
|
+
import path8 from "node:path";
|
|
5294
|
+
import process11 from "node:process";
|
|
5295
|
+
|
|
5296
|
+
// src/ecosystem/rust.ts
|
|
5292
5297
|
import { readFile, stat as stat2, writeFile } from "node:fs/promises";
|
|
5293
5298
|
import path7 from "node:path";
|
|
5294
|
-
import
|
|
5299
|
+
import { parse, stringify } from "smol-toml";
|
|
5300
|
+
|
|
5301
|
+
// src/ecosystem/ecosystem.ts
|
|
5302
|
+
var Ecosystem = class {
|
|
5303
|
+
constructor(packagePath) {
|
|
5304
|
+
this.packagePath = packagePath;
|
|
5305
|
+
}
|
|
5306
|
+
};
|
|
5307
|
+
|
|
5308
|
+
// src/ecosystem/rust.ts
|
|
5309
|
+
var RustEcosystem = class extends Ecosystem {
|
|
5310
|
+
static async detect(packagePath) {
|
|
5311
|
+
try {
|
|
5312
|
+
return (await stat2(path7.join(packagePath, "Cargo.toml"))).isFile();
|
|
5313
|
+
} catch {
|
|
5314
|
+
return false;
|
|
5315
|
+
}
|
|
5316
|
+
}
|
|
5317
|
+
async readCargoToml() {
|
|
5318
|
+
const raw = await readFile(
|
|
5319
|
+
path7.join(this.packagePath, "Cargo.toml"),
|
|
5320
|
+
"utf-8"
|
|
5321
|
+
);
|
|
5322
|
+
return parse(raw);
|
|
5323
|
+
}
|
|
5324
|
+
async packageName() {
|
|
5325
|
+
const cargo = await this.readCargoToml();
|
|
5326
|
+
const pkg = cargo.package;
|
|
5327
|
+
return pkg.name;
|
|
5328
|
+
}
|
|
5329
|
+
async readVersion() {
|
|
5330
|
+
const cargo = await this.readCargoToml();
|
|
5331
|
+
const pkg = cargo.package;
|
|
5332
|
+
return pkg.version;
|
|
5333
|
+
}
|
|
5334
|
+
async writeVersion(newVersion) {
|
|
5335
|
+
const filePath = path7.join(this.packagePath, "Cargo.toml");
|
|
5336
|
+
const raw = await readFile(filePath, "utf-8");
|
|
5337
|
+
const cargo = parse(raw);
|
|
5338
|
+
const pkg = cargo.package;
|
|
5339
|
+
pkg.version = newVersion;
|
|
5340
|
+
await writeFile(filePath, stringify(cargo));
|
|
5341
|
+
}
|
|
5342
|
+
manifestFiles() {
|
|
5343
|
+
return ["Cargo.toml"];
|
|
5344
|
+
}
|
|
5345
|
+
defaultTestCommand() {
|
|
5346
|
+
return "cargo test";
|
|
5347
|
+
}
|
|
5348
|
+
defaultBuildCommand() {
|
|
5349
|
+
return "cargo build --release";
|
|
5350
|
+
}
|
|
5351
|
+
supportedRegistries() {
|
|
5352
|
+
return ["crates"];
|
|
5353
|
+
}
|
|
5354
|
+
};
|
|
5355
|
+
|
|
5356
|
+
// src/utils/package.ts
|
|
5295
5357
|
var cachedPackageJson = {};
|
|
5296
5358
|
var cachedJsrJson = {};
|
|
5297
5359
|
function patchCachedJsrJson(contents, { cwd = process11.cwd() } = {}) {
|
|
@@ -5300,16 +5362,16 @@ function patchCachedJsrJson(contents, { cwd = process11.cwd() } = {}) {
|
|
|
5300
5362
|
async function findOutFile(file, { cwd = process11.cwd() } = {}) {
|
|
5301
5363
|
let directory = cwd;
|
|
5302
5364
|
let filePath = "";
|
|
5303
|
-
const { root } =
|
|
5365
|
+
const { root } = path8.parse(cwd);
|
|
5304
5366
|
while (directory) {
|
|
5305
|
-
filePath =
|
|
5367
|
+
filePath = path8.join(directory, file);
|
|
5306
5368
|
try {
|
|
5307
|
-
if ((await
|
|
5369
|
+
if ((await stat3(filePath)).isFile()) {
|
|
5308
5370
|
break;
|
|
5309
5371
|
}
|
|
5310
5372
|
} catch {
|
|
5311
5373
|
}
|
|
5312
|
-
directory =
|
|
5374
|
+
directory = path8.dirname(directory);
|
|
5313
5375
|
if (directory === root) return null;
|
|
5314
5376
|
}
|
|
5315
5377
|
return filePath;
|
|
@@ -5321,7 +5383,7 @@ async function getPackageJson({
|
|
|
5321
5383
|
if (cachedPackageJson[cwd]) return cachedPackageJson[cwd];
|
|
5322
5384
|
try {
|
|
5323
5385
|
const packageJsonPath = await findOutFile("package.json");
|
|
5324
|
-
const raw = packageJsonPath && (await
|
|
5386
|
+
const raw = packageJsonPath && (await readFile2(packageJsonPath)).toString();
|
|
5325
5387
|
if (!raw) {
|
|
5326
5388
|
if (!fallbackJsr) {
|
|
5327
5389
|
throw new Error(
|
|
@@ -5354,7 +5416,7 @@ async function getJsrJson({
|
|
|
5354
5416
|
if (cachedJsrJson[cwd]) return cachedJsrJson[cwd];
|
|
5355
5417
|
try {
|
|
5356
5418
|
const jsrJsonPath = await findOutFile("jsr.json");
|
|
5357
|
-
const raw = jsrJsonPath && (await
|
|
5419
|
+
const raw = jsrJsonPath && (await readFile2(jsrJsonPath)).toString();
|
|
5358
5420
|
if (!raw) {
|
|
5359
5421
|
if (!fallbackPackage) {
|
|
5360
5422
|
throw new Error(
|
|
@@ -5438,14 +5500,14 @@ async function version({ cwd = process11.cwd() } = {}) {
|
|
|
5438
5500
|
return version2;
|
|
5439
5501
|
}
|
|
5440
5502
|
var versionRegex = /("version"\s*:\s*")[^"]*(")/;
|
|
5441
|
-
async function replaceVersion(version2) {
|
|
5503
|
+
async function replaceVersion(version2, packages) {
|
|
5442
5504
|
const results = await Promise.all([
|
|
5443
5505
|
(async () => {
|
|
5444
5506
|
const packageJsonPath = await findOutFile("package.json");
|
|
5445
5507
|
if (!packageJsonPath) return void 0;
|
|
5446
|
-
const packageJson = (await
|
|
5508
|
+
const packageJson = (await readFile2(packageJsonPath)).toString();
|
|
5447
5509
|
try {
|
|
5448
|
-
await
|
|
5510
|
+
await writeFile2(
|
|
5449
5511
|
packageJsonPath,
|
|
5450
5512
|
packageJson.replace(versionRegex, `$1${version2}$2`)
|
|
5451
5513
|
);
|
|
@@ -5460,9 +5522,9 @@ async function replaceVersion(version2) {
|
|
|
5460
5522
|
(async () => {
|
|
5461
5523
|
const jsrJsonPath = await findOutFile("jsr.json");
|
|
5462
5524
|
if (!jsrJsonPath) return void 0;
|
|
5463
|
-
const jsrJson = (await
|
|
5525
|
+
const jsrJson = (await readFile2(jsrJsonPath)).toString();
|
|
5464
5526
|
try {
|
|
5465
|
-
await
|
|
5527
|
+
await writeFile2(
|
|
5466
5528
|
jsrJsonPath,
|
|
5467
5529
|
jsrJson.replace(versionRegex, `$1${version2}$2`)
|
|
5468
5530
|
);
|
|
@@ -5473,7 +5535,19 @@ async function replaceVersion(version2) {
|
|
|
5473
5535
|
);
|
|
5474
5536
|
}
|
|
5475
5537
|
return "jsr.json";
|
|
5476
|
-
})()
|
|
5538
|
+
})(),
|
|
5539
|
+
...(packages ?? []).filter((pkg) => pkg.registries.includes("crates")).map(async (pkg) => {
|
|
5540
|
+
const eco = new RustEcosystem(path8.resolve(pkg.path));
|
|
5541
|
+
try {
|
|
5542
|
+
await eco.writeVersion(version2);
|
|
5543
|
+
} catch (error) {
|
|
5544
|
+
throw new AbstractError(
|
|
5545
|
+
`Failed to write version to Cargo.toml at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
|
|
5546
|
+
{ cause: error }
|
|
5547
|
+
);
|
|
5548
|
+
}
|
|
5549
|
+
return path8.join(pkg.path, "Cargo.toml");
|
|
5550
|
+
})
|
|
5477
5551
|
]);
|
|
5478
5552
|
return results.filter((v) => v);
|
|
5479
5553
|
}
|
|
@@ -5494,67 +5568,26 @@ async function getPackageManager() {
|
|
|
5494
5568
|
return "npm";
|
|
5495
5569
|
}
|
|
5496
5570
|
|
|
5497
|
-
// src/
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
}
|
|
5508
|
-
|
|
5509
|
-
// src/ecosystem/rust.ts
|
|
5510
|
-
var RustEcosystem = class extends Ecosystem {
|
|
5511
|
-
static async detect(packagePath) {
|
|
5512
|
-
try {
|
|
5513
|
-
return (await stat3(path8.join(packagePath, "Cargo.toml"))).isFile();
|
|
5514
|
-
} catch {
|
|
5515
|
-
return false;
|
|
5571
|
+
// src/utils/registries.ts
|
|
5572
|
+
function collectRegistries(ctx) {
|
|
5573
|
+
if (ctx.packages?.length) {
|
|
5574
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5575
|
+
const result = [];
|
|
5576
|
+
for (const pkg of ctx.packages) {
|
|
5577
|
+
for (const reg of pkg.registries) {
|
|
5578
|
+
if (!seen.has(reg)) {
|
|
5579
|
+
seen.add(reg);
|
|
5580
|
+
result.push(reg);
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5516
5583
|
}
|
|
5584
|
+
return result;
|
|
5517
5585
|
}
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
path8.join(this.packagePath, "Cargo.toml"),
|
|
5521
|
-
"utf-8"
|
|
5522
|
-
);
|
|
5523
|
-
return parse(raw);
|
|
5524
|
-
}
|
|
5525
|
-
async packageName() {
|
|
5526
|
-
const cargo = await this.readCargoToml();
|
|
5527
|
-
const pkg = cargo.package;
|
|
5528
|
-
return pkg.name;
|
|
5529
|
-
}
|
|
5530
|
-
async readVersion() {
|
|
5531
|
-
const cargo = await this.readCargoToml();
|
|
5532
|
-
const pkg = cargo.package;
|
|
5533
|
-
return pkg.version;
|
|
5534
|
-
}
|
|
5535
|
-
async writeVersion(newVersion) {
|
|
5536
|
-
const filePath = path8.join(this.packagePath, "Cargo.toml");
|
|
5537
|
-
const raw = await readFile2(filePath, "utf-8");
|
|
5538
|
-
const cargo = parse(raw);
|
|
5539
|
-
const pkg = cargo.package;
|
|
5540
|
-
pkg.version = newVersion;
|
|
5541
|
-
await writeFile2(filePath, stringify(cargo));
|
|
5542
|
-
}
|
|
5543
|
-
manifestFiles() {
|
|
5544
|
-
return ["Cargo.toml"];
|
|
5545
|
-
}
|
|
5546
|
-
defaultTestCommand() {
|
|
5547
|
-
return "cargo test";
|
|
5548
|
-
}
|
|
5549
|
-
defaultBuildCommand() {
|
|
5550
|
-
return "cargo build --release";
|
|
5551
|
-
}
|
|
5552
|
-
supportedRegistries() {
|
|
5553
|
-
return ["crates"];
|
|
5554
|
-
}
|
|
5555
|
-
};
|
|
5586
|
+
return ctx.registries;
|
|
5587
|
+
}
|
|
5556
5588
|
|
|
5557
5589
|
// src/registry/crates.ts
|
|
5590
|
+
import path9 from "node:path";
|
|
5558
5591
|
import { exec as exec3 } from "tinyexec";
|
|
5559
5592
|
|
|
5560
5593
|
// src/registry/registry.ts
|
|
@@ -5628,9 +5661,13 @@ var CratesRegistry = class extends Registry {
|
|
|
5628
5661
|
);
|
|
5629
5662
|
}
|
|
5630
5663
|
}
|
|
5631
|
-
async publish() {
|
|
5664
|
+
async publish(manifestDir) {
|
|
5632
5665
|
try {
|
|
5633
|
-
|
|
5666
|
+
const args = ["publish"];
|
|
5667
|
+
if (manifestDir) {
|
|
5668
|
+
args.push("--manifest-path", path9.join(manifestDir, "Cargo.toml"));
|
|
5669
|
+
}
|
|
5670
|
+
await exec3("cargo", args, { throwOnError: true });
|
|
5634
5671
|
return true;
|
|
5635
5672
|
} catch (error) {
|
|
5636
5673
|
throw new CratesError("Failed to run `cargo publish`", {
|
|
@@ -5686,35 +5723,43 @@ var CratesError2 = class extends AbstractError {
|
|
|
5686
5723
|
this.stack = "";
|
|
5687
5724
|
}
|
|
5688
5725
|
};
|
|
5689
|
-
async function getCrateName() {
|
|
5690
|
-
const eco = new RustEcosystem(process.cwd());
|
|
5726
|
+
async function getCrateName(packagePath) {
|
|
5727
|
+
const eco = new RustEcosystem(packagePath ?? process.cwd());
|
|
5691
5728
|
return await eco.packageName();
|
|
5692
5729
|
}
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5730
|
+
function createCratesAvailableCheckTask(packagePath) {
|
|
5731
|
+
const label = packagePath ? ` (${packagePath})` : "";
|
|
5732
|
+
return {
|
|
5733
|
+
title: `Checking crates.io availability${label}`,
|
|
5734
|
+
task: async () => {
|
|
5735
|
+
const packageName = await getCrateName(packagePath);
|
|
5736
|
+
const registry = new CratesRegistry(packageName);
|
|
5737
|
+
if (!await registry.isInstalled()) {
|
|
5738
|
+
throw new CratesError2(
|
|
5739
|
+
"cargo is not installed. Please install Rust toolchain to proceed."
|
|
5740
|
+
);
|
|
5741
|
+
}
|
|
5742
|
+
if (!await registry.hasPermission()) {
|
|
5743
|
+
throw new CratesError2(
|
|
5744
|
+
"No crates.io credentials found. Run `cargo login` or set CARGO_REGISTRY_TOKEN."
|
|
5745
|
+
);
|
|
5746
|
+
}
|
|
5702
5747
|
}
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5748
|
+
};
|
|
5749
|
+
}
|
|
5750
|
+
function createCratesPublishTask(packagePath) {
|
|
5751
|
+
const label = packagePath ? ` (${packagePath})` : "";
|
|
5752
|
+
return {
|
|
5753
|
+
title: `Publishing to crates.io${label}`,
|
|
5754
|
+
task: async () => {
|
|
5755
|
+
const packageName = await getCrateName(packagePath);
|
|
5756
|
+
const registry = new CratesRegistry(packageName);
|
|
5757
|
+
await registry.publish(packagePath);
|
|
5707
5758
|
}
|
|
5708
|
-
}
|
|
5709
|
-
}
|
|
5710
|
-
var
|
|
5711
|
-
|
|
5712
|
-
task: async () => {
|
|
5713
|
-
const packageName = await getCrateName();
|
|
5714
|
-
const registry = new CratesRegistry(packageName);
|
|
5715
|
-
await registry.publish();
|
|
5716
|
-
}
|
|
5717
|
-
};
|
|
5759
|
+
};
|
|
5760
|
+
}
|
|
5761
|
+
var cratesAvailableCheckTasks = createCratesAvailableCheckTask();
|
|
5762
|
+
var cratesPublishTasks = createCratesPublishTask();
|
|
5718
5763
|
|
|
5719
5764
|
// src/tasks/jsr.ts
|
|
5720
5765
|
import process12 from "node:process";
|
|
@@ -5727,7 +5772,7 @@ import { exec as exec4, NonZeroExitError } from "tinyexec";
|
|
|
5727
5772
|
// src/utils/db.ts
|
|
5728
5773
|
import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
|
|
5729
5774
|
import { mkdirSync as mkdirSync5, readFileSync as readFileSync3, statSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
5730
|
-
import
|
|
5775
|
+
import path10 from "node:path";
|
|
5731
5776
|
var a = "aes-256-cbc";
|
|
5732
5777
|
var n = statSync(import.meta.dirname);
|
|
5733
5778
|
var k = `${n.rdev}${n.birthtimeMs}${n.nlink}${n.gid}`;
|
|
@@ -5742,7 +5787,7 @@ function d(g, h) {
|
|
|
5742
5787
|
}
|
|
5743
5788
|
var Db = class {
|
|
5744
5789
|
constructor() {
|
|
5745
|
-
__publicField(this, "path",
|
|
5790
|
+
__publicField(this, "path", path10.resolve(import.meta.dirname, ".pubm"));
|
|
5746
5791
|
try {
|
|
5747
5792
|
if (!statSync(this.path).isDirectory()) {
|
|
5748
5793
|
mkdirSync5(this.path);
|
|
@@ -5760,7 +5805,7 @@ var Db = class {
|
|
|
5760
5805
|
set(field, value) {
|
|
5761
5806
|
try {
|
|
5762
5807
|
writeFileSync4(
|
|
5763
|
-
|
|
5808
|
+
path10.resolve(
|
|
5764
5809
|
this.path,
|
|
5765
5810
|
Buffer.from(e(field, field)).toString("base64")
|
|
5766
5811
|
),
|
|
@@ -5774,7 +5819,7 @@ var Db = class {
|
|
|
5774
5819
|
}
|
|
5775
5820
|
}
|
|
5776
5821
|
get(field) {
|
|
5777
|
-
const filePath =
|
|
5822
|
+
const filePath = path10.resolve(
|
|
5778
5823
|
this.path,
|
|
5779
5824
|
Buffer.from(e(field, field)).toString("base64")
|
|
5780
5825
|
);
|
|
@@ -6611,9 +6656,7 @@ var npmAvailableCheckTasks = {
|
|
|
6611
6656
|
child.stderr?.on("data", onData);
|
|
6612
6657
|
child.on(
|
|
6613
6658
|
"close",
|
|
6614
|
-
(code) => code === 0 ? resolve() : reject(
|
|
6615
|
-
new Error(`npm login exited with code ${code}`)
|
|
6616
|
-
)
|
|
6659
|
+
(code) => code === 0 ? resolve() : reject(new Error(`npm login exited with code ${code}`))
|
|
6617
6660
|
);
|
|
6618
6661
|
child.on("error", reject);
|
|
6619
6662
|
});
|
|
@@ -6916,7 +6959,7 @@ var requiredConditionsCheckTask = (options) => createListr({
|
|
|
6916
6959
|
{
|
|
6917
6960
|
title: "Ping registries",
|
|
6918
6961
|
task: (ctx, parentTask2) => parentTask2.newListr(
|
|
6919
|
-
ctx.
|
|
6962
|
+
collectRegistries(ctx).map((registryKey) => ({
|
|
6920
6963
|
title: `Ping to ${registryKey}`,
|
|
6921
6964
|
task: async () => {
|
|
6922
6965
|
const registry = await getRegistry(registryKey);
|
|
@@ -6933,7 +6976,9 @@ var requiredConditionsCheckTask = (options) => createListr({
|
|
|
6933
6976
|
task: async (_2, parentTask2) => parentTask2.newListr(
|
|
6934
6977
|
[
|
|
6935
6978
|
{
|
|
6936
|
-
enabled: (ctx) => ctx.
|
|
6979
|
+
enabled: (ctx) => collectRegistries(ctx).some(
|
|
6980
|
+
(registry) => registry !== "jsr"
|
|
6981
|
+
),
|
|
6937
6982
|
title: "Verifying if npm are installed",
|
|
6938
6983
|
task: async () => {
|
|
6939
6984
|
const npm = await npmRegistry();
|
|
@@ -6945,7 +6990,9 @@ var requiredConditionsCheckTask = (options) => createListr({
|
|
|
6945
6990
|
}
|
|
6946
6991
|
},
|
|
6947
6992
|
{
|
|
6948
|
-
enabled: (ctx) => ctx.
|
|
6993
|
+
enabled: (ctx) => collectRegistries(ctx).some(
|
|
6994
|
+
(registry) => registry === "jsr"
|
|
6995
|
+
),
|
|
6949
6996
|
title: "Verifying if jsr are installed",
|
|
6950
6997
|
task: async (_3, task) => {
|
|
6951
6998
|
const jsr = await jsrRegistry();
|
|
@@ -6976,7 +7023,7 @@ var requiredConditionsCheckTask = (options) => createListr({
|
|
|
6976
7023
|
},
|
|
6977
7024
|
{
|
|
6978
7025
|
title: "Checking if test and build scripts exist",
|
|
6979
|
-
skip: (ctx) => !needsPackageScripts(ctx
|
|
7026
|
+
skip: (ctx) => !needsPackageScripts(collectRegistries(ctx)),
|
|
6980
7027
|
task: async (ctx) => {
|
|
6981
7028
|
const { scripts } = await getPackageJson();
|
|
6982
7029
|
const errors = [];
|
|
@@ -7004,23 +7051,42 @@ var requiredConditionsCheckTask = (options) => createListr({
|
|
|
7004
7051
|
},
|
|
7005
7052
|
{
|
|
7006
7053
|
title: "Checking available registries for publishing",
|
|
7007
|
-
task: (ctx, parentTask2) =>
|
|
7008
|
-
ctx.
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7054
|
+
task: (ctx, parentTask2) => {
|
|
7055
|
+
if (ctx.packages?.length) {
|
|
7056
|
+
const tasks = ctx.packages.flatMap(
|
|
7057
|
+
(pkg) => pkg.registries.map((registryKey) => {
|
|
7058
|
+
switch (registryKey) {
|
|
7059
|
+
case "npm":
|
|
7060
|
+
return npmAvailableCheckTasks;
|
|
7061
|
+
case "jsr":
|
|
7062
|
+
return jsrAvailableCheckTasks;
|
|
7063
|
+
case "crates":
|
|
7064
|
+
return createCratesAvailableCheckTask(pkg.path);
|
|
7065
|
+
default:
|
|
7066
|
+
return npmAvailableCheckTasks;
|
|
7067
|
+
}
|
|
7068
|
+
})
|
|
7069
|
+
);
|
|
7070
|
+
return parentTask2.newListr(tasks, { concurrent: true });
|
|
7022
7071
|
}
|
|
7023
|
-
|
|
7072
|
+
return parentTask2.newListr(
|
|
7073
|
+
collectRegistries(ctx).map((registryKey) => {
|
|
7074
|
+
switch (registryKey) {
|
|
7075
|
+
case "npm":
|
|
7076
|
+
return npmAvailableCheckTasks;
|
|
7077
|
+
case "jsr":
|
|
7078
|
+
return jsrAvailableCheckTasks;
|
|
7079
|
+
case "crates":
|
|
7080
|
+
return cratesAvailableCheckTasks;
|
|
7081
|
+
default:
|
|
7082
|
+
return npmAvailableCheckTasks;
|
|
7083
|
+
}
|
|
7084
|
+
}),
|
|
7085
|
+
{
|
|
7086
|
+
concurrent: true
|
|
7087
|
+
}
|
|
7088
|
+
);
|
|
7089
|
+
}
|
|
7024
7090
|
}
|
|
7025
7091
|
],
|
|
7026
7092
|
{
|
|
@@ -7032,21 +7098,27 @@ var requiredConditionsCheckTask = (options) => createListr({
|
|
|
7032
7098
|
// src/tasks/runner.ts
|
|
7033
7099
|
var { open: open3 } = npmCli3;
|
|
7034
7100
|
var { prerelease } = SemVer;
|
|
7035
|
-
function
|
|
7101
|
+
function registryTask(registry) {
|
|
7102
|
+
switch (registry) {
|
|
7103
|
+
case "npm":
|
|
7104
|
+
return npmPublishTasks;
|
|
7105
|
+
case "jsr":
|
|
7106
|
+
return jsrPublishTasks;
|
|
7107
|
+
case "crates":
|
|
7108
|
+
return cratesPublishTasks;
|
|
7109
|
+
default:
|
|
7110
|
+
return npmPublishTasks;
|
|
7111
|
+
}
|
|
7112
|
+
}
|
|
7113
|
+
function collectPublishTasks(ctx) {
|
|
7036
7114
|
if (ctx.packages?.length) {
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
seen.add(reg);
|
|
7043
|
-
result.push(reg);
|
|
7044
|
-
}
|
|
7045
|
-
}
|
|
7046
|
-
}
|
|
7047
|
-
return result;
|
|
7115
|
+
return ctx.packages.flatMap(
|
|
7116
|
+
(pkg) => pkg.registries.map(
|
|
7117
|
+
(reg) => reg === "crates" ? createCratesPublishTask(pkg.path) : registryTask(reg)
|
|
7118
|
+
)
|
|
7119
|
+
);
|
|
7048
7120
|
}
|
|
7049
|
-
return ctx.
|
|
7121
|
+
return collectRegistries(ctx).map(registryTask);
|
|
7050
7122
|
}
|
|
7051
7123
|
async function run(options) {
|
|
7052
7124
|
const ctx = {
|
|
@@ -7066,21 +7138,9 @@ async function run(options) {
|
|
|
7066
7138
|
await createListr(
|
|
7067
7139
|
options.publishOnly ? {
|
|
7068
7140
|
title: "Publishing",
|
|
7069
|
-
task: (ctx2, parentTask) => parentTask.newListr(
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
case "npm":
|
|
7073
|
-
return npmPublishTasks;
|
|
7074
|
-
case "jsr":
|
|
7075
|
-
return jsrPublishTasks;
|
|
7076
|
-
case "crates":
|
|
7077
|
-
return cratesPublishTasks;
|
|
7078
|
-
default:
|
|
7079
|
-
return npmPublishTasks;
|
|
7080
|
-
}
|
|
7081
|
-
}),
|
|
7082
|
-
{ concurrent: true }
|
|
7083
|
-
)
|
|
7141
|
+
task: (ctx2, parentTask) => parentTask.newListr(collectPublishTasks(ctx2), {
|
|
7142
|
+
concurrent: true
|
|
7143
|
+
})
|
|
7084
7144
|
} : [
|
|
7085
7145
|
{
|
|
7086
7146
|
skip: options.skipTests,
|
|
@@ -7149,7 +7209,10 @@ async function run(options) {
|
|
|
7149
7209
|
}
|
|
7150
7210
|
}, ctx2);
|
|
7151
7211
|
await git.reset();
|
|
7152
|
-
const replaced = await replaceVersion(
|
|
7212
|
+
const replaced = await replaceVersion(
|
|
7213
|
+
ctx2.version,
|
|
7214
|
+
ctx2.packages
|
|
7215
|
+
);
|
|
7153
7216
|
for (const replacedFile of replaced) {
|
|
7154
7217
|
await git.stage(replacedFile);
|
|
7155
7218
|
}
|
|
@@ -7164,21 +7227,9 @@ async function run(options) {
|
|
|
7164
7227
|
{
|
|
7165
7228
|
skip: (ctx2) => options.skipPublish || !!ctx2.preview,
|
|
7166
7229
|
title: "Publishing",
|
|
7167
|
-
task: (ctx2, parentTask) => parentTask.newListr(
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
case "npm":
|
|
7171
|
-
return npmPublishTasks;
|
|
7172
|
-
case "jsr":
|
|
7173
|
-
return jsrPublishTasks;
|
|
7174
|
-
case "crates":
|
|
7175
|
-
return cratesPublishTasks;
|
|
7176
|
-
default:
|
|
7177
|
-
return npmPublishTasks;
|
|
7178
|
-
}
|
|
7179
|
-
}),
|
|
7180
|
-
{ concurrent: true }
|
|
7181
|
-
)
|
|
7230
|
+
task: (ctx2, parentTask) => parentTask.newListr(collectPublishTasks(ctx2), {
|
|
7231
|
+
concurrent: true
|
|
7232
|
+
})
|
|
7182
7233
|
},
|
|
7183
7234
|
{
|
|
7184
7235
|
title: "Pushing tags to GitHub",
|
|
@@ -7244,7 +7295,7 @@ import { inc } from "semver";
|
|
|
7244
7295
|
|
|
7245
7296
|
// src/monorepo/discover.ts
|
|
7246
7297
|
import { existsSync as existsSync6, readdirSync as readdirSync3, statSync as statSync2 } from "node:fs";
|
|
7247
|
-
import
|
|
7298
|
+
import path11 from "node:path";
|
|
7248
7299
|
import micromatch from "micromatch";
|
|
7249
7300
|
|
|
7250
7301
|
// src/monorepo/workspace.ts
|
|
@@ -7257,7 +7308,7 @@ import micromatch2 from "micromatch";
|
|
|
7257
7308
|
|
|
7258
7309
|
// src/validate/entry-points.ts
|
|
7259
7310
|
import { existsSync as existsSync7 } from "node:fs";
|
|
7260
|
-
import
|
|
7311
|
+
import path12 from "node:path";
|
|
7261
7312
|
|
|
7262
7313
|
// src/validate/extraneous-files.ts
|
|
7263
7314
|
import micromatch3 from "micromatch";
|