@enke.dev/bumper 0.0.2 → 0.0.3

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.mjs +32 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -122,7 +122,7 @@ then the remaining file-rewriting features:
122
122
  | id | kind | detects | does |
123
123
  | ---------------- | --------------- | ------------------------------- | ------------------------------------------------------- |
124
124
  | `node` | runtime | node runtime / `.node-version` | install latest LTS via fnm/asdf, write `.node-version` |
125
- | `types-node` | feature | `@types/node` in any package | pin spec to Node LTS major |
125
+ | `types-node` | feature | `@types/node` in any package | pin spec to exact latest in the Node LTS major line |
126
126
  | `bun` | package-manager | bun packageManager / lockfile | self-upgrade, bump specs, pin `.bun-version`, reinstall |
127
127
  | `npm` | package-manager | npm packageManager / lockfile | bump specs to latest, clean reinstall |
128
128
  | `pnpm` | package-manager | pnpm packageManager / lockfile | self-update, bump specs to latest, clean reinstall |
package/dist/cli.mjs CHANGED
@@ -2400,17 +2400,45 @@ async function dirsWithTypesNode(ctx) {
2400
2400
  }));
2401
2401
  return dirs.filter((dir) => dir !== null);
2402
2402
  }
2403
- function pinTypesNode(pkg, major) {
2403
+ function pinTypesNode(pkg, version) {
2404
2404
  return BUCKETS.reduce((changed, bucket) => {
2405
2405
  const deps = pkg[bucket];
2406
2406
  const spec = deps?.[TYPES_NODE_PACKAGE];
2407
2407
  if (deps && spec && !isVersionRange(spec)) {
2408
- deps[TYPES_NODE_PACKAGE] = major;
2409
- return true;
2408
+ const next = `${operatorOf(spec)}${version}`;
2409
+ if (next !== spec) {
2410
+ deps[TYPES_NODE_PACKAGE] = next;
2411
+ return true;
2412
+ }
2410
2413
  }
2411
2414
  return changed;
2412
2415
  }, false);
2413
2416
  }
2417
+ async function updateTypesNode(ctx, resolveInRange = latestVersionInRange) {
2418
+ const { major } = await ensureNodeLts(ctx);
2419
+ const majorSpec = String(major);
2420
+ const dirs = await dirsWithTypesNode(ctx);
2421
+ if (dirs.length === 0) {
2422
+ return;
2423
+ }
2424
+ if (ctx.dryRun) {
2425
+ dirs.forEach((dir) => {
2426
+ const label = relative3(ctx.cwd, dir) || ".";
2427
+ planLine(`pin ${TYPES_NODE_PACKAGE} to latest ${majorSpec}.x in ${label}`);
2428
+ });
2429
+ return;
2430
+ }
2431
+ const version = await resolveInRange(TYPES_NODE_PACKAGE, majorSpec, viewTool(ctx.packageManager), ctx.cwd);
2432
+ if (!version) {
2433
+ return;
2434
+ }
2435
+ await Promise.all(dirs.map(async (dir) => {
2436
+ const pkg = await readPackageJson(dir);
2437
+ if (pkg && pinTypesNode(pkg, version)) {
2438
+ await writePackageJson(dir, pkg);
2439
+ }
2440
+ }));
2441
+ }
2414
2442
  var typesNodeFeature = {
2415
2443
  kind: "feature" /* Feature */,
2416
2444
  id: "types-node",
@@ -2421,22 +2449,7 @@ var typesNodeFeature = {
2421
2449
  async managedDependencies() {
2422
2450
  return [TYPES_NODE_PACKAGE];
2423
2451
  },
2424
- async update(ctx) {
2425
- const { major } = await ensureNodeLts(ctx);
2426
- const majorSpec = String(major);
2427
- const dirs = await dirsWithTypesNode(ctx);
2428
- await Promise.all(dirs.map(async (dir) => {
2429
- const label = relative3(ctx.cwd, dir) || ".";
2430
- if (ctx.dryRun) {
2431
- planLine(`pin ${TYPES_NODE_PACKAGE}@${majorSpec} in ${label}`);
2432
- return;
2433
- }
2434
- const pkg = await readPackageJson(dir);
2435
- if (pkg && pinTypesNode(pkg, majorSpec)) {
2436
- await writePackageJson(dir, pkg);
2437
- }
2438
- }));
2439
- }
2452
+ update: updateTypesNode
2440
2453
  };
2441
2454
 
2442
2455
  // src/modules/package-managers/bun/bun.package-manager.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enke.dev/bumper",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",