cherrypick-interactive 1.4.1 → 1.4.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 (2) hide show
  1. package/cli.js +8 -8
  2. package/package.json +14 -5
package/cli.js CHANGED
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import chalk from 'chalk';
3
- import inquirer from 'inquirer';
4
2
  import { spawn } from 'node:child_process';
5
3
  import { promises as fsPromises, readFileSync } from 'node:fs';
6
4
  import { dirname, join } from 'node:path';
7
5
  import { fileURLToPath } from 'node:url';
6
+ import chalk from 'chalk';
7
+ import inquirer from 'inquirer';
8
+ import semver from 'semver';
8
9
  import simpleGit from 'simple-git';
9
10
  import updateNotifier from 'update-notifier';
10
11
  import yargs from 'yargs';
@@ -14,21 +15,20 @@ const git = simpleGit();
14
15
 
15
16
  const __filename = fileURLToPath(import.meta.url);
16
17
  const __dirname = dirname(__filename);
18
+
17
19
  const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
18
20
 
19
21
  const notifier = updateNotifier({
20
22
  pkg,
21
- updateCheckInterval: 0, // 12h
22
23
  });
23
24
 
24
- // Only print if an update is available
25
- if (notifier.update) {
25
+ // Only print if a *real* newer version exists
26
+ const upd = notifier.update;
27
+ if (upd && semver.valid(upd.latest) && semver.valid(pkg.version) && semver.gt(upd.latest, pkg.version)) {
26
28
  const name = pkg.name || 'cherrypick-interactive';
27
- const current = notifier.update.current;
28
- const latest = notifier.update.latest;
29
29
  console.log('');
30
30
  console.log(chalk.yellow('⚠️ A new version is available'));
31
- console.log(chalk.gray(` ${name}: ${chalk.red(current)} → ${chalk.green(latest)}`));
31
+ console.log(chalk.gray(` ${name}: ${chalk.red(pkg.version)} → ${chalk.green(upd.latest)}`));
32
32
  console.log(chalk.cyan(` Update with: ${chalk.bold(`npm i -g ${name}`)}\n`));
33
33
  }
34
34
 
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "cherrypick-interactive",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Interactively cherry-pick commits that are in dev but not in main, using subject-based comparison.",
5
5
  "main": "cli.js",
6
- "bin": "./cli.js",
6
+ "bin": {
7
+ "cherrypick-interactive": "cli.js"
8
+ },
7
9
  "type": "module",
8
10
  "scripts": {
9
- "publish": "npm publish --access public",
10
11
  "lint": "biome lint .",
11
12
  "format": "biome format --write .",
12
13
  "check": "biome check .",
13
- "fix": "biome check --write ."
14
+ "fix": "biome check --write .",
15
+ "release": "npm publish --access public"
14
16
  },
15
17
  "engines": {
16
18
  "node": ">=20"
@@ -18,6 +20,7 @@
18
20
  "dependencies": {
19
21
  "chalk": "^5.6.2",
20
22
  "inquirer": "^12.9.6",
23
+ "semver": "^7.7.3",
21
24
  "simple-git": "^3.28.0",
22
25
  "update-notifier": "^7.3.1",
23
26
  "yargs": "^18.0.0"
@@ -25,7 +28,13 @@
25
28
  "devDependencies": {
26
29
  "@biomejs/biome": "^1.9.4"
27
30
  },
28
- "keywords": ["git", "cli", "cherry-pick", "interactive", "devops"],
31
+ "keywords": [
32
+ "git",
33
+ "cli",
34
+ "cherry-pick",
35
+ "interactive",
36
+ "devops"
37
+ ],
29
38
  "license": "MIT",
30
39
  "packageManager": "yarn@4.6.0"
31
40
  }