@enke.dev/bumper 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +25 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -2147,6 +2147,19 @@ function detectVersionManager() {
|
|
|
2147
2147
|
// src/context/detectors/workspace.detector.ts
|
|
2148
2148
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
2149
2149
|
import { dirname, join as join5, matchesGlob, relative } from "node:path";
|
|
2150
|
+
async function withoutIgnored(cwd, dirs, run2 = exec) {
|
|
2151
|
+
if (dirs.length === 0) {
|
|
2152
|
+
return dirs;
|
|
2153
|
+
}
|
|
2154
|
+
const manifestOf = (dir) => join5(dir, "package.json");
|
|
2155
|
+
const { exitCode, stdout } = await run2(["git", "check-ignore", ...dirs.map(manifestOf)], { cwd });
|
|
2156
|
+
if (exitCode !== 0 && exitCode !== 1) {
|
|
2157
|
+
return dirs;
|
|
2158
|
+
}
|
|
2159
|
+
const ignored = new Set(stdout.split(`
|
|
2160
|
+
`).map((line) => line.trim()).filter(Boolean));
|
|
2161
|
+
return dirs.filter((dir) => !ignored.has(manifestOf(dir)));
|
|
2162
|
+
}
|
|
2150
2163
|
function parsePnpmPackages(yaml) {
|
|
2151
2164
|
return yaml.split(`
|
|
2152
2165
|
`).reduce((state, raw) => {
|
|
@@ -2183,7 +2196,7 @@ async function readWorkspaceGlobs(cwd, pm) {
|
|
|
2183
2196
|
}
|
|
2184
2197
|
return [];
|
|
2185
2198
|
}
|
|
2186
|
-
async function detectWorkspaces(cwd, pm) {
|
|
2199
|
+
async function detectWorkspaces(cwd, pm, run2 = exec) {
|
|
2187
2200
|
const globs = await readWorkspaceGlobs(cwd, pm);
|
|
2188
2201
|
const positives = globs.filter((g) => !g.startsWith("!"));
|
|
2189
2202
|
const negatives = globs.filter((g) => g.startsWith("!")).map((g) => g.slice(1));
|
|
@@ -2192,7 +2205,7 @@ async function detectWorkspaces(cwd, pm) {
|
|
|
2192
2205
|
}
|
|
2193
2206
|
const matches = await Promise.all(positives.map((pattern) => globFiles(cwd, `${pattern}/package.json`)));
|
|
2194
2207
|
const found = new Set(matches.flat().map((match) => dirname(match)).filter((dir) => !negatives.some((neg) => matchesGlob(relative(cwd, dir), neg))));
|
|
2195
|
-
const members = [...found].sort();
|
|
2208
|
+
const members = await withoutIgnored(cwd, [...found].sort(), run2);
|
|
2196
2209
|
return { isMonorepo: members.length > 0, workspaces: [cwd, ...members] };
|
|
2197
2210
|
}
|
|
2198
2211
|
|
|
@@ -2525,6 +2538,7 @@ async function selfUpdate(ctx, cmd) {
|
|
|
2525
2538
|
}
|
|
2526
2539
|
|
|
2527
2540
|
// src/utils/upgrade.utils.ts
|
|
2541
|
+
var import_semver3 = __toESM(require_semver2(), 1);
|
|
2528
2542
|
import { join as join8 } from "node:path";
|
|
2529
2543
|
var BUCKETS2 = [
|
|
2530
2544
|
"dependencies",
|
|
@@ -2650,10 +2664,18 @@ async function rewriteSpecs(pkg, managed, latest, peerCaps, tool, cwd, lookups)
|
|
|
2650
2664
|
if (managed.has(name) || !isPinnable(spec)) {
|
|
2651
2665
|
return acc;
|
|
2652
2666
|
}
|
|
2653
|
-
const
|
|
2667
|
+
const capped_ = capRanges.has(name);
|
|
2668
|
+
const version = capped_ ? capped.get(name) : latest.get(name);
|
|
2654
2669
|
if (!version) {
|
|
2655
2670
|
return acc;
|
|
2656
2671
|
}
|
|
2672
|
+
const current = spec.replace(/^[\^~]/, "");
|
|
2673
|
+
if (import_semver3.default.valid(current) && import_semver3.default.lt(version, current)) {
|
|
2674
|
+
const currentViolatesCaps = capped_ && !(capRanges.get(name) ?? []).every((range) => import_semver3.default.satisfies(current, range));
|
|
2675
|
+
if (!currentViolatesCaps) {
|
|
2676
|
+
return acc;
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2657
2679
|
const next = `${operatorOf(spec)}${version}`;
|
|
2658
2680
|
if (next === spec) {
|
|
2659
2681
|
return acc;
|