@pubm/core 0.5.0 → 0.5.2
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/config/defaults.d.ts.map +1 -1
- package/dist/config/types.d.ts +14 -2
- package/dist/config/types.d.ts.map +1 -1
- package/dist/ecosystem/ecosystem.d.ts +9 -2
- package/dist/ecosystem/ecosystem.d.ts.map +1 -1
- package/dist/ecosystem/js.d.ts +9 -2
- package/dist/ecosystem/js.d.ts.map +1 -1
- package/dist/ecosystem/rust.d.ts +9 -2
- package/dist/ecosystem/rust.d.ts.map +1 -1
- package/dist/index.cjs +463 -233
- package/dist/index.js +443 -213
- package/dist/plugin/types.d.ts +0 -1
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/registry/catalog.d.ts +0 -1
- package/dist/registry/catalog.d.ts.map +1 -1
- package/dist/registry/crates.d.ts.map +1 -1
- package/dist/registry/jsr.d.ts.map +1 -1
- package/dist/registry/npm.d.ts.map +1 -1
- package/dist/registry/package-registry.d.ts +0 -1
- package/dist/registry/package-registry.d.ts.map +1 -1
- package/dist/tasks/phases/test-build.d.ts.map +1 -1
- package/dist/tasks/prompts/independent-mode.d.ts.map +1 -1
- package/dist/tasks/required-conditions-check.d.ts.map +1 -1
- package/dist/utils/secure-store.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17614,7 +17614,7 @@ var package_default;
|
|
|
17614
17614
|
var init_package = __esm(() => {
|
|
17615
17615
|
package_default = {
|
|
17616
17616
|
name: "@pubm/core",
|
|
17617
|
-
version: "0.5.
|
|
17617
|
+
version: "0.5.2",
|
|
17618
17618
|
type: "module",
|
|
17619
17619
|
description: "Core SDK for pubm - publish manager for multiple registries",
|
|
17620
17620
|
types: "./dist/index.d.ts",
|
|
@@ -17693,7 +17693,7 @@ var coreEngines, PUBM_VERSION, PUBM_ENGINES;
|
|
|
17693
17693
|
var init_pubm_metadata = __esm(() => {
|
|
17694
17694
|
init_package();
|
|
17695
17695
|
coreEngines = package_default.engines ?? {};
|
|
17696
|
-
PUBM_VERSION = resolveDefine("0.5.
|
|
17696
|
+
PUBM_VERSION = resolveDefine("0.5.2", package_default.version);
|
|
17697
17697
|
PUBM_ENGINES = {
|
|
17698
17698
|
node: resolveDefine(">=24", coreEngines.node ?? ">=18"),
|
|
17699
17699
|
git: resolveDefine(">=2.11.0", coreEngines.git ?? ">=2.11.0"),
|
|
@@ -20492,7 +20492,6 @@ ${stderr}` : ""}`, {
|
|
|
20492
20492
|
}
|
|
20493
20493
|
getRequirements() {
|
|
20494
20494
|
return {
|
|
20495
|
-
needsPackageScripts: false,
|
|
20496
20495
|
requiredManifest: "jsr.json or deno.json"
|
|
20497
20496
|
};
|
|
20498
20497
|
}
|
|
@@ -21897,7 +21896,6 @@ ${cleanCargoStderr(stderr)}` : "Failed to run `cargo publish --dry-run`";
|
|
|
21897
21896
|
}
|
|
21898
21897
|
getRequirements() {
|
|
21899
21898
|
return {
|
|
21900
|
-
needsPackageScripts: false,
|
|
21901
21899
|
requiredManifest: "Cargo.toml"
|
|
21902
21900
|
};
|
|
21903
21901
|
}
|
|
@@ -22077,11 +22075,16 @@ var init_rust = __esm(() => {
|
|
|
22077
22075
|
manifestFiles() {
|
|
22078
22076
|
return ["Cargo.toml"];
|
|
22079
22077
|
}
|
|
22080
|
-
|
|
22081
|
-
|
|
22078
|
+
resolveTestCommand(script) {
|
|
22079
|
+
const parts = script.split(/\s+/);
|
|
22080
|
+
return Promise.resolve({ cmd: "cargo", args: parts });
|
|
22082
22081
|
}
|
|
22083
|
-
|
|
22084
|
-
|
|
22082
|
+
resolveBuildCommand(script) {
|
|
22083
|
+
const parts = script.split(/\s+/);
|
|
22084
|
+
return Promise.resolve({ cmd: "cargo", args: parts });
|
|
22085
|
+
}
|
|
22086
|
+
validateScript(_script, _type) {
|
|
22087
|
+
return Promise.resolve(null);
|
|
22085
22088
|
}
|
|
22086
22089
|
supportedRegistries() {
|
|
22087
22090
|
return ["crates"];
|
|
@@ -22949,7 +22952,6 @@ function registerPrivateRegistry(config, ecosystemKey, catalog = registryCatalog
|
|
|
22949
22952
|
tokenUrl: config.url,
|
|
22950
22953
|
tokenUrlLabel: key
|
|
22951
22954
|
},
|
|
22952
|
-
needsPackageScripts: false,
|
|
22953
22955
|
concurrentPublish: true,
|
|
22954
22956
|
unpublishLabel: "Unpublish",
|
|
22955
22957
|
requiresEarlyAuth: false,
|
|
@@ -22992,7 +22994,6 @@ var init_catalog = __esm(() => {
|
|
|
22992
22994
|
tokenUrl: "https://www.npmjs.com/settings/~/tokens/granular-access-tokens/new",
|
|
22993
22995
|
tokenUrlLabel: "npmjs.com"
|
|
22994
22996
|
},
|
|
22995
|
-
needsPackageScripts: true,
|
|
22996
22997
|
additionalEnvVars: (token) => ({
|
|
22997
22998
|
"npm_config_//registry.npmjs.org/:_authToken": token
|
|
22998
22999
|
}),
|
|
@@ -23040,7 +23041,6 @@ var init_catalog = __esm(() => {
|
|
|
23040
23041
|
tokenUrl: "https://jsr.io/account/tokens/create",
|
|
23041
23042
|
tokenUrlLabel: "jsr.io"
|
|
23042
23043
|
},
|
|
23043
|
-
needsPackageScripts: false,
|
|
23044
23044
|
validateToken: async (token) => {
|
|
23045
23045
|
const res = await fetch("https://jsr.io/api/user", {
|
|
23046
23046
|
headers: { Authorization: `Bearer ${token}` }
|
|
@@ -23078,7 +23078,6 @@ var init_catalog = __esm(() => {
|
|
|
23078
23078
|
tokenUrl: "https://crates.io/settings/tokens/new",
|
|
23079
23079
|
tokenUrlLabel: "crates.io"
|
|
23080
23080
|
},
|
|
23081
|
-
needsPackageScripts: false,
|
|
23082
23081
|
validateToken: async (token) => {
|
|
23083
23082
|
return token.trim().length >= 32;
|
|
23084
23083
|
},
|
|
@@ -23454,7 +23453,6 @@ ${stderr}` : ""}`, { cause: error4 });
|
|
|
23454
23453
|
}
|
|
23455
23454
|
getRequirements() {
|
|
23456
23455
|
return {
|
|
23457
|
-
needsPackageScripts: true,
|
|
23458
23456
|
requiredManifest: "package.json"
|
|
23459
23457
|
};
|
|
23460
23458
|
}
|
|
@@ -23615,13 +23613,26 @@ var init_js = __esm(() => {
|
|
|
23615
23613
|
manifestFiles() {
|
|
23616
23614
|
return ["package.json"];
|
|
23617
23615
|
}
|
|
23618
|
-
async
|
|
23616
|
+
async resolveTestCommand(script) {
|
|
23619
23617
|
const pm = await getPackageManager();
|
|
23620
|
-
return
|
|
23618
|
+
return { cmd: pm, args: ["run", script] };
|
|
23621
23619
|
}
|
|
23622
|
-
async
|
|
23620
|
+
async resolveBuildCommand(script) {
|
|
23623
23621
|
const pm = await getPackageManager();
|
|
23624
|
-
return
|
|
23622
|
+
return { cmd: pm, args: ["run", script] };
|
|
23623
|
+
}
|
|
23624
|
+
async validateScript(script, _type) {
|
|
23625
|
+
const pkgPath = path5.join(this.packagePath, "package.json");
|
|
23626
|
+
try {
|
|
23627
|
+
const raw = await readFile5(pkgPath, "utf-8");
|
|
23628
|
+
const { scripts } = JSON.parse(raw);
|
|
23629
|
+
if (!scripts?.[script]) {
|
|
23630
|
+
return `Script '${script}' not found in ${pkgPath}`;
|
|
23631
|
+
}
|
|
23632
|
+
return null;
|
|
23633
|
+
} catch {
|
|
23634
|
+
return `Cannot read ${pkgPath}`;
|
|
23635
|
+
}
|
|
23625
23636
|
}
|
|
23626
23637
|
supportedRegistries() {
|
|
23627
23638
|
return ["npm", "jsr"];
|
|
@@ -23762,13 +23773,6 @@ var init_catalog2 = __esm(() => {
|
|
|
23762
23773
|
init_js();
|
|
23763
23774
|
init_rust();
|
|
23764
23775
|
ecosystemCatalog = new EcosystemCatalog;
|
|
23765
|
-
ecosystemCatalog.register({
|
|
23766
|
-
key: "js",
|
|
23767
|
-
label: "JavaScript",
|
|
23768
|
-
defaultRegistries: ["npm", "jsr"],
|
|
23769
|
-
ecosystemClass: JsEcosystem,
|
|
23770
|
-
detect: (path6) => JsEcosystem.detect(path6)
|
|
23771
|
-
});
|
|
23772
23776
|
ecosystemCatalog.register({
|
|
23773
23777
|
key: "rust",
|
|
23774
23778
|
label: "Rust",
|
|
@@ -23776,6 +23780,13 @@ var init_catalog2 = __esm(() => {
|
|
|
23776
23780
|
ecosystemClass: RustEcosystem,
|
|
23777
23781
|
detect: (path6) => RustEcosystem.detect(path6)
|
|
23778
23782
|
});
|
|
23783
|
+
ecosystemCatalog.register({
|
|
23784
|
+
key: "js",
|
|
23785
|
+
label: "JavaScript",
|
|
23786
|
+
defaultRegistries: ["npm", "jsr"],
|
|
23787
|
+
ecosystemClass: JsEcosystem,
|
|
23788
|
+
detect: (path6) => JsEcosystem.detect(path6)
|
|
23789
|
+
});
|
|
23779
23790
|
});
|
|
23780
23791
|
|
|
23781
23792
|
// src/plugin/runner.ts
|
|
@@ -35526,8 +35537,8 @@ var prerequisitesCheckTask = (options) => {
|
|
|
35526
35537
|
};
|
|
35527
35538
|
|
|
35528
35539
|
// src/tasks/required-conditions-check.ts
|
|
35529
|
-
import
|
|
35530
|
-
|
|
35540
|
+
import path12 from "node:path";
|
|
35541
|
+
init_catalog2();
|
|
35531
35542
|
init_error4();
|
|
35532
35543
|
init_git();
|
|
35533
35544
|
init_i18n();
|
|
@@ -35554,10 +35565,6 @@ async function validateEngineVersion(engine, version) {
|
|
|
35554
35565
|
}
|
|
35555
35566
|
|
|
35556
35567
|
// src/tasks/required-conditions-check.ts
|
|
35557
|
-
function needsPackageScripts(registries) {
|
|
35558
|
-
return registries.some((r2) => registryCatalog.get(r2)?.needsPackageScripts ?? true);
|
|
35559
|
-
}
|
|
35560
|
-
|
|
35561
35568
|
class RequiredConditionCheckError extends AbstractError {
|
|
35562
35569
|
name = t("error.conditions.name");
|
|
35563
35570
|
constructor(message, { cause } = {}) {
|
|
@@ -35619,20 +35626,66 @@ var requiredConditionsCheckTask = (options) => {
|
|
|
35619
35626
|
},
|
|
35620
35627
|
{
|
|
35621
35628
|
title: t("task.conditions.checkScripts"),
|
|
35622
|
-
skip: (ctx2) =>
|
|
35629
|
+
skip: (ctx2) => !!ctx2.options.skipTests && !!ctx2.options.skipBuild,
|
|
35623
35630
|
task: async (ctx2) => {
|
|
35624
|
-
const raw = await readFile7(join9(ctx2.cwd, "package.json"), "utf-8");
|
|
35625
|
-
const { scripts } = JSON.parse(raw);
|
|
35626
35631
|
const errors = [];
|
|
35627
|
-
|
|
35628
|
-
|
|
35629
|
-
|
|
35630
|
-
|
|
35632
|
+
const JS_WS_TYPES = new Set([
|
|
35633
|
+
"pnpm",
|
|
35634
|
+
"npm",
|
|
35635
|
+
"yarn",
|
|
35636
|
+
"bun",
|
|
35637
|
+
"deno"
|
|
35638
|
+
]);
|
|
35639
|
+
const workspaces = detectWorkspace(ctx2.cwd);
|
|
35640
|
+
const byEcosystem = new Map;
|
|
35641
|
+
for (const pkg of ctx2.config.packages) {
|
|
35642
|
+
const key = pkg.ecosystem ?? "js";
|
|
35643
|
+
if (!byEcosystem.has(key))
|
|
35644
|
+
byEcosystem.set(key, []);
|
|
35645
|
+
byEcosystem.get(key).push(pkg);
|
|
35631
35646
|
}
|
|
35632
|
-
|
|
35633
|
-
|
|
35634
|
-
|
|
35635
|
-
|
|
35647
|
+
for (const [ecosystemKey, packages] of byEcosystem) {
|
|
35648
|
+
const descriptor = ecosystemCatalog.get(ecosystemKey);
|
|
35649
|
+
if (!descriptor)
|
|
35650
|
+
continue;
|
|
35651
|
+
const hasWorkspace = ecosystemKey === "js" ? workspaces.some((w2) => JS_WS_TYPES.has(w2.type)) : ecosystemKey === "rust" ? workspaces.some((w2) => w2.type === "cargo") : false;
|
|
35652
|
+
const ecoConfig = ctx2.config.ecosystems?.[ecosystemKey];
|
|
35653
|
+
let testGroupValidated = false;
|
|
35654
|
+
let buildGroupValidated = false;
|
|
35655
|
+
for (const pkg of packages) {
|
|
35656
|
+
if (!ctx2.options.skipTests) {
|
|
35657
|
+
const hasCommand = pkg.testCommand ?? ecoConfig?.testCommand;
|
|
35658
|
+
if (!hasCommand) {
|
|
35659
|
+
const script = pkg.testScript ?? ecoConfig?.testScript ?? ctx2.options.testScript;
|
|
35660
|
+
const isPackageOverride = !!pkg.testScript;
|
|
35661
|
+
const validateCwd = hasWorkspace && !isPackageOverride ? ctx2.cwd : path12.resolve(ctx2.cwd, pkg.path);
|
|
35662
|
+
if (!hasWorkspace || isPackageOverride || !testGroupValidated) {
|
|
35663
|
+
const instance = new descriptor.ecosystemClass(validateCwd);
|
|
35664
|
+
const error4 = await instance.validateScript(script, "test");
|
|
35665
|
+
if (error4)
|
|
35666
|
+
errors.push(error4);
|
|
35667
|
+
if (hasWorkspace && !isPackageOverride)
|
|
35668
|
+
testGroupValidated = true;
|
|
35669
|
+
}
|
|
35670
|
+
}
|
|
35671
|
+
}
|
|
35672
|
+
if (!ctx2.options.skipBuild) {
|
|
35673
|
+
const hasCommand = pkg.buildCommand ?? ecoConfig?.buildCommand;
|
|
35674
|
+
if (!hasCommand) {
|
|
35675
|
+
const script = pkg.buildScript ?? ecoConfig?.buildScript ?? ctx2.options.buildScript;
|
|
35676
|
+
const isPackageOverride = !!pkg.buildScript;
|
|
35677
|
+
const validateCwd = hasWorkspace && !isPackageOverride ? ctx2.cwd : path12.resolve(ctx2.cwd, pkg.path);
|
|
35678
|
+
if (!hasWorkspace || isPackageOverride || !buildGroupValidated) {
|
|
35679
|
+
const instance = new descriptor.ecosystemClass(validateCwd);
|
|
35680
|
+
const error4 = await instance.validateScript(script, "build");
|
|
35681
|
+
if (error4)
|
|
35682
|
+
errors.push(error4);
|
|
35683
|
+
if (hasWorkspace && !isPackageOverride)
|
|
35684
|
+
buildGroupValidated = true;
|
|
35685
|
+
}
|
|
35686
|
+
}
|
|
35687
|
+
}
|
|
35688
|
+
}
|
|
35636
35689
|
}
|
|
35637
35690
|
if (errors.length) {
|
|
35638
35691
|
throw new RequiredConditionCheckError(t("error.conditions.scriptsMissing", {
|
|
@@ -35810,7 +35863,7 @@ function createPublishTasks(hasPublish, dryRun, skipPublish) {
|
|
|
35810
35863
|
init_dist2();
|
|
35811
35864
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
35812
35865
|
import { existsSync as existsSync6, readFileSync as readFileSync9, rmSync } from "node:fs";
|
|
35813
|
-
import { join as
|
|
35866
|
+
import { join as join9 } from "node:path";
|
|
35814
35867
|
import process19 from "node:process";
|
|
35815
35868
|
|
|
35816
35869
|
// src/changeset/changelog-parser.ts
|
|
@@ -35985,7 +36038,7 @@ async function deleteGitHubRelease(releaseId) {
|
|
|
35985
36038
|
|
|
35986
36039
|
// src/tasks/runner-utils/version-pr.ts
|
|
35987
36040
|
import { existsSync as existsSync5, readFileSync as readFileSync8 } from "node:fs";
|
|
35988
|
-
import
|
|
36041
|
+
import path13 from "node:path";
|
|
35989
36042
|
import process18 from "node:process";
|
|
35990
36043
|
init_error4();
|
|
35991
36044
|
init_git();
|
|
@@ -36170,8 +36223,8 @@ function buildPrBodyFromContext(ctx, plan) {
|
|
|
36170
36223
|
const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
|
|
36171
36224
|
const name = pkgConfig?.name ?? pkgPath;
|
|
36172
36225
|
packages.push({ name, version: pkgVersion, bump: "" });
|
|
36173
|
-
const changelogDir = pkgConfig ?
|
|
36174
|
-
const changelogPath =
|
|
36226
|
+
const changelogDir = pkgConfig ? path13.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
|
|
36227
|
+
const changelogPath = path13.join(changelogDir, "CHANGELOG.md");
|
|
36175
36228
|
if (existsSync5(changelogPath)) {
|
|
36176
36229
|
const section = parseChangelogSection(readFileSync8(changelogPath, "utf-8"), pkgVersion);
|
|
36177
36230
|
if (section)
|
|
@@ -36184,7 +36237,7 @@ function buildPrBodyFromContext(ctx, plan) {
|
|
|
36184
36237
|
packages.push({ name: pkg.name, version, bump: "" });
|
|
36185
36238
|
}
|
|
36186
36239
|
if (plan.mode === "single") {
|
|
36187
|
-
const changelogPath =
|
|
36240
|
+
const changelogPath = path13.join(ctx.cwd, "CHANGELOG.md");
|
|
36188
36241
|
if (existsSync5(changelogPath)) {
|
|
36189
36242
|
const section = parseChangelogSection(readFileSync8(changelogPath, "utf-8"), version);
|
|
36190
36243
|
if (section)
|
|
@@ -36192,7 +36245,7 @@ function buildPrBodyFromContext(ctx, plan) {
|
|
|
36192
36245
|
}
|
|
36193
36246
|
} else {
|
|
36194
36247
|
for (const pkg of ctx.config.packages) {
|
|
36195
|
-
const changelogPath =
|
|
36248
|
+
const changelogPath = path13.join(ctx.cwd, pkg.path, "CHANGELOG.md");
|
|
36196
36249
|
if (existsSync5(changelogPath)) {
|
|
36197
36250
|
const section = parseChangelogSection(readFileSync8(changelogPath, "utf-8"), version);
|
|
36198
36251
|
if (section)
|
|
@@ -36295,7 +36348,7 @@ function createReleaseTask(hasPublish, dryRun, mode, skipReleaseDraft) {
|
|
|
36295
36348
|
let changelogBody;
|
|
36296
36349
|
const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
|
|
36297
36350
|
if (pkgConfig) {
|
|
36298
|
-
const changelogPath =
|
|
36351
|
+
const changelogPath = join9(ctx.cwd, pkgConfig.path, "CHANGELOG.md");
|
|
36299
36352
|
if (existsSync6(changelogPath)) {
|
|
36300
36353
|
const section = parseChangelogSection(readFileSync9(changelogPath, "utf-8"), pkgVersion);
|
|
36301
36354
|
if (section)
|
|
@@ -36353,7 +36406,7 @@ function createReleaseTask(hasPublish, dryRun, mode, skipReleaseDraft) {
|
|
|
36353
36406
|
const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath2);
|
|
36354
36407
|
if (!pkgConfig)
|
|
36355
36408
|
continue;
|
|
36356
|
-
const changelogPath =
|
|
36409
|
+
const changelogPath = join9(ctx.cwd, pkgConfig.path, "CHANGELOG.md");
|
|
36357
36410
|
if (existsSync6(changelogPath)) {
|
|
36358
36411
|
const section = parseChangelogSection(readFileSync9(changelogPath, "utf-8"), pkgVersion);
|
|
36359
36412
|
if (section) {
|
|
@@ -36371,7 +36424,7 @@ ${section}`);
|
|
|
36371
36424
|
`);
|
|
36372
36425
|
}
|
|
36373
36426
|
} else {
|
|
36374
|
-
const changelogPath =
|
|
36427
|
+
const changelogPath = join9(ctx.cwd, "CHANGELOG.md");
|
|
36375
36428
|
if (existsSync6(changelogPath)) {
|
|
36376
36429
|
const section = parseChangelogSection(readFileSync9(changelogPath, "utf-8"), version);
|
|
36377
36430
|
if (section)
|
|
@@ -36479,10 +36532,166 @@ ${repositoryUrl}/compare/${lastRev}...${tag}`;
|
|
|
36479
36532
|
}
|
|
36480
36533
|
|
|
36481
36534
|
// src/tasks/phases/test-build.ts
|
|
36535
|
+
init_catalog2();
|
|
36482
36536
|
init_error4();
|
|
36483
36537
|
init_i18n();
|
|
36538
|
+
import path14 from "node:path";
|
|
36484
36539
|
init_exec();
|
|
36485
|
-
|
|
36540
|
+
var JS_WORKSPACE_TYPES = new Set(["pnpm", "npm", "yarn", "bun", "deno"]);
|
|
36541
|
+
var ECOSYSTEM_DEFAULTS = {
|
|
36542
|
+
js: { test: "test", build: "build" },
|
|
36543
|
+
rust: { test: "test", build: "build --release" }
|
|
36544
|
+
};
|
|
36545
|
+
function hasWorkspaceForEcosystem(cwd, ecosystemKey) {
|
|
36546
|
+
const workspaces = detectWorkspace(cwd);
|
|
36547
|
+
if (ecosystemKey === "js") {
|
|
36548
|
+
return workspaces.some((w2) => JS_WORKSPACE_TYPES.has(w2.type));
|
|
36549
|
+
}
|
|
36550
|
+
if (ecosystemKey === "rust") {
|
|
36551
|
+
return workspaces.some((w2) => w2.type === "cargo");
|
|
36552
|
+
}
|
|
36553
|
+
return false;
|
|
36554
|
+
}
|
|
36555
|
+
function hasPackageLevelOverride(pkg, type) {
|
|
36556
|
+
return type === "test" ? !!(pkg.testCommand || pkg.testScript) : !!(pkg.buildCommand || pkg.buildScript);
|
|
36557
|
+
}
|
|
36558
|
+
function resolveScript(pkg, ecosystemKey, ctx, type) {
|
|
36559
|
+
const sf = type === "test" ? "testScript" : "buildScript";
|
|
36560
|
+
const cf = type === "test" ? "testCommand" : "buildCommand";
|
|
36561
|
+
if (pkg[cf])
|
|
36562
|
+
return { command: pkg[cf] };
|
|
36563
|
+
if (pkg[sf])
|
|
36564
|
+
return { script: pkg[sf] };
|
|
36565
|
+
const eco = ctx.config.ecosystems?.[ecosystemKey];
|
|
36566
|
+
if (eco?.[cf])
|
|
36567
|
+
return { command: eco[cf] };
|
|
36568
|
+
if (eco?.[sf])
|
|
36569
|
+
return { script: eco[sf] };
|
|
36570
|
+
const globalScript = type === "test" ? ctx.options.testScript : ctx.options.buildScript;
|
|
36571
|
+
if (globalScript)
|
|
36572
|
+
return { script: globalScript };
|
|
36573
|
+
return { script: ECOSYSTEM_DEFAULTS[ecosystemKey]?.[type] ?? type };
|
|
36574
|
+
}
|
|
36575
|
+
function groupByEcosystem(ctx, type) {
|
|
36576
|
+
const map = new Map;
|
|
36577
|
+
for (const pkg of ctx.config.packages) {
|
|
36578
|
+
const key = pkg.ecosystem ?? "js";
|
|
36579
|
+
if (!map.has(key))
|
|
36580
|
+
map.set(key, { group: [], individual: [] });
|
|
36581
|
+
const entry = map.get(key);
|
|
36582
|
+
if (hasPackageLevelOverride(pkg, type)) {
|
|
36583
|
+
entry.individual.push(pkg);
|
|
36584
|
+
} else {
|
|
36585
|
+
entry.group.push(pkg);
|
|
36586
|
+
}
|
|
36587
|
+
}
|
|
36588
|
+
const result = [];
|
|
36589
|
+
for (const descriptor of ecosystemCatalog.all()) {
|
|
36590
|
+
const entry = map.get(descriptor.key);
|
|
36591
|
+
if (!entry)
|
|
36592
|
+
continue;
|
|
36593
|
+
if (entry.group.length === 0 && entry.individual.length === 0)
|
|
36594
|
+
continue;
|
|
36595
|
+
result.push({
|
|
36596
|
+
ecosystemKey: descriptor.key,
|
|
36597
|
+
groupPackages: entry.group,
|
|
36598
|
+
individualPackages: entry.individual,
|
|
36599
|
+
hasWorkspace: hasWorkspaceForEcosystem(ctx.cwd, descriptor.key)
|
|
36600
|
+
});
|
|
36601
|
+
}
|
|
36602
|
+
return result;
|
|
36603
|
+
}
|
|
36604
|
+
async function resolveExecutions(ctx, type) {
|
|
36605
|
+
const groups = groupByEcosystem(ctx, type);
|
|
36606
|
+
const executions = [];
|
|
36607
|
+
for (const group of groups) {
|
|
36608
|
+
const descriptor = ecosystemCatalog.get(group.ecosystemKey);
|
|
36609
|
+
if (!descriptor)
|
|
36610
|
+
continue;
|
|
36611
|
+
if (group.groupPackages.length > 0) {
|
|
36612
|
+
const resolved = resolveScript(group.groupPackages[0], group.ecosystemKey, ctx, type);
|
|
36613
|
+
if (resolved.command) {
|
|
36614
|
+
if (group.hasWorkspace) {
|
|
36615
|
+
executions.push({
|
|
36616
|
+
label: resolved.command,
|
|
36617
|
+
cmd: "sh",
|
|
36618
|
+
args: ["-c", resolved.command],
|
|
36619
|
+
cwd: ctx.cwd
|
|
36620
|
+
});
|
|
36621
|
+
} else {
|
|
36622
|
+
for (const pkg of group.groupPackages) {
|
|
36623
|
+
const pkgCwd = path14.resolve(ctx.cwd, pkg.path);
|
|
36624
|
+
executions.push({
|
|
36625
|
+
label: `${resolved.command} (${pkg.path})`,
|
|
36626
|
+
cmd: "sh",
|
|
36627
|
+
args: ["-c", resolved.command],
|
|
36628
|
+
cwd: pkgCwd
|
|
36629
|
+
});
|
|
36630
|
+
}
|
|
36631
|
+
}
|
|
36632
|
+
} else if (resolved.script) {
|
|
36633
|
+
if (group.hasWorkspace) {
|
|
36634
|
+
const instance = new descriptor.ecosystemClass(ctx.cwd);
|
|
36635
|
+
const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
|
|
36636
|
+
executions.push({
|
|
36637
|
+
label: `${cmd} ${args.join(" ")}`,
|
|
36638
|
+
cmd,
|
|
36639
|
+
args,
|
|
36640
|
+
cwd: ctx.cwd
|
|
36641
|
+
});
|
|
36642
|
+
} else {
|
|
36643
|
+
for (const pkg of group.groupPackages) {
|
|
36644
|
+
const pkgCwd = path14.resolve(ctx.cwd, pkg.path);
|
|
36645
|
+
const instance = new descriptor.ecosystemClass(pkgCwd);
|
|
36646
|
+
const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
|
|
36647
|
+
executions.push({
|
|
36648
|
+
label: `${cmd} ${args.join(" ")} (${pkg.path})`,
|
|
36649
|
+
cmd,
|
|
36650
|
+
args,
|
|
36651
|
+
cwd: pkgCwd
|
|
36652
|
+
});
|
|
36653
|
+
}
|
|
36654
|
+
}
|
|
36655
|
+
}
|
|
36656
|
+
}
|
|
36657
|
+
for (const pkg of group.individualPackages) {
|
|
36658
|
+
const pkgCwd = path14.resolve(ctx.cwd, pkg.path);
|
|
36659
|
+
const resolved = resolveScript(pkg, group.ecosystemKey, ctx, type);
|
|
36660
|
+
if (resolved.command) {
|
|
36661
|
+
executions.push({
|
|
36662
|
+
label: `${resolved.command} (${pkg.path})`,
|
|
36663
|
+
cmd: "sh",
|
|
36664
|
+
args: ["-c", resolved.command],
|
|
36665
|
+
cwd: pkgCwd
|
|
36666
|
+
});
|
|
36667
|
+
} else if (resolved.script) {
|
|
36668
|
+
const instance = new descriptor.ecosystemClass(pkgCwd);
|
|
36669
|
+
const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
|
|
36670
|
+
executions.push({
|
|
36671
|
+
label: `${cmd} ${args.join(" ")} (${pkg.path})`,
|
|
36672
|
+
cmd,
|
|
36673
|
+
args,
|
|
36674
|
+
cwd: pkgCwd
|
|
36675
|
+
});
|
|
36676
|
+
}
|
|
36677
|
+
}
|
|
36678
|
+
}
|
|
36679
|
+
return executions;
|
|
36680
|
+
}
|
|
36681
|
+
async function runExecution(execution, ctx, task) {
|
|
36682
|
+
const liveOutput = shouldRenderLiveCommandOutput(ctx) ? createLiveCommandOutput(task, execution.label) : undefined;
|
|
36683
|
+
task.output = `Executing \`${execution.label}\``;
|
|
36684
|
+
try {
|
|
36685
|
+
await exec3(execution.cmd, execution.args, {
|
|
36686
|
+
onStdout: liveOutput?.onStdout,
|
|
36687
|
+
onStderr: liveOutput?.onStderr,
|
|
36688
|
+
throwOnError: true,
|
|
36689
|
+
nodeOptions: { cwd: execution.cwd }
|
|
36690
|
+
});
|
|
36691
|
+
} finally {
|
|
36692
|
+
liveOutput?.finish();
|
|
36693
|
+
}
|
|
36694
|
+
}
|
|
36486
36695
|
function createTestTask(hasPrepare, skipTests) {
|
|
36487
36696
|
return {
|
|
36488
36697
|
enabled: hasPrepare && !skipTests,
|
|
@@ -36490,28 +36699,25 @@ function createTestTask(hasPrepare, skipTests) {
|
|
|
36490
36699
|
task: async (ctx, task) => {
|
|
36491
36700
|
task.output = t("task.test.runningBeforeHooks");
|
|
36492
36701
|
await ctx.runtime.pluginRunner.runHook("beforeTest", ctx);
|
|
36493
|
-
const
|
|
36494
|
-
const
|
|
36495
|
-
|
|
36496
|
-
|
|
36497
|
-
task.output = `Executing \`${command}\``;
|
|
36498
|
-
try {
|
|
36499
|
-
await exec3(packageManager, ["run", ctx.options.testScript], {
|
|
36500
|
-
onStdout: liveOutput?.onStdout,
|
|
36501
|
-
onStderr: liveOutput?.onStderr,
|
|
36502
|
-
throwOnError: true
|
|
36702
|
+
const executions = await resolveExecutions(ctx, "test");
|
|
36703
|
+
for (const execution of executions) {
|
|
36704
|
+
task.title = t("task.test.titleWithCommand", {
|
|
36705
|
+
command: execution.label
|
|
36503
36706
|
});
|
|
36504
|
-
|
|
36505
|
-
|
|
36506
|
-
|
|
36507
|
-
|
|
36508
|
-
|
|
36509
|
-
|
|
36707
|
+
try {
|
|
36708
|
+
await runExecution(execution, ctx, task);
|
|
36709
|
+
} catch (error4) {
|
|
36710
|
+
throw new AbstractError(t("error.test.failedWithHint", {
|
|
36711
|
+
script: execution.label,
|
|
36712
|
+
command: execution.label
|
|
36713
|
+
}), { cause: error4 });
|
|
36714
|
+
}
|
|
36510
36715
|
}
|
|
36511
|
-
liveOutput?.finish();
|
|
36512
36716
|
task.output = t("task.test.runningAfterHooks");
|
|
36513
36717
|
await ctx.runtime.pluginRunner.runHook("afterTest", ctx);
|
|
36514
|
-
task.output = t("task.test.completed", {
|
|
36718
|
+
task.output = t("task.test.completed", {
|
|
36719
|
+
command: executions.map((e3) => e3.label).join(", ")
|
|
36720
|
+
});
|
|
36515
36721
|
}
|
|
36516
36722
|
};
|
|
36517
36723
|
}
|
|
@@ -36522,41 +36728,38 @@ function createBuildTask(hasPrepare, skipBuild) {
|
|
|
36522
36728
|
task: async (ctx, task) => {
|
|
36523
36729
|
task.output = t("task.build.runningBeforeHooks");
|
|
36524
36730
|
await ctx.runtime.pluginRunner.runHook("beforeBuild", ctx);
|
|
36525
|
-
const
|
|
36526
|
-
const
|
|
36527
|
-
|
|
36528
|
-
|
|
36529
|
-
task.output = `Executing \`${command}\``;
|
|
36530
|
-
try {
|
|
36531
|
-
await exec3(packageManager, ["run", ctx.options.buildScript], {
|
|
36532
|
-
onStdout: liveOutput?.onStdout,
|
|
36533
|
-
onStderr: liveOutput?.onStderr,
|
|
36534
|
-
throwOnError: true
|
|
36731
|
+
const executions = await resolveExecutions(ctx, "build");
|
|
36732
|
+
for (const execution of executions) {
|
|
36733
|
+
task.title = t("task.build.titleWithCommand", {
|
|
36734
|
+
command: execution.label
|
|
36535
36735
|
});
|
|
36536
|
-
|
|
36537
|
-
|
|
36538
|
-
|
|
36539
|
-
|
|
36540
|
-
|
|
36541
|
-
|
|
36736
|
+
try {
|
|
36737
|
+
await runExecution(execution, ctx, task);
|
|
36738
|
+
} catch (error4) {
|
|
36739
|
+
throw new AbstractError(t("error.build.failedWithHint", {
|
|
36740
|
+
script: execution.label,
|
|
36741
|
+
command: execution.label
|
|
36742
|
+
}), { cause: error4 });
|
|
36743
|
+
}
|
|
36542
36744
|
}
|
|
36543
|
-
liveOutput?.finish();
|
|
36544
36745
|
task.output = t("task.build.runningAfterHooks");
|
|
36545
36746
|
await ctx.runtime.pluginRunner.runHook("afterBuild", ctx);
|
|
36546
|
-
task.output = t("task.build.completed", {
|
|
36747
|
+
task.output = t("task.build.completed", {
|
|
36748
|
+
command: executions.map((e3) => e3.label).join(", ")
|
|
36749
|
+
});
|
|
36547
36750
|
}
|
|
36548
36751
|
};
|
|
36549
36752
|
}
|
|
36550
36753
|
|
|
36551
36754
|
// src/tasks/phases/version.ts
|
|
36552
36755
|
init_dist2();
|
|
36553
|
-
import
|
|
36756
|
+
import path17 from "node:path";
|
|
36554
36757
|
|
|
36555
36758
|
// src/changelog/file.ts
|
|
36556
36759
|
import { existsSync as existsSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "node:fs";
|
|
36557
|
-
import
|
|
36760
|
+
import path15 from "node:path";
|
|
36558
36761
|
function writeChangelogToFile(cwd, newContent) {
|
|
36559
|
-
const changelogPath =
|
|
36762
|
+
const changelogPath = path15.join(cwd, "CHANGELOG.md");
|
|
36560
36763
|
let existing = "";
|
|
36561
36764
|
if (existsSync7(changelogPath)) {
|
|
36562
36765
|
existing = readFileSync10(changelogPath, "utf-8");
|
|
@@ -36621,7 +36824,7 @@ function buildChangelogEntries(changesets, packagePath) {
|
|
|
36621
36824
|
|
|
36622
36825
|
// src/changeset/reader.ts
|
|
36623
36826
|
import { existsSync as existsSync8, readdirSync as readdirSync3, readFileSync as readFileSync11, rmSync as rmSync2 } from "node:fs";
|
|
36624
|
-
import
|
|
36827
|
+
import path16 from "node:path";
|
|
36625
36828
|
import process20 from "node:process";
|
|
36626
36829
|
|
|
36627
36830
|
// src/changeset/parser.ts
|
|
@@ -36642,8 +36845,8 @@ function parseChangeset(content, fileName, resolveKey) {
|
|
|
36642
36845
|
if (!VALID_BUMP_TYPES.has(type)) {
|
|
36643
36846
|
throw new Error(`Invalid bump type "${type}" for package "${key}" in "${fileName}". Expected: patch, minor, or major.`);
|
|
36644
36847
|
}
|
|
36645
|
-
const
|
|
36646
|
-
releases.push({ path:
|
|
36848
|
+
const path16 = resolveKey ? resolveKey(key) : key;
|
|
36849
|
+
releases.push({ path: path16, type });
|
|
36647
36850
|
}
|
|
36648
36851
|
}
|
|
36649
36852
|
const id = fileName.replace(/\.md$/, "");
|
|
@@ -36656,7 +36859,7 @@ function parseChangeset(content, fileName, resolveKey) {
|
|
|
36656
36859
|
|
|
36657
36860
|
// src/changeset/reader.ts
|
|
36658
36861
|
function readChangesets(cwd = process20.cwd(), resolveKey) {
|
|
36659
|
-
const changesetsDir =
|
|
36862
|
+
const changesetsDir = path16.join(cwd, ".pubm", "changesets");
|
|
36660
36863
|
if (!existsSync8(changesetsDir)) {
|
|
36661
36864
|
return [];
|
|
36662
36865
|
}
|
|
@@ -36666,16 +36869,16 @@ function readChangesets(cwd = process20.cwd(), resolveKey) {
|
|
|
36666
36869
|
if (!file.endsWith(".md") || file === "README.md") {
|
|
36667
36870
|
continue;
|
|
36668
36871
|
}
|
|
36669
|
-
const filePath =
|
|
36872
|
+
const filePath = path16.join(changesetsDir, file);
|
|
36670
36873
|
const content = readFileSync11(filePath, "utf-8");
|
|
36671
36874
|
changesets.push(parseChangeset(content, file, resolveKey));
|
|
36672
36875
|
}
|
|
36673
36876
|
return changesets;
|
|
36674
36877
|
}
|
|
36675
36878
|
function deleteChangesetFiles(cwd, changesets) {
|
|
36676
|
-
const changesetsDir =
|
|
36879
|
+
const changesetsDir = path16.join(cwd, ".pubm", "changesets");
|
|
36677
36880
|
for (const changeset of changesets) {
|
|
36678
|
-
const filePath =
|
|
36881
|
+
const filePath = path16.join(changesetsDir, `${changeset.id}.md`);
|
|
36679
36882
|
if (existsSync8(filePath)) {
|
|
36680
36883
|
rmSync2(filePath);
|
|
36681
36884
|
}
|
|
@@ -36732,7 +36935,7 @@ function createVersionTask(hasPrepare, dryRun) {
|
|
|
36732
36935
|
const changesets = readChangesets(ctx.cwd, resolver);
|
|
36733
36936
|
if (changesets.length > 0) {
|
|
36734
36937
|
registerChangesetBackups(ctx, changesets);
|
|
36735
|
-
const changelogPath =
|
|
36938
|
+
const changelogPath = path17.join(ctx.cwd, "CHANGELOG.md");
|
|
36736
36939
|
registerChangelogBackup(ctx, changelogPath);
|
|
36737
36940
|
const pkgPath = ctx.config.packages[0]?.path ?? "";
|
|
36738
36941
|
const entries = buildChangelogEntries(changesets, pkgPath);
|
|
@@ -36789,7 +36992,7 @@ ${ctx.config.packages.map((pkg) => `- ${pkg.name}: ${plan.version}`).join(`
|
|
|
36789
36992
|
const changesets = readChangesets(ctx.cwd, resolver);
|
|
36790
36993
|
if (changesets.length > 0) {
|
|
36791
36994
|
registerChangesetBackups(ctx, changesets);
|
|
36792
|
-
const changelogPath =
|
|
36995
|
+
const changelogPath = path17.join(ctx.cwd, "CHANGELOG.md");
|
|
36793
36996
|
registerChangelogBackup(ctx, changelogPath);
|
|
36794
36997
|
const allEntries = [...plan.packages.keys()].flatMap((pkgPath) => buildChangelogEntries(changesets, pkgPath));
|
|
36795
36998
|
if (allEntries.length > 0) {
|
|
@@ -36849,15 +37052,15 @@ ${[...plan.packages].map(([pkgPath]) => `- ${getPackageName(ctx, pkgPath)}: ${pl
|
|
|
36849
37052
|
registerChangesetBackups(ctx, changesets);
|
|
36850
37053
|
for (const [pkgPath] of plan.packages) {
|
|
36851
37054
|
const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
|
|
36852
|
-
const changelogDir = pkgConfig ?
|
|
36853
|
-
const changelogPath =
|
|
37055
|
+
const changelogDir = pkgConfig ? path17.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
|
|
37056
|
+
const changelogPath = path17.join(changelogDir, "CHANGELOG.md");
|
|
36854
37057
|
registerChangelogBackup(ctx, changelogPath);
|
|
36855
37058
|
}
|
|
36856
37059
|
for (const [pkgPath, pkgVersion] of plan.packages) {
|
|
36857
37060
|
const entries = buildChangelogEntries(changesets, pkgPath);
|
|
36858
37061
|
if (entries.length > 0) {
|
|
36859
37062
|
const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
|
|
36860
|
-
const changelogDir = pkgConfig ?
|
|
37063
|
+
const changelogDir = pkgConfig ? path17.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
|
|
36861
37064
|
writeChangelogToFile(changelogDir, generateChangelog(pkgVersion, entries));
|
|
36862
37065
|
}
|
|
36863
37066
|
}
|
|
@@ -37109,11 +37312,11 @@ function maxBump(a3, b2) {
|
|
|
37109
37312
|
}
|
|
37110
37313
|
// src/changeset/migrate.ts
|
|
37111
37314
|
import { copyFileSync, existsSync as existsSync9, mkdirSync as mkdirSync3, readdirSync as readdirSync4 } from "node:fs";
|
|
37112
|
-
import
|
|
37315
|
+
import path18 from "node:path";
|
|
37113
37316
|
import process22 from "node:process";
|
|
37114
37317
|
var SKIPPED_FILES = new Set(["config.json", "README.md"]);
|
|
37115
37318
|
function migrateFromChangesets(cwd = process22.cwd()) {
|
|
37116
|
-
const changesetDir =
|
|
37319
|
+
const changesetDir = path18.join(cwd, ".changeset");
|
|
37117
37320
|
if (!existsSync9(changesetDir)) {
|
|
37118
37321
|
return {
|
|
37119
37322
|
success: false,
|
|
@@ -37122,7 +37325,7 @@ function migrateFromChangesets(cwd = process22.cwd()) {
|
|
|
37122
37325
|
configMigrated: false
|
|
37123
37326
|
};
|
|
37124
37327
|
}
|
|
37125
|
-
const pubmDir =
|
|
37328
|
+
const pubmDir = path18.join(cwd, ".pubm", "changesets");
|
|
37126
37329
|
mkdirSync3(pubmDir, { recursive: true });
|
|
37127
37330
|
const files = readdirSync4(changesetDir);
|
|
37128
37331
|
const migratedFiles = [];
|
|
@@ -37136,13 +37339,13 @@ function migrateFromChangesets(cwd = process22.cwd()) {
|
|
|
37136
37339
|
continue;
|
|
37137
37340
|
}
|
|
37138
37341
|
if (file === "pre.json") {
|
|
37139
|
-
copyFileSync(
|
|
37342
|
+
copyFileSync(path18.join(changesetDir, file), path18.resolve(cwd, ".pubm", "pre.json"));
|
|
37140
37343
|
migratedFiles.push(file);
|
|
37141
37344
|
continue;
|
|
37142
37345
|
}
|
|
37143
37346
|
if (file.endsWith(".md")) {
|
|
37144
|
-
const src =
|
|
37145
|
-
const dest =
|
|
37347
|
+
const src = path18.join(changesetDir, file);
|
|
37348
|
+
const dest = path18.join(pubmDir, file);
|
|
37146
37349
|
copyFileSync(src, dest);
|
|
37147
37350
|
migratedFiles.push(file);
|
|
37148
37351
|
}
|
|
@@ -37217,7 +37420,7 @@ function calculateVersionBumps(currentVersions, cwd = process24.cwd(), resolveKe
|
|
|
37217
37420
|
// src/changeset/writer.ts
|
|
37218
37421
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
37219
37422
|
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync9 } from "node:fs";
|
|
37220
|
-
import
|
|
37423
|
+
import path19 from "node:path";
|
|
37221
37424
|
import process25 from "node:process";
|
|
37222
37425
|
var adjectives = [
|
|
37223
37426
|
"brave",
|
|
@@ -37313,11 +37516,11 @@ ${summary}
|
|
|
37313
37516
|
return content;
|
|
37314
37517
|
}
|
|
37315
37518
|
function writeChangeset(releases, summary, cwd = process25.cwd()) {
|
|
37316
|
-
const changesetsDir =
|
|
37519
|
+
const changesetsDir = path19.join(cwd, ".pubm", "changesets");
|
|
37317
37520
|
mkdirSync4(changesetsDir, { recursive: true });
|
|
37318
37521
|
const id = generateChangesetId();
|
|
37319
37522
|
const fileName = `${id}.md`;
|
|
37320
|
-
const filePath =
|
|
37523
|
+
const filePath = path19.join(changesetsDir, fileName);
|
|
37321
37524
|
const content = generateChangesetContent(releases, summary);
|
|
37322
37525
|
writeFileSync9(filePath, content, "utf-8");
|
|
37323
37526
|
return filePath;
|
|
@@ -37325,6 +37528,8 @@ function writeChangeset(releases, summary, cwd = process25.cwd()) {
|
|
|
37325
37528
|
// src/config/defaults.ts
|
|
37326
37529
|
init_catalog2();
|
|
37327
37530
|
init_i18n();
|
|
37531
|
+
var import_micromatch4 = __toESM(require_micromatch(), 1);
|
|
37532
|
+
import path20 from "node:path";
|
|
37328
37533
|
init_catalog();
|
|
37329
37534
|
var defaultValidate = {
|
|
37330
37535
|
cleanInstall: true,
|
|
@@ -37370,6 +37575,16 @@ async function resolveConfig(config, cwd) {
|
|
|
37370
37575
|
}
|
|
37371
37576
|
}
|
|
37372
37577
|
}
|
|
37578
|
+
if (config.ecosystems) {
|
|
37579
|
+
for (const key of Object.keys(config.ecosystems)) {
|
|
37580
|
+
if (!ecosystemCatalog.get(key)) {
|
|
37581
|
+
throw new Error(t("error.config.unknownEcosystem", {
|
|
37582
|
+
ecosystem: key,
|
|
37583
|
+
list: ecosystemCatalog.all().map((d3) => d3.key).join(", ")
|
|
37584
|
+
}));
|
|
37585
|
+
}
|
|
37586
|
+
}
|
|
37587
|
+
}
|
|
37373
37588
|
const configPackages = config.packages?.map((pkg) => {
|
|
37374
37589
|
if (!pkg.registries)
|
|
37375
37590
|
return pkg;
|
|
@@ -37391,15 +37606,29 @@ async function resolveConfig(config, cwd) {
|
|
|
37391
37606
|
discoveryEmpty = true;
|
|
37392
37607
|
packages = [];
|
|
37393
37608
|
} else {
|
|
37394
|
-
packages = discovered.map((pkg) =>
|
|
37395
|
-
|
|
37396
|
-
|
|
37397
|
-
|
|
37398
|
-
|
|
37399
|
-
|
|
37400
|
-
|
|
37401
|
-
|
|
37402
|
-
|
|
37609
|
+
packages = discovered.map((pkg) => {
|
|
37610
|
+
const configPkg = configPackages?.find((cp) => {
|
|
37611
|
+
const normalized = cp.path.replace(/\\/g, "/");
|
|
37612
|
+
const pkgPathForward = pkg.path.replace(/\\/g, "/");
|
|
37613
|
+
if (import_micromatch4.default.scan(normalized).isGlob) {
|
|
37614
|
+
return import_micromatch4.default.isMatch(pkgPathForward, normalized);
|
|
37615
|
+
}
|
|
37616
|
+
return path20.normalize(cp.path) === pkg.path;
|
|
37617
|
+
});
|
|
37618
|
+
return {
|
|
37619
|
+
path: pkg.path,
|
|
37620
|
+
name: pkg.name,
|
|
37621
|
+
version: pkg.version,
|
|
37622
|
+
dependencies: pkg.dependencies,
|
|
37623
|
+
ecosystem: pkg.ecosystem,
|
|
37624
|
+
registries: pkg.registries,
|
|
37625
|
+
...pkg.registryVersions ? { registryVersions: pkg.registryVersions } : {},
|
|
37626
|
+
...configPkg?.testScript ? { testScript: configPkg.testScript } : {},
|
|
37627
|
+
...configPkg?.testCommand ? { testCommand: configPkg.testCommand } : {},
|
|
37628
|
+
...configPkg?.buildScript ? { buildScript: configPkg.buildScript } : {},
|
|
37629
|
+
...configPkg?.buildCommand ? { buildCommand: configPkg.buildCommand } : {}
|
|
37630
|
+
};
|
|
37631
|
+
});
|
|
37403
37632
|
}
|
|
37404
37633
|
return {
|
|
37405
37634
|
...defaultConfig,
|
|
@@ -37412,6 +37641,7 @@ async function resolveConfig(config, cwd) {
|
|
|
37412
37641
|
...config.rollback
|
|
37413
37642
|
},
|
|
37414
37643
|
snapshotTemplate: config.snapshotTemplate ?? defaultConfig.snapshotTemplate,
|
|
37644
|
+
ecosystems: config.ecosystems ?? {},
|
|
37415
37645
|
plugins: config.plugins ?? [],
|
|
37416
37646
|
versionSources: config.versionSources ?? defaultConfig.versionSources,
|
|
37417
37647
|
conventionalCommits: {
|
|
@@ -37436,14 +37666,14 @@ import { execFile } from "node:child_process";
|
|
|
37436
37666
|
import {
|
|
37437
37667
|
mkdir,
|
|
37438
37668
|
mkdtemp,
|
|
37439
|
-
readFile as
|
|
37669
|
+
readFile as readFile7,
|
|
37440
37670
|
rm,
|
|
37441
37671
|
stat as stat6,
|
|
37442
37672
|
writeFile as writeFile3
|
|
37443
37673
|
} from "node:fs/promises";
|
|
37444
37674
|
import { createRequire as createRequire2 } from "node:module";
|
|
37445
37675
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
37446
|
-
import
|
|
37676
|
+
import path21 from "node:path";
|
|
37447
37677
|
import { pathToFileURL } from "node:url";
|
|
37448
37678
|
import vm from "node:vm";
|
|
37449
37679
|
var CONFIG_FILES = [
|
|
@@ -37496,7 +37726,7 @@ var CONFIG_MODULE_SHIMS = {
|
|
|
37496
37726
|
};
|
|
37497
37727
|
async function findConfigFile(cwd) {
|
|
37498
37728
|
for (const file of CONFIG_FILES) {
|
|
37499
|
-
const filePath =
|
|
37729
|
+
const filePath = path21.join(cwd, file);
|
|
37500
37730
|
try {
|
|
37501
37731
|
if ((await stat6(filePath)).isFile()) {
|
|
37502
37732
|
return filePath;
|
|
@@ -37517,15 +37747,15 @@ function isBareSpecifier(specifier) {
|
|
|
37517
37747
|
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("file:") && !specifier.startsWith("node:");
|
|
37518
37748
|
}
|
|
37519
37749
|
async function findClosestPackageManifest(filePath) {
|
|
37520
|
-
let current =
|
|
37750
|
+
let current = path21.dirname(filePath);
|
|
37521
37751
|
while (true) {
|
|
37522
|
-
const manifestPath =
|
|
37752
|
+
const manifestPath = path21.join(current, "package.json");
|
|
37523
37753
|
try {
|
|
37524
37754
|
if ((await stat6(manifestPath)).isFile()) {
|
|
37525
37755
|
return manifestPath;
|
|
37526
37756
|
}
|
|
37527
37757
|
} catch {}
|
|
37528
|
-
const parent =
|
|
37758
|
+
const parent = path21.dirname(current);
|
|
37529
37759
|
if (parent === current) {
|
|
37530
37760
|
return null;
|
|
37531
37761
|
}
|
|
@@ -37541,7 +37771,7 @@ async function isOptionalDependencyImport(specifier, importerPath) {
|
|
|
37541
37771
|
return false;
|
|
37542
37772
|
}
|
|
37543
37773
|
const packageName = getPackageName2(specifier);
|
|
37544
|
-
const manifest = JSON.parse(await
|
|
37774
|
+
const manifest = JSON.parse(await readFile7(manifestPath, "utf8"));
|
|
37545
37775
|
if (manifest.optionalDependencies?.[packageName]) {
|
|
37546
37776
|
return true;
|
|
37547
37777
|
}
|
|
@@ -37612,7 +37842,7 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
|
|
|
37612
37842
|
}
|
|
37613
37843
|
const optionalDependencies = new Set;
|
|
37614
37844
|
for (const manifestPath of manifestPaths) {
|
|
37615
|
-
const manifest = JSON.parse(await
|
|
37845
|
+
const manifest = JSON.parse(await readFile7(manifestPath, "utf8"));
|
|
37616
37846
|
for (const dependency of Object.keys(manifest.optionalDependencies ?? {})) {
|
|
37617
37847
|
optionalDependencies.add(dependency);
|
|
37618
37848
|
}
|
|
@@ -37627,13 +37857,13 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
|
|
|
37627
37857
|
async function findInstalledPackagePath(startDir, dependency) {
|
|
37628
37858
|
let current = startDir;
|
|
37629
37859
|
while (true) {
|
|
37630
|
-
const packageDir =
|
|
37860
|
+
const packageDir = path21.join(current, "node_modules", dependency);
|
|
37631
37861
|
try {
|
|
37632
37862
|
if ((await stat6(packageDir)).isDirectory()) {
|
|
37633
37863
|
return packageDir;
|
|
37634
37864
|
}
|
|
37635
37865
|
} catch {}
|
|
37636
|
-
const parent =
|
|
37866
|
+
const parent = path21.dirname(current);
|
|
37637
37867
|
if (parent === current) {
|
|
37638
37868
|
return null;
|
|
37639
37869
|
}
|
|
@@ -37641,19 +37871,19 @@ async function findInstalledPackagePath(startDir, dependency) {
|
|
|
37641
37871
|
}
|
|
37642
37872
|
}
|
|
37643
37873
|
async function writeOptionalDependencyStubs(moduleDir, resolveFromDir, optionalDependencies) {
|
|
37644
|
-
const nodeModulesDir =
|
|
37874
|
+
const nodeModulesDir = path21.join(moduleDir, "node_modules");
|
|
37645
37875
|
for (const dependency of optionalDependencies) {
|
|
37646
37876
|
if (await findInstalledPackagePath(resolveFromDir, dependency)) {
|
|
37647
37877
|
continue;
|
|
37648
37878
|
}
|
|
37649
|
-
const packageDir =
|
|
37879
|
+
const packageDir = path21.join(nodeModulesDir, dependency);
|
|
37650
37880
|
await mkdir(packageDir, { recursive: true });
|
|
37651
|
-
await writeFile3(
|
|
37881
|
+
await writeFile3(path21.join(packageDir, "package.json"), JSON.stringify({
|
|
37652
37882
|
name: dependency,
|
|
37653
37883
|
private: true,
|
|
37654
37884
|
main: "./index.js"
|
|
37655
37885
|
}, null, 2), "utf8");
|
|
37656
|
-
await writeFile3(
|
|
37886
|
+
await writeFile3(path21.join(packageDir, "index.js"), createOptionalDependencyProxyPackage(dependency), "utf8");
|
|
37657
37887
|
}
|
|
37658
37888
|
}
|
|
37659
37889
|
function createOptionalDependencyPlugin(specifiers) {
|
|
@@ -37707,7 +37937,7 @@ function createConfigModuleShimPlugin() {
|
|
|
37707
37937
|
};
|
|
37708
37938
|
}
|
|
37709
37939
|
async function runBunBuild(build, entrypoint, format3 = "esm", optionalDynamicImports = []) {
|
|
37710
|
-
const entrypointSource = await
|
|
37940
|
+
const entrypointSource = await readFile7(entrypoint, "utf8");
|
|
37711
37941
|
const result = await build({
|
|
37712
37942
|
entrypoints: [entrypoint],
|
|
37713
37943
|
target: "bun",
|
|
@@ -37765,10 +37995,10 @@ async function buildConfigWithFormat(entrypoint, format3) {
|
|
|
37765
37995
|
}
|
|
37766
37996
|
async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
|
|
37767
37997
|
const extension = format3 === "esm" ? "mjs" : "cjs";
|
|
37768
|
-
const tempDir = await mkdtemp(
|
|
37769
|
-
const buildScript =
|
|
37770
|
-
const outfile =
|
|
37771
|
-
const resultFile =
|
|
37998
|
+
const tempDir = await mkdtemp(path21.join(tmpdir3(), "pubm-config-"));
|
|
37999
|
+
const buildScript = path21.join(tempDir, "build-config.mjs");
|
|
38000
|
+
const outfile = path21.join(tempDir, `pubm.config.${extension}`);
|
|
38001
|
+
const resultFile = path21.join(tempDir, "build-result.json");
|
|
37772
38002
|
try {
|
|
37773
38003
|
await writeFile3(buildScript, [
|
|
37774
38004
|
'import { readFile, stat, writeFile } from "node:fs/promises";',
|
|
@@ -38019,8 +38249,8 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
|
|
|
38019
38249
|
resolve2();
|
|
38020
38250
|
});
|
|
38021
38251
|
});
|
|
38022
|
-
const result = JSON.parse(await
|
|
38023
|
-
const contents = result.hasEntrypoint ? await
|
|
38252
|
+
const result = JSON.parse(await readFile7(resultFile, "utf8"));
|
|
38253
|
+
const contents = result.hasEntrypoint ? await readFile7(outfile, "utf8") : null;
|
|
38024
38254
|
return {
|
|
38025
38255
|
success: result.success,
|
|
38026
38256
|
logs: result.logs,
|
|
@@ -38044,11 +38274,11 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
|
|
|
38044
38274
|
}
|
|
38045
38275
|
function rewriteImportMeta(source, configPath) {
|
|
38046
38276
|
const replacements = [
|
|
38047
|
-
["import.meta.dirname", JSON.stringify(
|
|
38277
|
+
["import.meta.dirname", JSON.stringify(path21.dirname(configPath))],
|
|
38048
38278
|
["import.meta.filename", JSON.stringify(configPath)],
|
|
38049
38279
|
["import.meta.path", JSON.stringify(configPath)],
|
|
38050
38280
|
["import.meta.url", JSON.stringify(pathToFileURL(configPath).href)],
|
|
38051
|
-
["import.meta.dir", JSON.stringify(
|
|
38281
|
+
["import.meta.dir", JSON.stringify(path21.dirname(configPath))]
|
|
38052
38282
|
];
|
|
38053
38283
|
let rewritten = source;
|
|
38054
38284
|
for (const [pattern, value] of replacements) {
|
|
@@ -38064,10 +38294,10 @@ async function importConfigModule(configPath) {
|
|
|
38064
38294
|
return normalizeConfigNamespace(namespace);
|
|
38065
38295
|
}
|
|
38066
38296
|
async function importBundledConfig(source, configPath, optionalDependencies) {
|
|
38067
|
-
const tempDir = await mkdtemp(
|
|
38068
|
-
const tempFile =
|
|
38297
|
+
const tempDir = await mkdtemp(path21.join(path21.dirname(configPath), ".pubm-config-module-"));
|
|
38298
|
+
const tempFile = path21.join(tempDir, "pubm.config.mjs");
|
|
38069
38299
|
try {
|
|
38070
|
-
await writeOptionalDependencyStubs(tempDir,
|
|
38300
|
+
await writeOptionalDependencyStubs(tempDir, path21.dirname(configPath), optionalDependencies);
|
|
38071
38301
|
await writeFile3(tempFile, source, "utf8");
|
|
38072
38302
|
return importConfigModule(tempFile);
|
|
38073
38303
|
} finally {
|
|
@@ -38082,7 +38312,7 @@ async function executeBundledConfigInVm(source, configPath) {
|
|
|
38082
38312
|
exports: module.exports,
|
|
38083
38313
|
require: require2,
|
|
38084
38314
|
__filename: configPath,
|
|
38085
|
-
__dirname:
|
|
38315
|
+
__dirname: path21.dirname(configPath),
|
|
38086
38316
|
console,
|
|
38087
38317
|
process,
|
|
38088
38318
|
Buffer,
|
|
@@ -38113,7 +38343,7 @@ function formatStageError(stage, error4) {
|
|
|
38113
38343
|
async function loadConfig(cwd = process.cwd(), configPath) {
|
|
38114
38344
|
let resolvedConfigPath;
|
|
38115
38345
|
if (configPath) {
|
|
38116
|
-
resolvedConfigPath =
|
|
38346
|
+
resolvedConfigPath = path21.resolve(cwd, configPath);
|
|
38117
38347
|
try {
|
|
38118
38348
|
if (!(await stat6(resolvedConfigPath)).isFile()) {
|
|
38119
38349
|
throw new Error(`Config path is not a file: ${resolvedConfigPath}`);
|
|
@@ -38193,12 +38423,12 @@ function defineConfig(config) {
|
|
|
38193
38423
|
init_context();
|
|
38194
38424
|
|
|
38195
38425
|
// src/conventional-commit/scope-resolver.ts
|
|
38196
|
-
import
|
|
38426
|
+
import path22 from "node:path";
|
|
38197
38427
|
function resolveCommitPackages(commit, packagePaths) {
|
|
38198
38428
|
const matched = new Set;
|
|
38199
38429
|
if (commit.scope) {
|
|
38200
38430
|
for (const pkgPath of packagePaths) {
|
|
38201
|
-
const dirName =
|
|
38431
|
+
const dirName = path22.basename(pkgPath);
|
|
38202
38432
|
if (dirName === commit.scope) {
|
|
38203
38433
|
matched.add(pkgPath);
|
|
38204
38434
|
}
|
|
@@ -38453,7 +38683,7 @@ function inspectPackages(config, cwd) {
|
|
|
38453
38683
|
init_manifest_reader();
|
|
38454
38684
|
// src/migrate/adapters/changesets.ts
|
|
38455
38685
|
import { existsSync as existsSync10, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "node:fs";
|
|
38456
|
-
import
|
|
38686
|
+
import path23 from "node:path";
|
|
38457
38687
|
var SKIPPED_DIR_ENTRIES = new Set(["config.json", "README.md", ".gitkeep"]);
|
|
38458
38688
|
var CHANGELOG_PRESET_MAP = {
|
|
38459
38689
|
"@changesets/changelog-github": "github",
|
|
@@ -38471,11 +38701,11 @@ var changesetsAdapter = {
|
|
|
38471
38701
|
name: "changesets",
|
|
38472
38702
|
configFilePatterns: [".changeset/config.json"],
|
|
38473
38703
|
async detect(cwd) {
|
|
38474
|
-
const configFile =
|
|
38704
|
+
const configFile = path23.join(cwd, ".changeset", "config.json");
|
|
38475
38705
|
if (!existsSync10(configFile)) {
|
|
38476
38706
|
return { found: false, configFiles: [], relatedFiles: [] };
|
|
38477
38707
|
}
|
|
38478
|
-
const changesetDir =
|
|
38708
|
+
const changesetDir = path23.dirname(configFile);
|
|
38479
38709
|
const relatedFiles = [];
|
|
38480
38710
|
try {
|
|
38481
38711
|
const entries = readdirSync5(changesetDir, { encoding: "utf-8" });
|
|
@@ -38483,7 +38713,7 @@ var changesetsAdapter = {
|
|
|
38483
38713
|
if (SKIPPED_DIR_ENTRIES.has(entry))
|
|
38484
38714
|
continue;
|
|
38485
38715
|
if (entry.endsWith(".md") || entry === "pre.json") {
|
|
38486
|
-
relatedFiles.push(
|
|
38716
|
+
relatedFiles.push(path23.join(changesetDir, entry));
|
|
38487
38717
|
}
|
|
38488
38718
|
}
|
|
38489
38719
|
} catch {}
|
|
@@ -38494,7 +38724,7 @@ var changesetsAdapter = {
|
|
|
38494
38724
|
};
|
|
38495
38725
|
},
|
|
38496
38726
|
async parse(files, cwd) {
|
|
38497
|
-
const configFile = files.find((f2) => f2.endsWith(`${
|
|
38727
|
+
const configFile = files.find((f2) => f2.endsWith(`${path23.sep}config.json`) || f2.endsWith("/config.json"));
|
|
38498
38728
|
if (configFile === undefined) {
|
|
38499
38729
|
return { source: "changesets", unmappable: [] };
|
|
38500
38730
|
}
|
|
@@ -38529,7 +38759,7 @@ var changesetsAdapter = {
|
|
|
38529
38759
|
if (hasUpdateInternalDeps)
|
|
38530
38760
|
result.monorepo.updateInternalDeps = config.updateInternalDependencies;
|
|
38531
38761
|
}
|
|
38532
|
-
const preJsonPath =
|
|
38762
|
+
const preJsonPath = path23.join(cwd, ".changeset", "pre.json");
|
|
38533
38763
|
if (existsSync10(preJsonPath)) {
|
|
38534
38764
|
try {
|
|
38535
38765
|
const preRaw = readFileSync12(preJsonPath, "utf-8");
|
|
@@ -38563,12 +38793,12 @@ var changesetsAdapter = {
|
|
|
38563
38793
|
const configFile = detected.configFiles[0];
|
|
38564
38794
|
if (configFile === undefined)
|
|
38565
38795
|
return [];
|
|
38566
|
-
return [
|
|
38796
|
+
return [path23.dirname(configFile)];
|
|
38567
38797
|
}
|
|
38568
38798
|
};
|
|
38569
38799
|
// src/migrate/adapters/np.ts
|
|
38570
38800
|
import { existsSync as existsSync11, readFileSync as readFileSync13 } from "node:fs";
|
|
38571
|
-
import
|
|
38801
|
+
import path24 from "node:path";
|
|
38572
38802
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
38573
38803
|
var STANDALONE_CONFIG_FILES = [
|
|
38574
38804
|
".np-config.json",
|
|
@@ -38673,12 +38903,12 @@ var npAdapter = {
|
|
|
38673
38903
|
async detect(cwd) {
|
|
38674
38904
|
const configFiles = [];
|
|
38675
38905
|
for (const filename of STANDALONE_CONFIG_FILES) {
|
|
38676
|
-
const filePath =
|
|
38906
|
+
const filePath = path24.join(cwd, filename);
|
|
38677
38907
|
if (existsSync11(filePath)) {
|
|
38678
38908
|
configFiles.push(filePath);
|
|
38679
38909
|
}
|
|
38680
38910
|
}
|
|
38681
|
-
const pkgJsonPath =
|
|
38911
|
+
const pkgJsonPath = path24.join(cwd, PACKAGE_JSON);
|
|
38682
38912
|
if (existsSync11(pkgJsonPath)) {
|
|
38683
38913
|
try {
|
|
38684
38914
|
const raw = readFileSync13(pkgJsonPath, "utf-8");
|
|
@@ -38695,8 +38925,8 @@ var npAdapter = {
|
|
|
38695
38925
|
};
|
|
38696
38926
|
},
|
|
38697
38927
|
async parse(files, _cwd) {
|
|
38698
|
-
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES.some((name) => f2.endsWith(
|
|
38699
|
-
const pkgJsonFile = files.find((f2) => f2.endsWith(
|
|
38928
|
+
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES.some((name) => f2.endsWith(path24.sep + name) || f2.endsWith(`/${name}`)));
|
|
38929
|
+
const pkgJsonFile = files.find((f2) => f2.endsWith(path24.sep + PACKAGE_JSON) || f2.endsWith(`/${PACKAGE_JSON}`));
|
|
38700
38930
|
const configFile = standaloneFile ?? pkgJsonFile;
|
|
38701
38931
|
if (configFile === undefined) {
|
|
38702
38932
|
return {
|
|
@@ -38715,13 +38945,13 @@ var npAdapter = {
|
|
|
38715
38945
|
};
|
|
38716
38946
|
},
|
|
38717
38947
|
getCleanupTargets(detected) {
|
|
38718
|
-
return detected.configFiles.filter((f2) => !f2.endsWith(
|
|
38948
|
+
return detected.configFiles.filter((f2) => !f2.endsWith(path24.sep + PACKAGE_JSON) && !f2.endsWith(`/${PACKAGE_JSON}`));
|
|
38719
38949
|
}
|
|
38720
38950
|
};
|
|
38721
38951
|
// src/migrate/adapters/release-it.ts
|
|
38722
38952
|
var import_yaml4 = __toESM(require_dist(), 1);
|
|
38723
38953
|
import { existsSync as existsSync12, readFileSync as readFileSync14 } from "node:fs";
|
|
38724
|
-
import
|
|
38954
|
+
import path25 from "node:path";
|
|
38725
38955
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
38726
38956
|
var STANDALONE_CONFIG_FILES2 = [
|
|
38727
38957
|
".release-it.json",
|
|
@@ -38746,7 +38976,7 @@ async function loadConfigFile(filePath) {
|
|
|
38746
38976
|
if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
|
|
38747
38977
|
return import_yaml4.default.parse(raw);
|
|
38748
38978
|
}
|
|
38749
|
-
if (filePath.endsWith(
|
|
38979
|
+
if (filePath.endsWith(path25.sep + PACKAGE_JSON2) || filePath.endsWith(`/${PACKAGE_JSON2}`)) {
|
|
38750
38980
|
const parsed = JSON.parse(raw);
|
|
38751
38981
|
return parsed["release-it"] ?? {};
|
|
38752
38982
|
}
|
|
@@ -38861,12 +39091,12 @@ var releaseItAdapter = {
|
|
|
38861
39091
|
async detect(cwd) {
|
|
38862
39092
|
const configFiles = [];
|
|
38863
39093
|
for (const filename of STANDALONE_CONFIG_FILES2) {
|
|
38864
|
-
const filePath =
|
|
39094
|
+
const filePath = path25.join(cwd, filename);
|
|
38865
39095
|
if (existsSync12(filePath)) {
|
|
38866
39096
|
configFiles.push(filePath);
|
|
38867
39097
|
}
|
|
38868
39098
|
}
|
|
38869
|
-
const pkgJsonPath =
|
|
39099
|
+
const pkgJsonPath = path25.join(cwd, PACKAGE_JSON2);
|
|
38870
39100
|
if (existsSync12(pkgJsonPath)) {
|
|
38871
39101
|
try {
|
|
38872
39102
|
const raw = readFileSync14(pkgJsonPath, "utf-8");
|
|
@@ -38883,8 +39113,8 @@ var releaseItAdapter = {
|
|
|
38883
39113
|
};
|
|
38884
39114
|
},
|
|
38885
39115
|
async parse(files, _cwd) {
|
|
38886
|
-
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES2.some((name) => f2.endsWith(
|
|
38887
|
-
const pkgJsonFile = files.find((f2) => f2.endsWith(
|
|
39116
|
+
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES2.some((name) => f2.endsWith(path25.sep + name) || f2.endsWith(`/${name}`)));
|
|
39117
|
+
const pkgJsonFile = files.find((f2) => f2.endsWith(path25.sep + PACKAGE_JSON2) || f2.endsWith(`/${PACKAGE_JSON2}`));
|
|
38888
39118
|
const configFile = standaloneFile ?? pkgJsonFile;
|
|
38889
39119
|
if (configFile === undefined) {
|
|
38890
39120
|
return {
|
|
@@ -38914,13 +39144,13 @@ var releaseItAdapter = {
|
|
|
38914
39144
|
};
|
|
38915
39145
|
},
|
|
38916
39146
|
getCleanupTargets(detected) {
|
|
38917
|
-
return detected.configFiles.filter((f2) => !f2.endsWith(
|
|
39147
|
+
return detected.configFiles.filter((f2) => !f2.endsWith(path25.sep + PACKAGE_JSON2) && !f2.endsWith(`/${PACKAGE_JSON2}`));
|
|
38918
39148
|
}
|
|
38919
39149
|
};
|
|
38920
39150
|
// src/migrate/adapters/semantic-release.ts
|
|
38921
39151
|
var import_yaml5 = __toESM(require_dist(), 1);
|
|
38922
39152
|
import { existsSync as existsSync13, readFileSync as readFileSync15 } from "node:fs";
|
|
38923
|
-
import
|
|
39153
|
+
import path26 from "node:path";
|
|
38924
39154
|
import { pathToFileURL as pathToFileURL4 } from "node:url";
|
|
38925
39155
|
var STANDALONE_CONFIG_FILES3 = [
|
|
38926
39156
|
".releaserc",
|
|
@@ -39010,11 +39240,11 @@ async function loadConfigFile2(filePath) {
|
|
|
39010
39240
|
if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
|
|
39011
39241
|
return import_yaml5.default.parse(raw);
|
|
39012
39242
|
}
|
|
39013
|
-
if (filePath.endsWith(
|
|
39243
|
+
if (filePath.endsWith(path26.sep + PACKAGE_JSON3) || filePath.endsWith(`/${PACKAGE_JSON3}`)) {
|
|
39014
39244
|
const parsed = JSON.parse(raw);
|
|
39015
39245
|
return parsed.release ?? {};
|
|
39016
39246
|
}
|
|
39017
|
-
const basename4 =
|
|
39247
|
+
const basename4 = path26.basename(filePath);
|
|
39018
39248
|
if (basename4 === ".releaserc") {
|
|
39019
39249
|
try {
|
|
39020
39250
|
return JSON.parse(raw);
|
|
@@ -39124,12 +39354,12 @@ var semanticReleaseAdapter = {
|
|
|
39124
39354
|
async detect(cwd) {
|
|
39125
39355
|
const configFiles = [];
|
|
39126
39356
|
for (const filename of STANDALONE_CONFIG_FILES3) {
|
|
39127
|
-
const filePath =
|
|
39357
|
+
const filePath = path26.join(cwd, filename);
|
|
39128
39358
|
if (existsSync13(filePath)) {
|
|
39129
39359
|
configFiles.push(filePath);
|
|
39130
39360
|
}
|
|
39131
39361
|
}
|
|
39132
|
-
const pkgJsonPath =
|
|
39362
|
+
const pkgJsonPath = path26.join(cwd, PACKAGE_JSON3);
|
|
39133
39363
|
if (existsSync13(pkgJsonPath)) {
|
|
39134
39364
|
try {
|
|
39135
39365
|
const raw = readFileSync15(pkgJsonPath, "utf-8");
|
|
@@ -39146,8 +39376,8 @@ var semanticReleaseAdapter = {
|
|
|
39146
39376
|
};
|
|
39147
39377
|
},
|
|
39148
39378
|
async parse(files, _cwd) {
|
|
39149
|
-
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES3.some((name) => f2.endsWith(
|
|
39150
|
-
const pkgJsonFile = files.find((f2) => f2.endsWith(
|
|
39379
|
+
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES3.some((name) => f2.endsWith(path26.sep + name) || f2.endsWith(`/${name}`)));
|
|
39380
|
+
const pkgJsonFile = files.find((f2) => f2.endsWith(path26.sep + PACKAGE_JSON3) || f2.endsWith(`/${PACKAGE_JSON3}`));
|
|
39151
39381
|
const configFile = standaloneFile ?? pkgJsonFile;
|
|
39152
39382
|
if (configFile === undefined) {
|
|
39153
39383
|
return {
|
|
@@ -39165,12 +39395,12 @@ var semanticReleaseAdapter = {
|
|
|
39165
39395
|
};
|
|
39166
39396
|
},
|
|
39167
39397
|
getCleanupTargets(detected) {
|
|
39168
|
-
return detected.configFiles.filter((f2) => !f2.endsWith(
|
|
39398
|
+
return detected.configFiles.filter((f2) => !f2.endsWith(path26.sep + PACKAGE_JSON3) && !f2.endsWith(`/${PACKAGE_JSON3}`));
|
|
39169
39399
|
}
|
|
39170
39400
|
};
|
|
39171
39401
|
// src/migrate/ci-advisor.ts
|
|
39172
39402
|
import { existsSync as existsSync14, readdirSync as readdirSync6, readFileSync as readFileSync16 } from "node:fs";
|
|
39173
|
-
import { join as
|
|
39403
|
+
import { join as join10 } from "node:path";
|
|
39174
39404
|
var CI_PATTERNS = {
|
|
39175
39405
|
"semantic-release": [
|
|
39176
39406
|
/npx\s+semantic-release/,
|
|
@@ -39190,7 +39420,7 @@ var CI_PATTERNS = {
|
|
|
39190
39420
|
np: [/npx\s+np\b/, /yarn\s+np\b/]
|
|
39191
39421
|
};
|
|
39192
39422
|
function scanCiWorkflows(cwd, source) {
|
|
39193
|
-
const workflowsDir =
|
|
39423
|
+
const workflowsDir = join10(cwd, ".github", "workflows");
|
|
39194
39424
|
if (!existsSync14(workflowsDir))
|
|
39195
39425
|
return [];
|
|
39196
39426
|
const patterns = CI_PATTERNS[source];
|
|
@@ -39199,7 +39429,7 @@ function scanCiWorkflows(cwd, source) {
|
|
|
39199
39429
|
for (const filename of files) {
|
|
39200
39430
|
if (!filename.endsWith(".yml") && !filename.endsWith(".yaml"))
|
|
39201
39431
|
continue;
|
|
39202
|
-
const filePath =
|
|
39432
|
+
const filePath = join10(workflowsDir, filename);
|
|
39203
39433
|
const content = readFileSync16(filePath, "utf-8");
|
|
39204
39434
|
for (const line of content.split(`
|
|
39205
39435
|
`)) {
|
|
@@ -39442,7 +39672,7 @@ async function detectMigrationSources(cwd, adapters, from) {
|
|
|
39442
39672
|
}
|
|
39443
39673
|
// src/migrate/pipeline.ts
|
|
39444
39674
|
import { existsSync as existsSync15, writeFileSync as writeFileSync10 } from "node:fs";
|
|
39445
|
-
import { join as
|
|
39675
|
+
import { join as join11 } from "node:path";
|
|
39446
39676
|
async function executeMigration(options) {
|
|
39447
39677
|
const { adapter, detected, cwd, dryRun, clean } = options;
|
|
39448
39678
|
const parsed = await adapter.parse(detected.configFiles, cwd);
|
|
@@ -39451,7 +39681,7 @@ async function executeMigration(options) {
|
|
|
39451
39681
|
const configString = generateConfigString(convertResult.config);
|
|
39452
39682
|
const ciAdvice = scanCiWorkflows(cwd, adapter.name);
|
|
39453
39683
|
if (!dryRun) {
|
|
39454
|
-
const outFile =
|
|
39684
|
+
const outFile = join11(cwd, "pubm.config.ts");
|
|
39455
39685
|
if (existsSync15(outFile)) {
|
|
39456
39686
|
throw new Error("pubm.config.ts already exists. Remove or rename it before migrating.");
|
|
39457
39687
|
}
|
|
@@ -39516,12 +39746,12 @@ function topologicalSort(graph) {
|
|
|
39516
39746
|
return sorted.reverse();
|
|
39517
39747
|
}
|
|
39518
39748
|
// src/monorepo/groups.ts
|
|
39519
|
-
var
|
|
39749
|
+
var import_micromatch5 = __toESM(require_micromatch(), 1);
|
|
39520
39750
|
function resolveGroups(groups, allPackages) {
|
|
39521
39751
|
return groups.map((group) => {
|
|
39522
39752
|
const resolved = new Set;
|
|
39523
39753
|
for (const pattern of group) {
|
|
39524
|
-
const matches =
|
|
39754
|
+
const matches = import_micromatch5.default(allPackages, pattern);
|
|
39525
39755
|
for (const match of matches) {
|
|
39526
39756
|
resolved.add(match);
|
|
39527
39757
|
}
|
|
@@ -39586,8 +39816,8 @@ init_catalog();
|
|
|
39586
39816
|
|
|
39587
39817
|
// src/tasks/prompts/independent-mode.ts
|
|
39588
39818
|
init_dist2();
|
|
39589
|
-
init_i18n();
|
|
39590
39819
|
var import_semver9 = __toESM(require_semver2(), 1);
|
|
39820
|
+
init_i18n();
|
|
39591
39821
|
|
|
39592
39822
|
// src/utils/filter-config.ts
|
|
39593
39823
|
function filterConfigPackages(ctx, publishPaths) {
|
|
@@ -39718,7 +39948,7 @@ class ChangesetSource {
|
|
|
39718
39948
|
}
|
|
39719
39949
|
}
|
|
39720
39950
|
// src/version-source/conventional-commit-source.ts
|
|
39721
|
-
import
|
|
39951
|
+
import path27 from "node:path";
|
|
39722
39952
|
class ConventionalCommitSource {
|
|
39723
39953
|
name = "conventional-commit";
|
|
39724
39954
|
typeOverrides;
|
|
@@ -39729,7 +39959,7 @@ class ConventionalCommitSource {
|
|
|
39729
39959
|
const packagePaths = [...context.packages.keys()];
|
|
39730
39960
|
const recommendations = [];
|
|
39731
39961
|
for (const packagePath of packagePaths) {
|
|
39732
|
-
const packageName =
|
|
39962
|
+
const packageName = path27.basename(packagePath);
|
|
39733
39963
|
const ref = findLastReleaseRef(context.cwd, packageName);
|
|
39734
39964
|
const rawCommits = getCommitsSinceRef(context.cwd, ref);
|
|
39735
39965
|
const parsed = [];
|
|
@@ -39960,7 +40190,7 @@ async function handleMultiPackage(ctx, task, packageInfos) {
|
|
|
39960
40190
|
const graph = buildGraphFromPackages(packageInfos);
|
|
39961
40191
|
const currentVersions = new Map(packageInfos.map((p2) => [p2.path, p2.version]));
|
|
39962
40192
|
const recommendations = await analyzeAllSources(ctx);
|
|
39963
|
-
if (
|
|
40193
|
+
if (m && recommendations.length > 0) {
|
|
39964
40194
|
const packages = new Map;
|
|
39965
40195
|
for (const rec of recommendations) {
|
|
39966
40196
|
const current = currentVersions.get(rec.packagePath);
|
|
@@ -40132,8 +40362,8 @@ async function handleIndependentMode(ctx, task, packageInfos, currentVersions, g
|
|
|
40132
40362
|
|
|
40133
40363
|
// src/tasks/prompts/single-package.ts
|
|
40134
40364
|
init_dist2();
|
|
40135
|
-
init_i18n();
|
|
40136
40365
|
var import_semver10 = __toESM(require_semver2(), 1);
|
|
40366
|
+
init_i18n();
|
|
40137
40367
|
async function handleSinglePackage(ctx, task) {
|
|
40138
40368
|
const pkg = ctx.config.packages[0];
|
|
40139
40369
|
const currentVersion = pkg?.version ?? "0.0.0";
|
|
@@ -40142,7 +40372,7 @@ async function handleSinglePackage(ctx, task) {
|
|
|
40142
40372
|
if (rec) {
|
|
40143
40373
|
const newVer = import_semver10.default.inc(currentVersion, rec.bumpType);
|
|
40144
40374
|
if (newVer) {
|
|
40145
|
-
if (
|
|
40375
|
+
if (m) {
|
|
40146
40376
|
ctx.runtime.versionPlan = {
|
|
40147
40377
|
mode: "single",
|
|
40148
40378
|
version: newVer,
|
|
@@ -40479,7 +40709,7 @@ import { spawn } from "child_process";
|
|
|
40479
40709
|
import { execFile as execFile2 } from "child_process";
|
|
40480
40710
|
import { createWriteStream } from "fs";
|
|
40481
40711
|
import fs2 from "fs/promises";
|
|
40482
|
-
import
|
|
40712
|
+
import path28 from "path";
|
|
40483
40713
|
import { Readable } from "stream";
|
|
40484
40714
|
import { pipeline } from "stream/promises";
|
|
40485
40715
|
import { promisify } from "util";
|
|
@@ -40488,16 +40718,16 @@ import crypto2 from "crypto";
|
|
|
40488
40718
|
import { createReadStream } from "fs";
|
|
40489
40719
|
import crypto from "crypto";
|
|
40490
40720
|
import fs3 from "fs/promises";
|
|
40491
|
-
import
|
|
40721
|
+
import path29 from "path";
|
|
40492
40722
|
import { realpath } from "fs/promises";
|
|
40493
40723
|
import { execFile as execFile22 } from "child_process";
|
|
40494
40724
|
import { promisify as promisify2 } from "util";
|
|
40495
40725
|
import { execFile as execFile3 } from "child_process";
|
|
40496
40726
|
import { lstat, readlink } from "fs/promises";
|
|
40497
40727
|
import { promisify as promisify3 } from "util";
|
|
40498
|
-
import { readFile as
|
|
40728
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
40499
40729
|
import { homedir as homedir2 } from "os";
|
|
40500
|
-
import { join as
|
|
40730
|
+
import { join as join12 } from "path";
|
|
40501
40731
|
import os2 from "os";
|
|
40502
40732
|
import path32 from "path";
|
|
40503
40733
|
import { readFileSync as readFileSync17 } from "fs";
|
|
@@ -40909,7 +41139,7 @@ async function downloadArtifact(url, tmpDir, options) {
|
|
|
40909
41139
|
}
|
|
40910
41140
|
const totalBytes = Number(response.headers.get("content-length")) || undefined;
|
|
40911
41141
|
const filename = extractFilename(url);
|
|
40912
|
-
const destPath =
|
|
41142
|
+
const destPath = path28.join(tmpDir, filename);
|
|
40913
41143
|
let bytesDownloaded = 0;
|
|
40914
41144
|
const nodeStream = Readable.fromWeb(response.body);
|
|
40915
41145
|
const writeStream = createWriteStream(destPath);
|
|
@@ -40925,7 +41155,7 @@ async function downloadArtifact(url, tmpDir, options) {
|
|
|
40925
41155
|
return destPath;
|
|
40926
41156
|
}
|
|
40927
41157
|
async function extractBinary(archivePath, tmpDir) {
|
|
40928
|
-
const extractDir =
|
|
41158
|
+
const extractDir = path28.join(tmpDir, "extracted");
|
|
40929
41159
|
await fs2.mkdir(extractDir, { recursive: true });
|
|
40930
41160
|
if (archivePath.endsWith(".tar.gz") || archivePath.endsWith(".tgz")) {
|
|
40931
41161
|
try {
|
|
@@ -40952,7 +41182,7 @@ async function extractBinary(archivePath, tmpDir) {
|
|
|
40952
41182
|
});
|
|
40953
41183
|
}
|
|
40954
41184
|
} else {
|
|
40955
|
-
const destPath =
|
|
41185
|
+
const destPath = path28.join(extractDir, path28.basename(archivePath));
|
|
40956
41186
|
await fs2.copyFile(archivePath, destPath);
|
|
40957
41187
|
return destPath;
|
|
40958
41188
|
}
|
|
@@ -40969,10 +41199,10 @@ async function findBinaryInDir(dir) {
|
|
|
40969
41199
|
if (!e3.isFile())
|
|
40970
41200
|
continue;
|
|
40971
41201
|
const parentDir = e3.parentPath ?? ("path" in e3 ? e3.path : dir);
|
|
40972
|
-
const filePath =
|
|
41202
|
+
const filePath = path28.join(parentDir, e3.name);
|
|
40973
41203
|
try {
|
|
40974
41204
|
const resolvedFile = await fs2.realpath(filePath);
|
|
40975
|
-
if (!resolvedFile.startsWith(resolvedDir +
|
|
41205
|
+
if (!resolvedFile.startsWith(resolvedDir + path28.sep) && resolvedFile !== resolvedDir) {
|
|
40976
41206
|
continue;
|
|
40977
41207
|
}
|
|
40978
41208
|
} catch {
|
|
@@ -41006,8 +41236,8 @@ async function findBinaryInDir(dir) {
|
|
|
41006
41236
|
".css"
|
|
41007
41237
|
]);
|
|
41008
41238
|
const binaryCandidates = files.filter((file) => {
|
|
41009
|
-
const ext =
|
|
41010
|
-
const basename4 =
|
|
41239
|
+
const ext = path28.extname(file).toLowerCase();
|
|
41240
|
+
const basename4 = path28.basename(file).toLowerCase();
|
|
41011
41241
|
return !NON_BINARY_EXTENSIONS.has(ext) && basename4 !== "license" && basename4 !== "readme";
|
|
41012
41242
|
});
|
|
41013
41243
|
return binaryCandidates.length > 0 ? binaryCandidates[0] : files[0];
|
|
@@ -41018,8 +41248,8 @@ function extractFilename(url) {
|
|
|
41018
41248
|
return segments[segments.length - 1] || "artifact";
|
|
41019
41249
|
}
|
|
41020
41250
|
async function createTempDir(targetPath) {
|
|
41021
|
-
const targetDir =
|
|
41022
|
-
const tmpDir =
|
|
41251
|
+
const targetDir = path28.dirname(targetPath);
|
|
41252
|
+
const tmpDir = path28.join(targetDir, `.update-kit-tmp-${process.pid}-${Date.now()}`);
|
|
41023
41253
|
await fs2.mkdir(tmpDir, { recursive: true });
|
|
41024
41254
|
return tmpDir;
|
|
41025
41255
|
}
|
|
@@ -41032,7 +41262,7 @@ async function setExecutablePermission(filePath) {
|
|
|
41032
41262
|
await fs2.chmod(filePath, 493);
|
|
41033
41263
|
}
|
|
41034
41264
|
function getCachePath(cacheDir, appName) {
|
|
41035
|
-
return
|
|
41265
|
+
return path29.join(cacheDir, appName, "update-check.json");
|
|
41036
41266
|
}
|
|
41037
41267
|
async function readCache(cacheDir, appName) {
|
|
41038
41268
|
const filePath = getCachePath(cacheDir, appName);
|
|
@@ -41052,7 +41282,7 @@ async function readCache(cacheDir, appName) {
|
|
|
41052
41282
|
}
|
|
41053
41283
|
async function writeCache(cacheDir, appName, entry) {
|
|
41054
41284
|
const filePath = getCachePath(cacheDir, appName);
|
|
41055
|
-
const dir =
|
|
41285
|
+
const dir = path29.dirname(filePath);
|
|
41056
41286
|
await fs3.mkdir(dir, { recursive: true });
|
|
41057
41287
|
const tmpPath = `${filePath}.${process.pid}-${Date.now()}.tmp`;
|
|
41058
41288
|
try {
|
|
@@ -41768,10 +41998,10 @@ async function detectFromNpm(execPath) {
|
|
|
41768
41998
|
};
|
|
41769
41999
|
}
|
|
41770
42000
|
async function detectFromReceipt(config, receiptDir) {
|
|
41771
|
-
const dir = receiptDir ??
|
|
41772
|
-
const receiptPath =
|
|
42001
|
+
const dir = receiptDir ?? join12(homedir2(), ".config", config.appName);
|
|
42002
|
+
const receiptPath = join12(dir, "install-receipt.json");
|
|
41773
42003
|
try {
|
|
41774
|
-
const content = await
|
|
42004
|
+
const content = await readFile8(receiptPath, "utf-8");
|
|
41775
42005
|
const receipt = JSON.parse(content);
|
|
41776
42006
|
if (receipt.appName !== config.appName) {
|
|
41777
42007
|
return null;
|
|
@@ -42491,10 +42721,10 @@ init_ui();
|
|
|
42491
42721
|
|
|
42492
42722
|
// src/validate/entry-points.ts
|
|
42493
42723
|
import { existsSync as existsSync16 } from "node:fs";
|
|
42494
|
-
import
|
|
42724
|
+
import path30 from "node:path";
|
|
42495
42725
|
var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
|
|
42496
42726
|
function checkPath(filePath, cwd) {
|
|
42497
|
-
return existsSync16(
|
|
42727
|
+
return existsSync16(path30.resolve(cwd, filePath));
|
|
42498
42728
|
}
|
|
42499
42729
|
function validateExports(exports, cwd, prefix = "exports") {
|
|
42500
42730
|
const errors = [];
|
|
@@ -42544,7 +42774,7 @@ function validateEntryPoints(pkg, cwd) {
|
|
|
42544
42774
|
return errors;
|
|
42545
42775
|
}
|
|
42546
42776
|
// src/validate/extraneous-files.ts
|
|
42547
|
-
var
|
|
42777
|
+
var import_micromatch6 = __toESM(require_micromatch(), 1);
|
|
42548
42778
|
var PATTERNS = [
|
|
42549
42779
|
{
|
|
42550
42780
|
pattern: [".env", ".env.*"],
|
|
@@ -42582,7 +42812,7 @@ function detectExtraneousFiles(files) {
|
|
|
42582
42812
|
const seen = new Set;
|
|
42583
42813
|
for (const { pattern, reason, basename: basename4 } of PATTERNS) {
|
|
42584
42814
|
const options = basename4 ? { basename: true } : {};
|
|
42585
|
-
const matched =
|
|
42815
|
+
const matched = import_micromatch6.default(files, pattern, options);
|
|
42586
42816
|
for (const file of matched) {
|
|
42587
42817
|
if (!seen.has(file)) {
|
|
42588
42818
|
seen.add(file);
|