cherrypick-interactive 1.4.2 → 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.
- package/cli.js +8 -8
- package/package.json +2 -1
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
|
|
25
|
-
|
|
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(
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cherrypick-interactive",
|
|
3
|
-
"version": "1.4.
|
|
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
6
|
"bin": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"chalk": "^5.6.2",
|
|
22
22
|
"inquirer": "^12.9.6",
|
|
23
|
+
"semver": "^7.7.3",
|
|
23
24
|
"simple-git": "^3.28.0",
|
|
24
25
|
"update-notifier": "^7.3.1",
|
|
25
26
|
"yargs": "^18.0.0"
|